summaryrefslogtreecommitdiff
path: root/package/hostapd/patches/320-nl80211_multicall_fixes.patch
blob: 62ad1be8f892f0f43cc3a5f3f3f9801314673fe8 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -1847,6 +1847,7 @@ static void * wpa_driver_nl80211_init(vo
 	drv->monitor_ifidx = -1;
 	drv->monitor_sock = -1;
 	drv->ioctl_sock = -1;
+	drv->nlmode = NL80211_IFTYPE_STATION;
 
 	if (wpa_driver_nl80211_init_nl(drv)) {
 		os_free(drv);
@@ -2013,29 +2014,29 @@ wpa_driver_nl80211_finish_drv_init(struc
 	drv->ifindex = if_nametoindex(bss->ifname);
 	drv->first_bss.ifindex = drv->ifindex;
 
-#ifndef HOSTAPD
-	if (wpa_driver_nl80211_set_mode(bss, IEEE80211_MODE_INFRA) < 0) {
-		wpa_printf(MSG_DEBUG, "nl80211: Could not configure driver to "
-			   "use managed mode");
-	}
+	if (drv->nlmode == NL80211_IFTYPE_STATION) {
+		if (wpa_driver_nl80211_set_mode(bss, IEEE80211_MODE_INFRA) < 0) {
+			wpa_printf(MSG_DEBUG, "nl80211: Could not configure driver to "
+				   "use managed mode");
+		}
 
-	if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) {
-		if (rfkill_is_blocked(drv->rfkill)) {
-			wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable "
-				   "interface '%s' due to rfkill",
-				   bss->ifname);
-			drv->if_disabled = 1;
-			send_rfkill_event = 1;
-		} else {
-			wpa_printf(MSG_ERROR, "nl80211: Could not set "
-				   "interface '%s' UP", bss->ifname);
-			return -1;
+		if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) {
+			if (rfkill_is_blocked(drv->rfkill)) {
+				wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable "
+					   "interface '%s' due to rfkill",
+					   bss->ifname);
+				drv->if_disabled = 1;
+				send_rfkill_event = 1;
+			} else {
+				wpa_printf(MSG_ERROR, "nl80211: Could not set "
+					   "interface '%s' UP", bss->ifname);
+				return -1;
+			}
 		}
-	}
 
-	netlink_send_oper_ifla(drv->netlink, drv->ifindex,
-			       1, IF_OPER_DORMANT);
-#endif /* HOSTAPD */
+		netlink_send_oper_ifla(drv->netlink, drv->ifindex,
+				       1, IF_OPER_DORMANT);
+	}
 
 	if (wpa_driver_nl80211_capa(drv))
 		return -1;
@@ -3765,7 +3766,8 @@ static void nl80211_remove_iface(struct 
 
 #ifdef HOSTAPD
 	/* stop listening for EAPOL on this interface */
-	del_ifidx(drv, ifidx);
+	if (drv->nlmode == NL80211_IFTYPE_AP)
+		del_ifidx(drv, ifidx);
 #endif /* HOSTAPD */
 
 	msg = nlmsg_alloc();
@@ -3838,7 +3840,8 @@ static int nl80211_create_iface_once(str
 
 #ifdef HOSTAPD
 	/* start listening for EAPOL on this interface */
-	add_ifidx(drv, ifidx);
+	if (drv->nlmode == NL80211_IFTYPE_AP)
+		add_ifidx(drv, ifidx);
 #endif /* HOSTAPD */
 
 	if (addr && iftype != NL80211_IFTYPE_MONITOR &&