diff options
author | Thomas Haller <thaller@redhat.com> | 2016-07-05 15:04:37 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-07-05 20:54:17 +0200 |
commit | 707a8992476a9e0ecbba7610011f5fa003e69793 (patch) | |
tree | 92c782f53bef4e4a494d579593d2f4ffbf2faed7 | |
parent | ca3b3a4f0f5d0b99556d6cdae903c4f7c8dcad13 (diff) | |
download | NetworkManager-th/avoid-wrong-warnings-rh1323571.tar.gz |
device: tune down warning about failure to set userspace IPv6LL on non-existing deviceth/avoid-wrong-warnings-rh1323571
When a device gets removed externally, we still try to clear userspace IPv6LL address handling.
That fails, due to non-existing device. Such a failure should not be logged as warning.
<debug> [1467723214.2078] device[0x558c59335ca0] (enp0s25): disposing
<debug> [1467723214.2079] device[0x558c59335ca0] (enp0s25): remove_pending_action (0): 'dhcp6' not pending (expected)
<debug> [1467723214.2079] device[0x558c59335ca0] (enp0s25): remove_pending_action (0): 'autoconf6' not pending (expected)
<debug> [1467723214.2079] device[0x558c59335ca0] (enp0s25): will disable userland IPv6LL
<debug> [1467723214.2079] platform-linux: link: change 20: user-ipv6ll: set IPv6 address generation mode to eui64
<trace> [1467723214.2080] platform-linux: delayed-action: schedule wait-for-nl-response (seq 92, timeout in 0.199998611)
<trace> [1467723214.2080] platform-linux: delayed-action: schedule refresh-link (ifindex 20)
<trace> [1467723214.2080] platform-linux: delayed-action: handle refresh-link (ifindex 20)
<debug> [1467723214.2080] platform-linux: do-request-link: 20
<trace> [1467723214.2080] platform-linux: netlink: recvmsg: new message type 2, seq 92
<debug> [1467723214.2080] platform-linux: netlink: recvmsg: error message from kernel: No such device (19) for request 92
<trace> [1467723214.2081] platform-linux: delayed-action: complete wait-for-nl-response (seq 92, timeout in 0.199895684, failure 19 (No such device))
<trace> [1467723214.2081] platform-linux: delayed-action: schedule wait-for-nl-response (seq 93, timeout in 0.199999306)
<trace> [1467723214.2081] platform-linux: delayed-action: handle wait-for-nl-response (any)
<trace> [1467723214.2081] platform-linux: netlink: recvmsg: new message type 2, seq 93
<debug> [1467723214.2081] platform-linux: netlink: recvmsg: error message from kernel: No such device (19) for request 93
<trace> [1467723214.2082] platform-linux: delayed-action: complete wait-for-nl-response (seq 93, timeout in 0.199921142, failure 19 (No such device))
<debug> [1467723214.2082] platform-linux: do-change-link[20]: failure changing link: failure 19 (No such device)
<warn> [1467723214.2082] device (enp0s25): failed to disable userspace IPv6LL address handling
-rw-r--r-- | src/devices/nm-device.c | 11 | ||||
-rw-r--r-- | src/platform/nm-linux-platform.c | 8 | ||||
-rw-r--r-- | src/platform/nm-platform.c | 13 | ||||
-rw-r--r-- | src/platform/nm-platform.h | 5 |
4 files changed, 22 insertions, 15 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index fea4911f43..61a5d4e9d0 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -6440,11 +6440,18 @@ set_nm_ipv6ll (NMDevice *self, gboolean enable) priv->nm_ipv6ll = enable; if (ifindex > 0) { + NMPlatformError plerr; const char *detail = enable ? "enable" : "disable"; _LOGD (LOGD_IP6, "will %s userland IPv6LL", detail); - if (!nm_platform_link_set_user_ipv6ll_enabled (NM_PLATFORM_GET, ifindex, enable)) - _LOGW (LOGD_IP6, "failed to %s userspace IPv6LL address handling", detail); + plerr = nm_platform_link_set_user_ipv6ll_enabled (NM_PLATFORM_GET, ifindex, enable); + if (plerr != NM_PLATFORM_ERROR_SUCCESS) { + _NMLOG (plerr == NM_PLATFORM_ERROR_NOT_FOUND ? LOGL_DEBUG : LOGL_WARN, + LOGD_IP6, + "failed to %s userspace IPv6LL address handling (%s)", + detail, + nm_platform_error_to_string (plerr)); + } if (enable) { /* Bounce IPv6 to ensure the kernel stops IPv6LL address generation */ diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index 9e98665b72..360670a174 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -4328,7 +4328,7 @@ link_get_udev_device (NMPlatform *platform, int ifindex) return obj_cache ? (GObject *) obj_cache->_link.udev.device : NULL; } -static gboolean +static NMPlatformError link_set_user_ipv6ll_enabled (NMPlatform *platform, int ifindex, gboolean enabled) { nm_auto_nlmsg struct nl_msg *nlmsg = NULL; @@ -4336,7 +4336,7 @@ link_set_user_ipv6ll_enabled (NMPlatform *platform, int ifindex, gboolean enable if (!_support_user_ipv6ll_get ()) { _LOGD ("link: change %d: user-ipv6ll: not supported", ifindex); - return FALSE; + return NM_PLATFORM_ERROR_OPNOTSUPP; } _LOGD ("link: change %d: user-ipv6ll: set IPv6 address generation mode to %s", @@ -4351,9 +4351,9 @@ link_set_user_ipv6ll_enabled (NMPlatform *platform, int ifindex, gboolean enable 0); if ( !nlmsg || !_nl_msg_new_link_set_afspec (nlmsg, mode, NULL)) - g_return_val_if_reached (FALSE); + g_return_val_if_reached (NM_PLATFORM_ERROR_BUG); - return do_change_link (platform, ifindex, nlmsg) == NM_PLATFORM_ERROR_SUCCESS; + return do_change_link (platform, ifindex, nlmsg); } static gboolean diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c index fd8e32cb28..75c85b9255 100644 --- a/src/platform/nm-platform.c +++ b/src/platform/nm-platform.c @@ -205,6 +205,7 @@ NM_UTILS_LOOKUP_STR_DEFINE (_nm_platform_error_to_string, NMPlatformError, NM_UTILS_LOOKUP_STR_ITEM (NM_PLATFORM_ERROR_WRONG_TYPE, "wrong-type"), NM_UTILS_LOOKUP_STR_ITEM (NM_PLATFORM_ERROR_NOT_SLAVE, "not-slave"), NM_UTILS_LOOKUP_STR_ITEM (NM_PLATFORM_ERROR_NO_FIRMWARE, "no-firmware"), + NM_UTILS_LOOKUP_STR_ITEM (NM_PLATFORM_ERROR_OPNOTSUPP, "not-supported"), NM_UTILS_LOOKUP_ITEM_IGNORE (_NM_PLATFORM_ERROR_MININT), ); @@ -981,18 +982,16 @@ nm_platform_link_get_user_ipv6ll_enabled (NMPlatform *self, int ifindex) * platform or OS doesn't support changing the IPv6LL address mode, this call * will fail and return %FALSE. * - * Returns: %TRUE if the operation was successful, %FALSE if it failed. + * Returns: %NM_PLATFORM_ERROR_SUCCESS if the operation was successful or an error code otherwise. */ -gboolean +NMPlatformError nm_platform_link_set_user_ipv6ll_enabled (NMPlatform *self, int ifindex, gboolean enabled) { - _CHECK_SELF (self, klass, FALSE); + _CHECK_SELF (self, klass, NM_PLATFORM_ERROR_BUG); - g_return_val_if_fail (ifindex >= 0, FALSE); + g_return_val_if_fail (ifindex > 0, NM_PLATFORM_ERROR_BUG); - if (klass->link_set_user_ipv6ll_enabled) - return klass->link_set_user_ipv6ll_enabled (self, ifindex, enabled); - return FALSE; + return klass->link_set_user_ipv6ll_enabled (self, ifindex, enabled); } /** diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h index f2d3ae64d3..c419855a98 100644 --- a/src/platform/nm-platform.h +++ b/src/platform/nm-platform.h @@ -88,6 +88,7 @@ typedef enum { /*< skip >*/ NM_PLATFORM_ERROR_WRONG_TYPE, NM_PLATFORM_ERROR_NOT_SLAVE, NM_PLATFORM_ERROR_NO_FIRMWARE, + NM_PLATFORM_ERROR_OPNOTSUPP, } NMPlatformError; @@ -519,7 +520,7 @@ typedef struct { const char *(*link_get_udi) (NMPlatform *self, int ifindex); GObject *(*link_get_udev_device) (NMPlatform *self, int ifindex); - gboolean (*link_set_user_ipv6ll_enabled) (NMPlatform *, int ifindex, gboolean enabled); + NMPlatformError (*link_set_user_ipv6ll_enabled) (NMPlatform *, int ifindex, gboolean enabled); gboolean (*link_set_token) (NMPlatform *, int ifindex, NMUtilsIPv6IfaceId iid); gboolean (*link_get_permanent_address) (NMPlatform *, @@ -753,7 +754,7 @@ const char *nm_platform_link_get_udi (NMPlatform *self, int ifindex); GObject *nm_platform_link_get_udev_device (NMPlatform *self, int ifindex); -gboolean nm_platform_link_set_user_ipv6ll_enabled (NMPlatform *self, int ifindex, gboolean enabled); +NMPlatformError nm_platform_link_set_user_ipv6ll_enabled (NMPlatform *self, int ifindex, gboolean enabled); gboolean nm_platform_link_set_ipv6_token (NMPlatform *self, int ifindex, NMUtilsIPv6IfaceId iid); gboolean nm_platform_link_get_permanent_address (NMPlatform *self, int ifindex, guint8 *buf, size_t *length); |