Skip to content

gnrc_ipv6_simple_subnets: auto-configuration for nested subnets on a simple tree topology #16536

Merged
benpicco merged 3 commits intoRIOT-OS:masterfrom
benpicco:gnrc_ipv6_nib_subnets
Sep 2, 2021
Merged

gnrc_ipv6_simple_subnets: auto-configuration for nested subnets on a simple tree topology #16536
benpicco merged 3 commits intoRIOT-OS:masterfrom
benpicco:gnrc_ipv6_nib_subnets

Conversation

@benpicco
Copy link
Copy Markdown
Contributor

@benpicco benpicco commented Jun 7, 2021

Contribution description

This module provides an automatic configuration for networks with a simple tree topology.

If a sufficiently large IPv6 prefix is provided via Router Advertisements, a routing node with this module will automatically configure subnets from it for each downstream interface.

There can only be a single routing node on each level of the network but an arbitrary number of leaf nodes.

The downstream network(s) get the reduced prefix via Router Advertisements and the process repeats until the bits of prefix are exhausted. (The smallest network must still have a /64 prefix.)

The downstream router will send an otherwise empty router advertisement with only the Route Information Option set to the upstream network.
The Route Information Option contains the prefix of the downstream network so that upstream hosts will no longer consider hosts in this subnet on-link but instead will use the downstream router to route to the new subnet.

Testing procedure

I daisy-chained three boards (one same54-xpro and two weact-f411ce).
The same54-xpro uses Ethernet as the uplink interface and SLIP for downlink (using #16530 and #16531).
The WeAct boards have two SLIP interfaces each:

#define SLIPDEV_PARAMS          { .uart = UART_DEV(0),   \
                                  .baudrate = SLIPDEV_PARAM_BAUDRATE }, \
                                { .uart = UART_DEV(1),   \
                                  .baudrate = SLIPDEV_PARAM_BAUDRATE }

This was then tested with examples/gnrc_networking and

USEMODULE += slipdev
USEMODULE += gnrc_ipv6_auto_subnets

The same54-xpro was configured with

USEMODULE += slipdev
USEMODULE += gnrc_dhcpv6_client_6lbr
CFLAGS += -DSLIPDEV_PARAM_UART=UART_DEV\(1\)
first level node (gateway)
2021-06-07 18:23:51,539 # Iface  6 
2021-06-07 18:23:51,543 #           Long HWaddr: E6:EA:AF:F8:AF:5D:EB:E5 
2021-06-07 18:23:51,547 #           MTU:65535  HL:64  RTR  
2021-06-07 18:23:51,548 #           RTR_ADV  
2021-06-07 18:23:51,551 #           Link type: wired
2021-06-07 18:23:51,556 #           inet6 addr: fe80::e4ea:aff8:af5d:ebe5  scope: link  VAL
2021-06-07 18:23:51,564 #           inet6 addr: 2001:16b8:4569:88fc:e4ea:aff8:af5d:ebe5  scope: global  VAL
2021-06-07 18:23:51,566 #           inet6 group: ff02::2
2021-06-07 18:23:51,569 #           inet6 group: ff02::1
2021-06-07 18:23:51,573 #           inet6 group: ff02::1:ff5d:ebe5
2021-06-07 18:23:51,575 #           inet6 group: ff02::1a
2021-06-07 18:23:51,577 #           
2021-06-07 18:23:51,579 #           Statistics for Layer 2
2021-06-07 18:23:51,582 #             RX packets 2  bytes 168
2021-06-07 18:23:51,587 #             TX packets 11 (Multicast: 0)  bytes 1038
2021-06-07 18:23:51,590 #             TX succeeded 0 errors 0
2021-06-07 18:23:51,593 #           Statistics for IPv6
2021-06-07 18:23:51,596 #             RX packets 2  bytes 168
2021-06-07 18:23:51,601 #             TX packets 11 (Multicast: 11)  bytes 1038
2021-06-07 18:23:51,604 #             TX succeeded 11 errors 0
2021-06-07 18:23:51,604 # 
2021-06-07 18:23:51,607 # Iface  5  HWaddr: FC:C2:3D:0D:2D:1F 
2021-06-07 18:23:51,612 #           L2-PDU:1500  MTU:1492  HL:255  RTR  
2021-06-07 18:23:51,615 #           Source address length: 6
2021-06-07 18:23:51,617 #           Link type: wired
2021-06-07 18:23:51,623 #           inet6 addr: fe80::fec2:3dff:fe0d:2d1f  scope: link  VAL
2021-06-07 18:23:51,630 #           inet6 addr: 2001:16b8:4569:8800:fec2:3dff:fe0d:2d1f  scope: global  VAL
2021-06-07 18:23:51,633 #           inet6 group: ff02::2
2021-06-07 18:23:51,635 #           inet6 group: ff02::1
2021-06-07 18:23:51,639 #           inet6 group: ff02::1:ff0d:2d1f
2021-06-07 18:23:51,640 #           
2021-06-07 18:23:51,643 #           Statistics for Layer 2
2021-06-07 18:23:51,646 #             RX packets 55  bytes 12315
2021-06-07 18:23:51,651 #             TX packets 8 (Multicast: 8)  bytes 734
2021-06-07 18:23:51,654 #             TX succeeded 8 errors 0
2021-06-07 18:23:51,657 #           Statistics for IPv6
2021-06-07 18:23:51,660 #             RX packets 16  bytes 4722
2021-06-07 18:23:51,664 #             TX packets 8 (Multicast: 8)  bytes 622
2021-06-07 18:23:51,667 #             TX succeeded 8 errors 0
2021-06-07 18:23:51,668 # 
> nib prefix
2021-06-07 18:23:59,163 # nib prefix
2021-06-07 18:23:59,169 # 2001:16b8:4569:88fc::/62 dev #6  expires 7187 sec deprecates 3587 sec
2021-06-07 18:23:59,175 # 2001:16b8:4569:8800::/64 dev #5  expires 7188 sec deprecates 3588 sec
second level node
2021-06-07 18:23:53,306 # Iface  7 
2021-06-07 18:23:53,306 #           Long HWaddr: 6E:A6:68:BD:60:63:21:D5 
2021-06-07 18:23:53,307 #           MTU:65535  HL:64  RTR  
2021-06-07 18:23:53,307 #           RTR_ADV  
2021-06-07 18:23:53,307 #           Link type: wired
2021-06-07 18:23:53,308 #           inet6 addr: fe80::6ca6:68bd:6063:21d5  scope: link  VAL
2021-06-07 18:23:53,309 #           inet6 addr: 2001:16b8:4569:88fc:6ca6:68bd:6063:21d5  scope: global  VAL
2021-06-07 18:23:53,310 #           inet6 group: ff02::2
2021-06-07 18:23:53,310 #           inet6 group: ff02::1
2021-06-07 18:23:53,311 #           inet6 group: ff02::1:ff63:21d5
2021-06-07 18:23:53,311 #           
2021-06-07 18:23:53,311 #           Statistics for Layer 2
2021-06-07 18:23:53,312 #             RX packets 12  bytes 1138
2021-06-07 18:23:53,312 #             TX packets 3 (Multicast: 0)  bytes 232
2021-06-07 18:23:53,313 #             TX succeeded 0 errors 0
2021-06-07 18:23:53,313 #           Statistics for IPv6
2021-06-07 18:23:53,314 #             RX packets 12  bytes 1138
2021-06-07 18:23:53,314 #             TX packets 3 (Multicast: 3)  bytes 232
2021-06-07 18:23:53,315 #             TX succeeded 3 errors 0
2021-06-07 18:23:53,315 # 
2021-06-07 18:23:53,315 # Iface  6 
2021-06-07 18:23:53,316 #           Long HWaddr: 6E:A6:68:BD:60:63:21:D4 
2021-06-07 18:23:53,316 #           MTU:65535  HL:64  RTR  
2021-06-07 18:23:53,316 #           RTR_ADV  
2021-06-07 18:23:53,317 #           Link type: wired
2021-06-07 18:23:53,318 #           inet6 addr: fe80::6ca6:68bd:6063:21d4  scope: link  VAL
2021-06-07 18:23:53,319 #           inet6 addr: 2001:16b8:4569:88fe:6ca6:68bd:6063:21d4  scope: global  VAL
2021-06-07 18:23:53,319 #           inet6 group: ff02::2
2021-06-07 18:23:53,320 #           inet6 group: ff02::1
2021-06-07 18:23:53,320 #           inet6 group: ff02::1:ff63:21d4
2021-06-07 18:23:53,320 #           
2021-06-07 18:23:53,321 #           Statistics for Layer 2
2021-06-07 18:23:53,321 #             RX packets 1  bytes 64
2021-06-07 18:23:53,322 #             TX packets 3 (Multicast: 0)  bytes 232
2021-06-07 18:23:53,322 #             TX succeeded 0 errors 0
2021-06-07 18:23:53,323 #           Statistics for IPv6
2021-06-07 18:23:53,323 #             RX packets 1  bytes 64
2021-06-07 18:23:53,324 #             TX packets 3 (Multicast: 3)  bytes 232
2021-06-07 18:23:53,325 #             TX succeeded 3 errors 0
2021-06-07 18:23:53,325 # 
> nib prefix
2021-06-07 18:23:56,314 # nib prefix
2021-06-07 18:23:56,316 # 2001:16b8:4569:88fc::/62 dev #7  expires 7190 sec deprecates 3590 sec
2021-06-07 18:23:56,317 # 2001:16b8:4569:88fe::/63 dev #6  expires 7190 sec deprecates 3590 sec
third level node
2021-06-07 18:24:01,378 # Iface  7 
2021-06-07 18:24:01,379 #           Long HWaddr: BE:4E:31:E9:94:58:5F:37 
2021-06-07 18:24:01,380 #           MTU:65535  HL:64  RTR  
2021-06-07 18:24:01,380 #           RTR_ADV  
2021-06-07 18:24:01,381 #           Link type: wired
2021-06-07 18:24:01,381 #           inet6 addr: fe80::bc4e:31e9:9458:5f37  scope: link  VAL
2021-06-07 18:24:01,382 #           inet6 addr: 2001:16b8:4569:88ff:bc4e:31e9:9458:5f37  scope: global  VAL
2021-06-07 18:24:01,383 #           inet6 group: ff02::2
2021-06-07 18:24:01,383 #           inet6 group: ff02::1
2021-06-07 18:24:01,384 #           inet6 group: ff02::1:ff58:5f37
2021-06-07 18:24:01,384 #           
2021-06-07 18:24:01,384 #           Statistics for Layer 2
2021-06-07 18:24:01,385 #             RX packets 0  bytes 0
2021-06-07 18:24:01,385 #             TX packets 5 (Multicast: 0)  bytes 344
2021-06-07 18:24:01,386 #             TX succeeded 0 errors 0
2021-06-07 18:24:01,386 #           Statistics for IPv6
2021-06-07 18:24:01,386 #             RX packets 0  bytes 0
2021-06-07 18:24:01,387 #             TX packets 5 (Multicast: 5)  bytes 344
2021-06-07 18:24:01,387 #             TX succeeded 5 errors 0
2021-06-07 18:24:01,388 # 
2021-06-07 18:24:01,388 # Iface  6 
2021-06-07 18:24:01,389 #           Long HWaddr: BE:4E:31:E9:94:58:5F:36 
2021-06-07 18:24:01,389 #           MTU:65535  HL:64  RTR  
2021-06-07 18:24:01,390 #           RTR_ADV  
2021-06-07 18:24:01,391 #           Link type: wired
2021-06-07 18:24:01,392 #           inet6 addr: fe80::bc4e:31e9:9458:5f36  scope: link  VAL
2021-06-07 18:24:01,393 #           inet6 addr: 2001:16b8:4569:88fe:bc4e:31e9:9458:5f36  scope: global  VAL
2021-06-07 18:24:01,394 #           inet6 group: ff02::2
2021-06-07 18:24:01,394 #           inet6 group: ff02::1
2021-06-07 18:24:01,395 #           inet6 group: ff02::1:ff58:5f36
2021-06-07 18:24:01,395 #           
2021-06-07 18:24:01,395 #           Statistics for Layer 2
2021-06-07 18:24:01,396 #             RX packets 9  bytes 604
2021-06-07 18:24:01,397 #             TX packets 8 (Multicast: 0)  bytes 500
2021-06-07 18:24:01,397 #             TX succeeded 0 errors 0
2021-06-07 18:24:01,398 #           Statistics for IPv6
2021-06-07 18:24:01,398 #             RX packets 9  bytes 604
2021-06-07 18:24:01,399 #             TX packets 8 (Multicast: 5)  bytes 500
2021-06-07 18:24:01,399 #             TX succeeded 8 errors 0
2021-06-07 18:24:01,399 # 
> nib prefix
2021-06-07 18:24:04,386 # nib prefix
2021-06-07 18:24:04,388 # 2001:16b8:4569:88fe::/63 dev #6  expires 7181 sec deprecates 3581 sec
2021-06-07 18:24:04,390 # 2001:16b8:4569:88ff::/64 dev #7  expires 7181 sec deprecates 3581 sec
> ping 2600::
2021-06-07 18:24:07,754 # ping 2600::
2021-06-07 18:24:07,896 # 12 bytes from 2600::: icmp_seq=0 ttl=51 time=141.650 ms
2021-06-07 18:24:08,897 # 12 bytes from 2600::: icmp_seq=1 ttl=51 time=141.296 ms
2021-06-07 18:24:09,896 # 12 bytes from 2600::: icmp_seq=2 ttl=51 time=141.132 ms
2021-06-07 18:24:09,896 # 
2021-06-07 18:24:09,896 # --- 2600:: PING statistics ---
2021-06-07 18:24:09,897 # 3 packets transmitted, 3 packets received, 0% packet loss
2021-06-07 18:24:09,898 # round-trip min/avg/max = 141.132/141.359/141.650 ms

The deepest node is reachable from an outside host

% ping 2001:16b8:4569:88ff:bc4e:31e9:9458:5f37
PING 2001:16b8:4569:88ff:bc4e:31e9:9458:5f37(2001:16b8:4569:88ff:bc4e:31e9:9458:5f37) 56 data bytes
64 bytes from 2001:16b8:4569:88ff:bc4e:31e9:9458:5f37: icmp_seq=1 ttl=62 time=41.4 ms
64 bytes from 2001:16b8:4569:88ff:bc4e:31e9:9458:5f37: icmp_seq=2 ttl=62 time=40.2 ms
64 bytes from 2001:16b8:4569:88ff:bc4e:31e9:9458:5f37: icmp_seq=3 ttl=62 time=40.2 ms
^C
--- 2001:16b8:4569:88ff:bc4e:31e9:9458:5f37 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 40.226/40.632/41.427/0.561 ms

Issues/PRs references

depends on #16568, #16672, #16557, #16671

@benpicco benpicco added Area: network Area: Networking Type: new feature The issue requests / The PR implemements a new feature for RIOT labels Jun 7, 2021
@github-actions github-actions bot added Area: build system Area: Build system Area: sys Area: System labels Jun 7, 2021
@benpicco benpicco force-pushed the gnrc_ipv6_nib_subnets branch from e2bc1fb to 028a32f Compare June 7, 2021 20:10
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jun 7, 2021
Comment on lines +1519 to +1521
if (downstream == upstream) {
continue;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if there are supposed to be multiple upstreams?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not supported - but it's also not supported by gnrc_dhcpv6_client_6lbr.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be possible when using multiple clients, one for each interface?

@miri64 miri64 added the Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR label Jun 8, 2021
@miri64
Copy link
Copy Markdown
Member

miri64 commented Jun 8, 2021

I'd like some more input from other contributors before merging this.

@benpicco benpicco force-pushed the gnrc_ipv6_nib_subnets branch 2 times, most recently from 2a96b62 to 0032dde Compare June 10, 2021 15:45
@benpicco benpicco added the State: waiting for other PR State: The PR requires another PR to be merged first label Jun 21, 2021
@MrKevinWeiss MrKevinWeiss added this to the Release 2021.07 milestone Jun 21, 2021
@MrKevinWeiss
Copy link
Copy Markdown
Contributor

ping @cgundogan @PeterKietzmann

@MrKevinWeiss
Copy link
Copy Markdown
Contributor

Though this is a new feature and I wouldn't mind waiting until the next release.

@benpicco
Copy link
Copy Markdown
Contributor Author

benpicco commented Jun 22, 2021

I think the consensus was to move this somewhere else (sys/net/gnrc/routing?), but I don't know how to best hook into router advertisements from outside nib.c.

@miri64
Copy link
Copy Markdown
Member

miri64 commented Jun 22, 2021

I think the consensus was to move this somewhere else (sys/net/gnrc/routing?), but I don't know how to best hook into router advertisements from outside nib.c.

Do you have to? As far as I understand you are only interested in the upstream prefix from the PIO, not the whole RA. So can't there just be a mechanism (msgbus, route_info_cb, other callback, ...) that hands the prefix information to the new "routing" module?

@github-actions github-actions bot added the Area: examples Area: Example Applications label Jul 7, 2021
@MrKevinWeiss MrKevinWeiss removed this from the Release 2021.07 milestone Jul 15, 2021
@benpicco benpicco force-pushed the gnrc_ipv6_nib_subnets branch from 92d6e55 to 659ab90 Compare July 22, 2021 14:26
Copy link
Copy Markdown
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please find a way to move this to sys/net/gnrc/routing. This is still a somewhat primitive routing protocol that you invented and not an intrinsic sub-component of IPv6 like the current module structure implies.

@benpicco benpicco added State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet and removed State: waiting for other PR State: The PR requires another PR to be merged first labels Jul 22, 2021
@benpicco
Copy link
Copy Markdown
Contributor Author

Will do, that's why there it still has the WIP tag 😉
I just wanted to clean this branch up so I can assemble a new integration branch with all the pending PRs that are needed to get this working.

@benpicco benpicco force-pushed the gnrc_ipv6_nib_subnets branch from 659ab90 to b59faef Compare July 22, 2021 15:11
@benpicco
Copy link
Copy Markdown
Contributor Author

Also

$ PORT=tap_a0 make term

The routers all have two interfaces, so

PORT="tap_a0 tap_b1" make term
PORT="tap_b0 tap_c1" make term
…

@benpicco benpicco force-pushed the gnrc_ipv6_nib_subnets branch 2 times, most recently from 6581881 to a602e48 Compare September 1, 2021 14:36
@benpicco benpicco force-pushed the gnrc_ipv6_nib_subnets branch from a602e48 to b98fc18 Compare September 1, 2021 15:09
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Sep 1, 2021
@benpicco benpicco force-pushed the gnrc_ipv6_nib_subnets branch from b98fc18 to e8c3f91 Compare September 1, 2021 15:24
@github-actions github-actions bot added the Area: tests Area: tests and testing framework label Sep 1, 2021
@benpicco benpicco removed the Area: tests Area: tests and testing framework label Sep 1, 2021
Comment on lines +11 to +13
blackpill \
bluepill-stm32f030c8 \
bluepill \
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How could that happen?

Copy link
Copy Markdown
Contributor Author

@benpicco benpicco Sep 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arg looks like 4c7ac22 adds 8 bytes to ROM.
I can make gnrc_ipv6_nib_rtr_adv_pio_cb depend on a pseudo-module

@miri64 miri64 added Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines labels Sep 2, 2021
Copy link
Copy Markdown
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Application works as described in the README

image

However, there is a problem with the LEAF corner case

@github-actions github-actions bot added the Area: build system Area: Build system label Sep 2, 2021
@miri64 miri64 added the Reviewed: 3-testing The PR was tested according to the maintainer guidelines label Sep 2, 2021
@miri64
Copy link
Copy Markdown
Member

miri64 commented Sep 2, 2021

All steps in the README now work as advertised.

Copy link
Copy Markdown
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please squash!

benpicco and others added 3 commits September 2, 2021 15:35
If we get a large (e.g. /62) prefix from e.g. DHCPv6, we can split it
into subnets automatically to configure downstream interfaces.

This allows for automatic configuration of daisy-chained nodes or
nodes connected in a tree topology.

To enable the feature, a new pseudo-module `gnrc_ipv6_auto_subnets` is
provided.
@benpicco benpicco force-pushed the gnrc_ipv6_nib_subnets branch from 8ee1a1a to faae6d5 Compare September 2, 2021 13:35
Copy link
Copy Markdown
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK!

@miri64 miri64 added the Reviewed: 5-documentation The documentation details of the PR were reviewed according to the maintainer guidelines label Sep 2, 2021
@benpicco benpicco merged commit 9ac9b41 into RIOT-OS:master Sep 2, 2021
@benpicco benpicco deleted the gnrc_ipv6_nib_subnets branch September 2, 2021 14:24
@benpicco
Copy link
Copy Markdown
Contributor Author

benpicco commented Sep 2, 2021

Thank you for the review!

@benpicco benpicco added this to the Release 2021.10 milestone Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: build system Area: Build system Area: doc Area: Documentation Area: examples Area: Example Applications Area: network Area: Networking Area: sys Area: System CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 3-testing The PR was tested according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines Reviewed: 5-documentation The documentation details of the PR were reviewed according to the maintainer guidelines Type: new feature The issue requests / The PR implemements a new feature for RIOT

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants