Skip to content
New issue

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

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

Already on GitHub? # to your account

gnrc_netif_lorawan: add support for LINK_UP/_DOWN events #18699

Merged

Conversation

miri64
Copy link
Member

@miri64 miri64 commented Oct 6, 2022

Contribution description

This prepares for SCHC support with LoRaWAN, by adding UP/DOWN events to gnrc_netif_lorawan. Since with LoRaWAN there is only a hardware address (and thus an IID) after the device joined the network (which is the UP event), auto-configuration of link-local addresses needs to be done on UP. Since the hardware address (and the IID for that matter, see https://datatracker.ietf.org/doc/html/rfc9011#section-5.3) might change on the next connect, the link-local address needs to be removed on down.

Testing procedure

Sadly, there is no IPv6 support for LoRaWAN yet, so only a compile test must suffice for now. However, I need this for SCHC and IPv6 support (i.e. SCHC) for LoRaWAN is needed to test this, so this is somewhat of a hen-and-egg problem...

Issues/PRs references

In preparation for #18700.

Requires #18708 (merged).

@miri64 miri64 added the Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation label Oct 6, 2022
@miri64 miri64 requested a review from jia200x October 6, 2022 13:56
@github-actions github-actions bot added Area: network Area: Networking Area: sys Area: System labels Oct 6, 2022
@miri64 miri64 force-pushed the gnrc_netif_lorawan/enh/up-down-support branch 3 times, most recently from 3d2c2b6 to ed4b21b Compare October 6, 2022 14:53
@miri64 miri64 requested a review from fabian18 October 6, 2022 14:54
@miri64 miri64 force-pushed the gnrc_netif_lorawan/enh/up-down-support branch from ed4b21b to 175a152 Compare October 7, 2022 10:40
@miri64
Copy link
Member Author

miri64 commented Oct 7, 2022

Rebased and adopted for the change introduced in #18708

@miri64 miri64 added State: waiting for other PR State: The PR requires another PR to be merged first and removed State: waiting for other PR State: The PR requires another PR to be merged first labels Oct 7, 2022
@miri64 miri64 force-pushed the gnrc_netif_lorawan/enh/up-down-support branch from db7e1f5 to 4ac0740 Compare October 11, 2022 10:27
@miri64 miri64 force-pushed the gnrc_netif_lorawan/enh/up-down-support branch from 4ac0740 to 4ac550c Compare October 11, 2022 10:29
@miri64
Copy link
Member Author

miri64 commented Oct 11, 2022

Rebased to current master. No longer waiting for another PR.

@miri64 miri64 requested a review from benpicco October 11, 2022 10:31
@miri64 miri64 force-pushed the gnrc_netif_lorawan/enh/up-down-support branch from 4ac550c to 98f70f9 Compare October 11, 2022 10:37
Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

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

examples/gnrc_border_router still works on esp32-wroom-32

2022-10-11 22:52:47,163 # Iface  9  HWaddr: 3C:71:BF:9E:13:FD  Channel: 6 
2022-10-11 22:52:47,166 #           L2-PDU:249  MTU:1280  HL:64  RTR  
2022-10-11 22:52:47,170 #           6LO  Source address length: 6
2022-10-11 22:52:47,172 #           Link type: wireless
2022-10-11 22:52:47,178 #           inet6 addr: fe80::3e71:bfff:fe9e:13fd  scope: link  VAL
2022-10-11 22:52:47,181 #           inet6 group: ff02::2
2022-10-11 22:52:47,184 #           inet6 group: ff02::1
2022-10-11 22:52:47,187 #           inet6 group: ff02::1:ff9e:13fd
2022-10-11 22:52:47,188 #           
2022-10-11 22:52:47,193 # Iface  10  HWaddr: 3C:71:BF:9E:13:FC  Channel: 0  Link: down 
2022-10-11 22:52:47,197 #           L2-PDU:1500  MTU:1500  HL:64  RTR  
2022-10-11 22:52:47,200 #           Source address length: 6
2022-10-11 22:52:47,203 #           Link type: wireless
2022-10-11 22:52:47,206 #           inet6 group: ff02::2
2022-10-11 22:52:47,208 #           inet6 group: ff02::1
2022-10-11 22:52:47,209 #           

2022-10-11 22:52:49,254 # WiFi connected to ssid beersperminute, channel 1

2022-10-11 22:54:40,175 # > ifconfig
2022-10-11 22:54:40,179 # Iface  9  HWaddr: 3C:71:BF:9E:13:FD  Channel: 1 
2022-10-11 22:54:40,183 #           L2-PDU:249  MTU:1280  HL:64  RTR  
2022-10-11 22:54:40,187 #           RTR_ADV  6LO  Source address length: 6
2022-10-11 22:54:40,190 #           Link type: wireless
2022-10-11 22:54:40,196 #           inet6 addr: fe80::3e71:bfff:fe9e:13fd  scope: link  VAL
2022-10-11 22:54:40,203 #           inet6 addr: 2001:9e8:1436:e5fc:3e71:bfff:fe9e:13fd  scope: global  VAL
2022-10-11 22:54:40,205 #           inet6 group: ff02::2
2022-10-11 22:54:40,208 #           inet6 group: ff02::1
2022-10-11 22:54:40,212 #           inet6 group: ff02::1:ff9e:13fd
2022-10-11 22:54:40,213 #           
2022-10-11 22:54:40,218 # Iface  10  HWaddr: 3C:71:BF:9E:13:FC  Channel: 1  Link: up 
2022-10-11 22:54:40,222 #           L2-PDU:1500  MTU:1492  HL:255  RTR  
2022-10-11 22:54:40,225 #           Source address length: 6
2022-10-11 22:54:40,228 #           Link type: wireless
2022-10-11 22:54:40,233 #           inet6 addr: fe80::3e71:bfff:fe9e:13fc  scope: link  VAL
2022-10-11 22:54:40,240 #           inet6 addr: 2001:9e8:1436:e500:3e71:bfff:fe9e:13fc  scope: global  VAL
2022-10-11 22:54:40,243 #           inet6 group: ff02::2
2022-10-11 22:54:40,246 #           inet6 group: ff02::1
2022-10-11 22:54:40,249 #           inet6 group: ff02::1:ff9e:13fc

Please squash

@miri64
Copy link
Member Author

miri64 commented Oct 11, 2022

2022-10-11 22:52:49,254 # WiFi connected to ssid beersperminute, channel 1

I see the WG SSID did not change in the past 10 years :D

@miri64 miri64 force-pushed the gnrc_netif_lorawan/enh/up-down-support branch from 789b878 to 5f504ad Compare October 11, 2022 20:57
@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 Oct 11, 2022
@miri64
Copy link
Member Author

miri64 commented Oct 11, 2022

Iface 9 is not WiFi, I assume?

@miri64
Copy link
Member Author

miri64 commented Oct 11, 2022

(because it says "wireless")

@benpicco
Copy link
Contributor

Iface 9 is esp_now.
All ESPs can run both in parallel and act as a WiFi <-> esp_now border router.

@riot-ci
Copy link

riot-ci commented Oct 11, 2022

Murdock results

✔️ PASSED

7f146b6 tests/gnrc_ipv6_nib: up interface on initial initialization

Success Failures Total Runtime
2017 0 2017 09m:37s

Artifacts

This only reflects a subset of all builds from https://ci-prod.riot-os.org. Please refer to https://ci.riot-os.org for a complete build for now.

@benpicco benpicco removed the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Oct 11, 2022
@miri64
Copy link
Member Author

miri64 commented Oct 12, 2022

Mh, the test expects the address to be configured. Wasn't there some way to wait for the up event?

@miri64
Copy link
Member Author

miri64 commented Oct 12, 2022

Ah, since it is only a mock interface, I can just call _common_set_up() which handles the bootstrapping of the interface between tests sufficiently.

@benpicco
Copy link
Contributor

benpicco commented Oct 12, 2022

The test needs to call gnrc_ipv6_nib_iface_up() which it does in _common_set_up() - but looks like _tests_init() and the expect(!ipv6_addr_is_unspecified(&_mock_netif->ipv6.addrs[0])); is called before that.

Since SLAAC now happens on the up event, the tests needs to ensure, that
`gnrc_ipv6_nib_iface_up()` is called before assuming SLAAC happened. For
the mock interface, this is done by gnrc_ipv6_nib_iface_up().
@miri64 miri64 added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: run tests If set, CI server will run tests on hardware for the labeled PR labels Oct 12, 2022
@github-actions github-actions bot added the Area: tests Area: tests and testing framework label Oct 12, 2022
@benpicco benpicco merged commit 913bf37 into RIOT-OS:master Oct 12, 2022
@miri64 miri64 deleted the gnrc_netif_lorawan/enh/up-down-support branch October 12, 2022 15:12
@maribu maribu added this to the Release 2022.10 milestone Oct 14, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Area: network Area: Networking Area: sys Area: System Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: run tests If set, CI server will run tests on hardware for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants