diff options
author | Felix Fietkau <nbd@openwrt.org> | 2014-09-10 13:01:53 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2014-09-10 13:01:53 +0000 |
commit | 5d8c6d088a6a754a1eff6a3ac9099a085702f807 (patch) | |
tree | c7dbd9a68d89b661237cc722bcb1ca3d3b99564f /package/network/services/hostapd/patches | |
parent | cc1bd10ed4170e1af202614ec9fe2bdfea2d6bd5 (diff) | |
download | master-187ad058-5d8c6d088a6a754a1eff6a3ac9099a085702f807.tar.gz master-187ad058-5d8c6d088a6a754a1eff6a3ac9099a085702f807.tar.bz2 master-187ad058-5d8c6d088a6a754a1eff6a3ac9099a085702f807.zip |
hostapd: add ubus bindings for wps
With this patch WPS discovery can be started or canceled over ubus if
WPS is enabled in wireless configuration. This is equivalent of
'hostapd_cli wps_pbc' and 'hostapd_cli wps_cancel' commands.
Signed-off-by: Petar Koretic <petar.koretic@sartura.hr>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@42459 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/network/services/hostapd/patches')
-rw-r--r-- | package/network/services/hostapd/patches/600-ubus_support.patch | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch index 96a91db664..e57c01f749 100644 --- a/package/network/services/hostapd/patches/600-ubus_support.patch +++ b/package/network/services/hostapd/patches/600-ubus_support.patch @@ -41,7 +41,7 @@ HAPD_IFACE_DISABLED, --- /dev/null +++ b/src/ap/ubus.c -@@ -0,0 +1,373 @@ +@@ -0,0 +1,408 @@ +/* + * hostapd / ubus support + * Copyright (c) 2013, Felix Fietkau <nbd@openwrt.org> @@ -55,6 +55,7 @@ +#include "utils/eloop.h" +#include "common/ieee802_11_defs.h" +#include "hostapd.h" ++#include "wps_hostapd.h" +#include "sta_info.h" +#include "ubus.h" + @@ -304,10 +305,44 @@ + return 0; +} + ++static int ++hostapd_bss_wps_start(struct ubus_context *ctx, struct ubus_object *obj, ++ struct ubus_request_data *req, const char *method, ++ struct blob_attr *msg) ++{ ++ int rc; ++ struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); ++ ++ rc = hostapd_wps_button_pushed(hapd, NULL); ++ ++ if (rc != 0) ++ return UBUS_STATUS_NOT_SUPPORTED; ++ ++ return 0; ++} ++ ++static int ++hostapd_bss_wps_cancel(struct ubus_context *ctx, struct ubus_object *obj, ++ struct ubus_request_data *req, const char *method, ++ struct blob_attr *msg) ++{ ++ int rc; ++ struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); ++ ++ rc = hostapd_wps_cancel(hapd); ++ ++ if (rc != 0) ++ return UBUS_STATUS_NOT_SUPPORTED; ++ ++ return 0; ++} ++ +static const struct ubus_method bss_methods[] = { + UBUS_METHOD_NOARG("get_clients", hostapd_bss_get_clients), + UBUS_METHOD("del_client", hostapd_bss_del_client, del_policy), + UBUS_METHOD_NOARG("list_bans", hostapd_bss_list_bans), ++ UBUS_METHOD_NOARG("wps_start", hostapd_bss_wps_start), ++ UBUS_METHOD_NOARG("wps_cancel", hostapd_bss_wps_cancel), +}; + +static struct ubus_object_type bss_object_type = @@ -612,7 +647,7 @@ sta->capability = capab_info; sta->listen_interval = listen_interval; -@@ -1765,7 +1791,7 @@ int ieee802_11_mgmt(struct hostapd_data +@@ -1765,7 +1791,7 @@ int ieee802_11_mgmt(struct hostapd_data if (stype == WLAN_FC_STYPE_PROBE_REQ) { @@ -621,7 +656,7 @@ return 1; } -@@ -1780,17 +1806,17 @@ int ieee802_11_mgmt(struct hostapd_data +@@ -1780,17 +1806,17 @@ int ieee802_11_mgmt(struct hostapd_data switch (stype) { case WLAN_FC_STYPE_AUTH: wpa_printf(MSG_DEBUG, "mgmt::auth"); |