[systemd-commits] src/network

Tom Gundersen tomegun at kemper.freedesktop.org
Mon May 25 08:42:06 PDT 2015


 src/network/networkd-link.c |   31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)

New commits:
commit 01d28f81a782616b6daa84a42447fd4939783a66
Author: Tom Gundersen <teg at jklm.no>
Date:   Mon May 25 17:34:47 2015 +0200

    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

diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 8b0de1f..f039a2d 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);



More information about the systemd-commits mailing list