NetworkConfiguration / dhcpcd

DHCP / IPv4LL / IPv6RA / DHCPv6 client.
https://roy.marples.name/projects/dhcpcd
BSD 2-Clause "Simplified" License
348 stars 112 forks source link

Can't access $new_delegated_dhcp6_prefix in BOUND6 hook. #155

Open corvus1 opened 1 year ago

corvus1 commented 1 year ago

I'd like to do some things in BOUND6 exit hook, for which it's necessary to know what prefix was just assigned to me. But for some reason, the $new_delegated_dhcp6_prefix variable is only available in the DELEGATED6 hook. And that's a bit inconvenient, because DELEGATED6 runs on renewal of the lease, but I only want to do those things if it's actually a new lease, new prefix, and things changed. Which can be once a month. But DELEGATED6 runs every half an hour or so.

So I had to resort to some hacks, to work out if the prefix has changed. But maybe I'm missing something, and there's a reasonable way to work out the new address in the BOUND6 exit hook?

r2ixuz commented 1 year ago

I grep my dhcpcd.log for the string "delegated prefix". Really dirty but it works and my Docker containers have IPv6 access again when a new prefix was delegated by my router.