summaryrefslogtreecommitdiff
path: root/src/network/networkd-link.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-09-23 16:42:18 +0200
committerLennart Poettering <lennart@poettering.net>2015-09-23 16:42:18 +0200
commit41b59f264e2b02ecdc6adc9637f195fe3875e51a (patch)
treeb6cfe8836bcea8bad10fdbd7a2097afc498af47f /src/network/networkd-link.c
parent7bcff8dabaa44047184faf6f558820dd3a8f92cd (diff)
parent6a512301bbf77617b20292e746767f78cb743299 (diff)
Merge pull request #1345 from georgmu/fix_accept_ra
Set accept_ra to "2" if enabled in config
Diffstat (limited to 'src/network/networkd-link.c')
-rw-r--r--src/network/networkd-link.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 86f1c3bb1a..05a1358eca 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -1794,7 +1794,6 @@ static int link_set_ipv6_privacy_extensions(Link *link) {
static int link_set_ipv6_accept_ra(Link *link) {
const char *p = NULL, *v = NULL;
- bool b;
int r;
/* Make this a NOP if IPv6 is not available */
@@ -1804,20 +1803,21 @@ static int link_set_ipv6_accept_ra(Link *link) {
if (link->flags & IFF_LOOPBACK)
return 0;
- /* if unset check the ip forwarding setting maintained for the interface
- * and then set it to depending on that. enabled if local forwarding
- * is disabled. disabled if local forwarding is enabled.
+ /* If unset use system default (enabled if local forwarding is disabled.
+ * disabled if local forwarding is enabled).
+ * If set, ignore or enforce RA independent of local forwarding state.
*/
if (link->network->ipv6_accept_ra < 0) {
- if (IN_SET(link->network->ip_forward, ADDRESS_FAMILY_YES, ADDRESS_FAMILY_IPV6))
- b = false;
- else
- b = true;
- } else
- b = link->network->ipv6_accept_ra;
-
+ /* default to accept RA if ip_forward is disabled and ignore RA if ip_forward is enabled */
+ v = "1";
+ } else if (link->network->ipv6_accept_ra > 0) {
+ /* "2" means accept RA even if ip_forward is enabled */
+ v = "2";
+ } else {
+ /* "0" means ignore RA */
+ v = "0";
+ }
p = strjoina("/proc/sys/net/ipv6/conf/", link->ifname, "/accept_ra");
- v = one_zero(b);
r = write_string_file(p, v, 0);
if (r < 0) {