diff options
author | Nick Owens <nick.owens@coreos.com> | 2015-05-01 11:48:08 -0700 |
---|---|---|
committer | Nick Owens <nick.owens@coreos.com> | 2015-06-11 12:09:21 -0700 |
commit | 8add5f79709f323f1b077dde8a4a1aa7f560886f (patch) | |
tree | 744695e5c53b990c4416b3c8679b683357d8b07a /src/network/networkd-network.c | |
parent | 96490500cffcd5771ee29c939151d87b0673507e (diff) |
networkd: create "kernel" setting for IPForwarding
In 5a8bcb674f71a20e95df55319b34c556638378ce, IPForwarding was introduced
to set forwarding flags on interfaces in .network files. networkd sets
forwarding options regardless of the previous setting, even if it was
set by e.g. sysctl. This commit creates a new option for IPForwarding,
"kernel", that preserves the sysctl settings rather than always setting
them.
See https://bugs.freedesktop.org/show_bug.cgi?id=89509 for the initial
bug report.
Diffstat (limited to 'src/network/networkd-network.c')
-rw-r--r-- | src/network/networkd-network.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index 6f32e5f4a4..ec95c8661e 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -717,3 +717,37 @@ int config_parse_ipv6token( return 0; } + +int config_parse_address_family_boolean_with_kernel( + 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) { + + AddressFamilyBoolean *fwd = data, s; + + assert(filename); + assert(lvalue); + assert(rvalue); + assert(data); + + s = address_family_boolean_from_string(rvalue); + if (s < 0) { + if (streq(rvalue, "kernel")) + s = _ADDRESS_FAMILY_BOOLEAN_INVALID; + else { + log_syntax(unit, LOG_ERR, filename, line, s, "Failed to parse IPForwarding option, ignoring: %s", rvalue); + return 0; + } + } + + *fwd = s; + + return 0; +} |