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: allow for predictable static link-local addresses #20224

Merged
merged 2 commits into from
Jan 5, 2024

Conversation

benpicco
Copy link
Contributor

@benpicco benpicco commented Jan 3, 2024

Contribution description

With GNRC_IPV6_STATIC_LLADDR we can set static link-local addresses.
They are however not predictable: the interface ID gets added to least significant byte of the address. Add another option CONFIG_GNRC_IPV6_STATIC_LLADDR_IS_FIXED to avoid that.

Testing procedure

with CONFIG_GNRC_IPV6_STATIC_LLADDR_IS_FIXED=0

2024-01-03 13:56:03,778 # Iface  7  HWaddr: 42:72  Channel: 26  NID: 0x23  PHY: O-QPSK 
2024-01-03 13:56:03,778 #           Long HWaddr: EE:9A:35:CC:EB:C8:42:72 
2024-01-03 13:56:03,779 #            State: IDLE 
2024-01-03 13:56:03,779 #           ACK_REQ  L2-PDU:102  MTU:1280  HL:64  RTR  
2024-01-03 13:56:03,779 #           RTR_ADV  6LO  IPHC  
2024-01-03 13:56:03,779 #           Source address length: 8
2024-01-03 13:56:03,780 #           Link type: wireless
2024-01-03 13:56:03,780 #           inet6 addr: fe80::cafe:cafe:cafe:8  scope: link  VAL
2024-01-03 13:56:03,780 #           inet6 addr: fe80::ec9a:35cc:ebc8:4272  scope: link  VAL
2024-01-03 13:56:03,780 #           inet6 group: ff02::2
2024-01-03 13:56:03,780 #           inet6 group: ff02::1
2024-01-03 13:56:03,781 #           inet6 group: ff02::1:fffe:8
2024-01-03 13:56:03,781 #           inet6 group: ff02::1:ffc8:4272
2024-01-03 13:56:03,781 #           inet6 group: ff02::1a

with CONFIG_GNRC_IPV6_STATIC_LLADDR_IS_FIXED=1

2024-01-03 13:56:45,673 # Iface  7  HWaddr: 16:BE  Channel: 26  NID: 0x23  PHY: O-QPSK 
2024-01-03 13:56:45,673 #           Long HWaddr: AE:8A:E9:6C:B7:14:16:BE 
2024-01-03 13:56:45,674 #            State: IDLE 
2024-01-03 13:56:45,674 #           ACK_REQ  L2-PDU:102  MTU:1280  HL:64  RTR  
2024-01-03 13:56:45,675 #           RTR_ADV  6LO  IPHC  
2024-01-03 13:56:45,675 #           Source address length: 8
2024-01-03 13:56:45,675 #           Link type: wireless
2024-01-03 13:56:45,676 #           inet6 addr: fe80::cafe:cafe:cafe:1  scope: link  VAL
2024-01-03 13:56:45,677 #           inet6 addr: fe80::ac8a:e96c:b714:16be  scope: link  VAL
2024-01-03 13:56:45,677 #           inet6 group: ff02::2
2024-01-03 13:56:45,678 #           inet6 group: ff02::1
2024-01-03 13:56:45,678 #           inet6 group: ff02::1:fffe:1
2024-01-03 13:56:45,678 #           inet6 group: ff02::1:ff14:16be
2024-01-03 13:56:45,678 #           inet6 group: ff02::1a

Issues/PRs references

@github-actions github-actions bot added Area: network Area: Networking Area: sys Area: System labels Jan 3, 2024
@benpicco benpicco force-pushed the GNRC_IPV6_STATIC_LLADDR_FIXED branch from 0deea3d to 4ca2dab Compare January 3, 2024 13:05
@fabian18
Copy link
Contributor

fabian18 commented Jan 3, 2024

You should probably add a sentence of documentation in ipv6.h close to GNRC_IPV6_STATIC_LLADDR, and Kconfig.

@benpicco benpicco force-pushed the GNRC_IPV6_STATIC_LLADDR_FIXED branch from 4ca2dab to ec8271e Compare January 3, 2024 22:46
@miri64
Copy link
Member

miri64 commented Jan 4, 2024

Just out of curiosity: What happens if you have this enabled with multiple interfaces (say the gnrc_border_router example) and ping the static address?

@fabian18
Copy link
Contributor

fabian18 commented Jan 4, 2024

Just out of curiosity: What happens if you have this enabled with multiple interfaces (say the gnrc_border_router example) and ping the static address?

gnrc_border_router on same54-xpro + ethos (6) + ethernet (7) + atwinc15x0 (5)

Iface  5  HWaddr: F8:F0:05:AD:B2:94  Channel: 6  RSSI: -50  Link: up 
           State: IDLE 
          L2-PDU:1500  MTU:1500  HL:64  RTR  
          Source address length: 6
          Link type: wireless
          inet6 addr: fe80::cafe:cafe:cafe:1  scope: link  VAL
          inet6 addr: fe80::faf0:5ff:fead:b294  scope: link  VAL
          inet6 group: ff02::2
          inet6 group: ff02::1
          inet6 group: ff02::1:fffe:1
          inet6 group: ff02::1:ffad:b294
          
Iface  6  HWaddr: FE:76:BD:F3:16:D8 
          L2-PDU:1500  MTU:1500  HL:64  RTR  
          Source address length: 6
          Link type: wired
          inet6 addr: fe80::cafe:cafe:cafe:1  scope: link  VAL
          inet6 addr: fe80::fc76:bdff:fef3:16d8  scope: link  VAL
          inet6 group: ff02::2
          inet6 group: ff02::1
          inet6 group: ff02::1:fffe:1
          inet6 group: ff02::1:fff3:16d8
          
Iface  7  HWaddr: FC:C2:3D:2F:8E:90  Link: up 
          L2-PDU:1500  MTU:1500  HL:64  RTR  
          Source address length: 6
          Link type: wired
          inet6 addr: fe80::2  scope: link  VAL
          inet6 addr: fe80::cafe:cafe:cafe:1  scope: link  VAL
          inet6 group: ff02::2
          inet6 group: ff02::1
          inet6 group: ff02::1:ff00:2
          inet6 group: ff02::1:fffe:1

Linux: ping -I tap0 fe80::cafe:cafe:cafe:1

Screenshot from 2024-01-04 16-01-11

From the mac address I see that the ethos interface replies.

@fabian18
Copy link
Contributor

fabian18 commented Jan 4, 2024

Is Kconfig not mandatory anymore?

@fabian18
Copy link
Contributor

fabian18 commented Jan 4, 2024

A question ragarding GNRC_IPV6_STATIC_LLADDR. My first idea to implement this would have been a configuration consisting of the { const char *addr, netdev_type_t type, unsigned index }. Did you rule this out because it obviously consumes more ROM?

@benpicco
Copy link
Contributor Author

benpicco commented Jan 4, 2024

In this case we actually want the same link-local address on all interfaces (we use them to identify the board type).

I can add Kconfig but this will require renaming the GNRC_IPV6_STATIC_LLADDR macro to something like CONFIG_GNRC_IPV6_STATIC_LLADDR_STRING.

@fabian18
Copy link
Contributor

fabian18 commented Jan 4, 2024

I mean Kconfig for CONFIG_GNRC_IPV6_STATIC_LLADDR_IS_FIXED. I mean personally I do not really care much about that but I think it is still required by RIOT to have all CONFIG_ as Kconfig

@benpicco benpicco force-pushed the GNRC_IPV6_STATIC_LLADDR_FIXED branch from ec8271e to 7c97c7c Compare January 4, 2024 16:21
@github-actions github-actions bot added Area: examples Area: Example Applications Area: Kconfig Area: Kconfig integration labels Jan 4, 2024
@benpicco
Copy link
Contributor Author

benpicco commented Jan 4, 2024

I think this was never a requirement, but I added a Kconfig entry.

@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 Jan 4, 2024
@benpicco benpicco force-pushed the GNRC_IPV6_STATIC_LLADDR_FIXED branch from 7c97c7c to 4a5757b Compare January 4, 2024 16:45
@riot-ci
Copy link

riot-ci commented Jan 4, 2024

Murdock results

✔️ PASSED

4a5757b gnrc/ipv6/nib: add Kconfig for static link-local address

Success Failures Total Runtime
8101 0 8101 10m:55s

Artifacts

Copy link
Contributor

@fabian18 fabian18 left a comment

Choose a reason for hiding this comment

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

I think this was never a requirement, but I added a Kconfig entry.

Ok sorry, I didn't want to enlarge this unnecessarily.

@benpicco benpicco added this pull request to the merge queue Jan 4, 2024
Merged via the queue into RIOT-OS:master with commit 1d3a7cd Jan 5, 2024
26 checks passed
@benpicco benpicco deleted the GNRC_IPV6_STATIC_LLADDR_FIXED branch January 5, 2024 10:46
@miri64
Copy link
Member

miri64 commented Jan 5, 2024

Just out of curiosity: What happens if you have this enabled with multiple interfaces (say the gnrc_border_router example) and ping the static address?

gnrc_border_router on same54-xpro + ethos (6) + ethernet (7) + atwinc15x0 (5)

Iface  5  HWaddr: F8:F0:05:AD:B2:94  Channel: 6  RSSI: -50  Link: up 
           State: IDLE 
          L2-PDU:1500  MTU:1500  HL:64  RTR  
          Source address length: 6
          Link type: wireless
          inet6 addr: fe80::cafe:cafe:cafe:1  scope: link  VAL
          inet6 addr: fe80::faf0:5ff:fead:b294  scope: link  VAL
          inet6 group: ff02::2
          inet6 group: ff02::1
          inet6 group: ff02::1:fffe:1
          inet6 group: ff02::1:ffad:b294
          
Iface  6  HWaddr: FE:76:BD:F3:16:D8 
          L2-PDU:1500  MTU:1500  HL:64  RTR  
          Source address length: 6
          Link type: wired
          inet6 addr: fe80::cafe:cafe:cafe:1  scope: link  VAL
          inet6 addr: fe80::fc76:bdff:fef3:16d8  scope: link  VAL
          inet6 group: ff02::2
          inet6 group: ff02::1
          inet6 group: ff02::1:fffe:1
          inet6 group: ff02::1:fff3:16d8
          
Iface  7  HWaddr: FC:C2:3D:2F:8E:90  Link: up 
          L2-PDU:1500  MTU:1500  HL:64  RTR  
          Source address length: 6
          Link type: wired
          inet6 addr: fe80::2  scope: link  VAL
          inet6 addr: fe80::cafe:cafe:cafe:1  scope: link  VAL
          inet6 group: ff02::2
          inet6 group: ff02::1
          inet6 group: ff02::1:ff00:2
          inet6 group: ff02::1:fffe:1

Linux: ping -I tap0 fe80::cafe:cafe:cafe:1

Screenshot from 2024-01-04 16-01-11

From the mac address I see that the ethos interface replies.

Remotely, that was to be expected, since it is a link-local address (so only the address at the link would reply). However, my curiosity was more when you locally try to ping yourself. But now that I thought about this: You need to provide an interface with that anyways. So all fine. Thanks for testing though!

@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: examples Area: Example Applications Area: Kconfig Area: Kconfig integration 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants