Merge pull request #13405 from yuwata/network-ipv6-privacy-extensions-cleanup
Network ipv6 privacy extensions cleanup
This commit is contained in:
commit
3af900718e
|
@ -548,8 +548,7 @@ int dhcp6_request_address(Link *link, int ir) {
|
|||
r = sd_dhcp6_client_is_running(link->dhcp6_client);
|
||||
if (r < 0)
|
||||
return r;
|
||||
else
|
||||
running = r;
|
||||
running = r;
|
||||
|
||||
r = sd_dhcp6_client_get_prefix_delegation(link->dhcp6_client, &pd);
|
||||
if (r < 0)
|
||||
|
|
|
@ -899,7 +899,8 @@ static const char* const ipv6_privacy_extensions_table[_IPV6_PRIVACY_EXTENSIONS_
|
|||
[IPV6_PRIVACY_EXTENSIONS_YES] = "yes",
|
||||
};
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(ipv6_privacy_extensions, IPv6PrivacyExtensions);
|
||||
DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(ipv6_privacy_extensions, IPv6PrivacyExtensions,
|
||||
IPV6_PRIVACY_EXTENSIONS_YES);
|
||||
|
||||
int config_parse_ipv6_privacy_extensions(
|
||||
const char* unit,
|
||||
|
@ -913,40 +914,26 @@ int config_parse_ipv6_privacy_extensions(
|
|||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
IPv6PrivacyExtensions *ipv6_privacy_extensions = data;
|
||||
int k;
|
||||
IPv6PrivacyExtensions s, *ipv6_privacy_extensions = data;
|
||||
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(ipv6_privacy_extensions);
|
||||
|
||||
/* Our enum shall be a superset of booleans, hence first try
|
||||
* to parse as boolean, and then as enum */
|
||||
|
||||
k = parse_boolean(rvalue);
|
||||
if (k > 0)
|
||||
*ipv6_privacy_extensions = IPV6_PRIVACY_EXTENSIONS_YES;
|
||||
else if (k == 0)
|
||||
*ipv6_privacy_extensions = IPV6_PRIVACY_EXTENSIONS_NO;
|
||||
else {
|
||||
IPv6PrivacyExtensions s;
|
||||
|
||||
s = ipv6_privacy_extensions_from_string(rvalue);
|
||||
if (s < 0) {
|
||||
|
||||
if (streq(rvalue, "kernel"))
|
||||
s = _IPV6_PRIVACY_EXTENSIONS_INVALID;
|
||||
else {
|
||||
log_syntax(unit, LOG_ERR, filename, line, 0,
|
||||
"Failed to parse IPv6 privacy extensions option, ignoring: %s", rvalue);
|
||||
return 0;
|
||||
}
|
||||
s = ipv6_privacy_extensions_from_string(rvalue);
|
||||
if (s < 0) {
|
||||
if (streq(rvalue, "kernel"))
|
||||
s = _IPV6_PRIVACY_EXTENSIONS_INVALID;
|
||||
else {
|
||||
log_syntax(unit, LOG_ERR, filename, line, 0,
|
||||
"Failed to parse IPv6 privacy extensions option, ignoring: %s", rvalue);
|
||||
return 0;
|
||||
}
|
||||
|
||||
*ipv6_privacy_extensions = s;
|
||||
}
|
||||
|
||||
*ipv6_privacy_extensions = s;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue