From: Arend van Spriel Date: Tue, 25 Jun 2013 10:52:58 +0000 (+0300) Subject: nl80211: Fix P2P group interface creating using P2P Device X-Git-Tag: aosp-kk-from-upstream~162 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab7a1addf25b4178c0fe864f0288aaf57c9f3889;p=thirdparty%2Fhostap.git nl80211: Fix P2P group interface creating using P2P Device When P2P Device is used as P2P management interface the creation of the P2P group interface fails because MAC address retrieval fails for the P2P Device interface. Signed-hostap: Arend van Spriel --- diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index f0ae8e314..cde90f0e9 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -9030,11 +9030,14 @@ static int wpa_driver_nl80211_if_add(void *priv, enum wpa_driver_if_type type, } } - if (!addr && - linux_get_ifhwaddr(drv->global->ioctl_sock, bss->ifname, - if_addr) < 0) { - nl80211_remove_iface(drv, ifidx); - return -1; + if (!addr) { + if (drv->nlmode == NL80211_IFTYPE_P2P_DEVICE) + os_memcpy(if_addr, bss->addr, ETH_ALEN); + else if (linux_get_ifhwaddr(drv->global->ioctl_sock, + bss->ifname, if_addr) < 0) { + nl80211_remove_iface(drv, ifidx); + return -1; + } } #ifdef CONFIG_P2P @@ -9042,16 +9045,14 @@ static int wpa_driver_nl80211_if_add(void *priv, enum wpa_driver_if_type type, (type == WPA_IF_P2P_CLIENT || type == WPA_IF_P2P_GROUP || type == WPA_IF_P2P_GO)) { /* Enforce unique P2P Interface Address */ - u8 new_addr[ETH_ALEN], own_addr[ETH_ALEN]; + u8 new_addr[ETH_ALEN]; - if (linux_get_ifhwaddr(drv->global->ioctl_sock, bss->ifname, - own_addr) < 0 || - linux_get_ifhwaddr(drv->global->ioctl_sock, ifname, + if (linux_get_ifhwaddr(drv->global->ioctl_sock, ifname, new_addr) < 0) { nl80211_remove_iface(drv, ifidx); return -1; } - if (os_memcmp(own_addr, new_addr, ETH_ALEN) == 0) { + if (os_memcmp(if_addr, new_addr, ETH_ALEN) == 0) { wpa_printf(MSG_DEBUG, "nl80211: Allocate new address " "for P2P group interface"); if (nl80211_p2p_interface_addr(drv, new_addr) < 0) {