brcm47xx: update bcma and ssb to master-2011-07-21
[openwrt.git] / package / hostapd / patches / 540-optional_rfkill.patch
1 --- a/src/drivers/driver_nl80211.c
2 +++ b/src/drivers/driver_nl80211.c
3 @@ -129,7 +129,9 @@ struct wpa_driver_nl80211_data {
4 int ifindex;
5 int if_removed;
6 int if_disabled;
7 +#ifdef CONFIG_RFKILL
8 struct rfkill_data *rfkill;
9 +#endif
10 struct wpa_driver_capa capa;
11 int has_capability;
12
13 @@ -1819,7 +1821,7 @@ err1:
14 return -1;
15 }
16
17 -
18 +#ifdef CONFIG_RFKILL
19 static void wpa_driver_nl80211_rfkill_blocked(void *ctx)
20 {
21 wpa_printf(MSG_DEBUG, "nl80211: RFKILL blocked");
22 @@ -1841,6 +1843,7 @@ static void wpa_driver_nl80211_rfkill_un
23 }
24 /* rtnetlink ifup handler will report interface as enabled */
25 }
26 +#endif /* CONFIG_RFKILL */
27
28
29 static void nl80211_get_phy_name(struct wpa_driver_nl80211_data *drv)
30 @@ -1889,7 +1892,9 @@ static void * wpa_driver_nl80211_init(vo
31 {
32 struct wpa_driver_nl80211_data *drv;
33 struct netlink_config *cfg;
34 +#ifdef CONFIG_RFKILL
35 struct rfkill_config *rcfg;
36 +#endif
37 struct i802_bss *bss;
38
39 drv = os_zalloc(sizeof(*drv));
40 @@ -1930,6 +1935,7 @@ static void * wpa_driver_nl80211_init(vo
41 goto failed;
42 }
43
44 +#ifdef CONFIG_RFKILL
45 rcfg = os_zalloc(sizeof(*rcfg));
46 if (rcfg == NULL)
47 goto failed;
48 @@ -1942,6 +1948,7 @@ static void * wpa_driver_nl80211_init(vo
49 wpa_printf(MSG_DEBUG, "nl80211: RFKILL status not available");
50 os_free(rcfg);
51 }
52 +#endif /* CONFIG_RFKILL */
53
54 if (wpa_driver_nl80211_finish_drv_init(drv))
55 goto failed;
56 @@ -1952,7 +1959,9 @@ static void * wpa_driver_nl80211_init(vo
57 return bss;
58
59 failed:
60 +#ifdef CONFIG_RFKILL
61 rfkill_deinit(drv->rfkill);
62 +#endif
63 netlink_deinit(drv->netlink);
64 if (drv->ioctl_sock >= 0)
65 close(drv->ioctl_sock);
66 @@ -2055,10 +2064,12 @@ static int nl80211_register_action_frame
67 }
68
69
70 +#ifdef CONFIG_RFKILL
71 static void wpa_driver_nl80211_send_rfkill(void *eloop_ctx, void *timeout_ctx)
72 {
73 wpa_supplicant_event(timeout_ctx, EVENT_INTERFACE_DISABLED, NULL);
74 }
75 +#endif /* CONFIG_RFKILL */
76
77
78 static int
79 @@ -2077,13 +2088,16 @@ wpa_driver_nl80211_finish_drv_init(struc
80 }
81
82 if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) {
83 +#ifdef CONFIG_RFKILL
84 if (rfkill_is_blocked(drv->rfkill)) {
85 wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable "
86 "interface '%s' due to rfkill",
87 bss->ifname);
88 drv->if_disabled = 1;
89 send_rfkill_event = 1;
90 - } else {
91 + } else
92 +#endif
93 + {
94 wpa_printf(MSG_ERROR, "nl80211: Could not set "
95 "interface '%s' UP", bss->ifname);
96 return -1;
97 @@ -2111,8 +2125,10 @@ wpa_driver_nl80211_finish_drv_init(struc
98 }
99
100 if (send_rfkill_event) {
101 +#ifdef CONFIG_RFKILL
102 eloop_register_timeout(0, 0, wpa_driver_nl80211_send_rfkill,
103 drv, drv->ctx);
104 +#endif
105 }
106
107 return 0;
108 @@ -2193,7 +2209,9 @@ static void wpa_driver_nl80211_deinit(vo
109
110 netlink_send_oper_ifla(drv->netlink, drv->ifindex, 0, IF_OPER_UP);
111 netlink_deinit(drv->netlink);
112 +#ifdef CONFIG_RFKILL
113 rfkill_deinit(drv->rfkill);
114 +#endif
115
116 eloop_cancel_timeout(wpa_driver_nl80211_scan_timeout, drv, drv->ctx);
117
118 @@ -5785,7 +5803,9 @@ static void *i802_init(struct hostapd_da
119
120 failed:
121 nl80211_remove_monitor_interface(drv);
122 +#ifdef CONFIG_RFKILL
123 rfkill_deinit(drv->rfkill);
124 +#endif
125 netlink_deinit(drv->netlink);
126 if (drv->ioctl_sock >= 0)
127 close(drv->ioctl_sock);
128 --- a/src/drivers/driver_wext.c
129 +++ b/src/drivers/driver_wext.c
130 @@ -702,7 +702,7 @@ static void wpa_driver_wext_event_rtm_de
131 }
132 }
133
134 -
135 +#ifdef CONFIG_RFKILL
136 static void wpa_driver_wext_rfkill_blocked(void *ctx)
137 {
138 wpa_printf(MSG_DEBUG, "WEXT: RFKILL blocked");
139 @@ -724,7 +724,7 @@ static void wpa_driver_wext_rfkill_unblo
140 }
141 /* rtnetlink ifup handler will report interface as enabled */
142 }
143 -
144 +#endif /* CONFIG_RFKILL */
145
146 static void wext_get_phy_name(struct wpa_driver_wext_data *drv)
147 {
148 @@ -770,7 +770,9 @@ void * wpa_driver_wext_init(void *ctx, c
149 {
150 struct wpa_driver_wext_data *drv;
151 struct netlink_config *cfg;
152 +#ifdef CONFIG_RFKILL
153 struct rfkill_config *rcfg;
154 +#endif
155 char path[128];
156 struct stat buf;
157
158 @@ -805,6 +807,7 @@ void * wpa_driver_wext_init(void *ctx, c
159 goto err2;
160 }
161
162 +#ifdef CONFIG_RFKILL
163 rcfg = os_zalloc(sizeof(*rcfg));
164 if (rcfg == NULL)
165 goto err3;
166 @@ -817,6 +820,7 @@ void * wpa_driver_wext_init(void *ctx, c
167 wpa_printf(MSG_DEBUG, "WEXT: RFKILL status not available");
168 os_free(rcfg);
169 }
170 +#endif /* CONFIG_RFKILL */
171
172 drv->mlme_sock = -1;
173
174 @@ -828,7 +832,9 @@ void * wpa_driver_wext_init(void *ctx, c
175 return drv;
176
177 err3:
178 +#ifdef CONFIG_RFKILL
179 rfkill_deinit(drv->rfkill);
180 +#endif
181 netlink_deinit(drv->netlink);
182 err2:
183 close(drv->ioctl_sock);
184 @@ -838,10 +844,12 @@ err1:
185 }
186
187
188 +#ifdef CONFIG_RFKILL
189 static void wpa_driver_wext_send_rfkill(void *eloop_ctx, void *timeout_ctx)
190 {
191 wpa_supplicant_event(timeout_ctx, EVENT_INTERFACE_DISABLED, NULL);
192 }
193 +#endif /* CONFIG_RFKILL */
194
195
196 static int wpa_driver_wext_finish_drv_init(struct wpa_driver_wext_data *drv)
197 @@ -849,13 +857,16 @@ static int wpa_driver_wext_finish_drv_in
198 int send_rfkill_event = 0;
199
200 if (linux_set_iface_flags(drv->ioctl_sock, drv->ifname, 1) < 0) {
201 +#ifdef CONFIG_RFKILL
202 if (rfkill_is_blocked(drv->rfkill)) {
203 wpa_printf(MSG_DEBUG, "WEXT: Could not yet enable "
204 "interface '%s' due to rfkill",
205 drv->ifname);
206 drv->if_disabled = 1;
207 send_rfkill_event = 1;
208 - } else {
209 + } else
210 +#endif
211 + {
212 wpa_printf(MSG_ERROR, "WEXT: Could not set "
213 "interface '%s' UP", drv->ifname);
214 return -1;
215 @@ -903,8 +914,10 @@ static int wpa_driver_wext_finish_drv_in
216 1, IF_OPER_DORMANT);
217
218 if (send_rfkill_event) {
219 +#ifdef CONFIG_RFKILL
220 eloop_register_timeout(0, 0, wpa_driver_wext_send_rfkill,
221 drv, drv->ctx);
222 +#endif
223 }
224
225 return 0;
226 @@ -934,7 +947,9 @@ void wpa_driver_wext_deinit(void *priv)
227
228 netlink_send_oper_ifla(drv->netlink, drv->ifindex, 0, IF_OPER_UP);
229 netlink_deinit(drv->netlink);
230 +#ifdef CONFIG_RFKILL
231 rfkill_deinit(drv->rfkill);
232 +#endif
233
234 if (drv->mlme_sock >= 0)
235 eloop_unregister_read_sock(drv->mlme_sock);
236 --- a/src/drivers/drivers.mak
237 +++ b/src/drivers/drivers.mak
238 @@ -43,7 +43,6 @@ NEED_SME=y
239 NEED_AP_MLME=y
240 NEED_NETLINK=y
241 NEED_LINUX_IOCTL=y
242 -NEED_RFKILL=y
243 ifdef CONFIG_LIBNL_TINY
244 DRV_LIBS += -lnl-tiny
245 else
246 @@ -94,7 +93,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT
247 CONFIG_WIRELESS_EXTENSION=y
248 NEED_NETLINK=y
249 NEED_LINUX_IOCTL=y
250 -NEED_RFKILL=y
251 endif
252
253 ifdef CONFIG_DRIVER_RALINK
254 @@ -146,7 +144,6 @@ endif
255 ifdef CONFIG_WIRELESS_EXTENSION
256 DRV_CFLAGS += -DCONFIG_WIRELESS_EXTENSION
257 DRV_OBJS += ../src/drivers/driver_wext.o
258 -NEED_RFKILL=y
259 endif
260
261 ifdef NEED_NETLINK
262 @@ -159,6 +156,7 @@ endif
263
264 ifdef NEED_RFKILL
265 DRV_OBJS += ../src/drivers/rfkill.o
266 +DRV_WPA_CFLAGS += -DCONFIG_RFKILL
267 endif
268
269
270 --- a/src/drivers/driver_wext.h
271 +++ b/src/drivers/driver_wext.h
272 @@ -28,7 +28,9 @@ struct wpa_driver_wext_data {
273 int ifindex2;
274 int if_removed;
275 int if_disabled;
276 +#ifdef CONFIG_RFKILL
277 struct rfkill_data *rfkill;
278 +#endif
279 u8 *assoc_req_ies;
280 size_t assoc_req_ies_len;
281 u8 *assoc_resp_ies;
This page took 0.067768 seconds and 5 git commands to generate.