openwrt / odhcpd

This repository is a mirror of https://git.openwrt.org/?p=project/odhcpd.git. Pull requests will be accepted which will be merged in odhcpd.git
GNU General Public License v2.0
160 stars 96 forks source link

NoPrefixAvail trying to request a /64 from a /48 PD #180

Open brianjmurrell opened 2 years ago

brianjmurrell commented 2 years ago

With odhcpd 2021-07-18-bc9d317f-3 a downstream router requesting a subnet is getting NoPrefixAvail.

The request is for a /64 and the router reporting NoPrefxAvail is being delegated a /48 from it's upstream and only using two /64s out of it. I'm at a loss why odhcpd would not be able to find any more /64s out of that /48.

/etc/config/network:

config interface 'loopback'
    option device 'lo'
    option proto 'static'
    option ipaddr '127.0.0.1'
    option netmask '255.0.0.0'

config globals 'globals'
    option ula_prefix 'fd31:aeb1:48df::/48'

config interface 'lan'
    option proto 'static'
    option netmask '255.255.255.0'
    list ipaddr '10.75.22.250'
    list ipaddr '10.75.22.254'
    option ip6assign '64'
    option ip6hint '0'
    option defaultroute '0'
    option peerdns '0'
    option dns '10.75.22.247'
    option dns_search 'example.com foo'
    option device 'eth0.1'

config device
    option vid '1'
    option type '8021q'
    option name 'eth0.1'
    option ifname 'eth0'

config device
    option vid '2'
    option ifname 'eth0'
    option name 'eth0.2'
    option macaddr '6C:B0:CE:F5:1E:4B'
    option type '8021q'

config device
    option vid '3'
    option type '8021q'
    option name 'eth0.3'
    option ifname 'eth0'

config device
    option vid '15'
    option type '8021q'
    option name 'eth0.15'
    option ifname 'eth0'

config interface 'wan0'
    option proto 'dhcp'
    option device 'eth0.2'
    option peerdns '0'
    option metric '10'

config interface 'wan1'
    option device 'eth0.3'
    option proto 'pppoe'
    option username '[redacted]'
    option password '[redacted]'
    option ppp_redial 'persist'
    option peerdns '0'
    option defaultroute '1'
    option ipv6 '1'
    option metric '20'

config interface 'wan1_6'
    option device '@wan1'
    option proto 'dhcpv6'
    option reqaddress 'try'
    option reqprefix 'auto'
    option defaultroute '1'
    option peerdns '0'
    option metric '20'

config interface 'henet'
    option proto '6in4'
    option peeraddr '22.3.43.21'
    option ip6addr '2001:123:aa:123::2/64'
    option ip6prefix '2001:123:4567::/48'
    option tunnelid '[redacted]'
    option username '[redacted]'
    option password '[redacted]'
    option updatekey '[redacted]'
    option metric '10'

config interface 'guest'
    option proto 'static'
    option device 'eth0.15'
    list ipaddr '192.168.101.250'
    list ipaddr '192.168.101.254'
    option netmask '255.255.255.0'
    option ip6assign '64'

config interface 'lan1'
    option device '@lan'
    option proto 'static'

config interface 'lan2'
    option device '@lan'
    option proto 'static'

/etc/config/dhcp:

config dnsmasq
    option domainneeded '1'
    option boguspriv '1'
    option filterwin2k '0'
    option localise_queries '1'
    option rebind_protection '1'
    option rebind_localhost '1'
    option local '/lan/'
    option domain 'foo'
    option expandhosts '1'
    option nonegcache '0'
    option authoritative '1'
    option readethers '1'
    option leasefile '/tmp/dhcp.leases'
    option resolvfile '/tmp/resolv.conf.auto'

config dhcp 'lan'
    option interface 'lan'
    option dhcpv6 'server'
    option ra 'server'
    option ra_management '0'
    list dns 'fd31:aeb1:48df::2'
    list domain 'example.com'
    option prefix_filter 'fc00:0:0:0:0:0:0:0/7'
    option ra_preference 'high'
    option ra_default '1'
        option ip6assign '64'

config dhcp 'lan1'
    option interface 'lan1'
    option dhcpv6 'disabled'
    option ra 'server'
    option ra_management '0'
    list dns 'fd31:aeb1:48df::2'
    list domain 'example.com'
    option prefix_filter '2001:123:4567::/64'
    option ra_preference 'medium'

config odhcpd 'odhcpd'
    option maindhcp '0'
    option leasefile '/tmp/hosts/odhcpd'
    option leasetrigger '/usr/sbin/odhcpd-update'
    option loglevel '0'

odhcpd -l 7 didn't provide anything useful.

chrysn commented 5 months ago

Same issue for me at 2023-10-24-d8118f6e-1 (also 2023-06-24-52112643-1).

Wireshark decodings of request and response below ``` Frame 182286: 162 bytes on wire (1296 bits), 162 bytes captured (1296 bits) on interface any, id 0 Linux cooked capture v1 Internet Protocol Version 6, Src: fe80::f151:2971:f0f0:10f2, Dst: ff02::1:2 User Datagram Protocol, Src Port: 546, Dst Port: 547 DHCPv6 Message type: Solicit (1) Transaction ID: 0x5fb5c2 Rapid Commit Option: Rapid Commit (14) Length: 0 Identity Association for Non-temporary Address Option: Identity Association for Non-temporary Address (3) Length: 12 IAID: 9fab5644 T1: 0 T2: 0 Identity Association for Prefix Delegation Option: Identity Association for Prefix Delegation (25) Length: 12 IAID: 9fab5644 T1: 0 T2: 0 Client Fully Qualified Domain Name Option: Client Fully Qualified Domain Name (39) Length: 12 Flags: 0x01 [CLIENT wants SERVER to update both its AAAA and PTR RRs] Partial domain name: hephaistos Option Request Option: Option Request (6) Length: 10 Requested Option code: DNS recursive name server (23) Requested Option code: Domain Search List (24) Requested Option code: Simple Network Time Protocol Server (31) Requested Option code: NTP Server (56) Requested Option code: SOL_MAX_RT (82) Client Identifier Option: Client Identifier (1) Length: 18 DUID: 0004f230931d464e9d76a622f1964f9930f0 DUID Type: Universally Unique IDentifier (UUID) (4) UUID: f230931d464e9d76a622f1964f9930f0 Elapsed time Option: Elapsed time (8) Length: 2 Elapsed time: 10ms ``` ``` Frame 182287: 230 bytes on wire (1840 bits), 230 bytes captured (1840 bits) on interface any, id 0 Linux cooked capture v1 Internet Protocol Version 6, Src: fe80::265e:beff:fe52:80d8, Dst: fe80::f151:2971:f0f0:10f2 User Datagram Protocol, Src Port: 547, Dst Port: 546 DHCPv6 Message type: Reply (7) Transaction ID: 0x5fb5c2 Server Identifier Option: Server Identifier (2) Length: 10 DUID: 00030001245ebe5280d8 DUID Type: link-layer address (3) Hardware type: Ethernet (1) Link-layer address: 24:5e:be:52:80:d8 Link-layer address (Ethernet): QNAP_52:80:d8 (24:5e:be:52:80:d8) Client Identifier Option: Client Identifier (1) Length: 18 DUID: 0004f230931d464e9d76a622f1964f9930f0 DUID Type: Universally Unique IDentifier (UUID) (4) UUID: f230931d464e9d76a622f1964f9930f0 SOL_MAX_RT Option: SOL_MAX_RT (82) Length: 4 Rapid Commit Option: Rapid Commit (14) Length: 0 DNS recursive name server Option: DNS recursive name server (23) Length: 16 1 DNS server address: fda4:ae06:1a7e:10::1 Identity Association for Non-temporary Address Option: Identity Association for Non-temporary Address (3) Length: 68 IAID: 9fab5644 T1: 21600 T2: 34560 IA Address Option: IA Address (5) Length: 24 IPv6 address: 2a02:b18:c13b:8010::32b Preferred lifetime: 43200 Valid lifetime: 43200 IA Address Option: IA Address (5) Length: 24 IPv6 address: fda4:ae06:1a7e:10::32b Preferred lifetime: 43200 Valid lifetime: 43200 Identity Association for Prefix Delegation Option: Identity Association for Prefix Delegation (25) Length: 18 IAID: 9fab5644 T1: 0 T2: 0 Status code Option: Status code (13) Length: 2 Status Code: NoPrefixAvail (6) ```

My IPv6 routed prefix is a /56, settings are unmodified OpenWRT defaults (in particular, no PD minimum length is configured, and no prefix filter is set. The ULA's /48 should be available as well, and both were successfully delegated using older OpenWRT versions.)

tiagogaspar8 commented 3 weeks ago

Hi @brianjmurrell

You need to change the option ip6assign '64' in the lan configuration on the network file to something like 60, because odhcpd assigns PD from the prefix on the lan, so if you want to do downstream delegation you need to give lan a size that contains multiple /64's, like 60.