systemd/0009-networkd-fix-IFF_UP-when-ipv6-support-is-disabled.patch
2015-06-10 15:08:55 -04:00

64 lines
3.3 KiB
Diff

From c88fd204e9822cd92d97a93f9120c9d58d3a5037 Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Mon, 25 May 2015 17:34:47 +0200
Subject: [PATCH] networkd: fix IFF_UP when ipv6 support is disabled
Passing ipv6 options (even when they should be noops) caused IFF_UP to fail when
ipv6 was supported.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=90103
(cherry picked from commit 01d28f81a782616b6daa84a42447fd4939783a66)
---
src/network/networkd-link.c | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 8b0de1f741..f039a2d687 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -1010,27 +1010,30 @@ static int link_up(Link *link) {
if (r < 0)
return log_link_error_errno(link, r, "Could not open IFLA_AF_SPEC container: %m");
- r = sd_rtnl_message_open_container(req, AF_INET6);
- if (r < 0)
- return log_link_error_errno(link, r, "Could not open AF_INET6 container: %m");
+ if (socket_ipv6_is_supported()) {
+ /* if the kernel lacks ipv6 support setting IFF_UP fails if any ipv6 options are passed */
+ r = sd_rtnl_message_open_container(req, AF_INET6);
+ 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;
- r = sd_rtnl_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");
+ ipv6ll_mode = link_ipv6ll_enabled(link) ? IN6_ADDR_GEN_MODE_EUI64 : IN6_ADDR_GEN_MODE_NONE;
+ r = sd_rtnl_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");
+
+ if (!in_addr_is_null(AF_INET6, &link->network->ipv6_token)) {
+ r = sd_rtnl_message_append_in6_addr(req, IFLA_INET6_TOKEN, &link->network->ipv6_token.in6);
+ if (r < 0)
+ return log_link_error_errno(link, r, "Could not append IFLA_INET6_TOKEN: %m");
+ }
- if (!in_addr_is_null(AF_INET6, &link->network->ipv6_token)) {
- r = sd_rtnl_message_append_in6_addr(req, IFLA_INET6_TOKEN, &link->network->ipv6_token.in6);
+ r = sd_rtnl_message_close_container(req);
if (r < 0)
- return log_link_error_errno(link, r, "Could not append IFLA_INET6_TOKEN: %m");
+ return log_link_error_errno(link, r, "Could not close AF_INET6 container: %m");
}
r = sd_rtnl_message_close_container(req);
if (r < 0)
- return log_link_error_errno(link, r, "Could not close AF_INET6 container: %m");
-
- r = sd_rtnl_message_close_container(req);
- if (r < 0)
return log_link_error_errno(link, r, "Could not close IFLA_AF_SPEC container: %m");
r = sd_rtnl_call_async(link->manager->rtnl, req, link_up_handler, link, 0, NULL);