summaryrefslogtreecommitdiffstats
path: root/if.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2016-04-25 10:58:18 +0000
committerRoy Marples <roy@marples.name>2016-04-25 10:58:18 +0000
commitfbf8f9ae3b6ddabe1b1707fd79cf2e7b6879c43e (patch)
tree45ab701b76b698244ab3c1bc2030e83ab04adb6a /if.c
parent3107d370eb0231e281678b30bf7d7748349ff5e5 (diff)
downloaddhcpcd-fbf8f9ae3b6ddabe1b1707fd79cf2e7b6879c43e.tar.xz
dst becomes brd as it's makes more sense as we mainly deal with ethernet.
Ensure that handleifa is always passed brd. If brd does not match existing broadcast address on an existing inet address, delete it and add our new one.
Diffstat (limited to 'if.c')
-rw-r--r--if.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/if.c b/if.c
index 8715a9e6..b51b2d28 100644
--- a/if.c
+++ b/if.c
@@ -192,7 +192,7 @@ static void if_learnaddrs(struct dhcpcd_ctx *ctx, struct if_head *ifs,
struct ifaddrs *ifa;
struct interface *ifp;
#ifdef INET
- const struct sockaddr_in *addr, *net, *dst;
+ const struct sockaddr_in *addr, *net, *brd;
#endif
#ifdef INET6
struct sockaddr_in6 *sin6, *net6;
@@ -211,15 +211,14 @@ static void if_learnaddrs(struct dhcpcd_ctx *ctx, struct if_head *ifs,
addr = (void *)ifa->ifa_addr;
net = (void *)ifa->ifa_netmask;
if (ifa->ifa_flags & IFF_POINTOPOINT)
- dst = (const struct sockaddr_in *)
+ brd = (const struct sockaddr_in *)
(void *)ifa->ifa_dstaddr;
else
- dst = NULL;
+ brd = (void *)ifa->ifa_broadaddr;
ifa_flags = if_addrflags(&addr->sin_addr, ifp);
ipv4_handleifa(ctx, RTM_NEWADDR, ifs, ifa->ifa_name,
- &addr->sin_addr,
- &net->sin_addr,
- dst ? &dst->sin_addr : NULL, ifa_flags);
+ &addr->sin_addr, &net->sin_addr, &brd->sin_addr,
+ ifa_flags);
break;
#endif
#ifdef INET6