if (ifo->metric != -1)
iface->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(iface->name) != 1)
+ ifo->options &= ~DHCPCD_IPV6RS;
+ }
+
/* If we haven't specified a ClientID and our hardware address
* length is greater than DHCP_CHADDR_LEN then we enforce a ClientID
* of the hardware address family and the hardware address. */
free(iface->state->offer);
iface->state->offer = NULL;
- if (options & DHCPCD_IPV6RS && ifo->options & DHCPCD_IPV6RS) {
- if (check_ipv6(iface->name) == 1)
- ipv6rs_start(iface);
- else
- ifo->options &= ~DHCPCD_IPV6RS;
- }
+ if (options & DHCPCD_IPV6RS && ifo->options & DHCPCD_IPV6RS)
+ ipv6rs_start(iface);
if (iface->state->arping_index < ifo->arping_len) {
start_arping(iface);
int
check_ipv6(const char *ifname)
{
- int r, ex;
+ int r, ex, i;
char path[256];
if (ifname == NULL) {
syslog(LOG_ERR, "write_path: %s: %m", path);
return 0;
}
- restore = realloc(restore, (nrestore + 1) * sizeof(char *));
- if (restore == NULL) {
- syslog(LOG_ERR, "realloc: %m");
- exit(EXIT_FAILURE);
+ for (i = 0; i < nrestore; i++)
+ if (strcmp(restore[i], ifname) == 0)
+ break;
+ if (i == nrestore) {
+ restore = realloc(restore,
+ (nrestore + 1) * sizeof(char *));
+ if (restore == NULL) {
+ syslog(LOG_ERR, "realloc: %m");
+ exit(EXIT_FAILURE);
+ }
+ restore[nrestore++] = xstrdup(ifname);
}
- restore[nrestore++] = xstrdup(ifname);
if (ex)
atexit(restore_kernel_ra);
}