libelf: get rid of CRLF encoding in the makefile (thx, danimo)
[openwrt.git] / package / hostapd / patches / 390-nl80211_fixes.patch
1 --- a/src/drivers/driver_nl80211.c
2 +++ b/src/drivers/driver_nl80211.c
3 @@ -1119,7 +1119,6 @@ nla_put_failure:
4 }
5
6
7 -#ifndef HOSTAPD
8 struct wiphy_info_data {
9 int max_scan_ssids;
10 int ap_supported;
11 @@ -1231,7 +1230,6 @@ static int wpa_driver_nl80211_capa(struc
12
13 return 0;
14 }
15 -#endif /* HOSTAPD */
16
17
18 static int wpa_driver_nl80211_init_nl(struct wpa_driver_nl80211_data *drv,
19 @@ -1371,6 +1369,7 @@ static void * wpa_driver_nl80211_init(vo
20 drv->monitor_ifidx = -1;
21 drv->monitor_sock = -1;
22 drv->ioctl_sock = -1;
23 + drv->nlmode = NL80211_IFTYPE_STATION;
24
25 if (wpa_driver_nl80211_init_nl(drv, ctx)) {
26 os_free(drv);
27 @@ -1468,24 +1467,23 @@ wpa_driver_nl80211_finish_drv_init(struc
28 drv->ifindex = if_nametoindex(bss->ifname);
29 drv->first_bss.ifindex = drv->ifindex;
30
31 -#ifndef HOSTAPD
32 - if (wpa_driver_nl80211_set_mode(bss, IEEE80211_MODE_INFRA) < 0) {
33 - wpa_printf(MSG_DEBUG, "nl80211: Could not configure driver to "
34 - "use managed mode");
35 - }
36 -
37 - if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) {
38 - wpa_printf(MSG_ERROR, "Could not set interface '%s' UP",
39 - bss->ifname);
40 - return -1;
41 - }
42 + if (drv->nlmode == NL80211_IFTYPE_STATION) {
43 + if (wpa_driver_nl80211_set_mode(bss, IEEE80211_MODE_INFRA) < 0)
44 + wpa_printf(MSG_DEBUG, "nl80211: Could not configure "
45 + "driver to use managed mode");
46 +
47 + if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) {
48 + wpa_printf(MSG_ERROR, "Could not set interface '%s' UP",
49 + bss->ifname);
50 + return -1;
51 + }
52
53 - if (wpa_driver_nl80211_capa(drv))
54 - return -1;
55 + if (wpa_driver_nl80211_capa(drv))
56 + return -1;
57
58 - netlink_send_oper_ifla(drv->netlink, drv->ifindex,
59 - 1, IF_OPER_DORMANT);
60 -#endif /* HOSTAPD */
61 + netlink_send_oper_ifla(drv->netlink, drv->ifindex,
62 + 1, IF_OPER_DORMANT);
63 + }
64
65 if (nl80211_register_action_frames(drv) < 0) {
66 wpa_printf(MSG_DEBUG, "nl80211: Failed to register Action "
67 @@ -2143,13 +2141,9 @@ static int wpa_driver_nl80211_set_key(co
68 */
69 if (ret || !set_tx || alg == WPA_ALG_NONE)
70 return ret;
71 -#ifdef HOSTAPD
72 - if (addr)
73 - return ret;
74 -#else /* HOSTAPD */
75 +
76 if (drv->nlmode == NL80211_IFTYPE_AP && addr)
77 return ret;
78 -#endif /* HOSTAPD */
79
80 msg = nlmsg_alloc();
81 if (!msg)
82 @@ -2990,7 +2984,8 @@ static void nl80211_remove_iface(struct
83
84 #ifdef HOSTAPD
85 /* stop listening for EAPOL on this interface */
86 - del_ifidx(drv, ifidx);
87 + if (drv->nlmode == NL80211_IFTYPE_AP)
88 + del_ifidx(drv, ifidx);
89 #endif /* HOSTAPD */
90
91 msg = nlmsg_alloc();
92 @@ -3063,7 +3058,8 @@ static int nl80211_create_iface_once(str
93
94 #ifdef HOSTAPD
95 /* start listening for EAPOL on this interface */
96 - add_ifidx(drv, ifidx);
97 + if (drv->nlmode == NL80211_IFTYPE_AP)
98 + add_ifidx(drv, ifidx);
99 #endif /* HOSTAPD */
100
101 if (addr && iftype != NL80211_IFTYPE_MONITOR &&
102 @@ -4766,6 +4762,7 @@ static void *i802_init(struct hostapd_da
103 return NULL;
104
105 drv = bss->drv;
106 + drv->nlmode = NL80211_IFTYPE_AP;
107 if (linux_br_get(brname, params->ifname) == 0) {
108 wpa_printf(MSG_DEBUG, "nl80211: Interface %s is in bridge %s",
109 params->ifname, brname);
This page took 0.048134 seconds and 5 git commands to generate.