diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2021-08-15 11:51:22 +0200 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2021-09-21 22:37:08 +0200 |
commit | 8d777d12186bb6d5dc4c39e5ccbe50a164ea547c (patch) | |
tree | 593cee5bd1a6cb7c485bcafab343c04e51e77563 /src/dhcpv6-ia.c | |
parent | 01b4e6046f10e21809c3f380f2d33bf3fe59698d (diff) |
WIP dnsupdatednsupdate
Diffstat (limited to 'src/dhcpv6-ia.c')
-rw-r--r-- | src/dhcpv6-ia.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c index e8255b5..af0b367 100644 --- a/src/dhcpv6-ia.c +++ b/src/dhcpv6-ia.c @@ -453,12 +453,26 @@ void dhcpv6_ia_write_statefile(void) } } -static void __apply_lease(struct dhcp_assignment *a, +static void __apply_lease_na(struct dhcp_assignment *a, struct odhcpd_ipaddr *addrs, ssize_t addr_len, bool add) { - if (a->flags & OAF_DHCPV6_NA) - return; + for (ssize_t i = 0; i < addr_len; ++i) { + struct in6_addr addr; + /* if (ADDR_MATCH_PIO_FILTER(&addrs[i], a->iface)) */ + /* continue; */ + + addr = addrs[i].addr.in6; + addr.s6_addr32[2] = htonl(a->assigned_host_id >> 32); + addr.s6_addr32[3] = htonl(a->assigned_host_id & UINT32_MAX); + dns_update_rr(a->hostname, AF_INET6, &addr); + } + dns_update_finish(); +} + +static void __apply_lease_pd(struct dhcp_assignment *a, + struct odhcpd_ipaddr *addrs, ssize_t addr_len, bool add) +{ for (ssize_t i = 0; i < addr_len; ++i) { struct in6_addr prefix; @@ -479,7 +493,10 @@ static void apply_lease(struct dhcp_assignment *a, bool add) struct odhcpd_ipaddr *addrs = (a->managed) ? a->managed : iface->addr6; ssize_t addrlen = (a->managed) ? a->managed_size : (ssize_t)iface->addr6_len; - __apply_lease(a, addrs, addrlen, add); + if (a->flags & OAF_DHCPV6_NA) + __apply_lease_na(a, addrs, addrlen, add); + else + __apply_lease_pd(a, addrs, addrlen, add); } /* Set border assignment size based on the IPv6 address prefixes */ @@ -774,7 +791,7 @@ static void handle_addrlist_change(struct netevent_handler_info *info) list_for_each_entry(c, &iface->ia_assignments, head) { if ((c->flags & OAF_DHCPV6_PD) && !(iface->ra_flags & ND_RA_FLAG_MANAGED) && (c->flags & OAF_BOUND)) - __apply_lease(c, info->addrs_old.addrs, + __apply_lease_pd(c, info->addrs_old.addrs, info->addrs_old.len, false); } |