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