summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2018-07-09 18:51:51 +0200
committerLubomir Rintel <lkundrak@v3.sk>2018-07-27 15:57:44 +0200
commitec53082e0f8e62542eb5c871d66bb7fa2d4bd1e0 (patch)
tree12ed99bafef07eb138351cafef6b65a1b819c078
parent457a23385730692b8ba2ca6697dc4b3f586d7c71 (diff)
downloadNetworkManager-lr/ipv6-with-carrier.tar.gz
device: disable IPv6 on links when they're not ready for autoconfigurationlr/ipv6-with-carrier
Otherwise kernel logs a line every time we up a device that is not ready for IPv6 autoconfiguration (that is every 5 minutes when a random MAC address is genreated for Wi-Fi scanning), flooding its message buffer: IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
-rw-r--r--src/devices/nm-device.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 33faa4bf4f..52060fe1df 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -9192,14 +9192,6 @@ restore_ip6_properties (NMDevice *self)
}
static inline void
-set_disable_ipv6 (NMDevice *self, const char *value)
-{
- /* We only touch disable_ipv6 when NM is not managing the IPv6LL address */
- if (!NM_DEVICE_GET_PRIVATE (self)->ipv6ll_handle)
- nm_device_ipv6_sysctl_set (self, "disable_ipv6", value);
-}
-
-static inline void
set_nm_ipv6ll (NMDevice *self, gboolean enable)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
@@ -9387,7 +9379,7 @@ act_stage3_ip6_config_start (NMDevice *self,
set_nm_ipv6ll (self, TRUE);
/* Re-enable IPv6 on the interface */
- set_disable_ipv6 (self, "0");
+ nm_device_ipv6_sysctl_set (self, "disable_ipv6", "0");
/* Synchronize external IPv6 configuration with kernel, since
* linklocal6_start() uses the information there to determine if we can
@@ -13863,7 +13855,7 @@ nm_device_cleanup (NMDevice *self, NMDeviceStateReason reason, CleanupType clean
/* Turn off kernel IPv6 */
if (cleanup_type == CLEANUP_TYPE_DECONFIGURE) {
- set_disable_ipv6 (self, "1");
+ nm_device_ipv6_sysctl_set (self, "disable_ipv6", "1");
nm_device_ipv6_sysctl_set (self, "accept_ra", "0");
nm_device_ipv6_sysctl_set (self, "use_tempaddr", "0");
}
@@ -14140,8 +14132,21 @@ notify_ip_properties (NMDevice *self)
static void
ip6_managed_setup (NMDevice *self)
{
+ const char *disable_ipv6;
+
+ /* In general, we want to keep IPv6 enabled so that the user can add
+ * their addresses. We need to disable it when there's no support for
+ * userspace IPv6LL because the the kernel would interfere with us. */
+ if ( NM_DEVICE_GET_PRIVATE (self)->ipv6ll_handle
+ && nm_platform_link_is_connected (nm_device_get_platform (self),
+ nm_device_get_ip_ifindex (self))) {
+ disable_ipv6 = "0";
+ } else {
+ disable_ipv6 = "1";
+ }
+
set_nm_ipv6ll (self, TRUE);
- set_disable_ipv6 (self, "1");
+ nm_device_ipv6_sysctl_set (self, "disable_ipv6", disable_ipv6);
nm_device_ipv6_sysctl_set (self, "accept_ra_defrtr", "0");
nm_device_ipv6_sysctl_set (self, "accept_ra_pinfo", "0");
nm_device_ipv6_sysctl_set (self, "accept_ra_rtr_pref", "0");