summaryrefslogtreecommitdiff
path: root/src/platform/nm-platform.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-06-15 17:58:36 +0200
committerThomas Haller <thaller@redhat.com>2015-06-17 11:44:16 +0200
commit68a4ffb4e2e38f9476e51da75770239493cb47b7 (patch)
treecca77823f38f029e844a3350be3f2d072ac2f62e /src/platform/nm-platform.c
parentbaec89413916e9c7891a1e7a8e749b597a9c2a9d (diff)
downloadNetworkManager-68a4ffb4e2e38f9476e51da75770239493cb47b7.tar.gz
platform: drop nm_platform_get_error()
For NMPlatform instances we had an error reporting mechanism which stores the last error reason in a private field. Later we would check it via nm_platform_get_error(). Remove this. It was not used much, and it is not a great way to report errors. One problem is that at the point where the error happens, you don't know whether anybody cares about an error code. So, you add code to set the error reason because somebody *might* need it (but in realitiy, almost no caller cares). Also, we tested this functionality which is hardly used in non-testing code. While this was a burden to maintain in the tests, it was likely still buggy because there were no real use-cases, beside the tests. Then, sometimes platform functions call each other which might overwrite the error reason. So, every function must be cautious to preserve/set the error reason according to it's own meaning. This can involve storing the error code, calling another function, and restoring it afterwards. This is harder to get right compared to a "return-error-code" pattern, where every function manages its error code independently. It is better to return the error reason whenever due. For that we already have our common glib patterns (1) gboolean fcn (...); (2) gboolean fcn (..., GError **error); In few cases, we need more details then a #gboolean, but don't want to bother constructing a #GError. Then we should do instead: (3) NMPlatformError fcn (...);
Diffstat (limited to 'src/platform/nm-platform.c')
-rw-r--r--src/platform/nm-platform.c168
1 files changed, 7 insertions, 161 deletions
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index 3118f11291..230d7580ad 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -146,39 +146,6 @@ nm_platform_try_get (void)
/******************************************************************/
/**
- * nm_platform_set_error:
- * @self: platform instance
- * @error: The error code
- *
- * Convenience function to falsify self->error. It can be used for example
- * by functions that want to save the error, execute some operations and
- * restore it.
- */
-void nm_platform_set_error (NMPlatform *self, NMPlatformError error)
-{
- _CHECK_SELF_VOID (self, klass);
-
- self->error = error;
-}
-
-/**
- * nm_platform_get_error:
- * @self: platform instance
- *
- * Convenience function to quickly retrieve the error code of the last
- * operation.
- *
- * Returns: Integer error code.
- */
-NMPlatformError
-nm_platform_get_error (NMPlatform *self)
-{
- _CHECK_SELF (self, klass, NM_PLATFORM_ERROR_BUG);
-
- return self->error;
-}
-
-/**
* nm_platform_error_to_string:
* @error_code: the error code to stringify.
*
@@ -213,26 +180,7 @@ nm_platform_error_to_string (NMPlatformError error)
}
}
-/**
- * nm_platform_get_error_message:
- * @self: platform instance
- *
- * Returns: Static human-readable string for the error. Don't free.
- */
-const char *
-nm_platform_get_error_msg (NMPlatform *self)
-{
- _CHECK_SELF (self, klass, NULL);
-
- return nm_platform_error_to_string (self->error);
-}
-
-static void
-reset_error (NMPlatform *self)
-{
- g_assert (self);
- self->error = NM_PLATFORM_ERROR_SUCCESS;
-}
+/******************************************************************/
#define IFA_F_MANAGETEMPADDR_STR "mngtmpaddr"
#define IFA_F_NOPREFIXROUTE_STR "noprefixroute"
@@ -299,8 +247,6 @@ nm_platform_sysctl_set (NMPlatform *self, const char *path, const char *value)
g_return_val_if_fail (value, FALSE);
g_return_val_if_fail (klass->sysctl_set, FALSE);
- reset_error (self);
-
return klass->sysctl_set (self, path, value);
}
@@ -351,8 +297,6 @@ nm_platform_sysctl_get (NMPlatform *self, const char *path)
g_return_val_if_fail (path, NULL);
g_return_val_if_fail (klass->sysctl_get, NULL);
- reset_error (self);
-
return klass->sysctl_get (self, path);
}
@@ -430,7 +374,6 @@ nm_platform_link_get_all (NMPlatform *self)
NMPlatformLink *item;
_CHECK_SELF (self, klass, NULL);
- reset_error (self);
g_return_val_if_fail (klass->link_get_all, NULL);
@@ -592,11 +535,8 @@ _link_add_check_existing (NMPlatform *self, const char *name, NMLinkType type, N
wrong_type ? nm_link_type_to_string (type) : "");
if (out_link)
*out_link = pllink;
- if (wrong_type) {
- nm_platform_set_error (self, NM_PLATFORM_ERROR_WRONG_TYPE);
+ if (wrong_type)
return NM_PLATFORM_ERROR_WRONG_TYPE;
- }
- nm_platform_set_error (self, NM_PLATFORM_ERROR_EXISTS);
return NM_PLATFORM_ERROR_EXISTS;
}
/* strange, nm_platform_link_get_ifindex() returned a valid ifindex, but nm_platform_link_get() failed.
@@ -635,7 +575,6 @@ nm_platform_link_add (NMPlatform *self,
NMPlatformError plerr;
_CHECK_SELF (self, klass, NM_PLATFORM_ERROR_BUG);
- reset_error (self);
g_return_val_if_fail (name, NM_PLATFORM_ERROR_BUG);
g_return_val_if_fail (klass->link_add, NM_PLATFORM_ERROR_BUG);
@@ -646,12 +585,8 @@ nm_platform_link_add (NMPlatform *self,
return plerr;
debug ("link: adding %s '%s'", nm_link_type_to_string (type), name);
- reset_error(self);
- if (!klass->link_add (self, name, type, address, address_len, out_link)) {
- nm_platform_set_error (self, NM_PLATFORM_ERROR_UNSPECIFIED);
+ if (!klass->link_add (self, name, type, address, address_len, out_link))
return NM_PLATFORM_ERROR_UNSPECIFIED;
- }
- reset_error (self);
return NM_PLATFORM_ERROR_SUCCESS;
}
@@ -685,7 +620,6 @@ nm_platform_link_exists (NMPlatform *self, const char *name)
ifindex = nm_platform_link_get_ifindex (self, name);
- reset_error (self);
return ifindex > 0;
}
@@ -693,9 +627,6 @@ nm_platform_link_exists (NMPlatform *self, const char *name)
* nm_platform_link_delete:
* @self: platform instance
* @ifindex: Interface index
- *
- * Delete a software interface. Sets self->error to
- * NM_PLATFORM_ERROR_NOT_FOUND if ifindex not available.
*/
gboolean
nm_platform_link_delete (NMPlatform *self, int ifindex)
@@ -703,7 +634,6 @@ nm_platform_link_delete (NMPlatform *self, int ifindex)
const char *name;
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (klass->link_delete, FALSE);
@@ -730,17 +660,14 @@ nm_platform_link_get_ifindex (NMPlatform *self, const char *name)
int ifindex;
_CHECK_SELF (self, klass, 0);
- reset_error (self);
g_return_val_if_fail (name, 0);
g_return_val_if_fail (klass->link_get_ifindex, 0);
ifindex = klass->link_get_ifindex (self, name);
- if (!ifindex) {
+ if (!ifindex)
debug ("link not found: %s", name);
- self->error = NM_PLATFORM_ERROR_NOT_FOUND;
- }
return ifindex;
}
@@ -759,7 +686,6 @@ nm_platform_link_get_name (NMPlatform *self, int ifindex)
const char *name;
_CHECK_SELF (self, klass, NULL);
- reset_error (self);
g_return_val_if_fail (klass->link_get_name, NULL);
@@ -767,7 +693,6 @@ nm_platform_link_get_name (NMPlatform *self, int ifindex)
if (!name) {
debug ("link not found: %d", ifindex);
- self->error = NM_PLATFORM_ERROR_NOT_FOUND;
return FALSE;
}
@@ -786,7 +711,6 @@ NMLinkType
nm_platform_link_get_type (NMPlatform *self, int ifindex)
{
_CHECK_SELF (self, klass, NM_LINK_TYPE_NONE);
- reset_error (self);
g_return_val_if_fail (klass->link_get_type, NM_LINK_TYPE_NONE);
@@ -806,7 +730,6 @@ const char *
nm_platform_link_get_type_name (NMPlatform *self, int ifindex)
{
_CHECK_SELF (self, klass, NULL);
- reset_error (self);
g_return_val_if_fail (klass->link_get_type_name, NULL);
@@ -827,7 +750,6 @@ gboolean
nm_platform_link_get_unmanaged (NMPlatform *self, int ifindex, gboolean *managed)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (klass->link_get_unmanaged, FALSE);
@@ -873,7 +795,6 @@ gboolean
nm_platform_link_refresh (NMPlatform *self, int ifindex)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, FALSE);
@@ -894,7 +815,6 @@ gboolean
nm_platform_link_is_up (NMPlatform *self, int ifindex)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex >= 0, FALSE);
g_return_val_if_fail (klass->link_is_up, FALSE);
@@ -913,7 +833,6 @@ gboolean
nm_platform_link_is_connected (NMPlatform *self, int ifindex)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex >= 0, FALSE);
g_return_val_if_fail (klass->link_is_connected, FALSE);
@@ -932,7 +851,6 @@ gboolean
nm_platform_link_uses_arp (NMPlatform *self, int ifindex)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex >= 0, FALSE);
g_return_val_if_fail (klass->link_uses_arp, FALSE);
@@ -956,7 +874,6 @@ gboolean
nm_platform_link_get_ipv6_token (NMPlatform *self, int ifindex, NMUtilsIPv6IfaceId *iid)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex >= 0, FALSE);
g_return_val_if_fail (iid, FALSE);
@@ -970,7 +887,6 @@ const char *
nm_platform_link_get_udi (NMPlatform *self, int ifindex)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex >= 0, NULL);
@@ -983,7 +899,6 @@ GObject *
nm_platform_link_get_udev_device (NMPlatform *self, int ifindex)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex >= 0, NULL);
@@ -1007,7 +922,6 @@ gboolean
nm_platform_link_get_user_ipv6ll_enabled (NMPlatform *self, int ifindex)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex >= 0, FALSE);
g_return_val_if_fail (klass->check_support_user_ipv6ll, FALSE);
@@ -1032,7 +946,6 @@ gboolean
nm_platform_link_set_user_ipv6ll_enabled (NMPlatform *self, int ifindex, gboolean enabled)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex >= 0, FALSE);
g_return_val_if_fail (klass->check_support_user_ipv6ll, FALSE);
@@ -1054,7 +967,6 @@ gboolean
nm_platform_link_set_address (NMPlatform *self, int ifindex, gconstpointer address, size_t length)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, FALSE);
g_return_val_if_fail (address, FALSE);
@@ -1078,7 +990,6 @@ gconstpointer
nm_platform_link_get_address (NMPlatform *self, int ifindex, size_t *length)
{
_CHECK_SELF (self, klass, NULL);
- reset_error (self);
if (length)
*length = 0;
@@ -1104,7 +1015,6 @@ gboolean
nm_platform_link_get_permanent_address (NMPlatform *self, int ifindex, guint8 *buf, size_t *length)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
if (length)
*length = 0;
@@ -1151,7 +1061,6 @@ gboolean
nm_platform_link_set_up (NMPlatform *self, int ifindex, gboolean *out_no_firmware)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, FALSE);
g_return_val_if_fail (klass->link_set_up, FALSE);
@@ -1171,7 +1080,6 @@ gboolean
nm_platform_link_set_down (NMPlatform *self, int ifindex)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, FALSE);
g_return_val_if_fail (klass->link_set_down, FALSE);
@@ -1191,7 +1099,6 @@ gboolean
nm_platform_link_set_arp (NMPlatform *self, int ifindex)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex >= 0, FALSE);
g_return_val_if_fail (klass->link_set_arp, FALSE);
@@ -1211,7 +1118,6 @@ gboolean
nm_platform_link_set_noarp (NMPlatform *self, int ifindex)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex >= 0, FALSE);
g_return_val_if_fail (klass->link_set_noarp, FALSE);
@@ -1232,7 +1138,6 @@ gboolean
nm_platform_link_set_mtu (NMPlatform *self, int ifindex, guint32 mtu)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex >= 0, FALSE);
g_return_val_if_fail (mtu > 0, FALSE);
@@ -1253,7 +1158,6 @@ guint32
nm_platform_link_get_mtu (NMPlatform *self, int ifindex)
{
_CHECK_SELF (self, klass, 0);
- reset_error (self);
g_return_val_if_fail (ifindex >= 0, 0);
g_return_val_if_fail (klass->link_get_mtu, 0);
@@ -1279,7 +1183,6 @@ char *
nm_platform_link_get_physical_port_id (NMPlatform *self, int ifindex)
{
_CHECK_SELF (self, klass, NULL);
- reset_error (self);
g_return_val_if_fail (ifindex >= 0, NULL);
g_return_val_if_fail (klass->link_get_physical_port_id, NULL);
@@ -1303,7 +1206,6 @@ guint
nm_platform_link_get_dev_id (NMPlatform *self, int ifindex)
{
_CHECK_SELF (self, klass, 0);
- reset_error (self);
g_return_val_if_fail (ifindex >= 0, 0);
g_return_val_if_fail (klass->link_get_dev_id, 0);
@@ -1322,7 +1224,6 @@ gboolean
nm_platform_link_get_wake_on_lan (NMPlatform *self, int ifindex)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex >= 0, FALSE);
g_return_val_if_fail (klass->link_get_wake_on_lan, FALSE);
@@ -1350,7 +1251,6 @@ nm_platform_link_get_driver_info (NMPlatform *self,
char **out_fw_version)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex >= 0, FALSE);
g_return_val_if_fail (klass->link_get_driver_info, FALSE);
@@ -1374,7 +1274,6 @@ gboolean
nm_platform_link_enslave (NMPlatform *self, int master, int slave)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (master > 0, FALSE);
g_return_val_if_fail (slave> 0, FALSE);
@@ -1398,16 +1297,13 @@ gboolean
nm_platform_link_release (NMPlatform *self, int master, int slave)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (master > 0, FALSE);
g_return_val_if_fail (slave > 0, FALSE);
g_return_val_if_fail (klass->link_release, FALSE);
- if (nm_platform_link_get_master (self, slave) != master) {
- self->error = NM_PLATFORM_ERROR_NOT_SLAVE;
+ if (nm_platform_link_get_master (self, slave) != master)
return FALSE;
- }
debug ("link: releasing '%s' (%d) from master '%s' (%d)",
nm_platform_link_get_name (self, slave), slave,
@@ -1426,15 +1322,12 @@ int
nm_platform_link_get_master (NMPlatform *self, int slave)
{
_CHECK_SELF (self, klass, 0);
- reset_error (self);
g_return_val_if_fail (slave >= 0, FALSE);
g_return_val_if_fail (klass->link_get_master, FALSE);
- if (!nm_platform_link_get_name (self, slave)) {
- self->error = NM_PLATFORM_ERROR_NOT_FOUND;
+ if (!nm_platform_link_get_name (self, slave))
return 0;
- }
return klass->link_get_master (self, slave);
}
@@ -1507,7 +1400,6 @@ nm_platform_vlan_add (NMPlatform *self,
NMPlatformError plerr;
_CHECK_SELF (self, klass, NM_PLATFORM_ERROR_BUG);
- reset_error (self);
g_return_val_if_fail (parent >= 0, NM_PLATFORM_ERROR_BUG);
g_return_val_if_fail (vlanid >= 0, NM_PLATFORM_ERROR_BUG);
@@ -1529,7 +1421,6 @@ gboolean
nm_platform_master_set_option (NMPlatform *self, int ifindex, const char *option, const char *value)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, FALSE);
g_return_val_if_fail (option, FALSE);
@@ -1543,7 +1434,6 @@ char *
nm_platform_master_get_option (NMPlatform *self, int ifindex, const char *option)
{
_CHECK_SELF (self, klass, NULL);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, FALSE);
g_return_val_if_fail (option, FALSE);
@@ -1556,7 +1446,6 @@ gboolean
nm_platform_slave_set_option (NMPlatform *self, int ifindex, const char *option, const char *value)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, FALSE);
g_return_val_if_fail (option, FALSE);
@@ -1570,7 +1459,6 @@ char *
nm_platform_slave_get_option (NMPlatform *self, int ifindex, const char *option)
{
_CHECK_SELF (self, klass, NULL);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, FALSE);
g_return_val_if_fail (option, FALSE);
@@ -1583,7 +1471,6 @@ gboolean
nm_platform_vlan_get_info (NMPlatform *self, int ifindex, int *parent, int *vlanid)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (klass->vlan_get_info, FALSE);
@@ -1602,7 +1489,6 @@ gboolean
nm_platform_vlan_set_ingress_map (NMPlatform *self, int ifindex, int from, int to)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (klass->vlan_set_ingress_map, FALSE);
@@ -1614,7 +1500,6 @@ gboolean
nm_platform_vlan_set_egress_map (NMPlatform *self, int ifindex, int from, int to)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (klass->vlan_set_egress_map, FALSE);
@@ -1630,7 +1515,6 @@ nm_platform_infiniband_partition_add (NMPlatform *self, int parent, int p_key, N
NMPlatformError plerr;
_CHECK_SELF (self, klass, NM_PLATFORM_ERROR_BUG);
- reset_error (self);
g_return_val_if_fail (parent >= 0, NM_PLATFORM_ERROR_BUG);
g_return_val_if_fail (p_key >= 0, NM_PLATFORM_ERROR_BUG);
@@ -1638,10 +1522,8 @@ nm_platform_infiniband_partition_add (NMPlatform *self, int parent, int p_key, N
parent_name = g_strdup (nm_platform_link_get_name (self, parent));
if ( !parent_name
- || nm_platform_link_get_type (self, parent) != NM_LINK_TYPE_INFINIBAND) {
- self->error = NM_PLATFORM_ERROR_WRONG_TYPE;
+ || nm_platform_link_get_type (self, parent) != NM_LINK_TYPE_INFINIBAND)
return NM_PLATFORM_ERROR_WRONG_TYPE;
- }
name = g_strdup_printf ("%s.%04x", parent_name, p_key);
plerr = _link_add_check_existing (self, name, NM_LINK_TYPE_INFINIBAND, out_link);
@@ -1663,7 +1545,6 @@ nm_platform_infiniband_get_info (NMPlatform *self,
const char **mode)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, FALSE);
g_return_val_if_fail (klass->infiniband_get_info, FALSE);
@@ -1675,7 +1556,6 @@ gboolean
nm_platform_veth_get_properties (NMPlatform *self, int ifindex, NMPlatformVethProperties *props)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, FALSE);
g_return_val_if_fail (props != NULL, FALSE);
@@ -1687,7 +1567,6 @@ gboolean
nm_platform_tun_get_properties (NMPlatform *self, int ifindex, NMPlatformTunProperties *props)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, FALSE);
g_return_val_if_fail (props != NULL, FALSE);
@@ -1699,7 +1578,6 @@ gboolean
nm_platform_macvlan_get_properties (NMPlatform *self, int ifindex, NMPlatformMacvlanProperties *props)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, FALSE);
g_return_val_if_fail (props != NULL, FALSE);
@@ -1711,7 +1589,6 @@ gboolean
nm_platform_vxlan_get_properties (NMPlatform *self, int ifindex, NMPlatformVxlanProperties *props)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, FALSE);
g_return_val_if_fail (props != NULL, FALSE);
@@ -1723,7 +1600,6 @@ gboolean
nm_platform_gre_get_properties (NMPlatform *self, int ifindex, NMPlatformGreProperties *props)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, FALSE);
g_return_val_if_fail (props != NULL, FALSE);
@@ -1735,7 +1611,6 @@ gboolean
nm_platform_wifi_get_capabilities (NMPlatform *self, int ifindex, NMDeviceWifiCapabilities *caps)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, FALSE);
@@ -1746,7 +1621,6 @@ gboolean
nm_platform_wifi_get_bssid (NMPlatform *self, int ifindex, guint8 *bssid)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, FALSE);
@@ -1757,7 +1631,6 @@ guint32
nm_platform_wifi_get_frequency (NMPlatform *self, int ifindex)
{
_CHECK_SELF (self, klass, 0);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, 0);
@@ -1768,7 +1641,6 @@ int
nm_platform_wifi_get_quality (NMPlatform *self, int ifindex)
{
_CHECK_SELF (self, klass, 0);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, 0);
@@ -1779,7 +1651,6 @@ guint32
nm_platform_wifi_get_rate (NMPlatform *self, int ifindex)
{
_CHECK_SELF (self, klass, 0);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, 0);
@@ -1790,7 +1661,6 @@ NM80211Mode
nm_platform_wifi_get_mode (NMPlatform *self, int ifindex)
{
_CHECK_SELF (self, klass, NM_802_11_MODE_UNKNOWN);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, NM_802_11_MODE_UNKNOWN);
@@ -1801,7 +1671,6 @@ void
nm_platform_wifi_set_mode (NMPlatform *self, int ifindex, NM80211Mode mode)
{
_CHECK_SELF_VOID (self, klass);
- reset_error (self);
g_return_if_fail (ifindex > 0);
@@ -1818,7 +1687,6 @@ void
nm_platform_wifi_set_powersave (NMPlatform *self, int ifindex, guint32 powersave)
{
_CHECK_SELF_VOID (self, klass);
- reset_error (self);
g_return_if_fail (ifindex > 0);
@@ -1829,7 +1697,6 @@ guint32
nm_platform_wifi_find_frequency (NMPlatform *self, int ifindex, const guint32 *freqs)
{
_CHECK_SELF (self, klass, 0);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, 0);
g_return_val_if_fail (freqs != NULL, 0);
@@ -1841,7 +1708,6 @@ void
nm_platform_wifi_indicate_addressing_running (NMPlatform *self, int ifindex, gboolean running)
{
_CHECK_SELF_VOID (self, klass);
- reset_error (self);
g_return_if_fail (ifindex > 0);
@@ -1852,7 +1718,6 @@ guint32
nm_platform_mesh_get_channel (NMPlatform *self, int ifindex)
{
_CHECK_SELF (self, klass, 0);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, 0);
@@ -1863,7 +1728,6 @@ gboolean
nm_platform_mesh_set_channel (NMPlatform *self, int ifindex, guint32 channel)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, FALSE);
@@ -1874,7 +1738,6 @@ gboolean
nm_platform_mesh_set_ssid (NMPlatform *self, int ifindex, const guint8 *ssid, gsize len)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, FALSE);
g_return_val_if_fail (ssid != NULL, FALSE);
@@ -1912,7 +1775,6 @@ GArray *
nm_platform_ip4_address_get_all (NMPlatform *self, int ifindex)
{
_CHECK_SELF (self, klass, NULL);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, NULL);
g_return_val_if_fail (klass->ip4_address_get_all, NULL);
@@ -1924,7 +1786,6 @@ GArray *
nm_platform_ip6_address_get_all (NMPlatform *self, int ifindex)
{
_CHECK_SELF (self, klass, NULL);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, NULL);
g_return_val_if_fail (klass->ip6_address_get_all, NULL);
@@ -1943,7 +1804,6 @@ nm_platform_ip4_address_add (NMPlatform *self,
const char *label)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, FALSE);
g_return_val_if_fail (plen > 0, FALSE);
@@ -1981,7 +1841,6 @@ nm_platform_ip6_address_add (NMPlatform *self,
guint flags)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, FALSE);
g_return_val_if_fail (plen > 0, FALSE);
@@ -2013,7 +1872,6 @@ nm_platform_ip4_address_delete (NMPlatform *self, int ifindex, in_addr_t address
char str_peer[NM_UTILS_INET_ADDRSTRLEN];
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, FALSE);
g_return_val_if_fail (plen > 0, FALSE);
@@ -2035,7 +1893,6 @@ nm_platform_ip6_address_delete (NMPlatform *self, int ifindex, struct in6_addr a
char str_dev[TO_STRING_DEV_BUF_SIZE];
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (ifindex > 0, FALSE);
g_return_val_if_fail (plen > 0, FALSE);
@@ -2051,7 +1908,6 @@ gboolean
nm_platform_ip4_address_exists (NMPlatform *self, int ifindex, in_addr_t address, int plen)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (plen > 0, FALSE);
g_return_val_if_fail (klass->ip4_address_exists, FALSE);
@@ -2063,7 +1919,6 @@ gboolean
nm_platform_ip6_address_exists (NMPlatform *self, int ifindex, struct in6_addr address, int plen)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (plen > 0, FALSE);
g_return_val_if_fail (klass->ip6_address_exists, FALSE);
@@ -2177,7 +2032,6 @@ gboolean
nm_platform_ip4_check_reinstall_device_route (NMPlatform *self, int ifindex, const NMPlatformIP4Address *address, guint32 device_route_metric)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
if ( ifindex <= 0
|| address->plen <= 0
@@ -2338,7 +2192,6 @@ GArray *
nm_platform_ip4_route_get_all (NMPlatform *self, int ifindex, NMPlatformGetRouteMode mode)
{
_CHECK_SELF (self, klass, NULL);
- reset_error (self);
g_return_val_if_fail (ifindex >= 0, NULL);
g_return_val_if_fail (klass->ip4_route_get_all, NULL);
@@ -2350,7 +2203,6 @@ GArray *
nm_platform_ip6_route_get_all (NMPlatform *self, int ifindex, NMPlatformGetRouteMode mode)
{
_CHECK_SELF (self, klass, NULL);
- reset_error (self);
g_return_val_if_fail (ifindex >= 0, NULL);
g_return_val_if_fail (klass->ip6_route_get_all, NULL);
@@ -2366,7 +2218,6 @@ nm_platform_ip4_route_add (NMPlatform *self,
guint32 metric, guint32 mss)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (0 <= plen && plen <= 32, FALSE);
g_return_val_if_fail (klass->ip4_route_add, FALSE);
@@ -2398,7 +2249,6 @@ nm_platform_ip6_route_add (NMPlatform *self,
guint32 metric, guint32 mss)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (0 <= plen && plen <= 128, FALSE);
g_return_val_if_fail (klass->ip6_route_add, FALSE);
@@ -2425,7 +2275,6 @@ nm_platform_ip4_route_delete (NMPlatform *self, int ifindex, in_addr_t network,
char str_dev[TO_STRING_DEV_BUF_SIZE];
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (klass->ip4_route_delete, FALSE);
@@ -2441,7 +2290,6 @@ nm_platform_ip6_route_delete (NMPlatform *self, int ifindex, struct in6_addr net
char str_dev[TO_STRING_DEV_BUF_SIZE];
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (klass->ip6_route_delete, FALSE);
@@ -2455,7 +2303,6 @@ gboolean
nm_platform_ip4_route_exists (NMPlatform *self, int ifindex, in_addr_t network, int plen, guint32 metric)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (klass->ip4_route_exists, FALSE);
@@ -2466,7 +2313,6 @@ gboolean
nm_platform_ip6_route_exists (NMPlatform *self, int ifindex, struct in6_addr network, int plen, guint32 metric)
{
_CHECK_SELF (self, klass, FALSE);
- reset_error (self);
g_return_val_if_fail (klass->ip6_route_exists, FALSE);