diff options
author | Susant Sahani <ssahani@gmail.com> | 2015-10-12 14:31:10 +0530 |
---|---|---|
committer | Susant Sahani <ssahani@gmail.com> | 2015-10-16 10:53:20 +0530 |
commit | 8749cbcd4fe989709c6e680c4a141e34496e74d9 (patch) | |
tree | 8bbc903b22c42bb050fdc980f6b6a514033462be /src/network/networkd-link.c | |
parent | 8ee07361d0065a2d4ab9c4bf6aeb0893b05b2b6c (diff) |
networkd: add support for configure IPv6 DAD
Configures Ipv6 Duplicate Address Detection.
10
Diffstat (limited to 'src/network/networkd-link.c')
-rw-r--r-- | src/network/networkd-link.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index f6cc1f8ee2..9d97089576 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -1850,6 +1850,37 @@ static int link_set_ipv6_accept_ra(Link *link) { return 0; } +static int link_set_ipv6_dad_transmits(Link *link) { + char buf[DECIMAL_STR_MAX(unsigned) + 1]; + const char *p = NULL; + int r; + + /* Make this a NOP if IPv6 is not available */ + if (!socket_ipv6_is_supported()) + return 0; + + if (link->flags & IFF_LOOPBACK) + return 0; + + if (link->network->ipv6_dad_transmits < 0) + return 0; + + p = strjoina("/proc/sys/net/ipv6/conf/", link->ifname, "/dad_transmits"); + + xsprintf(buf, "%u", link->network->ipv6_dad_transmits); + + r = write_string_file(p, buf, 0); + if (r < 0) { + /* If the right value is set anyway, don't complain */ + if (verify_one_line_file(p, buf) > 0) + return 0; + + log_link_warning_errno(link, r, "Cannot set IPv6 dad transmits for interface: %m"); + } + + return 0; +} + static int link_configure(Link *link) { int r; @@ -1877,6 +1908,10 @@ static int link_configure(Link *link) { if (r < 0) return r; + r = link_set_ipv6_dad_transmits(link); + if (r < 0) + return r; + if (link_ipv4ll_enabled(link)) { r = ipv4ll_configure(link); if (r < 0) |