RIOT-OS / RIOT

RIOT - The friendly OS for IoT
https://riot-os.org
GNU Lesser General Public License v2.1
4.87k stars 1.98k forks source link

gnrc_rpl: nib route not updated when topology / DODAG changes #17327

Open benpicco opened 2 years ago

benpicco commented 2 years ago

Description

This issue can happen with a mobile node, but it can also arise if the DODAG changes at run-time (e.g. with #14623)

Steps to reproduce the issue

Setup ZEP dispatcher

In dist/tools/zep_dispatch replace the example.topo with

A       B
B       C
C       D

This constitutes a simple linear network. Start the ZEP dispatcher with make run.

Setup border router

Start the gnrc_border_router with gnrc_rpl enabled:

USEMODULE=gnrc_rpl make -C examples/gnrc_border_router all term

You should see the node being added by the ZEP dispatcher

adding node BE:0E:CF:F0:51:F6:B4:98

and the border router receiving a prefix on it's downstream interface

Iface  7  HWaddr: 34:98  Channel: 26  NID: 0x23 
          Long HWaddr: BE:0E:CF:F0:51:F6:B4:98 
          L2-PDU:102  MTU:1280  HL:64  RTR  
          RTR_ADV  6LO  IPHC  
          Source address length: 8
          Link type: wireless
          inet6 addr: fe80::bc0e:cff0:51f6:b498  scope: link  VAL
          inet6 addr: 2001:db8::bc0e:cff0:51f6:b498  scope: global  VAL
          inet6 group: ff02::2
          inet6 group: ff02::1
          inet6 group: ff02::1:fff6:b498
          inet6 group: ff02::1a

Iface  6  HWaddr: 7A:37:FC:7D:1A:AF 
          L2-PDU:1500  MTU:1500  HL:64  RTR  
          Source address length: 6
          Link type: wired
          inet6 addr: fe80::7837:fcff:fe7d:1aaf  scope: link  VAL
          inet6 addr: fe80::2  scope: link  VAL
          inet6 group: ff02::2
          inet6 group: ff02::1
          inet6 group: ff02::1:ff7d:1aaf
          inet6 group: ff02::1:ff00:2
Setup mesh nodes

Start 3 mesh nodes and initialize RPL on interface 7

USE_ZEP=1 make -C examples/gnrc_networking all term
rpl init 7

You should see them being added in the dispatcher:

adding node E6:65:A3:09:F5:9A:D0:BC
adding node FE:1E:98:42:04:09:A1:73
adding node 66:4E:F1:F0:57:34:36:5E

If you have foren6 running you can observe the topology:

image

Verify that the last (or any) node in the line can ping the border router:

ping 2001:db8::bc0e:cff0:51f6:b498
12 bytes from 2001:db8::bc0e:cff0:51f6:b498: icmp_seq=0 ttl=62 rssi=24672 dBm time=1.504 ms
12 bytes from 2001:db8::bc0e:cff0:51f6:b498: icmp_seq=1 ttl=62 rssi=24672 dBm time=1.610 ms
12 bytes from 2001:db8::bc0e:cff0:51f6:b498: icmp_seq=2 ttl=62 rssi=24672 dBm time=1.304 ms

--- 2001:db8::bc0e:cff0:51f6:b498 PING statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 1.304/1.472/1.610 ms
DODAG change

Next we change the topology and connect D directly to A:

A       B
B       C
A       D

We have to re-start the ZEP dispatcher for this to take effect.

image

Expected results

All nodes can still reach the border router

Actual results

Even though node bc has accepted node 98 as it's parent, it is still trying to route packets via the now unreachable 73

rpl
instance table: [X] 
parent table:   [ ] [X] [ ] 

instance [0 | Iface: 7 | mop: 2 | ocp: 0 | mhri: 256 | mri 0]
    dodag [2001:db8::bc0e:cff0:51f6:b498 | R: 512 | OP: Router | PIO: on | TR(I=[8,20], k=10, c=1)]
        parent [addr: fe80::bc0e:cff0:51f6:b498 | rank: 256]

nib route
2001:db8::/64 dev #7
2001:db8::fc1e:9842:409:a173/128 via fe80::fc1e:9842:409:a173 dev #7
2001:db8::644e:f1f0:5734:365e/128 via fe80::fc1e:9842:409:a173 dev #7
default* via fe80::bc0e:cff0:51f6:b498 dev #7

nib neigh
fe80::bc0e:cff0:51f6:b498 dev #7 lladdr BE:0E:CF:F0:51:F6:B4:98 router REACHABLE GC

ping 2001:db8::bc0e:cff0:51f6:b498

--- 2001:db8::bc0e:cff0:51f6:b498 PING statistics ---
3 packets transmitted, 0 packets received, 100% packet loss

Versions

Riot master

benpicco commented 11 months ago

When looking at the RPL source code it turns out that gnrc_ipv6_nib_ft_del() is only ever called for the default route (gnrc_ipv6_nib_ft_del(NULL, 0)) or when the route lifetime changes(?) - downstream routes are never removed.