summaryrefslogtreecommitdiffhomepage
path: root/src/config.c
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2017-07-03 16:39:21 +0200
committerHans Dedecker <dedeckeh@gmail.com>2017-08-07 15:27:20 +0200
commit95d0fb6c25944985b9717a51cebaa7ea8dc7222d (patch)
tree511a3d34366f148043a1920bf54b414ed7962199 /src/config.c
parent296b4a0ddd7d6d77e48ee36f3407b0769caaa0d7 (diff)
treewide: rework IPv4 address logic
Align IPv4 address logic with IPv6 by caching per interface the assigned IPv4 addresses. This allows to get rid of different ioctl calls in the DHCPv4 logic to retrieve the IPv4 address and netmask in use by an interface. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/config.c b/src/config.c
index 19b901c..8bf2011 100644
--- a/src/config.c
+++ b/src/config.c
@@ -240,6 +240,7 @@ static void close_interface(struct interface *iface)
setup_dhcpv4_interface(iface, false);
clean_interface(iface);
+ free(iface->addr4);
free(iface->ia_addr);
free(iface->ifname);
free(iface);
@@ -450,6 +451,11 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr
if (len > 0)
iface->ia_addr_len = len;
+
+ len = odhcpd_get_interface_addresses(iface->ifindex,
+ false, &iface->addr4);
+ if (len > 0)
+ iface->addr4_len = len;
}
iface->inuse = true;