diff options
author | Felix Fietkau <nbd@openwrt.org> | 2013-08-08 20:45:12 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2013-08-08 20:45:12 +0000 |
commit | fbf4f2e570231a7b6009e2d9110cde45533614e8 (patch) | |
tree | 074367365bea035ebd97a0665855faa710204087 /package/network/services/hostapd/patches | |
parent | 6992373daf9dfa451970aa879ef6a7501fc95a96 (diff) | |
download | upstream-fbf4f2e570231a7b6009e2d9110cde45533614e8.tar.gz upstream-fbf4f2e570231a7b6009e2d9110cde45533614e8.tar.bz2 upstream-fbf4f2e570231a7b6009e2d9110cde45533614e8.zip |
hostapd: fix ubus reconnect handling
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@37741 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/network/services/hostapd/patches')
-rw-r--r-- | package/network/services/hostapd/patches/700-ubus_support.patch | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/package/network/services/hostapd/patches/700-ubus_support.patch b/package/network/services/hostapd/patches/700-ubus_support.patch index 8e6f6c08bc..c1759c8fb8 100644 --- a/package/network/services/hostapd/patches/700-ubus_support.patch +++ b/package/network/services/hostapd/patches/700-ubus_support.patch @@ -40,7 +40,7 @@ struct hostapd_data **bss; --- /dev/null +++ b/src/ap/ubus.c -@@ -0,0 +1,356 @@ +@@ -0,0 +1,373 @@ +/* + * hostapd / ubus support + * Copyright (c) 2013, Felix Fietkau <nbd@openwrt.org> @@ -72,6 +72,22 @@ + ubus_handle_event(ctx); +} + ++static void ubus_reconnect_timeout(void *eloop_data, void *user_ctx) ++{ ++ if (ubus_reconnect(ctx, NULL)) { ++ eloop_register_timeout(1, 0, ubus_reconnect_timeout, ctx, NULL); ++ return; ++ } ++ ++ eloop_register_read_sock(ctx->sock.fd, ubus_receive, ctx, NULL); ++} ++ ++static void hostapd_ubus_connection_lost(struct ubus_context *ctx) ++{ ++ eloop_unregister_read_sock(ctx->sock.fd); ++ eloop_register_timeout(1, 0, ubus_reconnect_timeout, ctx, NULL); ++} ++ +static bool hostapd_ubus_init(void) +{ + if (ctx) @@ -81,6 +97,7 @@ + if (!ctx) + return false; + ++ ctx->connection_lost = hostapd_ubus_connection_lost; + eloop_register_read_sock(ctx->sock.fd, ubus_receive, ctx, NULL); + return true; +} |