From: Roy Marples Date: Tue, 14 Jan 2014 21:52:33 +0000 (+0000) Subject: On BSD, flush routes and prefixes only when we want to own them. X-Git-Tag: v6.2.1~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d35ff7b4f8387da5f2b885509fbf2cc2dd2af560;p=thirdparty%2Fdhcpcd.git On BSD, flush routes and prefixes only when we want to own them. --- diff --git a/platform-bsd.c b/platform-bsd.c index ab97199f..282dc683 100644 --- a/platform-bsd.c +++ b/platform-bsd.c @@ -112,8 +112,8 @@ ipv6_ra_flush(void) strcpy(dummy, "lo0"); if (ioctl(s, SIOCSRTRFLUSH_IN6, (caddr_t)&dummy) == -1) syslog(LOG_ERR, "SIOSRTRFLUSH_IN6: %m"); -// if (ioctl(s, SIOCSPFXFLUSH_IN6, (caddr_t)&dummy) == -1) -// syslog(LOG_ERR, "SIOSPFXFLUSH_IN6: %m"); + if (ioctl(s, SIOCSPFXFLUSH_IN6, (caddr_t)&dummy) == -1) + syslog(LOG_ERR, "SIOSPFXFLUSH_IN6: %m"); close(s); return 0; } @@ -146,13 +146,15 @@ check_ipv6(const char *ifname, int own) atexit(restore_kernel_ra); } ra = 0; + + /* Flush the kernel knowledge of advertised routers + * and prefixes so the kernel does not expire prefixes + * and default routes we are trying to own. */ + ipv6_ra_flush(); } if (ifname == NULL) global_ra = ra; - /* Flush the kernel knowledge of advertised routers */ - ipv6_ra_flush(); - return ra; }