diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-10-19 12:08:53 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-10-19 14:55:18 +0900 |
commit | 27ff0490e6b408e619b28d97b26853fa5ca6fd85 (patch) | |
tree | e23a9bcf55cff83a5226f8c8de96c3ab3d7bee41 /src/network/networkd-radv.c | |
parent | 4afd986753b1a8d50ea86d91732b32dff3e6e3e9 (diff) | |
download | systemd-27ff0490e6b408e619b28d97b26853fa5ca6fd85.tar.gz |
network: rename IPv6PrefixDelegation= to IPv6SendRA=
Diffstat (limited to 'src/network/networkd-radv.c')
-rw-r--r-- | src/network/networkd-radv.c | 50 |
1 files changed, 45 insertions, 5 deletions
diff --git a/src/network/networkd-radv.c b/src/network/networkd-radv.c index 48c37d7490..b9979f957a 100644 --- a/src/network/networkd-radv.c +++ b/src/network/networkd-radv.c @@ -916,11 +916,51 @@ DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN( RADVPrefixDelegation, RADV_PREFIX_DELEGATION_BOTH); -DEFINE_CONFIG_PARSE_ENUM( - config_parse_router_prefix_delegation, - radv_prefix_delegation, - RADVPrefixDelegation, - "Invalid router prefix delegation"); +int config_parse_router_prefix_delegation( + const char *unit, + const char *filename, + unsigned line, + const char *section, + unsigned section_line, + const char *lvalue, + int ltype, + const char *rvalue, + void *data, + void *userdata) { + + RADVPrefixDelegation val, *ra = data; + int r; + + assert(filename); + assert(lvalue); + assert(rvalue); + assert(data); + + if (streq(lvalue, "IPv6SendRA")) { + r = parse_boolean(rvalue); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Invalid %s= setting, ignoring assignment: %s", lvalue, rvalue); + return 0; + } + + /* When IPv6SendRA= is enabled, only static prefixes are sent by default, and users + * need to explicitly enable DHCPv6PrefixDelegation=. */ + *ra = r ? RADV_PREFIX_DELEGATION_STATIC : RADV_PREFIX_DELEGATION_NONE; + return 0; + } + + /* For backward compatibility */ + val = radv_prefix_delegation_from_string(rvalue); + if (val < 0) { + log_syntax(unit, LOG_WARNING, filename, line, 0, + "Invalid %s= setting, ignoring assignment: %s", lvalue, rvalue); + return 0; + } + + *ra = val; + return 0; +} int config_parse_router_preference( const char *unit, |