Skip to content

send DHCPv6 lease events over U-Bus#369

Open
1millibyte wants to merge 1 commit intoopenwrt:masterfrom
1millibyte:feature/ubus-dhcp6-events
Open

send DHCPv6 lease events over U-Bus#369
1millibyte wants to merge 1 commit intoopenwrt:masterfrom
1millibyte:feature/ubus-dhcp6-events

Conversation

@1millibyte
Copy link
Copy Markdown

odhcpd currently only sends DHCPv4 lease events over U-Bus. For DHCPv6 the only option was to use a trigger hook script and then parse a lease file and diff it against previous version.

This made it very inconvenient to use in cases like adding DHCP hosts to DNS server and the behavior is also inconsistent with DHCPv4 counterpart. Format of the U-Bus message is based on reply of ipv6leases U-Bus method.

This patch is largely based on mikma@b796d61

odhcpd currently only sends DHCPv4 lease events over U-Bus. For DHCPv6
the only option was to use a trigger hook script and then parse a lease
file and diff it against previous version.

This made it very inconvenient to use in cases like adding DHCP hosts to
DNS server and the behavior is also inconsistent with DHCPv4 counterpart.
Format of the U-Bus message is based on reply of `ipv6leases` U-Bus
method.

This patch is largely based on mikma@b796d61
Signed-off-by: Erin Kalousková <erin.kalouskova@nic.cz>
@Noltari
Copy link
Copy Markdown
Member

Noltari commented Jan 13, 2026

@erin-desu there are conflicts with current master, so this branch has to be rebased.

@systemcrash
Copy link
Copy Markdown
Contributor

This was part of @mikma's patch-set to make WireGuard more useable,although he found another way to make WireGuard work without this patch, although it may still have some utility.

@mikma - can you comment?

Comment thread src/dhcpv6-ia.c
if (!(c->flags & OAF_DHCPV6_NA) || c->assigned_host_id > a->assigned_host_id ) {
list_add_tail(&a->head, &c->head);
if (a->flags &OAF_BOUND)
apply_lease(a, true);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apply_lease() is currently used for installing routes to prefixes delegated to DHCPv6-PD clients. (Ab)using it for sending ubus notifications for address leases not only hurts readability, but it is also a very slippery slope - and it already shows.

For lease renewals, this PR causes an erroneous dhcpv6.release notification to be emitted just before a dhcpv6.ack one for the same lease. Why? assign_na() is called from dhcpv6_ia_handle_IAs(), shortly after apply_lease(a, false); is called on line 1522. Note that no release actually happens from lease management perspective; this behavior is just an artifact of emitting notifications from __apply_lease().

Please see #393 for what I hope is a more maintainable counterproposal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants