]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - support/sdk/c/blip/driver/radvd-1.0/send.c
- fix async warning in resource queue
[tinyos-2.x.git] / support / sdk / c / blip / driver / radvd-1.0 / send.c
index 43145f8d064a7b8b3eb0ef1b99a43897f6354dc7..2a96d04cc7b036391e850e4e9f1f489471248422 100644 (file)
 #include <includes.h>
 #include <radvd.h>
 
+
+uint16_t routing_get_seqno();
+
+#define ICMP_EXT_TYPE_BEACON 17
+
+/* SDH : copied from ICMP.h */
+struct AdvMetric {
+  uint8_t type;
+  uint8_t length;
+  uint16_t metric;
+  uint16_t seqno;
+  uint8_t pad[2];
+};
+
+
 void
 send_ra(int sock, struct Interface *iface, struct in6_addr *dest)
 {
@@ -291,6 +306,19 @@ send_ra(int sock, struct Interface *iface, struct in6_addr *dest)
                memcpy(buff + len, &ha_info, sizeof(ha_info));
                len += sizeof(ha_info);
        }
+
+  {
+    /* add routing metric */
+    struct AdvMetric metric;
+    metric.type = ICMP_EXT_TYPE_BEACON;
+    metric.length = 1;
+    metric.metric = htons(0);
+    metric.seqno = htons(routing_get_seqno());
+    memset(metric.pad, 0, sizeof(metric.pad));
+
+    memcpy(buff + len, &metric, sizeof(struct AdvMetric));
+    len += sizeof(struct AdvMetric);
+  }
        
        iov.iov_len  = len;
        iov.iov_base = (caddr_t) buff;