1 --- a/src/drivers/driver_nl80211.c
2 +++ b/src/drivers/driver_nl80211.c
3 @@ -129,7 +129,9 @@ struct wpa_driver_nl80211_data {
8 struct rfkill_data *rfkill;
10 struct wpa_driver_capa capa;
13 @@ -1750,7 +1752,7 @@ err1:
19 static void wpa_driver_nl80211_rfkill_blocked(void *ctx)
21 wpa_printf(MSG_DEBUG, "nl80211: RFKILL blocked");
22 @@ -1772,6 +1774,7 @@ static void wpa_driver_nl80211_rfkill_un
24 /* rtnetlink ifup handler will report interface as enabled */
26 +#endif /* CONFIG_RFKILL */
29 static void nl80211_get_phy_name(struct wpa_driver_nl80211_data *drv)
30 @@ -1820,7 +1823,9 @@ static void * wpa_driver_nl80211_init(vo
32 struct wpa_driver_nl80211_data *drv;
33 struct netlink_config *cfg;
35 struct rfkill_config *rcfg;
39 drv = os_zalloc(sizeof(*drv));
40 @@ -1863,6 +1868,7 @@ static void * wpa_driver_nl80211_init(vo
45 rcfg = os_zalloc(sizeof(*rcfg));
48 @@ -1875,6 +1881,7 @@ static void * wpa_driver_nl80211_init(vo
49 wpa_printf(MSG_DEBUG, "nl80211: RFKILL status not available");
52 +#endif /* CONFIG_RFKILL */
54 if (wpa_driver_nl80211_finish_drv_init(drv))
56 @@ -1882,7 +1889,9 @@ static void * wpa_driver_nl80211_init(vo
61 rfkill_deinit(drv->rfkill);
63 netlink_deinit(drv->netlink);
64 if (drv->ioctl_sock >= 0)
65 close(drv->ioctl_sock);
66 @@ -1985,10 +1994,12 @@ static int nl80211_register_action_frame
71 static void wpa_driver_nl80211_send_rfkill(void *eloop_ctx, void *timeout_ctx)
73 wpa_supplicant_event(timeout_ctx, EVENT_INTERFACE_DISABLED, NULL);
75 +#endif /* CONFIG_RFKILL */
79 @@ -2007,13 +2018,16 @@ wpa_driver_nl80211_finish_drv_init(struc
82 if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) {
84 if (rfkill_is_blocked(drv->rfkill)) {
85 wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable "
86 "interface '%s' due to rfkill",
89 send_rfkill_event = 1;
94 wpa_printf(MSG_ERROR, "nl80211: Could not set "
95 "interface '%s' UP", bss->ifname);
97 @@ -2041,8 +2055,10 @@ wpa_driver_nl80211_finish_drv_init(struc
100 if (send_rfkill_event) {
101 +#ifdef CONFIG_RFKILL
102 eloop_register_timeout(0, 0, wpa_driver_nl80211_send_rfkill,
108 @@ -2123,7 +2139,9 @@ static void wpa_driver_nl80211_deinit(vo
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);
116 eloop_cancel_timeout(wpa_driver_nl80211_scan_timeout, drv, drv->ctx);
118 @@ -5672,7 +5690,9 @@ static void *i802_init(struct hostapd_da
121 nl80211_remove_monitor_interface(drv);
122 +#ifdef CONFIG_RFKILL
123 rfkill_deinit(drv->rfkill);
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
135 +#ifdef CONFIG_RFKILL
136 static void wpa_driver_wext_rfkill_blocked(void *ctx)
138 wpa_printf(MSG_DEBUG, "WEXT: RFKILL blocked");
139 @@ -724,7 +724,7 @@ static void wpa_driver_wext_rfkill_unblo
141 /* rtnetlink ifup handler will report interface as enabled */
144 +#endif /* CONFIG_RFKILL */
146 static void wext_get_phy_name(struct wpa_driver_wext_data *drv)
148 @@ -770,7 +770,9 @@ void * wpa_driver_wext_init(void *ctx, c
150 struct wpa_driver_wext_data *drv;
151 struct netlink_config *cfg;
152 +#ifdef CONFIG_RFKILL
153 struct rfkill_config *rcfg;
158 @@ -805,6 +807,7 @@ void * wpa_driver_wext_init(void *ctx, c
162 +#ifdef CONFIG_RFKILL
163 rcfg = os_zalloc(sizeof(*rcfg));
166 @@ -817,6 +820,7 @@ void * wpa_driver_wext_init(void *ctx, c
167 wpa_printf(MSG_DEBUG, "WEXT: RFKILL status not available");
170 +#endif /* CONFIG_RFKILL */
174 @@ -828,7 +832,9 @@ void * wpa_driver_wext_init(void *ctx, c
178 +#ifdef CONFIG_RFKILL
179 rfkill_deinit(drv->rfkill);
181 netlink_deinit(drv->netlink);
183 close(drv->ioctl_sock);
184 @@ -838,10 +844,12 @@ err1:
188 +#ifdef CONFIG_RFKILL
189 static void wpa_driver_wext_send_rfkill(void *eloop_ctx, void *timeout_ctx)
191 wpa_supplicant_event(timeout_ctx, EVENT_INTERFACE_DISABLED, NULL);
193 +#endif /* CONFIG_RFKILL */
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;
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",
206 drv->if_disabled = 1;
207 send_rfkill_event = 1;
212 wpa_printf(MSG_ERROR, "WEXT: Could not set "
213 "interface '%s' UP", drv->ifname);
215 @@ -903,8 +914,10 @@ static int wpa_driver_wext_finish_drv_in
218 if (send_rfkill_event) {
219 +#ifdef CONFIG_RFKILL
220 eloop_register_timeout(0, 0, wpa_driver_wext_send_rfkill,
226 @@ -934,7 +947,9 @@ void wpa_driver_wext_deinit(void *priv)
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);
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
243 ifdef CONFIG_LIBNL_TINY
244 DRV_LIBS += -lnl-tiny
246 @@ -94,7 +93,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT
247 CONFIG_WIRELESS_EXTENSION=y
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
262 @@ -159,6 +156,7 @@ endif
265 DRV_OBJS += ../src/drivers/rfkill.o
266 +DRV_WPA_CFLAGS += -DCONFIG_RFKILL
270 --- a/src/drivers/driver_wext.h
271 +++ b/src/drivers/driver_wext.h
272 @@ -28,7 +28,9 @@ struct wpa_driver_wext_data {
276 +#ifdef CONFIG_RFKILL
277 struct rfkill_data *rfkill;
280 size_t assoc_req_ies_len;