summaryrefslogtreecommitdiffstats
path: root/src/if-bsd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2017-10-10 21:04:27 +0100
committerRoy Marples <roy@marples.name>2017-10-10 21:04:27 +0100
commit940423ce04e167f88a70b961e6b0944c199642c3 (patch)
tree83cd19a5edf9b5a75b15de771fa3f1d738cb23ad /src/if-bsd.c
parentdb131cff3f004a742ac368d6d5c719898eb40d0a (diff)
downloaddhcpcd-940423ce04e167f88a70b961e6b0944c199642c3.tar.xz
Don't attempt to flush IPv6 routers or prefixes if the kernel
does not support setting them.
Diffstat (limited to 'src/if-bsd.c')
-rw-r--r--src/if-bsd.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/if-bsd.c b/src/if-bsd.c
index 43005556..6e65f584 100644
--- a/src/if-bsd.c
+++ b/src/if-bsd.c
@@ -1346,18 +1346,6 @@ ip6_temp_valid_lifetime(__unused const char *ifname)
}
#endif
-static int
-if_raflush(int s)
-{
- char dummy[IFNAMSIZ + 8];
-
- strlcpy(dummy, "lo0", sizeof(dummy));
- if (ioctl(s, SIOCSRTRFLUSH_IN6, (void *)&dummy) == -1 ||
- ioctl(s, SIOCSPFXFLUSH_IN6, (void *)&dummy) == -1)
- return -1;
- return 0;
-}
-
#ifdef SIOCIFAFATTACH
static int
af_attach(int s, const struct interface *ifp, int af)
@@ -1533,11 +1521,18 @@ if_checkipv6(struct dhcpcd_ctx *ctx, const struct interface *ifp)
ra = 0;
if (!(ctx->options & DHCPCD_TEST)) {
#endif
+#if defined(IPV6CTL_ACCEPT_RTADV) || defined(ND6_IFF_ACCEPT_RTADV)
/* Flush the kernel knowledge of advertised routers
* and prefixes so the kernel does not expire prefixes
* and default routes we are trying to own. */
- if (if_raflush(s) == -1)
- logwarn("if_raflush");
+ char dummy[IFNAMSIZ + 8];
+
+ strlcpy(dummy, "lo0", sizeof(dummy));
+ if (ioctl(s, SIOCSRTRFLUSH_IN6, (void *)&dummy) == -1)
+ logwarn("SIOCSRTRFLUSH_IN6");
+ if (ioctl(s, SIOCSPFXFLUSH_IN6, (void *)&dummy) == -1)
+ logwarn("SIOCSPFXFLUSH_IN6");
+#endif
}
ctx->ra_global = ra;