]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
On BSD, flush routes and prefixes only when we want to own them.
authorRoy Marples <roy@marples.name>
Tue, 14 Jan 2014 21:52:33 +0000 (21:52 +0000)
committerRoy Marples <roy@marples.name>
Tue, 14 Jan 2014 21:52:33 +0000 (21:52 +0000)
platform-bsd.c

index ab97199fe1aa3d4fdc1dcf3eed32eefc1dcda777..282dc683b5646740875f9ca1b3f16b636b77e963 100644 (file)
@@ -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;
 }