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