[PATCH 11/20] driver: nl80211: introduce i802_set_iface_flags()
Arend van Spriel
arend
Thu May 16 06:28:26 PDT 2013
The driver uses linux_set_iface_flags() in several places. Introduce
and use i802_set_iface_flags() which also works for P2P Device
interface.
Signed-hostap: Arend van Spriel <arend at broadcom.com>
---
src/drivers/driver_nl80211.c | 31 +++++++++++++++++++++++--------
1 file changed, 23 insertions(+), 8 deletions(-)
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 9d8d630..afdb098 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -3759,6 +3759,24 @@ nla_put_failure:
return ret;
}
+
+static int i802_set_iface_flags(struct i802_bss *bss, int up)
+{
+ enum nl80211_iftype nlmode;
+
+ nlmode = nl80211_get_ifmode(bss);
+ if (nlmode != NL80211_IFTYPE_P2P_DEVICE) {
+ int sock;
+
+ sock = bss->drv->global->ioctl_sock;
+ return linux_set_iface_flags(sock, bss->ifname, up);
+ }
+
+ /* P2P Device has start/stop which is equivalent */
+ return nl80211_set_p2pdev(bss, up);
+}
+
+
static int
wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv)
{
@@ -3921,7 +3939,7 @@ static void wpa_driver_nl80211_deinit(struct i802_bss *bss)
eloop_cancel_timeout(wpa_driver_nl80211_scan_timeout, drv, drv->ctx);
- (void) linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 0);
+ (void)i802_set_iface_flags(bss, 0);
wpa_driver_nl80211_set_mode(bss, NL80211_IFTYPE_STATION);
nl80211_mgmt_unsubscribe(bss, "deinit");
@@ -7749,8 +7767,7 @@ static int wpa_driver_nl80211_set_mode(struct i802_bss *bss,
wpa_printf(MSG_DEBUG, "nl80211: Try mode change after setting "
"interface down");
for (i = 0; i < 10; i++) {
- res = linux_set_iface_flags(drv->global->ioctl_sock,
- bss->ifname, 0);
+ res = i802_set_iface_flags(bss, 0);
if (res == -EACCES || res == -ENODEV)
break;
if (res == 0) {
@@ -7759,8 +7776,7 @@ static int wpa_driver_nl80211_set_mode(struct i802_bss *bss,
ret = nl80211_set_mode(drv, drv->ifindex, nlmode);
if (ret == -EACCES)
break;
- res = linux_set_iface_flags(drv->global->ioctl_sock,
- bss->ifname, 1);
+ res = i802_set_iface_flags(bss, 1);
if (res && !ret)
ret = -1;
else if (ret != -EBUSY)
@@ -9191,11 +9207,10 @@ static int wpa_driver_nl80211_deinit_p2p_cli(void *priv)
static void wpa_driver_nl80211_resume(void *priv)
{
struct i802_bss *bss = priv;
- struct wpa_driver_nl80211_data *drv = bss->drv;
- if (linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 1)) {
+
+ if (i802_set_iface_flags(bss, 1))
wpa_printf(MSG_DEBUG, "nl80211: Failed to set interface up on "
"resume event");
- }
}
--
1.7.10.4
More information about the Hostap
mailing list