network: ignore requested ipv6 addresses when ipv6 is disabled by sysctl

This commit is contained in:
Yu Watanabe 2019-06-11 23:20:56 +09:00
parent 12880d14ad
commit 54a1a535bd
3 changed files with 10 additions and 5 deletions

View File

@ -566,6 +566,11 @@ int address_configure(
assert(link->manager->rtnl);
assert(callback);
if (address->family == AF_INET6 && manager_sysctl_ipv6_enabled(link->manager) == 0) {
log_link_warning(link, "An IPv6 address is requested, but IPv6 is disabled by sysctl, ignoring.");
return 0;
}
/* If this is a new address, then refuse adding more than the limit */
if (address_get(link, address->family, &address->in_addr, address->prefixlen, NULL) <= 0 &&
set_size(link->addresses) >= ADDRESSES_PER_LINK_MAX)
@ -665,7 +670,7 @@ int address_configure(
return log_link_error_errno(link, r, "Could not add address: %m");
}
return 0;
return 1;
}
int config_parse_broadcast(

View File

@ -1194,8 +1194,8 @@ static int link_request_set_addresses(Link *link) {
link_enter_failed(link);
return r;
}
link->address_messages++;
if (r > 0)
link->address_messages++;
}
LIST_FOREACH(labels, label, link->network->address_labels) {

View File

@ -209,8 +209,8 @@ static int ndisc_router_process_autonomous_prefix(Link *link, sd_ndisc_router *r
link_enter_failed(link);
return r;
}
link->ndisc_messages++;
if (r > 0)
link->ndisc_messages++;
return 0;
}