1 --- a/src/drivers/driver_nl80211.c
2 +++ b/src/drivers/driver_nl80211.c
3 @@ -75,7 +75,9 @@ struct wpa_driver_nl80211_data {
8 struct rfkill_data *rfkill;
10 struct wpa_driver_capa capa;
13 @@ -1361,7 +1363,7 @@ err1:
19 static void wpa_driver_nl80211_rfkill_blocked(void *ctx)
21 wpa_printf(MSG_DEBUG, "nl80211: RFKILL blocked");
22 @@ -1383,6 +1385,7 @@ static void wpa_driver_nl80211_rfkill_un
24 /* rtnetlink ifup handler will report interface as enabled */
26 +#endif /* CONFIG_RFKILL */
30 @@ -1396,7 +1399,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 @@ -1434,6 +1439,7 @@ static void * wpa_driver_nl80211_init(vo
45 rcfg = os_zalloc(sizeof(*rcfg));
48 @@ -1446,6 +1452,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 @@ -1453,7 +1460,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 @@ -1514,10 +1523,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 @@ -1536,13 +1547,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 @@ -1567,8 +1581,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 @@ -1647,7 +1663,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 --- a/src/drivers/driver_wext.c
119 +++ b/src/drivers/driver_wext.c
120 @@ -700,7 +700,7 @@ static void wpa_driver_wext_event_rtm_de
125 +#ifdef CONFIG_RFKILL
126 static void wpa_driver_wext_rfkill_blocked(void *ctx)
128 wpa_printf(MSG_DEBUG, "WEXT: RFKILL blocked");
129 @@ -722,7 +722,7 @@ static void wpa_driver_wext_rfkill_unblo
131 /* rtnetlink ifup handler will report interface as enabled */
134 +#endif /* CONFIG_RFKILL */
137 * wpa_driver_wext_init - Initialize WE driver interface
138 @@ -735,7 +735,9 @@ void * wpa_driver_wext_init(void *ctx, c
140 struct wpa_driver_wext_data *drv;
141 struct netlink_config *cfg;
142 +#ifdef CONFIG_RFKILL
143 struct rfkill_config *rcfg;
148 @@ -769,6 +771,7 @@ void * wpa_driver_wext_init(void *ctx, c
152 +#ifdef CONFIG_RFKILL
153 rcfg = os_zalloc(sizeof(*rcfg));
156 @@ -781,6 +784,7 @@ void * wpa_driver_wext_init(void *ctx, c
157 wpa_printf(MSG_DEBUG, "WEXT: RFKILL status not available");
160 +#endif /* CONFIG_RFKILL */
164 @@ -792,7 +796,9 @@ void * wpa_driver_wext_init(void *ctx, c
168 +#ifdef CONFIG_RFKILL
169 rfkill_deinit(drv->rfkill);
171 netlink_deinit(drv->netlink);
173 close(drv->ioctl_sock);
174 @@ -802,10 +808,12 @@ err1:
178 +#ifdef CONFIG_RFKILL
179 static void wpa_driver_wext_send_rfkill(void *eloop_ctx, void *timeout_ctx)
181 wpa_supplicant_event(timeout_ctx, EVENT_INTERFACE_DISABLED, NULL);
183 +#endif /* CONFIG_RFKILL */
186 static int wpa_driver_wext_finish_drv_init(struct wpa_driver_wext_data *drv)
187 @@ -813,13 +821,16 @@ static int wpa_driver_wext_finish_drv_in
188 int send_rfkill_event = 0;
190 if (linux_set_iface_flags(drv->ioctl_sock, drv->ifname, 1) < 0) {
191 +#ifdef CONFIG_RFKILL
192 if (rfkill_is_blocked(drv->rfkill)) {
193 wpa_printf(MSG_DEBUG, "WEXT: Could not yet enable "
194 "interface '%s' due to rfkill",
196 drv->if_disabled = 1;
197 send_rfkill_event = 1;
202 wpa_printf(MSG_ERROR, "WEXT: Could not set "
203 "interface '%s' UP", drv->ifname);
205 @@ -867,8 +878,10 @@ static int wpa_driver_wext_finish_drv_in
208 if (send_rfkill_event) {
209 +#ifdef CONFIG_RFKILL
210 eloop_register_timeout(0, 0, wpa_driver_wext_send_rfkill,
216 @@ -898,7 +911,9 @@ void wpa_driver_wext_deinit(void *priv)
218 netlink_send_oper_ifla(drv->netlink, drv->ifindex, 0, IF_OPER_UP);
219 netlink_deinit(drv->netlink);
220 +#ifdef CONFIG_RFKILL
221 rfkill_deinit(drv->rfkill);
224 if (drv->mlme_sock >= 0)
225 eloop_unregister_read_sock(drv->mlme_sock);
226 --- a/src/drivers/drivers.mak
227 +++ b/src/drivers/drivers.mak
228 @@ -31,7 +31,6 @@ NEED_SME=y
236 @@ -78,7 +77,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT
237 CONFIG_WIRELESS_EXTENSION=y
243 ifdef CONFIG_DRIVER_HERMES
244 @@ -166,6 +164,7 @@ endif
247 DRV_OBJS += ../src/drivers/rfkill.o
248 +DRV_WPA_CFLAGS += -DCONFIG_RFKILL
252 --- a/src/drivers/driver_wext.h
253 +++ b/src/drivers/driver_wext.h
254 @@ -27,7 +27,9 @@ struct wpa_driver_wext_data {
258 +#ifdef CONFIG_RFKILL
259 struct rfkill_data *rfkill;
262 size_t assoc_req_ies_len;