From patchwork Mon Feb 11 11:15:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [RFC, 06/10] nl80211_driver: add support for P2P device in adding and removing interface Date: Mon, 11 Feb 2013 01:15:43 -0000 From: Arend van Spriel X-Patchwork-Id: 219574 Message-Id: <1360581347-26766-7-git-send-email-arend@broadcom.com> To: hostap@lists.shmoo.com Cc: Jouni Malinen , Johannes Berg From: David Spinadel Don't try to assign ifindex for P2P device interface and check that the ifindex is valid before trying to remove it. Don't try to set TX rates for P2P device interface since it's not a network device. Signed-hostap: David Spinadel --- src/drivers/driver_nl80211.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index f0306f1..183761a 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -6051,6 +6051,13 @@ static int nl80211_create_iface_once(struct wpa_driver_nl80211_data *drv, return ret; } + if (iftype == NL80211_IFTYPE_P2P_DEVICE) { + wpa_printf(MSG_DEBUG, + "nl80211 New P2P device interface %s created", + ifname); + return 0; + } + ifidx = if_nametoindex(ifname); wpa_printf(MSG_DEBUG, "nl80211: New interface %s created: ifindex=%d", ifname, ifidx); @@ -6094,7 +6101,8 @@ static int nl80211_create_iface(struct wpa_driver_nl80211_data *drv, wds, handler, arg); } - if (ret >= 0 && is_p2p_interface(iftype)) + if (ret >= 0 && is_p2p_interface(iftype) && + iftype != NL80211_IFTYPE_P2P_DEVICE) nl80211_disable_11b_rates(drv, ret, 1); return ret; @@ -7345,7 +7353,7 @@ done: return ret; } - if (is_p2p_interface(nlmode)) + if (is_p2p_interface(nlmode) && nlmode != NL80211_IFTYPE_P2P_DEVICE) nl80211_disable_11b_rates(drv, drv->ifindex, 1); else if (drv->disabled_11b_rates) nl80211_disable_11b_rates(drv, drv->ifindex, 0);