]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
- fix sequence number/dag bug
authorsdhsdh <sdhsdh>
Mon, 31 Aug 2009 18:09:27 +0000 (18:09 +0000)
committersdhsdh <sdhsdh>
Mon, 31 Aug 2009 18:09:27 +0000 (18:09 +0000)
tos/lib/net/blip/ICMPResponderP.nc
tos/lib/net/blip/IPDispatchP.nc
tos/lib/net/blip/IPRoutingP.nc

index 556cd6215343fd8dcc13cc032b19e442f299e306..5f2f0187e9c9e481284f52c01bf4e84b612dbf09 100644 (file)
@@ -224,14 +224,24 @@ module ICMPResponderP {
     if (len > sizeof(radv_t) + sizeof(pfx_t) && 
         beacon->type == ICMP_EXT_TYPE_BEACON) {
 
+      printfUART("beacon seqno: %i my seqno: %i\n", beacon->seqno, nd_seqno);
+
       if (beacon->seqno > nd_seqno || (nd_seqno > 0 && beacon->seqno == 0)) {
         call IPRouting.reset();
+        nd_seqno = beacon->seqno;
       }
 
-      nd_seqno = beacon->seqno;
-      call IPRouting.reportAdvertisement(meta->sender, r->hlim,
-                                         meta->lqi, beacon->metric);
+      if (beacon->seqno == nd_seqno) {
+        call IPRouting.reportAdvertisement(meta->sender, r->hlim,
+                                           meta->lqi, beacon->metric);
+        // push out the seqno update
+        call Advertisement.stop();
+        call ICMP.sendAdvertisements();
+
+        if (pfx->type != ICMP_EXT_TYPE_PREFIX) return;
 
+        call IPAddress.setPrefix((uint8_t *)pfx->prefix);
+      }
 
 
       dbg("ICMPResponder", " * beacon cost: 0x%x\n", cost);
@@ -239,9 +249,6 @@ module ICMPResponderP {
         dbg("ICMPResponder", " * no beacon cost\n");
     }
 
-    if (pfx->type != ICMP_EXT_TYPE_PREFIX) return;
-
-    call IPAddress.setPrefix((uint8_t *)pfx->prefix);
 
     // TODO : get short address here...
   }
@@ -285,6 +292,7 @@ module ICMPResponderP {
     q->type = ICMP_EXT_TYPE_BEACON;
     q->length = sizeof(rqual_t) >> 3;;
     q->metric = call IPRouting.getQuality();
+    q->seqno = nd_seqno;
 
     call IPAddress.getLLAddr(&ipmsg->hdr.ip6_src);
     ip_memclr((uint8_t *)&ipmsg->hdr.ip6_dst, 16);
index 8d4932809aedd89f09a421ecb4e2bc6ab850eb00..a83eee85125b084c72cc9d7feb420c1d3bdd42e4 100644 (file)
@@ -659,8 +659,6 @@ module IPDispatchP {
     packed_lowmsg_t lowmsg;
 
     printfUART("p1: %p p2: %p\n", msg_payload, call Packet.getPayload(msg, 0));
-    printfUART("l1: %i l2: %i\n", len, call Packet.payloadLength(msg));
-
     // set up the ip message structaddFragment
     lowmsg.data = msg_payload;
     lowmsg.len  = len;
index ebec62152686945b6a6a9c17fd2add83d2bb55aa..a348d7f0ea20946350d06d57c8d511a11b0c0d42 100644 (file)
@@ -119,6 +119,7 @@ module IPRoutingP {
     traffic_interval += (call Random.rand16()) % (TGEN_BASE_TIME);
     if (call TrafficGenTimer.isRunning())
       call TrafficGenTimer.stop();
+    traffic_sent = FALSE;
 
     call TrafficGenTimer.startOneShot(traffic_interval);
   }
@@ -158,7 +159,6 @@ module IPRoutingP {
 
   command void IPRouting.reset() {
     int i;
-    printfUART("ROUTING RESET\n");
 
     for (i = 0; i < N_NEIGH; i++) {
       neigh_table[i].flags = 0;