summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-05-28 15:28:51 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-05-28 15:28:51 -0400
commit662c7e5073fa7ddfb80ad9594365063cedd3fa23 (patch)
treea56ce2a5fecdbb750dfe5570d1e7333c8d1fd3fa /src
parentccf1c70800ef4fd7220599a1f6214ac592d51a3c (diff)
parent2b00a4e03dc375465de7f60f3a6937cbe8ffdf31 (diff)
Merge pull request #3326 from tomty89/update-2
networkd: IPv6 fixes
Diffstat (limited to 'src')
-rw-r--r--src/basic/missing.h1
-rw-r--r--src/network/networkd-link.c32
2 files changed, 29 insertions, 4 deletions
diff --git a/src/basic/missing.h b/src/basic/missing.h
index 2077ada72d..51dafcaca9 100644
--- a/src/basic/missing.h
+++ b/src/basic/missing.h
@@ -577,6 +577,7 @@ struct btrfs_ioctl_quota_ctl_args {
#define IN6_ADDR_GEN_MODE_EUI64 0
#define IN6_ADDR_GEN_MODE_NONE 1
+#define IN6_ADDR_GEN_MODE_STABLE_PRIVACY 2
#endif
#if !HAVE_DECL_IFLA_MACVLAN_FLAGS
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index a021fc886f..0d9d228796 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -110,7 +110,11 @@ static bool link_ipv6_enabled(Link *link) {
if (!socket_ipv6_is_supported())
return false;
- return link_dhcp6_enabled(link) || link_ipv6ll_enabled(link) || network_has_static_ipv6_addresses(link->network);
+ if (link->network->bridge)
+ return false;
+
+ /* DHCPv6 client will not be started if no IPv6 link-local address is configured. */
+ return link_ipv6ll_enabled(link) || network_has_static_ipv6_addresses(link->network);
}
static bool link_lldp_rx_enabled(Link *link) {
@@ -1567,6 +1571,13 @@ static int link_up(Link *link) {
if (r < 0)
return log_link_error_errno(link, r, "Could not allocate RTM_SETLINK message: %m");
+ /* set it free if not enslaved with networkd */
+ if (!link->network->bridge && !link->network->bond) {
+ r = sd_netlink_message_append_u32(req, IFLA_MASTER, 0);
+ if (r < 0)
+ return log_link_error_errno(link, r, "Could not append IFLA_MASTER attribute: %m");
+ }
+
r = sd_rtnl_message_link_set_flags(req, IFF_UP, IFF_UP);
if (r < 0)
return log_link_error_errno(link, r, "Could not set link flags: %m");
@@ -1577,8 +1588,8 @@ static int link_up(Link *link) {
return log_link_error_errno(link, r, "Could not set MAC address: %m");
}
- /* If IPv6 not configured (no static IPv6 address and neither DHCPv6 nor IPv6LL is enabled)
- for this interface then disable IPv6 else enable it. */
+ /* If IPv6 not configured (no static IPv6 address and IPv6LL autoconfiguration is disabled)
+ for this interface, or if it is a bridge slave, then disable IPv6 else enable it. */
(void) link_enable_ipv6(link);
if (link->network->mtu) {
@@ -1607,7 +1618,20 @@ static int link_up(Link *link) {
if (r < 0)
return log_link_error_errno(link, r, "Could not open AF_INET6 container: %m");
- ipv6ll_mode = link_ipv6ll_enabled(link) ? IN6_ADDR_GEN_MODE_EUI64 : IN6_ADDR_GEN_MODE_NONE;
+ if (!link_ipv6ll_enabled(link))
+ ipv6ll_mode = IN6_ADDR_GEN_MODE_NONE;
+ else {
+ const char *p = NULL;
+ _cleanup_free_ char *stable_secret = NULL;
+
+ p = strjoina("/proc/sys/net/ipv6/conf/", link->ifname, "/stable_secret");
+ r = read_one_line_file(p, &stable_secret);
+
+ if (r < 0)
+ ipv6ll_mode = IN6_ADDR_GEN_MODE_EUI64;
+ else
+ ipv6ll_mode = IN6_ADDR_GEN_MODE_STABLE_PRIVACY;
+ }
r = sd_netlink_message_append_u8(req, IFLA_INET6_ADDR_GEN_MODE, ipv6ll_mode);
if (r < 0)
return log_link_error_errno(link, r, "Could not append IFLA_INET6_ADDR_GEN_MODE: %m");