RIOT-OS / RIOT

RIOT - The friendly OS for IoT
https://riot-os.org
GNU Lesser General Public License v2.1
4.94k stars 1.99k forks source link

DHCPv6 client: Handling of NotOnLink incorrect #20349

Open maribu opened 9 months ago

maribu commented 9 months ago

Description

From: https://www.rfc-editor.org/rfc/rfc3315#section-18.1.8

When the client receives a NotOnLink status from the server in response to a Request, the client can either re-issue the Request without specifying any addresses or restart the DHCP server discovery process (see section 17).

This behavior however is not implemented.

Steps to reproduce the issue

Connect an OpenWrt router to a FritzBox and enable prefix delegation on both the FritzBox and the OpenWrt box. The OpenWrt will get /57 prefix delegated. Then, flash the gnrc_boarder_router example with UPLINK=wifi and SSID and password of the OpenWrt box.

Expected results

The ESP32 will get a prefix from the OpenWrt box.

Actual results

2024-02-07 12:12:44,243 # WiFi connected to ssid Loeffelnetz, channel 1
2024-02-07 12:12:48,108 # DHCPv6 client: resend SOLICIT
2024-02-07 12:12:48,121 # DHCPv6 client: received ADVERTISE
2024-02-07 12:12:48,122 # DHCPv6 client: scheduling REQUEST
2024-02-07 12:12:48,122 # DHCPv6 client: send REQUEST
2024-02-07 12:12:48,160 # DHCPv6 client: received REPLY
2024-02-07 12:12:48,161 # DHCPv6 client: server returned error (4) "��Py�?"
> ifconfig
2024-02-07 12:25:36,187 #      L2-PDU:249  MTU:1280  HL:64  RTR  
2024-02-07 12:25:36,187 #           6LO  Source address length: 6
2024-02-07 12:25:36,187 #           Link type: wireless
2024-02-07 12:25:36,187 #           inet6 addr: fe80::a6cf:12ff:fe44:e815  scope: link  VAL
2024-02-07 12:25:36,188 #           inet6 group: ff02::2
2024-02-07 12:25:36,188 #           inet6 group: ff02::1
2024-02-07 12:25:36,208 #           inet6 group: ff02::1:ff44:e815
2024-02-07 12:25:36,209 #           
2024-02-07 12:25:36,209 # Iface  10  HWaddr: A4:CF:12:44:E8:14  Channel: 1  Link: up 
2024-02-07 12:25:36,209 #           L2-PDU:1500  MTU:1492  HL:64  RTR  
2024-02-07 12:25:36,209 #           Source address length: 6
2024-02-07 12:25:36,210 #           Link type: wireless
2024-02-07 12:25:36,227 #           inet6 addr: fe80::a6cf:12ff:fe44:e814  scope: link  VAL
2024-02-07 12:25:36,227 #           inet6 addr: 2a01:c23:654d:3d80:a6cf:12ff:fe44:e814  scope: global  VAL
2024-02-07 12:25:36,228 #           inet6 group: ff02::2
2024-02-07 12:25:36,228 #           inet6 group: ff02::1
2024-02-07 12:25:36,228 #           inet6 group: ff02::1:ff44:e814

Versions

2024.01-branch and current master

benpicco commented 9 months ago

Do you have a packet capture of what RIOT is requesting there?

maribu commented 9 months ago

The request from the RIOT device:

DHCPv6
    Message type: Request (3)
    Transaction ID: 0x9c58a3
    Client Identifier
        Option: Client Identifier (1)
        Length: 10
        DUID: 00030001a4cf1244e814
        DUID Type: link-layer address (3)
        Hardware type: Ethernet (1)
        Link-layer address: a4:cf:12:44:e8:14
    Server Identifier
        Option: Server Identifier (2)
        Length: 10
        DUID: 00030001c87f54e24f50
        DUID Type: link-layer address (3)
        Hardware type: Ethernet (1)
        Link-layer address: c8:7f:54:e2:4f:50
    Option Request
        Option: Option Request (6)
        Length: 2
        Requested Option code: SOL_MAX_RT (82)
    Identity Association for Prefix Delegation
        Option: Identity Association for Prefix Delegation (25)
        Length: 41
        IAID: 00190009
        T1: 0
        T2: 0
        IA Prefix
            Option: IA Prefix (26)
            Length: 25
            Preferred lifetime: 0
            Valid lifetime: 0
            Prefix length: 64
            Prefix address: ::
    Elapsed time
        Option: Elapsed time (8)
        Length: 2
        Elapsed time: 0ms

The reply from the DHCPv6 server:

DHCPv6
    Message type: Reply (7)
    Transaction ID: 0x9c58a3
    Server Identifier
        Option: Server Identifier (2)
        Length: 10
        DUID: 00030001c87f54e24f50
        DUID Type: link-layer address (3)
        Hardware type: Ethernet (1)
        Link-layer address: c8:7f:54:e2:4f:50
    Client Identifier
        Option: Client Identifier (1)
        Length: 10
        DUID: 00030001a4cf1244e814
        DUID Type: link-layer address (3)
        Hardware type: Ethernet (1)
        Link-layer address: a4:cf:12:44:e8:14
    SOL_MAX_RT
        Option: SOL_MAX_RT (82)
        Length: 4
    DNS recursive name server
        Option: DNS recursive name server (23)
        Length: 16
         1 DNS server address: fd71:af38:1d57::1
    Identity Association for Prefix Delegation
        Option: Identity Association for Prefix Delegation (25)
        Length: 18
        IAID: 00190009
        T1: 0
        T2: 0
        Status code
            Option: Status code (13)
            Length: 2
            Status Code: NotOnLink (4)

And the whole exchanged captured at the OpenWrt Box: https://mari-bu.de/capture.pcapng