summaryrefslogtreecommitdiffstats
path: root/src/if-bsd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2017-03-20 10:24:49 +0000
committerRoy Marples <roy@marples.name>2017-03-20 10:24:49 +0000
commitad8a7a0a4634f80d93be725f158bbfda547b90bc (patch)
treee486bdc11eb1dedaf0dd087fa5396e73033c846b /src/if-bsd.c
parentde6f5a04f4d8e5c45ef5766048833dac5b3dcdbd (diff)
downloaddhcpcd-ad8a7a0a4634f80d93be725f158bbfda547b90bc.tar.xz
Test address family to test the correct address flags.
Diffstat (limited to 'src/if-bsd.c')
-rw-r--r--src/if-bsd.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/if-bsd.c b/src/if-bsd.c
index cad721d5..a3946f4d 100644
--- a/src/if-bsd.c
+++ b/src/if-bsd.c
@@ -957,23 +957,35 @@ if_ifa(struct dhcpcd_ctx *ctx, const struct ifa_msghdr *ifam)
const struct sockaddr *rti_info[RTAX_MAX];
int addrflags;
+ if ((ifp = if_findindex(ctx->ifaces, ifam->ifam_index)) == NULL)
+ return;
+ get_addrs(ifam->ifam_addrs, ifam + 1, rti_info);
+ if (rti_info[RTAX_IFA] == NULL)
+ return;
+
#ifdef HAVE_IFAM_PID
if (if_ownmsgpid(ctx, ifam->ifam_pid, 0)) {
#ifdef HAVE_IFAM_ADDRFLAGS
/* If the kernel isn't doing DAD for the newly added
* address we need to let it through. */
- if (ifam->ifam_type != RTM_NEWADDR ||
- ifam->ifam_addrflags & IN_IFF_TENTATIVE)
-#endif
+ if (ifam->ifam_type != RTM_NEWADDR)
return;
+ switch (rti_info[RTAX_IFA]->sa_family) {
+ case AF_INET:
+ if (ifam->ifam_addrflags & IN_IFF_TENTATIVE)
+ return;
+ break;
+ case AF_INET6:
+ if (ifam->ifam_addrflags & IN6_IFF_TENTATIVE)
+ return;
+ break;
+ default:
+ return;
+ }
+#endif
}
#endif
- if ((ifp = if_findindex(ctx->ifaces, ifam->ifam_index)) == NULL)
- return;
- get_addrs(ifam->ifam_addrs, ifam + 1, rti_info);
- if (rti_info[RTAX_IFA] == NULL)
- return;
#ifdef HAVE_IFAM_ADDRFLAGS
addrflags = ifam->ifam_addrflags;
#endif