summaryrefslogtreecommitdiffhomepage
path: root/src/dhcpv6.c
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2017-10-17 16:23:35 +0200
committerHans Dedecker <dedeckeh@gmail.com>2017-11-09 15:25:06 +0100
commitcf29925b29a4e4e38ab88573f12ec075eacb3d22 (patch)
tree50824b4e52d0b15592b58383e61a53334fbed545 /src/dhcpv6.c
parent24cdc1b59f00a065dd1cf0a04145ca6aaf6f23f1 (diff)
treewide: rework handling of netlink events
Rework the handling of netlink events by letting the different modules ndp, ra, dhcpv6 and dhcpv4 install netevent handlers. The installed netevent handlers are called by the netlink logic passing an event indication together with event data. Each netevent handler implements its own event logic; this makes the code more modular and less complex by moving all netlink code to netlink.c While at it rename ia_addr and ia_addr_len into addr6 and addr6_len respectively Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'src/dhcpv6.c')
-rw-r--r--src/dhcpv6.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/dhcpv6.c b/src/dhcpv6.c
index b94e84d..3edde95 100644
--- a/src/dhcpv6.c
+++ b/src/dhcpv6.c
@@ -483,17 +483,17 @@ static struct odhcpd_ipaddr *relay_link_address(struct interface *iface)
struct odhcpd_ipaddr *addr = NULL;
time_t now = odhcpd_time();
- for (size_t i = 0; i < iface->ia_addr_len; i++) {
- if (iface->ia_addr[i].valid <= (uint32_t)now)
+ for (size_t i = 0; i < iface->addr6_len; i++) {
+ if (iface->addr6[i].valid <= (uint32_t)now)
continue;
- if (iface->ia_addr[i].preferred > (uint32_t)now) {
- addr = &iface->ia_addr[i];
+ if (iface->addr6[i].preferred > (uint32_t)now) {
+ addr = &iface->addr6[i];
break;
}
- if (!addr || (iface->ia_addr[i].valid > addr->valid))
- addr = &iface->ia_addr[i];
+ if (!addr || (iface->addr6[i].valid > addr->valid))
+ addr = &iface->addr6[i];
}
return addr;