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: rejoin ipv6_addr_all_nodes_link_local on interface up #20259

Merged
merged 1 commit into from
Jan 16, 2024

Conversation

fabian18
Copy link
Contributor

@fabian18 fabian18 commented Jan 15, 2024

Contribution description

An interface should rejoin the ipv6_addr_all_nodes_link_local when brought up.
We had a very annoying problem that sometimes a global address could not be configured on an atwinc15x0.
This PR shows how to trigger the problem and what fixes it.

Testing procedure

BOARD = same54-xpro

USEMODULE+=shell_cmd_iw
USEMODULE+=atwinc15x0_dynamic_connect
USEMODULE+=atwinc15x0_dynamic_scan
USEMODULE+=atwinc15x0

ATWINC15X0_PARAM_EXT2 = "{                                \
                        .spi         = SPI_DEV(1),        \
                        .spi_clk     = SPI_CLK_10MHZ,     \
                        .ssn_pin     = GPIO_PIN(2, 6),    \
                        .reset_pin   = GPIO_PIN(1, 1),    \
                        .irq_pin     = GPIO_PIN(3, 0),    \
                        .chip_en_pin = GPIO_PIN(1, 2),    \
                        .wake_pin    = GPIO_PIN(1, 6),    \
                      }"

CFLAGS += -DATWINC15X0_PARAMS=$(ATWINC15X0_PARAM_EXT2)

make -C examples/gnrc_networking flash term

> 2024-01-15 20:25:48,182 # ifconfig
2024-01-15 20:25:48,190 # Iface  5  HWaddr: F8:F0:05:AD:B2:94  Channel: 0  Link: down 
2024-01-15 20:25:48,193 #            State: IDLE 
2024-01-15 20:25:48,197 #           L2-PDU:1500  MTU:1500  HL:64  RTR  
2024-01-15 20:25:48,200 #           Source address length: 6
2024-01-15 20:25:48,202 #           Link type: wireless
2024-01-15 20:25:48,205 #           inet6 group: ff02::2
2024-01-15 20:25:48,208 #           inet6 group: ff02::1
2024-01-15 20:25:48,209 #           
2024-01-15 20:25:48,212 #           Statistics for Layer 2
2024-01-15 20:25:48,215 #             RX packets 0  bytes 0
2024-01-15 20:25:48,219 #             TX packets 0 (Multicast: 0)  bytes 0
2024-01-15 20:25:48,222 #             TX succeeded 0 errors 0
2024-01-15 20:25:48,225 #           Statistics for IPv6
2024-01-15 20:25:48,228 #             RX packets 0  bytes 0
2024-01-15 20:25:48,232 #             TX packets 0 (Multicast: 0)  bytes 0
2024-01-15 20:25:48,235 #             TX succeeded 0 errors 0

Connect to some access point.

> iw 5 connect <SSID> -k <PASSWORD>
2024-01-15 20:27:17,595 # iw 5 connect <SSID> -k <PASSWORD>
2024-01-15 20:27:17,778 # [atwinc15x0] WiFi connected
2024-01-15 20:27:17,783 # connected to <SSID>
2024-01-15 20:27:17,785 # iw: ok

The interface gets a global address.

2024-01-15 20:28:57,705 # ifconfig
2024-01-15 20:28:57,713 # Iface  5  HWaddr: F8:F0:05:AD:B2:94  Channel: 6  Link: down 
2024-01-15 20:28:57,715 #            State: IDLE 
2024-01-15 20:28:57,719 #           L2-PDU:1500  MTU:1500  HL:255  RTR  
2024-01-15 20:28:57,723 #           Source address length: 6
2024-01-15 20:28:57,725 #           Link type: wireless
2024-01-15 20:28:57,732 #           inet6 addr: 2a0c:****:****:****:****:****:****:****  scope: global  VAL
2024-01-15 20:28:57,735 #           inet6 group: ff02::2
2024-01-15 20:28:57,738 #           inet6 group: ff02::1
2024-01-15 20:28:57,741 #           inet6 group: ff02::1:ffad:b294
2024-01-15 20:28:57,742 #           
2024-01-15 20:28:57,745 #           Statistics for Layer 2
2024-01-15 20:28:57,749 #             RX packets 90  bytes 5522
2024-01-15 20:28:57,753 #             TX packets 3 (Multicast: 3)  bytes 218
2024-01-15 20:28:57,756 #             TX succeeded 3 errors 0
2024-01-15 20:28:57,759 #           Statistics for IPv6
2024-01-15 20:28:57,762 #             RX packets 1  bytes 168
2024-01-15 20:28:57,766 #             TX packets 3 (Multicast: 3)  bytes 176
2024-01-15 20:28:57,770 #             TX succeeded 3 errors 0

Disconnect from the AP.

> 2024-01-15 20:34:36,854 # [atwinc15x0] WiFi disconnected

Delete the global address.

ifconfig 5 del 2a0c:****:****:****:****:****:****:****
2024-01-15 20:34:42,987 # ifconfig 5 del 2a0c:****:****:****:****:****:****:****
2024-01-15 20:34:42,996 # success: removed 2a0c:****:****:****:****:****:****:**** to interface 5

Now reset the interface.

ifconfig 5 set state reset
2024-01-15 20:35:02,964 # ifconfig 5 set state reset
2024-01-15 20:35:03,270 # success: set state of interface 5 to RESET

Try to connect again.

>w 5 connect <SSID> -k <PASSWORD>
2024-01-15 20:35:22,240 # iw 5 connect <SSID> -k <PASSWORD>
2024-01-15 20:35:23,256 # [atwinc15x0] WiFi connected
2024-01-15 20:35:23,261 # connected to <SSID>
2024-01-15 20:35:23,262 # iw: ok

You will see that no global address is configured.

2024-01-15 20:35:32,867 # ifconfig
2024-01-15 20:35:32,895 # Iface  5  HWaddr: F8:F0:05:AD:B2:94  Channel: 6  RSSI: -47  Link: up 
2024-01-15 20:35:32,897 #            State: IDLE 
2024-01-15 20:35:32,902 #           L2-PDU:1500  MTU:1500  HL:255  RTR  
2024-01-15 20:35:32,905 #           Source address length: 6
2024-01-15 20:35:32,908 #           Link type: wireless
2024-01-15 20:35:32,913 #           inet6 addr: fe80::faf0:5ff:fead:b294  scope: link  VAL
2024-01-15 20:35:32,916 #           inet6 group: ff02::2
2024-01-15 20:35:32,919 #           inet6 group: ff02::1
2024-01-15 20:35:32,922 #           inet6 group: ff02::1:ffad:b294
2024-01-15 20:35:32,923 #           
2024-01-15 20:35:32,926 #           Statistics for Layer 2
2024-01-15 20:35:32,930 #             RX packets 143  bytes 8842
2024-01-15 20:35:32,934 #             TX packets 10 (Multicast: 10)  bytes 716
2024-01-15 20:35:32,937 #             TX succeeded 10 errors 0
2024-01-15 20:35:32,940 #           Statistics for IPv6
2024-01-15 20:35:32,943 #             RX packets 3  bytes 400
2024-01-15 20:35:32,948 #             TX packets 10 (Multicast: 10)  bytes 576
2024-01-15 20:35:32,951 #             TX succeeded 10 errors 0

No global address could be configured even though I can see in Wireshark that the the exchange of RS and RA is happening.

Screenshot from 2024-01-15 20-39-24

You can see that the RA is sent to L2 multicast address 33:33:00:00:00:1, which is the L2 multicast group which is joined when the API gnrc_netif_ipv6_group_join_internal(netif,&ipv6_addr_all_nodes_link_local) is called. But this is only called once for every interface in gnrc_ipv6_nib_init_iface.

Screenshot from 2024-01-15 20-43-47

The atwinc15x0 driver has an internal API to join a L2 multicast group m2m_wifi_enable_mac_mcast() which is called when NETOPT_L2_GROUP or NETOPT_L2_GROUP_LEAVE are sent to the driver.

TLDR: The netif reset is calling the drivers init() function again and I strongly assume that m2m_wifi_init() makes the WiFi chip leave the L2 multicast group, which is why no RA to ff02::1 is received anymore. The fix in my opinion is, as you can see in the PR, to leave ipv6_addr_all_nodes_link_local when the interface is brought down and rejoin the group when it is brought up.
Repeat the testing procedure with this fix and an atwinc15x0 and you will see that the RA is received and a global address is configured successfully.

Issues/PRs references

@github-actions github-actions bot added Area: network Area: Networking Area: sys Area: System labels Jan 15, 2024
@fabian18 fabian18 added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jan 15, 2024
@riot-ci
Copy link

riot-ci commented Jan 15, 2024

Murdock results

✔️ PASSED

ab3f77e gnrc/ipv6/nib: rejoin ipv6_addr_all_nodes_link_local on interface up

Success Failures Total Runtime
8101 0 8101 13m:01s

Artifacts

@fabian18 fabian18 force-pushed the pr/gnrc/ipv6/nib_rejoin_ip6_mcast branch from 33cd3b7 to 720fc49 Compare January 15, 2024 21:56
@fabian18 fabian18 force-pushed the pr/gnrc/ipv6/nib_rejoin_ip6_mcast branch from 720fc49 to ab3f77e Compare January 16, 2024 11:39
@benpicco benpicco added the Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) label Jan 16, 2024
@benpicco benpicco added this pull request to the merge queue Jan 16, 2024
Merged via the queue into RIOT-OS:master with commit c1ae2ec Jan 16, 2024
27 checks passed
@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: 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