]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: Do not disable IPv6 by writing to sysctl
authorSusant Sahani <ssahani@vmware.com>
Mon, 19 Aug 2019 10:00:35 +0000 (15:30 +0530)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 22 Aug 2019 11:21:57 +0000 (13:21 +0200)
Only enable is and do not disable IPv6

src/network/networkd-link.c

index 47d4d08aeea6ecef337cc003ac264c10b94314cd..eca65c4fecf01f1e490b8971ff231f9c4fd8c33c 100644 (file)
@@ -330,19 +330,20 @@ static IPv6PrivacyExtensions link_ipv6_privacy_extensions(Link *link) {
 }
 
 static int link_enable_ipv6(Link *link) {
 }
 
 static int link_enable_ipv6(Link *link) {
-        bool disabled;
+        bool enabled;
         int r;
 
         if (link->flags & IFF_LOOPBACK)
                 return 0;
 
         int r;
 
         if (link->flags & IFF_LOOPBACK)
                 return 0;
 
-        disabled = !link_ipv6_enabled(link);
-
-        r = sysctl_write_ip_property_boolean(AF_INET6, link->ifname, "disable_ipv6", disabled);
-        if (r < 0)
-                log_link_warning_errno(link, r, "Cannot %s IPv6: %m", enable_disable(!disabled));
-        else
-                log_link_info(link, "IPv6 successfully %sd", enable_disable(!disabled));
+        enabled = link_ipv6_enabled(link);
+        if (enabled) {
+                r = sysctl_write_ip_property_boolean(AF_INET6, link->ifname, "disable_ipv6", false);
+                if (r < 0)
+                        log_link_warning_errno(link, r, "Cannot enable IPv6: %m");
+                else
+                        log_link_info(link, "IPv6 successfully enabled");
+        }
 
         return 0;
 }
 
         return 0;
 }
@@ -1281,10 +1282,6 @@ int link_set_mtu(Link *link, uint32_t mtu) {
         if (r < 0)
                 return log_link_error_errno(link, r, "Could not allocate RTM_SETLINK message: %m");
 
         if (r < 0)
                 return log_link_error_errno(link, r, "Could not allocate RTM_SETLINK message: %m");
 
-        /* If IPv6 not configured (no static IPv6 address and IPv6LL autoconfiguration is disabled)
-         * for this interface, then disable IPv6 else enable it. */
-        (void) link_enable_ipv6(link);
-
         /* IPv6 protocol requires a minimum MTU of IPV6_MTU_MIN(1280) bytes
          * on the interface. Bump up MTU bytes to IPV6_MTU_MIN. */
         if (link_ipv6_enabled(link) && mtu < IPV6_MIN_MTU) {
         /* IPv6 protocol requires a minimum MTU of IPV6_MTU_MIN(1280) bytes
          * on the interface. Bump up MTU bytes to IPV6_MTU_MIN. */
         if (link_ipv6_enabled(link) && mtu < IPV6_MIN_MTU) {
@@ -2554,6 +2551,10 @@ static int link_configure(Link *link) {
                         return r;
         }
 
                         return r;
         }
 
+        /* If IPv6 configured that is static IPv6 address and IPv6LL autoconfiguration is enabled
+         * for this interface, then enable IPv6 */
+        (void) link_enable_ipv6(link);
+
         r = link_set_proxy_arp(link);
         if (r < 0)
                return r;
         r = link_set_proxy_arp(link);
         if (r < 0)
                return r;