diff options
author | Dan Williams <dcbw@redhat.com> | 2012-05-15 09:44:49 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2012-05-17 13:23:39 -0500 |
commit | 4dc5e6c92aeeac638ba8f4647360e3c5a9c0cd69 (patch) | |
tree | f52237be07b38fd10295a69b493fbfa887a54d7b /src/nm-system.c | |
parent | 75257f5d7ee46daba71b7ad0eff2eabd5f6934b9 (diff) | |
download | NetworkManager-4dc5e6c92aeeac638ba8f4647360e3c5a9c0cd69.tar.gz |
core: fix ifindex value checks
Kernel ifindexes are always greater than zero (see dev_new_index()
in net/core/dev.c). Also don't bother warning about ifindex
lookup failures for devices we know aren't kernel network interfaces.
Diffstat (limited to 'src/nm-system.c')
-rw-r--r-- | src/nm-system.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/nm-system.c b/src/nm-system.c index 5156eee315..6a35997f09 100644 --- a/src/nm-system.c +++ b/src/nm-system.c @@ -479,7 +479,7 @@ nm_system_set_ip6_route (int ifindex, struct rtnl_route *route; int err = 0; - g_return_val_if_fail (ifindex >= 0, -1); + g_return_val_if_fail (ifindex > 0, -1); nlh = nm_netlink_get_default_handle (); g_return_val_if_fail (nlh != NULL, -1); @@ -1472,9 +1472,9 @@ nm_system_iface_enslave (gint master_ifindex, struct nl_sock *sock; int err; - g_return_val_if_fail (master_ifindex >= 0, FALSE); + g_return_val_if_fail (master_ifindex > 0, FALSE); g_return_val_if_fail (master_iface != NULL, FALSE); - g_return_val_if_fail (slave_ifindex >= 0, FALSE); + g_return_val_if_fail (slave_ifindex > 0, FALSE); g_return_val_if_fail (slave_iface != NULL, FALSE); sock = nm_netlink_get_default_handle (); @@ -1557,9 +1557,9 @@ nm_system_iface_release (gint master_ifindex, struct nl_sock *sock; int err; - g_return_val_if_fail (master_ifindex >= 0, FALSE); + g_return_val_if_fail (master_ifindex > 0, FALSE); g_return_val_if_fail (master_iface != NULL, FALSE); - g_return_val_if_fail (slave_ifindex >= 0, FALSE); + g_return_val_if_fail (slave_ifindex > 0, FALSE); g_return_val_if_fail (slave_iface != NULL, FALSE); sock = nm_netlink_get_default_handle (); @@ -1598,7 +1598,7 @@ nm_system_get_iface_type (int ifindex, const char *name) char *type; int res = NM_IFACE_TYPE_UNSPEC; - g_return_val_if_fail (ifindex >= 0 || name, NM_IFACE_TYPE_UNSPEC); + g_return_val_if_fail (ifindex > 0 || name, NM_IFACE_TYPE_UNSPEC); nlh = nm_netlink_get_default_handle (); if (!nlh) @@ -1905,7 +1905,7 @@ nm_system_add_vlan_iface (NMConnection *connection, guint32 vlan_flags = 0; guint32 num, i, from, to; - g_return_val_if_fail (parent_ifindex >= 0, FALSE); + g_return_val_if_fail (parent_ifindex > 0, FALSE); nlh = nm_netlink_get_default_handle (); g_return_val_if_fail (nlh != NULL, FALSE); |