Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gnrc_ipv6_nib: fix config for mixed 6lo/classic setup #20167

Merged
merged 2 commits into from
Dec 20, 2023

Conversation

benpicco
Copy link
Contributor

@benpicco benpicco commented Dec 11, 2023

Contribution description

When mixing 6lo interfaces with 'classic' IPv6 interfaces we would always see strange behavior in RIOT. E.g. if we enable gnrc_ipv6_default together with an Ethernet interface and a IEEE 802.15.4 interface, the node would get a global address on the Ethernet interface but seemingly can't be reached via that address. (After manually enabling CONFIG_GNRC_IPV6_NIB_SLAAC and CONFIG_GNRC_IPV6_NIB_ARSM)

This is because the 6lo optimizations would always get turned on globally when the gnrc_ipv6_nib_6ln module is in use, disregarding what other interfaces might be present.

In this case the CONFIG_GNRC_IPV6_NIB_NUMOF would get set to 1, leading to no space being left for any neighbor's address, other than the default router, so address resolution would always fail.

Fix this by introducing a pseudo-module gnrc_ipv6_classic that gets selected by non-6lo interfaces. Now we can only enable the 6lo optimizations when there are no 'classic' interfaces present.

Testing procedure

In examples/gnrc_networking replace gnrc_ipv6_router_default with gnrc_ipv6_default (or don't, it's just most apparent with that), then add USEMODULE += netdev_tap and build and run with USE_ZEP=1.

master

SLAAC not activated; will not auto-configure IPv6 address for interface 7.
    Use CONFIG_GNRC_IPV6_NIB_SLAAC=1 to activate.
main(): This is RIOT! (Version: 2024.01-devel-356-gfd3d92)
RIOT network stack example application
All up, running the shell now
> SLAAC not activated; will not auto-configure IPv6 address for interface 7.
    Use CONFIG_GNRC_IPV6_NIB_SLAAC=1 to activate.
ifconfig
ifconfig
Iface  7  HWaddr: E2:B9:1D:C4:14:21 
          L2-PDU:1500  MTU:1492  HL:255  Source address length: 6
          Link type: wired
          inet6 group: ff02::1
          
          Statistics for Layer 2
            RX packets 29  bytes 5112
            TX packets 1 (Multicast: 1)  bytes 62
            TX succeeded 1 errors 0
          Statistics for IPv6
            RX packets 13  bytes 2384
            TX packets 1 (Multicast: 1)  bytes 48
            TX succeeded 1 errors 0

Iface  8  HWaddr: 12:82  Channel: 26  NID: 0x23  PHY: O-QPSK 
          Long HWaddr: 66:BE:55:A0:3B:18:92:82 
           State: IDLE 
          ACK_REQ  L2-PDU:102  MTU:1280  HL:64  6LO  
          IPHC  
          Source address length: 8
          Link type: wireless
          inet6 addr: fe80::64be:55a0:3b18:9282  scope: link  VAL
          inet6 group: ff02::1
          
          Statistics for Layer 2
            RX packets 0  bytes 0
            TX packets 2 (Multicast: 2)  bytes 0
            TX succeeded 2 errors 0
          Statistics for IPv6
            RX packets 0  bytes 0
            TX packets 2 (Multicast: 2)  bytes 128
            TX succeeded 2 errors 0

let's manually enable SLAAC and ARSM…
But still no success:

Iface  7  HWaddr: E2:B9:1D:C4:14:21 
          L2-PDU:1500  MTU:1492  HL:255  Source address length: 6
          Link type: wired
          inet6 addr: fe80::e0b9:1dff:fec4:1421  scope: link  VAL
          inet6 addr: 2001:9e8:141e:bf00:e0b9:1dff:fec4:1421  scope: global  VAL
          inet6 group: ff02::1
          inet6 group: ff02::1:ffc4:1421
          
          Statistics for Layer 2
            RX packets 10  bytes 1204
            TX packets 3 (Multicast: 3)  bytes 218
            TX succeeded 3 errors 0
          Statistics for IPv6
            RX packets 5  bytes 552
            TX packets 3 (Multicast: 3)  bytes 176
            TX succeeded 3 errors 0

> ping 2001:9e8:141e:bf00:7dbd:ffa9:3dbb:7784   

--- 2001:9e8:141e:bf00:7dbd:ffa9:3dbb:7784 PING statistics ---
3 packets transmitted, 0 packets received, 100% packet loss
> nib neigh

fe80::de39:6fff:fe6a:6980 dev #7 lladdr DC:39:6F:6A:69:80 router STALE

this PR

main(): This is RIOT! (Version: 2024.01-devel-358-g6ba4e-gnrc_ipv6_classic)
RIOT network stack example application
All up, running the shell now
> ifconfig

Iface  7  HWaddr: E2:B9:1D:C4:14:21 
          L2-PDU:1500  MTU:1492  HL:255  Source address length: 6
          Link type: wired
          inet6 addr: fe80::e0b9:1dff:fec4:1421  scope: link  VAL
          inet6 addr: 2001:9e8:141e:bf00:e0b9:1dff:fec4:1421  scope: global  VAL
          inet6 group: ff02::1
          inet6 group: ff02::1:ffc4:1421
          
          Statistics for Layer 2
            RX packets 29  bytes 5112
            TX packets 3 (Multicast: 3)  bytes 218
            TX succeeded 3 errors 0
          Statistics for IPv6
            RX packets 13  bytes 2384
            TX packets 3 (Multicast: 3)  bytes 176
            TX succeeded 3 errors 0

Iface  8  HWaddr: 6F:E5  Channel: 26  NID: 0x23  PHY: O-QPSK 
          Long HWaddr: A6:4E:42:76:7E:03:6F:E5 
           State: IDLE 
          ACK_REQ  L2-PDU:102  MTU:1280  HL:64  6LO  
          IPHC  
          Source address length: 8
          Link type: wireless
          inet6 addr: fe80::a44e:4276:7e03:6fe5  scope: link  VAL
          inet6 group: ff02::1
          inet6 group: ff02::1:ff03:6fe5
          
          Statistics for Layer 2
            RX packets 0  bytes 0
            TX packets 2 (Multicast: 2)  bytes 0
            TX succeeded 2 errors 0
          Statistics for IPv6
            RX packets 0  bytes 0
            TX packets 2 (Multicast: 2)  bytes 128
            TX succeeded 2 errors 0

> ping 2001:9e8:141e:bf00:4876:5bff:fec8:eb84   
12 bytes from 2001:9e8:141e:bf00:4876:5bff:fec8:eb84: icmp_seq=0 ttl=255 time=1.073 ms
12 bytes from 2001:9e8:141e:bf00:4876:5bff:fec8:eb84: icmp_seq=1 ttl=255 time=0.204 ms
12 bytes from 2001:9e8:141e:bf00:4876:5bff:fec8:eb84: icmp_seq=2 ttl=255 time=0.429 ms

--- 2001:9e8:141e:bf00:4876:5bff:fec8:eb84 PING statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.204/0.568/1.073 ms

Issues/PRs references

@github-actions github-actions bot added Area: network Area: Networking Area: build system Area: Build system Area: sys Area: System labels Dec 11, 2023
@benpicco benpicco added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Dec 11, 2023
@riot-ci
Copy link

riot-ci commented Dec 11, 2023

Murdock results

✔️ PASSED

fa1f60f gnrc_ipv6_nib: fix config for mixed 6lo/classic setup

Success Failures Total Runtime
8098 0 8098 10m:51s

Artifacts

@OlegHahm
Copy link
Member

This is because the 6lo optimizations would always get turned on globally when the gnrc_ipv6_nib_6ln module is in use, disregarding what other interfaces might be present.

Which optimizations are you referring to exactly?

@benpicco
Copy link
Contributor Author

benpicco commented Dec 17, 2023

Which optimizations are you referring to exactly?

  • disabling SLAAC¹
  • disabling ARSM¹
  • setting the neighbor information base size to 1

[1] those are still disabled for the 6lo interface, but previously when gnrc_ipv6_nib_6ln was selected the code for this was not compiled in, even if we had a 2nd 'classic' interface that would need to use it. Now that code is only removed when gnrc_ipv6_classic is not present.

@@ -172,6 +172,14 @@ ifneq (,$(filter gnrc_netif_bus,$(USEMODULE)))
USEMODULE += core_msg_bus
endif

ifneq (,$(filter netdev_eth slipdev, $(USEMODULE)))
Copy link
Member

Choose a reason for hiding this comment

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

Would that cover esp32 or is the esp32 using its own IP implementation anyway?

Copy link
Contributor Author

@benpicco benpicco Dec 19, 2023

Choose a reason for hiding this comment

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

Both esp_wifi and esp_eth select netdev_eth.
esp_now is a 6lo interface.

And ESP32 does use our GNRC stack or LWIP, just like everyone else.

@OlegHahm
Copy link
Member

OlegHahm commented Dec 19, 2023

When building for a 6lo-only board (e.g., nrf52840) ideally nothing should change, right? However, I get 12 additional bytes in ROM compared to the state before this PR. I haven't really figured out where.

Edit: Maybe that's just an issue with the size command. cosy isn't showing any differences.

@OlegHahm OlegHahm added this pull request to the merge queue Dec 20, 2023
Merged via the queue into RIOT-OS:master with commit 724e6e0 Dec 20, 2023
29 checks passed
@benpicco benpicco deleted the gnrc_ipv6_classic branch December 21, 2023 15:07
@MrKevinWeiss MrKevinWeiss added this to the Release 2024.01 milestone Feb 7, 2024
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: 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 Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants