TyMeew / tinyos-main

Automatically exported from code.google.com/p/tinyos-main
1 stars 0 forks source link

TinyRPL: nodes do not propagate DODAG information (Grounded) correctly #132

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Run CoapBlip/UDPEcho and PppRouter according to the Wiki.
2. Sniff with Wireshark the 802.15.4 packets.
3. Dissect RPL DIO.

What is the expected output? What do you see instead?
RPL non-root nodes should have the same 'Grounded', 'MOP' and 'Preference' 
values as the RPL root node, cf. RFC 6550 section 8.1. 'Grounded' is not the 
same. 0x80 hasn't been shifted back.

Attached is a Wireshark capture file, which shows this e.g. in packets 101 and 
102. 

The diff below fixes it.

With this I assume that the border router can achieve the RPL goal. What is 
this goal for TinyRPL? Being a PppRouter and being able to forward to a fixed 
network?

Markus

diff --git a/tos/lib/net/rpl/RPL.h b/tos/lib/net/rpl/RPL.h
index 0628bc8..2e80210 100644
--- a/tos/lib/net/rpl/RPL.h
+++ b/tos/lib/net/rpl/RPL.h
@@ -377,6 +377,7 @@ struct dio_dest_prefix_t {
 };

 #define DIO_GROUNDED_MASK 0x80
+#define DIO_GROUNDED_SHIFT 7
 #define DIO_MOP_MASK 0x3c
 #define DIO_MOP_SHIFT 3
 #define DIO_PREF_MASK 0x07
diff --git a/tos/lib/net/rpl/RPLRoutingEngineP.nc 
b/tos/lib/net/rpl/RPLRoutingEngineP.nc
index 4bc93b8..9f21faf 100644
--- a/tos/lib/net/rpl/RPLRoutingEngineP.nc
+++ b/tos/lib/net/rpl/RPLRoutingEngineP.nc
@@ -78,7 +78,7 @@ implementation{
   bool riskHigh = FALSE;
   uint16_t node_rank = INFINITE_RANK;
   uint16_t LOWRANK = INFINITE_RANK;
-  uint8_t GROUND_STATE = 1;
+  uint8_t GROUND_STATE = 0;

   uint8_t RPLInstanceID = 0;
   struct in6_addr DODAGID;
@@ -123,6 +123,9 @@ implementation{

   /* Start the routing with DIS message probing */
   task void init() {
+    if (I_AM_ROOT) {
+   GROUND_STATE = 1; // GOAL is 'I am Border Router, I can forward to the 
Internet'
+    }
 #ifdef RPL_STORING_MODE
     MOP = RPL_MOP_Storing_No_Multicast;
 #else
@@ -196,7 +199,7 @@ implementation{
     msg.icmpv6.code = ICMPV6_CODE_DIO;
     msg.icmpv6.checksum = 0;
     msg.flags = 0;
-    msg.flags = GROUND_STATE << 7;
+    msg.flags = GROUND_STATE << DIO_GROUNDED_SHIFT;
     msg.flags |= MOP << DIO_MOP_SHIFT;
     msg.flags |= DAG_PREF << 0;
     msg.version = DODAGVersionNumber;
@@ -684,7 +687,7 @@ implementation{
     RPLInstanceID = dio->instance_id.id;
     memcpy(&DODAGID, &dio->dodagID, sizeof(struct in6_addr));
     DODAGVersionNumber = dio->version;
-    GROUND_STATE = dio->flags & DIO_GROUNDED_MASK;
+    GROUND_STATE = dio->flags & DIO_GROUNDED_MASK >> DIO_GROUNDED_SHIFT;
     //GROUND_STATE = dio->flags.flags_element.grounded;
     call RPLRouteInfo.resetTrickle();
     return;

Original issue reported on code.google.com by marku...@gmail.com on 24 Apr 2012 at 8:03

Attachments: