diff options
author | Thomas Haller <thaller@redhat.com> | 2016-12-26 12:00:08 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-01-04 14:18:01 +0100 |
commit | 87076d9345f7c61619eb67f4d4478f55d2980f84 (patch) | |
tree | 87b111ce1224da9bb281ac254a651678c9ea75ee | |
parent | e8d5a8356c871624bf3be471e995f434bd027f25 (diff) | |
download | NetworkManager-87076d9345f7c61619eb67f4d4478f55d2980f84.tar.gz |
platform: use wrappers for if_nametoindex() and if_indextoname()
-rw-r--r-- | src/nm-iface-helper.c | 7 | ||||
-rw-r--r-- | src/platform/nm-platform-utils.c | 6 |
2 files changed, 5 insertions, 8 deletions
diff --git a/src/nm-iface-helper.c b/src/nm-iface-helper.c index 393e8acc57..f7c43d2bb3 100644 --- a/src/nm-iface-helper.c +++ b/src/nm-iface-helper.c @@ -32,13 +32,10 @@ #include <sys/stat.h> #include <signal.h> -/* Cannot include <net/if.h> due to conflict with <linux/if.h>. - * Forward declare if_nametoindex. */ -extern unsigned int if_nametoindex (const char *__ifname); - #include "main-utils.h" #include "NetworkManagerUtils.h" #include "platform/nm-linux-platform.h" +#include "platform/nm-platform-utils.h" #include "dhcp/nm-dhcp-manager.h" #include "ndisc/nm-ndisc.h" #include "ndisc/nm-lndp-ndisc.h" @@ -394,7 +391,7 @@ main (int argc, char *argv[]) return 1; } - gl.ifindex = if_nametoindex (global_opt.ifname); + gl.ifindex = nmp_utils_if_nametoindex (global_opt.ifname); if (gl.ifindex <= 0) { fprintf (stderr, _("Failed to find interface index for %s (%s)\n"), global_opt.ifname, strerror (errno)); return 1; diff --git a/src/platform/nm-platform-utils.c b/src/platform/nm-platform-utils.c index 2c2b19a21d..22e723626e 100644 --- a/src/platform/nm-platform-utils.c +++ b/src/platform/nm-platform-utils.c @@ -113,7 +113,7 @@ ethtool_get (int ifindex, gpointer edata) * This does not solve the renaming race, but it minimizes the time for * the race to happen as much as possible. */ - if (!if_indextoname (ifindex, ifname)) { + if (!nmp_utils_if_indextoname (ifindex, ifname)) { nm_log_trace (LOGD_PLATFORM, "ethtool[%d]: %s: request fails resolving ifindex: %s", ifindex, _ethtool_data_to_string (edata, sbuf, sizeof (sbuf)), @@ -483,7 +483,7 @@ nmp_utils_mii_supports_carrier_detect (int ifindex) g_return_val_if_fail (ifindex > 0, FALSE); - if (!if_indextoname (ifindex, ifname)) { + if (!nmp_utils_if_indextoname (ifindex, ifname)) { nm_log_trace (LOGD_PLATFORM, "mii[%d]: carrier-detect no: request fails resolving ifindex: %s", ifindex, g_strerror (errno)); return FALSE; } @@ -718,7 +718,7 @@ nmp_utils_sysctl_open_netdir (int ifindex, int fd; if (!ifname) { - ifname = if_indextoname (ifindex, ifname_buf); + ifname = nmp_utils_if_indextoname (ifindex, ifname_buf); if (!ifname) return -1; } |