ifp->metric = ifo->metric;
/* We want to disable kernel interface RA as early as possible. */
- if (options & DHCPCD_IPV6RS && ifo->options & DHCPCD_IPV6RS) {
- if (check_ipv6(ifp->name) != 1)
+ if (ifo->options & DHCPCD_IPV6RS) {
+ if (check_ipv6(NULL) != 1 || check_ipv6(ifp->name) != 1)
ifo->options &= ~DHCPCD_IPV6RS;
}
syslog(LOG_ERR, "ipv4_init: %m");
ifo->options &= ~DHCPCD_IPV4;
}
-
- if (ifo->options & DHCPCD_IPV6RS && !check_ipv6(NULL))
- ifo->options &= ~DHCPCD_IPV6RS;
if (ifo->options & DHCPCD_IPV6RS && ipv6_init() == -1) {
syslog(LOG_ERR, "ipv6_init: %m");
ifo->options &= ~DHCPCD_IPV6RS;
int
check_ipv6(const char *ifname)
{
+ static int ipv6_checked = 0;
int r;
/* BSD doesn't support these values per iface, so just return 1 */
if (ifname)
return 1;
+ if (ipv6_checked)
+ return 1;
+ ipv6_checked = 1;
+
r = get_inet6_sysctl(IPV6CTL_ACCEPT_RTADV);
if (r == -1)
/* The sysctl probably doesn't exist, but this isn't an
int
check_ipv6(const char *ifname)
{
+ static int ipv6_checked = 0;
int r, ex, i;
char path[256], *p, **nrest;
if (ifname == NULL) {
+ if (ipv6_checked)
+ return 1;
+ ipv6_checked = 1;
ifname = "all";
ex = 1;
} else