summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/devices/nm-device.c11
-rw-r--r--src/platform/nm-linux-platform.c8
-rw-r--r--src/platform/nm-platform.c13
-rw-r--r--src/platform/nm-platform.h5
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);