[odhcpd bug?] Lingering IPv6 Leases in IPv6 Stateless Mode

Hello, I am running IPv6 in Stateless Mode (ra_managment=0 in odhcpd). I also set most of my permanent always-on servers to static leases "leasetime=infinite". For some reason, even after I set ra_managment=0 in LuCI, and restart my router, and restart all my clients... the router will still assign some clients ipv6leases, even though the ipv6 mode is set to STATELESS.

If I ipconfig /release6 on those clients it will remove the lease, but restarting the client, the router will assign the same static lease to restarted client. The SLAAC stuff is working just fine, the issue is just with 4 clients receiving 2 global ipv6 addresses (as if the ipv6 mode was set to Stateful+Stateless).

The bug is that in STATELESS, the odhcpd should not be sending ipv6leases to any clients, even if they are static clients or infinite lease time.

More of an issue is I can't stop it from issuing these leases after it starts. I've tried switching back to "Stateful+Stateless" changing leasetime to 5m, releasing all ipv6 ips, reverting back to "Stateless", and setting my static ips. And it'll start giving static ipv6 ip's as well.

ubus call dhcp ipv6leases

Shows all the ipv6 leases and such, but also has the "valid=-1" in all of them, but odhcpd doesn't seem to be honouring that.

/tmp/hosts/odhcpd

Does show all the current ipv6 leases (same as what LuCI is showing in the UI). But nothing I do stops the router from issuing the ipv6 static lease after I restart the client?

Anyone have any ideas on what I can do to fix this? Only 4 clients on my network have this issue. It used to be 3, until i switched modes back and forth, then the 4th started getting stuck. I'm unsure if it's cuz it assigned the DUID now, or because I am using infinite leases, and after 1 ipv6 infinite lease is set then it does it for life. I'm stumped.

Nonetheless, after the IPv6 Mode is set to Stateless, all the ipv6leases static leases should be ignored.

I am having an exactly same issue on 18.06-rc1. Seems like the bug is still present.

Sorry for necroposting, but this continues to be true in 19.07.4.

Is there any way to get odhcpd to behave and stop handing out leases in stateless mode? dnsmasq honors this properly, but (clearly) odhcpd doesn't.

What is the output of uci export dhcp ?

After 3 years, this bug is still present. Even though I want an ipv6 stateless, I now just let my PC's get stateful IPv6's. As I've accepted there is nothing I can do to tell OpenWrt to do what I want. LOL

Is there something specific in uci show dhcp, as there is a lot in there. I removed some of the static IP info, but included one machine so you can see nothing about IPv6 is in there, but it is still giving a IPv6 address. But yes, dhcp.lan.ra_management='0' which means no M-flag should be given (stateless).

As I said in the first comment, it seems to only give IPv6 stateful IP's to ones which I set with a static IPv4 address (some of them). But this should not happen, if DHCP6 is set to stateless, even if I set a Static IPv4 (and leave the ipv6 field blank), it should not give out a ipv6 stateful IP. Or perhaps have a mark in the static IP field, to not give out ipv6 addresses (say blank or none means no ipv6).

As I can see some people who may want a stateless ipv6, but still manually give a couple ipv6 addresses. But the vast majority who has stateless ipv6 set up, and leaves all their static ipv6 blank or none, do not want ANY ipv6 stateful (static) on those machines.

But yea I do still believe this is the problem, since leaving IPv6-Suffix (hex) blank in the static IP field defaults to an ipv6 hex of the last subnet of the ipv4. So even with ipv6 set to stateless, because I am request static ipv4 (which is stateful ip's), openwrt thinks I am ALSO request ipv6 static ip's, which I am not. An extra field in the STATIC DHCP section may be needed?

dhcp.@dnsmasq[0]=dnsmasq
dhcp.@dnsmasq[0].domainneeded='1'
dhcp.@dnsmasq[0].localise_queries='1'
dhcp.@dnsmasq[0].rebind_protection='1'
dhcp.@dnsmasq[0].rebind_localhost='1'
dhcp.@dnsmasq[0].local='/lan/'
dhcp.@dnsmasq[0].domain='lan'
dhcp.@dnsmasq[0].expandhosts='1'
dhcp.@dnsmasq[0].authoritative='1'
dhcp.@dnsmasq[0].readethers='1'
dhcp.@dnsmasq[0].leasefile='/tmp/dhcp.leases'
dhcp.@dnsmasq[0].resolvfile='/tmp/resolv.conf.d/resolv.conf.auto'
dhcp.@dnsmasq[0].localservice='1'
dhcp.lan=dhcp
dhcp.lan.interface='lan'
dhcp.lan.start='xxx'
dhcp.lan.limit='xxx'
dhcp.lan.leasetime='12h'
dhcp.lan.dhcpv6='server'
dhcp.lan.ra='server'
dhcp.lan.ra_slaac='1'
dhcp.lan.ra_flags='managed-config' 'other-config'
dhcp.lan.ra_management='0'
dhcp.wan=dhcp
dhcp.wan.interface='wan'
dhcp.wan.ignore='1'
dhcp.odhcpd=odhcpd
dhcp.odhcpd.maindhcp='0'
dhcp.odhcpd.leasefile='/tmp/hosts/odhcpd'
dhcp.odhcpd.leasetrigger='/usr/sbin/odhcpd-update'
dhcp.odhcpd.loglevel='4'

dhcp.@host[0]=host
dhcp.@host[0].name='SERV'
dhcp.@host[0].dns='1'
dhcp.@host[0].mac='00:24:xx:xx:xx:xx'
dhcp.@host[0].ip='192.168.0.xxx'
1 Like

@trendy I didn't reply with my uci output because @codster314 got it right in every single respect.

Stateless means exactly one thing - SLAAC for subnet and gateway (and optionally DNS and domain), DHCPv6 provides DNS and domain ONLY, no addressing ever.

dnsmasq gets this right, but sucks for prefix delegation. odhcpd does delegation well, but whiffs at handling stateless. Ugh.

uci -q delete dhcp.lan.ra_flags
uci commit dhcp
/etc/init.d/odhcpd restart

If that doesn't help, you should file a bug:
https://github.com/openwrt/odhcpd/issues

2 Likes