summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2015-02-14 00:51:54 +0100
committerJo-Philipp Wich <jow@openwrt.org>2015-02-14 00:54:34 +0100
commit3d591dfe4abf79c1e43d0126556f65774fe0c80b (patch)
tree01850ee41afbf917152c1f8c9c7093a104422bfc
parent9b6019a0eae7f7d9382f37e1236aef1a6d3d019e (diff)
downloadluci2-ui-3d591dfe4abf79c1e43d0126556f65774fe0c80b.tar.gz
luci2: add 'eap_support' ubus method
This method is used to query whether hostapd and wpa_supplicent support 802.1x authnetication. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
-rw-r--r--luci2/src/rpcd/luci2.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/luci2/src/rpcd/luci2.c b/luci2/src/rpcd/luci2.c
index 179a055..c8ef9bf 100644
--- a/luci2/src/rpcd/luci2.c
+++ b/luci2/src/rpcd/luci2.c
@@ -2283,6 +2283,18 @@ rpc_luci2_network_dev_list(struct ubus_context *ctx, struct ubus_object *obj,
return 0;
}
+static int
+rpc_luci2_network_eap_support(struct ubus_context *ctx, struct ubus_object *obj,
+ struct ubus_request_data *req, const char *method,
+ struct blob_attr *msg)
+{
+ blob_buf_init(&buf, 0);
+ blobmsg_add_u8(&buf, "master", !system("/usr/sbin/hostapd -veap"));
+ blobmsg_add_u8(&buf, "client", !system("/usr/sbin/wpa_supplicant -veap"));
+ ubus_send_reply(ctx, req, buf.head);
+ return 0;
+}
+
struct opkg_state {
int cur_offset;
@@ -2814,7 +2826,8 @@ rpc_luci2_api_init(const struct rpc_daemon_ops *o, struct ubus_context *ctx)
rpc_data_policy),
UBUS_METHOD("ifdown", rpc_luci2_network_ifdown,
rpc_data_policy),
- UBUS_METHOD_NOARG("device_list", rpc_luci2_network_dev_list)
+ UBUS_METHOD_NOARG("device_list", rpc_luci2_network_dev_list),
+ UBUS_METHOD_NOARG("eap_support", rpc_luci2_network_eap_support)
};
static struct ubus_object_type luci2_network_type =