mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-12-05 04:25:05 +02:00
aaca845659
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@28746 3c298f89-4303-0410-b956-a3cf2f4a3e73
262 lines
6.3 KiB
Diff
262 lines
6.3 KiB
Diff
--- a/src/drivers/driver_nl80211.c
|
|
+++ b/src/drivers/driver_nl80211.c
|
|
@@ -198,7 +198,9 @@ struct wpa_driver_nl80211_data {
|
|
int if_removed;
|
|
int if_disabled;
|
|
int ignore_if_down_event;
|
|
+#ifdef CONFIG_RFKILL
|
|
struct rfkill_data *rfkill;
|
|
+#endif
|
|
struct wpa_driver_capa capa;
|
|
int has_capability;
|
|
|
|
@@ -2203,7 +2205,7 @@ err3:
|
|
return -1;
|
|
}
|
|
|
|
-
|
|
+#ifdef CONFIG_RFKILL
|
|
static void wpa_driver_nl80211_rfkill_blocked(void *ctx)
|
|
{
|
|
wpa_printf(MSG_DEBUG, "nl80211: RFKILL blocked");
|
|
@@ -2226,6 +2228,7 @@ static void wpa_driver_nl80211_rfkill_un
|
|
}
|
|
/* rtnetlink ifup handler will report interface as enabled */
|
|
}
|
|
+#endif /* CONFIG_RFKILL */
|
|
|
|
|
|
static void nl80211_get_phy_name(struct wpa_driver_nl80211_data *drv)
|
|
@@ -2283,7 +2286,9 @@ static void * wpa_driver_nl80211_init(vo
|
|
void *global_priv)
|
|
{
|
|
struct wpa_driver_nl80211_data *drv;
|
|
+#ifdef CONFIG_RFKILL
|
|
struct rfkill_config *rcfg;
|
|
+#endif
|
|
struct i802_bss *bss;
|
|
|
|
drv = os_zalloc(sizeof(*drv));
|
|
@@ -2311,6 +2316,7 @@ static void * wpa_driver_nl80211_init(vo
|
|
|
|
nl80211_get_phy_name(drv);
|
|
|
|
+#ifdef CONFIG_RFKILL
|
|
rcfg = os_zalloc(sizeof(*rcfg));
|
|
if (rcfg == NULL)
|
|
goto failed;
|
|
@@ -2323,6 +2329,7 @@ static void * wpa_driver_nl80211_init(vo
|
|
wpa_printf(MSG_DEBUG, "nl80211: RFKILL status not available");
|
|
os_free(rcfg);
|
|
}
|
|
+#endif /* CONFIG_RFKILL */
|
|
|
|
if (wpa_driver_nl80211_finish_drv_init(drv))
|
|
goto failed;
|
|
@@ -2445,10 +2452,12 @@ static int nl80211_register_action_frame
|
|
}
|
|
|
|
|
|
+#ifdef CONFIG_RFKILL
|
|
static void wpa_driver_nl80211_send_rfkill(void *eloop_ctx, void *timeout_ctx)
|
|
{
|
|
wpa_supplicant_event(timeout_ctx, EVENT_INTERFACE_DISABLED, NULL);
|
|
}
|
|
+#endif /* CONFIG_RFKILL */
|
|
|
|
|
|
static int
|
|
@@ -2475,13 +2484,16 @@ wpa_driver_nl80211_finish_drv_init(struc
|
|
}
|
|
|
|
if (linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 1)) {
|
|
+#ifdef CONFIG_RFKILL
|
|
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 {
|
|
+ } else
|
|
+#endif
|
|
+ {
|
|
wpa_printf(MSG_ERROR, "nl80211: Could not set "
|
|
"interface '%s' UP", bss->ifname);
|
|
return -1;
|
|
@@ -2510,8 +2522,10 @@ wpa_driver_nl80211_finish_drv_init(struc
|
|
}
|
|
|
|
if (send_rfkill_event) {
|
|
+#ifdef CONFIG_RFKILL
|
|
eloop_register_timeout(0, 0, wpa_driver_nl80211_send_rfkill,
|
|
drv, drv->ctx);
|
|
+#endif
|
|
}
|
|
|
|
return 0;
|
|
@@ -2596,7 +2610,9 @@ static void wpa_driver_nl80211_deinit(vo
|
|
|
|
netlink_send_oper_ifla(drv->global->netlink, drv->ifindex, 0,
|
|
IF_OPER_UP);
|
|
+#ifdef CONFIG_RFKILL
|
|
rfkill_deinit(drv->rfkill);
|
|
+#endif
|
|
|
|
eloop_cancel_timeout(wpa_driver_nl80211_scan_timeout, drv, drv->ctx);
|
|
|
|
--- a/src/drivers/driver_wext.c
|
|
+++ b/src/drivers/driver_wext.c
|
|
@@ -702,7 +702,7 @@ static void wpa_driver_wext_event_rtm_de
|
|
}
|
|
}
|
|
|
|
-
|
|
+#ifdef CONFIG_RFKILL
|
|
static void wpa_driver_wext_rfkill_blocked(void *ctx)
|
|
{
|
|
wpa_printf(MSG_DEBUG, "WEXT: RFKILL blocked");
|
|
@@ -724,7 +724,7 @@ static void wpa_driver_wext_rfkill_unblo
|
|
}
|
|
/* rtnetlink ifup handler will report interface as enabled */
|
|
}
|
|
-
|
|
+#endif /* CONFIG_RFKILL */
|
|
|
|
static void wext_get_phy_name(struct wpa_driver_wext_data *drv)
|
|
{
|
|
@@ -770,7 +770,9 @@ void * wpa_driver_wext_init(void *ctx, c
|
|
{
|
|
struct wpa_driver_wext_data *drv;
|
|
struct netlink_config *cfg;
|
|
+#ifdef CONFIG_RFKILL
|
|
struct rfkill_config *rcfg;
|
|
+#endif
|
|
char path[128];
|
|
struct stat buf;
|
|
|
|
@@ -805,6 +807,7 @@ void * wpa_driver_wext_init(void *ctx, c
|
|
goto err2;
|
|
}
|
|
|
|
+#ifdef CONFIG_RFKILL
|
|
rcfg = os_zalloc(sizeof(*rcfg));
|
|
if (rcfg == NULL)
|
|
goto err3;
|
|
@@ -817,6 +820,7 @@ void * wpa_driver_wext_init(void *ctx, c
|
|
wpa_printf(MSG_DEBUG, "WEXT: RFKILL status not available");
|
|
os_free(rcfg);
|
|
}
|
|
+#endif /* CONFIG_RFKILL */
|
|
|
|
drv->mlme_sock = -1;
|
|
|
|
@@ -828,7 +832,9 @@ void * wpa_driver_wext_init(void *ctx, c
|
|
return drv;
|
|
|
|
err3:
|
|
+#ifdef CONFIG_RFKILL
|
|
rfkill_deinit(drv->rfkill);
|
|
+#endif
|
|
netlink_deinit(drv->netlink);
|
|
err2:
|
|
close(drv->ioctl_sock);
|
|
@@ -838,10 +844,12 @@ err1:
|
|
}
|
|
|
|
|
|
+#ifdef CONFIG_RFKILL
|
|
static void wpa_driver_wext_send_rfkill(void *eloop_ctx, void *timeout_ctx)
|
|
{
|
|
wpa_supplicant_event(timeout_ctx, EVENT_INTERFACE_DISABLED, NULL);
|
|
}
|
|
+#endif /* CONFIG_RFKILL */
|
|
|
|
|
|
static int wpa_driver_wext_finish_drv_init(struct wpa_driver_wext_data *drv)
|
|
@@ -849,13 +857,16 @@ static int wpa_driver_wext_finish_drv_in
|
|
int send_rfkill_event = 0;
|
|
|
|
if (linux_set_iface_flags(drv->ioctl_sock, drv->ifname, 1) < 0) {
|
|
+#ifdef CONFIG_RFKILL
|
|
if (rfkill_is_blocked(drv->rfkill)) {
|
|
wpa_printf(MSG_DEBUG, "WEXT: Could not yet enable "
|
|
"interface '%s' due to rfkill",
|
|
drv->ifname);
|
|
drv->if_disabled = 1;
|
|
send_rfkill_event = 1;
|
|
- } else {
|
|
+ } else
|
|
+#endif
|
|
+ {
|
|
wpa_printf(MSG_ERROR, "WEXT: Could not set "
|
|
"interface '%s' UP", drv->ifname);
|
|
return -1;
|
|
@@ -903,8 +914,10 @@ static int wpa_driver_wext_finish_drv_in
|
|
1, IF_OPER_DORMANT);
|
|
|
|
if (send_rfkill_event) {
|
|
+#ifdef CONFIG_RFKILL
|
|
eloop_register_timeout(0, 0, wpa_driver_wext_send_rfkill,
|
|
drv, drv->ctx);
|
|
+#endif
|
|
}
|
|
|
|
return 0;
|
|
@@ -934,7 +947,9 @@ void wpa_driver_wext_deinit(void *priv)
|
|
|
|
netlink_send_oper_ifla(drv->netlink, drv->ifindex, 0, IF_OPER_UP);
|
|
netlink_deinit(drv->netlink);
|
|
+#ifdef CONFIG_RFKILL
|
|
rfkill_deinit(drv->rfkill);
|
|
+#endif
|
|
|
|
if (drv->mlme_sock >= 0)
|
|
eloop_unregister_read_sock(drv->mlme_sock);
|
|
--- a/src/drivers/drivers.mak
|
|
+++ b/src/drivers/drivers.mak
|
|
@@ -43,7 +43,6 @@ NEED_SME=y
|
|
NEED_AP_MLME=y
|
|
NEED_NETLINK=y
|
|
NEED_LINUX_IOCTL=y
|
|
-NEED_RFKILL=y
|
|
ifdef CONFIG_LIBNL_TINY
|
|
DRV_LIBS += -lnl-tiny
|
|
else
|
|
@@ -94,7 +93,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT
|
|
CONFIG_WIRELESS_EXTENSION=y
|
|
NEED_NETLINK=y
|
|
NEED_LINUX_IOCTL=y
|
|
-NEED_RFKILL=y
|
|
endif
|
|
|
|
ifdef CONFIG_DRIVER_RALINK
|
|
@@ -146,7 +144,6 @@ endif
|
|
ifdef CONFIG_WIRELESS_EXTENSION
|
|
DRV_CFLAGS += -DCONFIG_WIRELESS_EXTENSION
|
|
DRV_OBJS += ../src/drivers/driver_wext.o
|
|
-NEED_RFKILL=y
|
|
endif
|
|
|
|
ifdef NEED_NETLINK
|
|
@@ -159,6 +156,7 @@ endif
|
|
|
|
ifdef NEED_RFKILL
|
|
DRV_OBJS += ../src/drivers/rfkill.o
|
|
+DRV_WPA_CFLAGS += -DCONFIG_RFKILL
|
|
endif
|
|
|
|
|
|
--- a/src/drivers/driver_wext.h
|
|
+++ b/src/drivers/driver_wext.h
|
|
@@ -28,7 +28,9 @@ struct wpa_driver_wext_data {
|
|
int ifindex2;
|
|
int if_removed;
|
|
int if_disabled;
|
|
+#ifdef CONFIG_RFKILL
|
|
struct rfkill_data *rfkill;
|
|
+#endif
|
|
u8 *assoc_req_ies;
|
|
size_t assoc_req_ies_len;
|
|
u8 *assoc_resp_ies;
|