summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2020-01-21 12:01:02 +0000
committerRoy Marples <roy@marples.name>2020-01-22 12:25:14 +0000
commite0c9e46ec5df2f99a11900855b72b13e76069861 (patch)
treef0e1eb3c8266b3cc40c7fcaa215986657c3e9e38
parentd00a89399e57bdef82372e4e87e0c83e7042f5b5 (diff)
downloaddhcpcd-e0c9e46ec5df2f99a11900855b72b13e76069861.tar.xz
BSD: Improve RTM_NEWADDR/RTM_DELADDR validaton some more
-rw-r--r--src/if-bsd.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/if-bsd.c b/src/if-bsd.c
index 49f98d5f..396dfb74 100644
--- a/src/if-bsd.c
+++ b/src/if-bsd.c
@@ -1267,11 +1267,13 @@ if_ifa(struct dhcpcd_ctx *ctx, const struct ifa_msghdr *ifam)
logerr("%s: SIOCGIFALIAS", __func__);
if (ifam->ifam_type != RTM_DELADDR)
break;
- }
+ } else {
+ if (ifam->ifam_type == RTM_DELADDR)
+ break;
#if defined(__NetBSD_Version__) && __NetBSD_Version__ < 800000000
- else
bcast = ifra.ifra_broadaddr.sin_addr;
#endif
+ }
#else
#warning No SIOCGIFALIAS support
/*
@@ -1330,16 +1332,15 @@ if_ifa(struct dhcpcd_ctx *ctx, const struct ifa_msghdr *ifam)
* dhcpcd to drop any lease to which it belongs.
* Also check an added address was really added.
*/
- if (ifam->ifam_type == RTM_DELADDR) {
- flags = if_addrflags6(ifp, &addr6, NULL);
- if (flags != -1)
- break;
- flags = 0;
- } else if ((flags = if_addrflags6(ifp, &addr6, NULL)) == -1) {
+ flags = if_addrflags6(ifp, &addr6, NULL);
+ if (flags == -1) {
if (errno != EADDRNOTAVAIL)
logerr("%s: if_addrflags6", __func__);
+ if (ifam->ifam_type != RTM_DELADDR)
+ break;
+ flags = 0;
+ } else if (ifam->ifam_type == RTM_DELADDR)
break;
- }
#ifdef __KAME__
if (IN6_IS_ADDR_LINKLOCAL(&addr6))