Odhcpd gets wrong prefix from DHCPv6 SOLICIT messages

I've been delegated a /56 IPv6 prefix from my ISP. My edge router gets this okay, and is set to be a server for dhcpv6 and ra options for lan in /etc/config/dhcp. Downstream I have another router with reqprefix set to 60, and it asks for that in DHCPv6 Solicit requests, confirmed by wireshark watching the traffic between them. But according to logread (odhcpd log level set to 5) it sees the prefix as 61 or 62. It then sends an Advert with the /61 or /62 and the downstream router has to accept that. I've tried reqprefix of 60, 59, 58, 56 all the same - logread always shows 61 or 62 and it only advertises /61 or /62. Only changes when I try 63, and then the upstream router advertises a /63. Has anybody seen this or know how to fix it?
OpenWRT is 18.06.2 on two RPi 3B+
edge router logread when prefix is set to 54 on downstream client:

Wed Mar 27 07:59:54 2019 daemon.warn odhcpd[545]: \
   DHCPV6 SOLICIT IA_PD from 00030001b827eb1052a1 on br-lan: \
   ok 2400:3740:200:d908::/61 \

Excerpt from /etc/config/network on downstream client with prefix set to 54

config interface wan6
    option ifname eth0
    option proto dhcpv6
    option reqprefix '54'

Image from wireshark between the two routers for the Solicit from the client router prefix-solicit

What is the ip6assign value on your downstream (br-lan) interface in /etc/config/network?

config interface 'lan'
option ip6assign '60'
option type bridge

Same on both upstream and downstream routers.

ifstatus wan
ifstatus lan

I've asked @dedeckeh in IRC about the behaviour and apparently it is by design. The odhcpd server will never hand out the entire downstream prefix on client requests but will always try to partition it into at least two halves. So I think you should be able to achieve your desired behaviour by bumping ip6assign from 60 to 59.


This is normal behavior by odhcpd as it picks a prefix form the available subprefixes to delegate to the downstream router as it wants to keep a pool of prefixes available for other downstream routers. In this case it cannot honour the requested /60 prefix size and will assign a bigger prefix size like /61

Thanks @jow, the idea that it hands out at most one half of the ip6assign value seems to be working out. To get a /60, I set ip6assign to 59. To get a /58 I set ip6assign to 57, etc. This isn't what the doco says " ip6assign : Prefix size used for assigned prefix to the interface (e.g. 64 will assign /64-prefixes)" though. Also, the logread output for SOLICIT seems to be the prefix after processing, i.e. what will be offered in the ADVERTISE.
Thanks to others for their suggestions too!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.