diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2017-01-16 15:51:05 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2017-01-16 22:14:47 +0100 |
commit | 5b51a5f26055487c0ecb75c5ae7d901f404e6f66 (patch) | |
tree | 63fa12eec4c8dc1aa0473e79582febb70c6d19c8 | |
parent | cb8e70546bea8278e1fbef697bedbe8277d783e8 (diff) | |
download | NetworkManager-5b51a5f26055487c0ecb75c5ae7d901f404e6f66.tar.gz |
platform/tun: don't passing around the ifname guess
nm_platform_sysctl_open_netdir() doesn't take it anyways, gets it from
the cache.
CID 160209 (#1 of 1): Unused value (UNUSED_VALUE)
-rw-r--r-- | src/devices/nm-device-tun.c | 4 | ||||
-rw-r--r-- | src/platform/nm-linux-platform.c | 2 | ||||
-rw-r--r-- | src/platform/nm-platform.c | 20 | ||||
-rw-r--r-- | src/platform/nm-platform.h | 2 |
4 files changed, 7 insertions, 21 deletions
diff --git a/src/devices/nm-device-tun.c b/src/devices/nm-device-tun.c index 2f42269234..a937ae2dc6 100644 --- a/src/devices/nm-device-tun.c +++ b/src/devices/nm-device-tun.c @@ -80,7 +80,7 @@ update_properties (NMDeviceTun *self) ifindex = nm_device_get_ifindex (NM_DEVICE (self)); if (ifindex > 0) { - if (!nm_platform_link_tun_get_properties (NM_PLATFORM_GET, ifindex, NULL, &props)) { + if (!nm_platform_link_tun_get_properties (NM_PLATFORM_GET, ifindex, &props)) { _LOGD (LOGD_DEVICE, "tun-properties: cannot loading tun properties from platform for ifindex %d", ifindex); ifindex = 0; } else if (g_strcmp0 (priv->mode, props.mode) != 0) { @@ -181,7 +181,7 @@ update_connection (NMDevice *device, NMConnection *connection) nm_connection_add_setting (connection, (NMSetting *) s_tun); } - if (!nm_platform_link_tun_get_properties (NM_PLATFORM_GET, nm_device_get_ifindex (device), NULL, &props)) { + if (!nm_platform_link_tun_get_properties (NM_PLATFORM_GET, nm_device_get_ifindex (device), &props)) { _LOGW (LOGD_PLATFORM, "failed to get TUN interface info while updating connection."); return; } diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index ef946e39a0..2c5f089710 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -672,7 +672,7 @@ _linktype_get_type (NMPlatform *platform, NMPlatformTunProperties props; if ( platform - && nm_platform_link_tun_get_properties (platform, ifindex, ifname, &props)) { + && nm_platform_link_tun_get_properties (platform, ifindex, &props)) { if (!g_strcmp0 (props.mode, "tap")) return NM_LINK_TYPE_TAP; if (!g_strcmp0 (props.mode, "tun")) diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c index 4552f76069..8b22ced2d8 100644 --- a/src/platform/nm-platform.c +++ b/src/platform/nm-platform.c @@ -2328,11 +2328,10 @@ nm_platform_link_veth_get_properties (NMPlatform *self, int ifindex, int *out_pe } gboolean -nm_platform_link_tun_get_properties (NMPlatform *self, int ifindex, const char *ifname_guess, NMPlatformTunProperties *props) +nm_platform_link_tun_get_properties (NMPlatform *self, int ifindex, NMPlatformTunProperties *props) { nm_auto_close int dirfd = -1; - const char *ifname; - char ifname_verified[IFNAMSIZ]; + char ifname[IFNAMSIZ]; gint64 flags; gboolean success = TRUE; _CHECK_SELF (self, klass, FALSE); @@ -2340,27 +2339,14 @@ nm_platform_link_tun_get_properties (NMPlatform *self, int ifindex, const char * g_return_val_if_fail (ifindex > 0, FALSE); g_return_val_if_fail (props, FALSE); - /* ifname_guess is an optional argument to find a guess for the ifname corresponding to - * ifindex. */ - if (!ifname_guess) { - /* if NULL, obtain the guess from the platform cache. */ - ifname = nm_platform_link_get_name (self, ifindex); - } else if (!ifname_guess[0]) { - /* if empty, don't use a guess. That means to use if_indextoname(). */ - ifname = NULL; - } else - ifname = ifname_guess; - memset (props, 0, sizeof (*props)); props->owner = -1; props->group = -1; - dirfd = nm_platform_sysctl_open_netdir (self, ifindex, ifname_verified); + dirfd = nm_platform_sysctl_open_netdir (self, ifindex, ifname); if (dirfd < 0) return FALSE; - ifname = ifname_verified; - props->owner = nm_platform_sysctl_get_int_checked (self, NMP_SYSCTL_PATHID_NETDIR (dirfd, ifname, "owner"), 10, -1, G_MAXINT64, -1); if (errno) success = FALSE; diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h index f0b2cc8225..63dbe5a07c 100644 --- a/src/platform/nm-platform.h +++ b/src/platform/nm-platform.h @@ -890,7 +890,7 @@ NMPlatformError nm_platform_link_infiniband_delete (NMPlatform *self, gboolean nm_platform_link_infiniband_get_properties (NMPlatform *self, int ifindex, int *parent, int *p_key, const char **mode); gboolean nm_platform_link_veth_get_properties (NMPlatform *self, int ifindex, int *out_peer_ifindex); -gboolean nm_platform_link_tun_get_properties (NMPlatform *self, int ifindex, const char *ifname_guess, NMPlatformTunProperties *properties); +gboolean nm_platform_link_tun_get_properties (NMPlatform *self, int ifindex, NMPlatformTunProperties *properties); gboolean nm_platform_wifi_get_capabilities (NMPlatform *self, int ifindex, NMDeviceWifiCapabilities *caps); gboolean nm_platform_wifi_get_bssid (NMPlatform *self, int ifindex, guint8 *bssid); |