diff options
| author | Michael Biebl <biebl@debian.org> | 2016-03-30 00:57:20 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2016-03-30 00:57:20 +0200 |
| commit | db70f92a77334e84ca9a04379afd49ea55c53098 (patch) | |
| tree | d91e6ec27d66ec3c5a20c9195a0eb1d834189618 /src/platform/wifi | |
| parent | 4a76b5857faa586add8d7ce28f7804ffb65f3c68 (diff) | |
| parent | d9c99a29a0d3384c9c3d2adce430f5cb1134ab6a (diff) | |
Merge tag 'upstream/1.1.92'
Upstream version 1.1.92
Diffstat (limited to 'src/platform/wifi')
| -rw-r--r-- | src/platform/wifi/wifi-utils-wext.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/platform/wifi/wifi-utils-wext.c b/src/platform/wifi/wifi-utils-wext.c index 029601e4..af285b45 100644 --- a/src/platform/wifi/wifi-utils-wext.c +++ b/src/platform/wifi/wifi-utils-wext.c @@ -101,7 +101,7 @@ wifi_wext_get_mode (WifiData *data) struct iwreq wrq; memset (&wrq, 0, sizeof (struct iwreq)); - strncpy (wrq.ifr_name, wext->parent.iface, IFNAMSIZ); + nm_utils_ifname_cpy (wrq.ifr_name, wext->parent.iface); if (ioctl (wext->fd, SIOCGIWMODE, &wrq) < 0) { if (errno != ENODEV) { @@ -118,6 +118,7 @@ wifi_wext_get_mode (WifiData *data) case IW_MODE_MASTER: return NM_802_11_MODE_AP; case IW_MODE_INFRA: + case IW_MODE_AUTO: /* hack for WEXT devices reporting IW_MODE_AUTO */ return NM_802_11_MODE_INFRA; default: break; @@ -150,7 +151,7 @@ wifi_wext_set_mode (WifiData *data, const NM80211Mode mode) return FALSE; } - strncpy (wrq.ifr_name, wext->parent.iface, IFNAMSIZ); + nm_utils_ifname_cpy (wrq.ifr_name, wext->parent.iface); if (ioctl (wext->fd, SIOCSIWMODE, &wrq) < 0) { if (errno != ENODEV) { nm_log_err (LOGD_HW | LOGD_WIFI, "(%s): error setting mode %d", @@ -174,7 +175,7 @@ wifi_wext_set_powersave (WifiData *data, guint32 powersave) } else wrq.u.power.disabled = 1; - strncpy (wrq.ifr_name, wext->parent.iface, IFNAMSIZ); + nm_utils_ifname_cpy (wrq.ifr_name, wext->parent.iface); if (ioctl (wext->fd, SIOCSIWPOWER, &wrq) < 0) { if (errno != ENODEV) { nm_log_err (LOGD_HW | LOGD_WIFI, "(%s): error setting powersave %" G_GUINT32_FORMAT, @@ -193,7 +194,7 @@ wifi_wext_get_freq (WifiData *data) struct iwreq wrq; memset (&wrq, 0, sizeof (struct iwreq)); - strncpy (wrq.ifr_name, wext->parent.iface, IFNAMSIZ); + nm_utils_ifname_cpy (wrq.ifr_name, wext->parent.iface); if (ioctl (wext->fd, SIOCGIWFREQ, &wrq) < 0) { nm_log_warn (LOGD_HW | LOGD_WIFI, "(%s): error getting frequency: %s", @@ -227,7 +228,7 @@ wifi_wext_get_bssid (WifiData *data, guint8 *out_bssid) struct iwreq wrq; memset (&wrq, 0, sizeof (wrq)); - strncpy (wrq.ifr_name, wext->parent.iface, IFNAMSIZ); + nm_utils_ifname_cpy (wrq.ifr_name, wext->parent.iface); if (ioctl (wext->fd, SIOCGIWAP, &wrq) < 0) { nm_log_warn (LOGD_HW | LOGD_WIFI, "(%s): error getting associated BSSID: %s", @@ -246,7 +247,7 @@ wifi_wext_get_rate (WifiData *data) int err; memset (&wrq, 0, sizeof (wrq)); - strncpy (wrq.ifr_name, wext->parent.iface, IFNAMSIZ); + nm_utils_ifname_cpy (wrq.ifr_name, wext->parent.iface); err = ioctl (wext->fd, SIOCGIWRATE, &wrq); return ((err == 0) ? wrq.u.bitrate.value / 1000 : 0); } @@ -356,7 +357,7 @@ wifi_wext_get_qual (WifiData *data) wrq.u.data.pointer = &stats; wrq.u.data.length = sizeof (stats); wrq.u.data.flags = 1; /* Clear updated flag */ - strncpy (wrq.ifr_name, wext->parent.iface, IFNAMSIZ); + nm_utils_ifname_cpy (wrq.ifr_name, wext->parent.iface); if (ioctl (wext->fd, SIOCGIWSTATS, &wrq) < 0) { nm_log_warn (LOGD_HW | LOGD_WIFI, @@ -393,7 +394,7 @@ wifi_wext_set_mesh_channel (WifiData *data, guint32 channel) struct iwreq wrq; memset (&wrq, 0, sizeof (struct iwreq)); - strncpy (wrq.ifr_name, wext->parent.iface, IFNAMSIZ); + nm_utils_ifname_cpy (wrq.ifr_name, wext->parent.iface); if (channel > 0) { wrq.u.freq.flags = IW_FREQ_FIXED; @@ -425,7 +426,7 @@ wifi_wext_set_mesh_ssid (WifiData *data, const guint8 *ssid, gsize len) wrq.u.essid.length = len; wrq.u.essid.flags = (len > 0) ? 1 : 0; /* 1=enable SSID, 0=disable/any */ - strncpy (wrq.ifr_name, wext->parent.iface, IFNAMSIZ); + nm_utils_ifname_cpy (wrq.ifr_name, wext->parent.iface); if (ioctl (wext->fd, SIOCSIWESSID, &wrq) == 0) return TRUE; @@ -448,7 +449,7 @@ wext_can_scan (WifiDataWext *wext) struct iwreq wrq; memset (&wrq, 0, sizeof (struct iwreq)); - strncpy (wrq.ifr_name, wext->parent.iface, IFNAMSIZ); + nm_utils_ifname_cpy (wrq.ifr_name, wext->parent.iface); if (ioctl (wext->fd, SIOCSIWSCAN, &wrq) < 0) { if (errno == EOPNOTSUPP) return FALSE; @@ -466,7 +467,7 @@ wext_get_range (WifiDataWext *wext, struct iwreq wrq; memset (&wrq, 0, sizeof (struct iwreq)); - strncpy (wrq.ifr_name, wext->parent.iface, IFNAMSIZ); + nm_utils_ifname_cpy (wrq.ifr_name, wext->parent.iface); wrq.u.data.pointer = (caddr_t) range; wrq.u.data.length = sizeof (struct iw_range); @@ -666,7 +667,7 @@ wifi_wext_is_wifi (const char *iface) fd = socket (PF_INET, SOCK_DGRAM, 0); if (fd >= 0) { - strncpy (iwr.ifr_ifrn.ifrn_name, iface, IFNAMSIZ); + nm_utils_ifname_cpy (iwr.ifr_ifrn.ifrn_name, iface); if (ioctl (fd, SIOCGIWNAME, &iwr) == 0) is_wifi = TRUE; close (fd); |