diff options
author | Thomas Haller <thaller@redhat.com> | 2017-10-23 15:16:50 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-10-23 18:00:23 +0200 |
commit | 663f5160ec7845b9223e43ec01a335f983db003c (patch) | |
tree | b5f8b5e8b7447a7acd4bda0646b91958d4812662 | |
parent | f3ad6790a73b4d99b5e6afd4c750e5fc161cb4b8 (diff) | |
download | NetworkManager-663f5160ec7845b9223e43ec01a335f983db003c.tar.gz |
platform: return platform error code from nm_platform_link_set_mtu()
-rw-r--r-- | src/platform/nm-fake-platform.c | 6 | ||||
-rw-r--r-- | src/platform/nm-linux-platform.c | 4 | ||||
-rw-r--r-- | src/platform/nm-platform.c | 2 | ||||
-rw-r--r-- | src/platform/nm-platform.h | 4 | ||||
-rw-r--r-- | src/platform/tests/test-link.c | 4 |
5 files changed, 10 insertions, 10 deletions
diff --git a/src/platform/nm-fake-platform.c b/src/platform/nm-fake-platform.c index de02ebe097..c199c5ed3e 100644 --- a/src/platform/nm-fake-platform.c +++ b/src/platform/nm-fake-platform.c @@ -585,7 +585,7 @@ link_set_address (NMPlatform *platform, int ifindex, gconstpointer addr, size_t return NM_PLATFORM_ERROR_SUCCESS; } -static gboolean +static NMPlatformError link_set_mtu (NMPlatform *platform, int ifindex, guint32 mtu) { NMFakePlatformLink *device = link_get (platform, ifindex); @@ -593,13 +593,13 @@ link_set_mtu (NMPlatform *platform, int ifindex, guint32 mtu) if (!device) { _LOGE ("failure changing link: netlink error (No such device)"); - return FALSE; + return NM_PLATFORM_ERROR_EXISTS; } obj_tmp = nmp_object_clone (device->obj, FALSE); obj_tmp->link.mtu = mtu; link_set_obj (platform, device, obj_tmp); - return TRUE; + return NM_PLATFORM_ERROR_SUCCESS; } static gboolean diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index 6071826ab7..cc8be1ad7a 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -4859,7 +4859,7 @@ link_get_permanent_address (NMPlatform *platform, return nmp_utils_ethtool_get_permanent_address (ifindex, buf, length); } -static gboolean +static NMPlatformError link_set_mtu (NMPlatform *platform, int ifindex, guint32 mtu) { nm_auto_nlmsg struct nl_msg *nlmsg = NULL; @@ -4877,7 +4877,7 @@ link_set_mtu (NMPlatform *platform, int ifindex, guint32 mtu) NLA_PUT_U32 (nlmsg, IFLA_MTU, mtu); - return do_change_link (platform, CHANGE_LINK_TYPE_SET_MTU, ifindex, nlmsg, NULL) == NM_PLATFORM_ERROR_SUCCESS; + return do_change_link (platform, CHANGE_LINK_TYPE_SET_MTU, ifindex, nlmsg, NULL); nla_put_failure: g_return_val_if_reached (FALSE); } diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c index 1697bc03eb..ffc4b3956d 100644 --- a/src/platform/nm-platform.c +++ b/src/platform/nm-platform.c @@ -1500,7 +1500,7 @@ nm_platform_link_set_noarp (NMPlatform *self, int ifindex) * * Set interface MTU. */ -gboolean +NMPlatformError nm_platform_link_set_mtu (NMPlatform *self, int ifindex, guint32 mtu) { _CHECK_SELF (self, klass, FALSE); diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h index 0d40ee129a..d155c1092e 100644 --- a/src/platform/nm-platform.h +++ b/src/platform/nm-platform.h @@ -719,7 +719,7 @@ typedef struct { guint8 *buf, size_t *length); NMPlatformError (*link_set_address) (NMPlatform *, int ifindex, gconstpointer address, size_t length); - gboolean (*link_set_mtu) (NMPlatform *, int ifindex, guint32 mtu); + NMPlatformError (*link_set_mtu) (NMPlatform *, int ifindex, guint32 mtu); gboolean (*link_set_name) (NMPlatform *, int ifindex, const char *name); gboolean (*link_set_sriov_num_vfs) (NMPlatform *, int ifindex, guint num_vfs); @@ -1061,7 +1061,7 @@ gboolean nm_platform_link_set_ipv6_token (NMPlatform *self, int ifindex, NMUtils gboolean nm_platform_link_get_permanent_address (NMPlatform *self, int ifindex, guint8 *buf, size_t *length); NMPlatformError nm_platform_link_set_address (NMPlatform *self, int ifindex, const void *address, size_t length); -gboolean nm_platform_link_set_mtu (NMPlatform *self, int ifindex, guint32 mtu); +NMPlatformError nm_platform_link_set_mtu (NMPlatform *self, int ifindex, guint32 mtu); gboolean nm_platform_link_set_name (NMPlatform *self, int ifindex, const char *name); gboolean nm_platform_link_set_sriov_num_vfs (NMPlatform *self, int ifindex, guint num_vfs); diff --git a/src/platform/tests/test-link.c b/src/platform/tests/test-link.c index ccbada32d7..0a4ab1a923 100644 --- a/src/platform/tests/test-link.c +++ b/src/platform/tests/test-link.c @@ -76,7 +76,7 @@ test_bogus(void) g_assert (!addrlen); g_assert (!nm_platform_link_get_address (NM_PLATFORM_GET, BOGUS_IFINDEX, NULL)); - g_assert (!nm_platform_link_set_mtu (NM_PLATFORM_GET, BOGUS_IFINDEX, MTU)); + g_assert (nm_platform_link_set_mtu (NM_PLATFORM_GET, BOGUS_IFINDEX, MTU) != NM_PLATFORM_ERROR_SUCCESS); g_assert (!nm_platform_link_get_mtu (NM_PLATFORM_GET, BOGUS_IFINDEX)); @@ -603,7 +603,7 @@ test_internal (void) accept_signal (link_changed); /* Set MTU */ - g_assert (nm_platform_link_set_mtu (NM_PLATFORM_GET, ifindex, MTU)); + g_assert (nm_platform_link_set_mtu (NM_PLATFORM_GET, ifindex, MTU) == NM_PLATFORM_ERROR_SUCCESS); g_assert_cmpint (nm_platform_link_get_mtu (NM_PLATFORM_GET, ifindex), ==, MTU); accept_signal (link_changed); |