summaryrefslogtreecommitdiff
path: root/src/network/networkd-link.c
diff options
context:
space:
mode:
authorNick Owens <nick.owens@coreos.com>2015-05-01 11:48:08 -0700
committerNick Owens <nick.owens@coreos.com>2015-06-11 12:09:21 -0700
commit8add5f79709f323f1b077dde8a4a1aa7f560886f (patch)
tree744695e5c53b990c4416b3c8679b683357d8b07a /src/network/networkd-link.c
parent96490500cffcd5771ee29c939151d87b0673507e (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-link.c')
-rw-r--r--src/network/networkd-link.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 7841f69dab..b1947886b7 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -1477,6 +1477,9 @@ static int link_set_ipv4_forward(Link *link) {
const char *p = NULL;
int r;
+ if (link->network->ip_forward == _ADDRESS_FAMILY_BOOLEAN_INVALID)
+ return 0;
+
p = strjoina("/proc/sys/net/ipv4/conf/", link->ifname, "/forwarding");
r = write_string_file_no_create(p, one_zero(link_ipv4_forward_enabled(link)));
if (r < 0)
@@ -1493,6 +1496,9 @@ static int link_set_ipv6_forward(Link *link) {
if (!socket_ipv6_is_supported())
return 0;
+ if (link->network->ip_forward == _ADDRESS_FAMILY_BOOLEAN_INVALID)
+ return 0;
+
p = strjoina("/proc/sys/net/ipv6/conf/", link->ifname, "/forwarding");
r = write_string_file_no_create(p, one_zero(link_ipv6_forward_enabled(link)));
if (r < 0)