summaryrefslogtreecommitdiffhomepage
path: root/src/odhcpd.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/odhcpd.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/odhcpd.c')
-rw-r--r--src/odhcpd.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/odhcpd.c b/src/odhcpd.c
index 5f87151..4972aa2 100644
--- a/src/odhcpd.c
+++ b/src/odhcpd.c
@@ -224,8 +224,8 @@ int odhcpd_get_interface_dns_addr(const struct interface *iface, struct in6_addr
time_t now = odhcpd_time();
ssize_t m = -1;
- 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 (m < 0) {
@@ -233,24 +233,24 @@ int odhcpd_get_interface_dns_addr(const struct interface *iface, struct in6_addr
continue;
}
- if (iface->ia_addr[m].preferred >= (uint32_t)now &&
- iface->ia_addr[i].preferred < (uint32_t)now)
+ if (iface->addr6[m].preferred >= (uint32_t)now &&
+ iface->addr6[i].preferred < (uint32_t)now)
continue;
- if (IN6_IS_ADDR_ULA(&iface->ia_addr[i].addr.in6)) {
- if (!IN6_IS_ADDR_ULA(&iface->ia_addr[m].addr.in6)) {
+ if (IN6_IS_ADDR_ULA(&iface->addr6[i].addr.in6)) {
+ if (!IN6_IS_ADDR_ULA(&iface->addr6[m].addr.in6)) {
m = i;
continue;
}
- } else if (IN6_IS_ADDR_ULA(&iface->ia_addr[m].addr.in6))
+ } else if (IN6_IS_ADDR_ULA(&iface->addr6[m].addr.in6))
continue;
- if (iface->ia_addr[i].preferred > iface->ia_addr[m].preferred)
+ if (iface->addr6[i].preferred > iface->addr6[m].preferred)
m = i;
}
if (m >= 0) {
- *addr = iface->ia_addr[m].addr.in6;
+ *addr = iface->addr6[m].addr.in6;
return 0;
}