platform: return platform error code from nm_platform_link_set_mtu()
This commit is contained in:
@@ -585,7 +585,7 @@ link_set_address (NMPlatform *platform, int ifindex, gconstpointer addr, size_t
|
|||||||
return NM_PLATFORM_ERROR_SUCCESS;
|
return NM_PLATFORM_ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static NMPlatformError
|
||||||
link_set_mtu (NMPlatform *platform, int ifindex, guint32 mtu)
|
link_set_mtu (NMPlatform *platform, int ifindex, guint32 mtu)
|
||||||
{
|
{
|
||||||
NMFakePlatformLink *device = link_get (platform, ifindex);
|
NMFakePlatformLink *device = link_get (platform, ifindex);
|
||||||
@@ -593,13 +593,13 @@ link_set_mtu (NMPlatform *platform, int ifindex, guint32 mtu)
|
|||||||
|
|
||||||
if (!device) {
|
if (!device) {
|
||||||
_LOGE ("failure changing link: netlink error (No such 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 = nmp_object_clone (device->obj, FALSE);
|
||||||
obj_tmp->link.mtu = mtu;
|
obj_tmp->link.mtu = mtu;
|
||||||
link_set_obj (platform, device, obj_tmp);
|
link_set_obj (platform, device, obj_tmp);
|
||||||
return TRUE;
|
return NM_PLATFORM_ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@@ -4859,7 +4859,7 @@ link_get_permanent_address (NMPlatform *platform,
|
|||||||
return nmp_utils_ethtool_get_permanent_address (ifindex, buf, length);
|
return nmp_utils_ethtool_get_permanent_address (ifindex, buf, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static NMPlatformError
|
||||||
link_set_mtu (NMPlatform *platform, int ifindex, guint32 mtu)
|
link_set_mtu (NMPlatform *platform, int ifindex, guint32 mtu)
|
||||||
{
|
{
|
||||||
nm_auto_nlmsg struct nl_msg *nlmsg = NULL;
|
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);
|
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:
|
nla_put_failure:
|
||||||
g_return_val_if_reached (FALSE);
|
g_return_val_if_reached (FALSE);
|
||||||
}
|
}
|
||||||
|
@@ -1500,7 +1500,7 @@ nm_platform_link_set_noarp (NMPlatform *self, int ifindex)
|
|||||||
*
|
*
|
||||||
* Set interface MTU.
|
* Set interface MTU.
|
||||||
*/
|
*/
|
||||||
gboolean
|
NMPlatformError
|
||||||
nm_platform_link_set_mtu (NMPlatform *self, int ifindex, guint32 mtu)
|
nm_platform_link_set_mtu (NMPlatform *self, int ifindex, guint32 mtu)
|
||||||
{
|
{
|
||||||
_CHECK_SELF (self, klass, FALSE);
|
_CHECK_SELF (self, klass, FALSE);
|
||||||
|
@@ -719,7 +719,7 @@ typedef struct {
|
|||||||
guint8 *buf,
|
guint8 *buf,
|
||||||
size_t *length);
|
size_t *length);
|
||||||
NMPlatformError (*link_set_address) (NMPlatform *, int ifindex, gconstpointer address, 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_name) (NMPlatform *, int ifindex, const char *name);
|
||||||
gboolean (*link_set_sriov_num_vfs) (NMPlatform *, int ifindex, guint num_vfs);
|
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);
|
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);
|
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_name (NMPlatform *self, int ifindex, const char *name);
|
||||||
gboolean nm_platform_link_set_sriov_num_vfs (NMPlatform *self, int ifindex, guint num_vfs);
|
gboolean nm_platform_link_set_sriov_num_vfs (NMPlatform *self, int ifindex, guint num_vfs);
|
||||||
|
|
||||||
|
@@ -76,7 +76,7 @@ test_bogus(void)
|
|||||||
g_assert (!addrlen);
|
g_assert (!addrlen);
|
||||||
g_assert (!nm_platform_link_get_address (NM_PLATFORM_GET, BOGUS_IFINDEX, NULL));
|
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));
|
g_assert (!nm_platform_link_get_mtu (NM_PLATFORM_GET, BOGUS_IFINDEX));
|
||||||
|
|
||||||
@@ -603,7 +603,7 @@ test_internal (void)
|
|||||||
accept_signal (link_changed);
|
accept_signal (link_changed);
|
||||||
|
|
||||||
/* Set MTU */
|
/* 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);
|
g_assert_cmpint (nm_platform_link_get_mtu (NM_PLATFORM_GET, ifindex), ==, MTU);
|
||||||
accept_signal (link_changed);
|
accept_signal (link_changed);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user