| 1 | --- a/src/drivers/driver_nl80211.c |
| 2 | +++ b/src/drivers/driver_nl80211.c |
| 3 | @@ -111,6 +111,7 @@ struct i802_bss { |
| 4 | struct wpa_driver_nl80211_data *drv; |
| 5 | struct i802_bss *next; |
| 6 | int ifindex; |
| 7 | + u8 addr[ETH_ALEN]; |
| 8 | char ifname[IFNAMSIZ + 1]; |
| 9 | char brname[IFNAMSIZ]; |
| 10 | unsigned int beacon_set:1; |
| 11 | @@ -121,7 +122,6 @@ struct i802_bss { |
| 12 | struct wpa_driver_nl80211_data { |
| 13 | struct nl80211_global *global; |
| 14 | struct dl_list list; |
| 15 | - u8 addr[ETH_ALEN]; |
| 16 | char phyname[32]; |
| 17 | void *ctx; |
| 18 | struct netlink_data *netlink; |
| 19 | @@ -2111,7 +2111,7 @@ wpa_driver_nl80211_finish_drv_init(struc |
| 20 | if (wpa_driver_nl80211_capa(drv)) |
| 21 | return -1; |
| 22 | |
| 23 | - if (linux_get_ifhwaddr(drv->ioctl_sock, bss->ifname, drv->addr)) |
| 24 | + if (linux_get_ifhwaddr(drv->ioctl_sock, bss->ifname, bss->addr)) |
| 25 | return -1; |
| 26 | |
| 27 | if (nl80211_register_action_frames(drv) < 0) { |
| 28 | @@ -5650,7 +5650,7 @@ static int i802_set_wds_sta(void *priv, |
| 29 | if (!if_nametoindex(name)) { |
| 30 | if (nl80211_create_iface(drv, name, |
| 31 | NL80211_IFTYPE_AP_VLAN, |
| 32 | - NULL, 1) < 0) |
| 33 | + bss->addr, 1) < 0) |
| 34 | return -1; |
| 35 | if (bridge_ifname && |
| 36 | linux_br_add_if(drv->ioctl_sock, bridge_ifname, |
| 37 | @@ -5878,7 +5878,7 @@ static int nl80211_addr_in_use(struct nl |
| 38 | struct wpa_driver_nl80211_data *drv; |
| 39 | dl_list_for_each(drv, &global->interfaces, |
| 40 | struct wpa_driver_nl80211_data, list) { |
| 41 | - if (os_memcmp(addr, drv->addr, ETH_ALEN) == 0) |
| 42 | + if (os_memcmp(addr, drv->first_bss.addr, ETH_ALEN) == 0) |
| 43 | return 1; |
| 44 | } |
| 45 | return 0; |
| 46 | @@ -5893,9 +5893,9 @@ static int nl80211_p2p_interface_addr(st |
| 47 | if (!drv->global) |
| 48 | return -1; |
| 49 | |
| 50 | - os_memcpy(new_addr, drv->addr, ETH_ALEN); |
| 51 | + os_memcpy(new_addr, drv->first_bss.addr, ETH_ALEN); |
| 52 | for (idx = 0; idx < 64; idx++) { |
| 53 | - new_addr[0] = drv->addr[0] | 0x02; |
| 54 | + new_addr[0] = drv->first_bss.addr[0] | 0x02; |
| 55 | new_addr[0] ^= idx << 2; |
| 56 | if (!nl80211_addr_in_use(drv->global, new_addr)) |
| 57 | break; |
| 58 | @@ -5996,6 +5996,7 @@ static int wpa_driver_nl80211_if_add(voi |
| 59 | os_free(new_bss); |
| 60 | return -1; |
| 61 | } |
| 62 | + memcpy(new_bss->addr, addr ? addr : if_addr, ETH_ALEN); |
| 63 | os_strlcpy(new_bss->ifname, ifname, IFNAMSIZ); |
| 64 | new_bss->ifindex = ifidx; |
| 65 | new_bss->drv = drv; |
| 66 | |