Skip to content

Commit

Permalink
hostapd: fix up ubus support
Browse files Browse the repository at this point in the history
Signed-off-by: John Crispin <[email protected]>
  • Loading branch information
blogic committed Oct 25, 2017
1 parent bca01fd commit 21e59ee
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 23 deletions.
62 changes: 44 additions & 18 deletions package/network/services/hostapd/patches/600-ubus_support.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
--- a/hostapd/Makefile
+++ b/hostapd/Makefile
Index: hostapd-2017-08-24-c2d4f2eb/hostapd/Makefile
===================================================================
--- hostapd-2017-08-24-c2d4f2eb.orig/hostapd/Makefile
+++ hostapd-2017-08-24-c2d4f2eb/hostapd/Makefile
@@ -165,6 +165,11 @@ OBJS += ../src/common/hw_features_common

OBJS += ../src/eapol_auth/eapol_auth_sm.o
Expand All @@ -12,8 +14,10 @@

ifdef CONFIG_CODE_COVERAGE
CFLAGS += -O0 -fprofile-arcs -ftest-coverage
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
Index: hostapd-2017-08-24-c2d4f2eb/src/ap/hostapd.h
===================================================================
--- hostapd-2017-08-24-c2d4f2eb.orig/src/ap/hostapd.h
+++ hostapd-2017-08-24-c2d4f2eb/src/ap/hostapd.h
@@ -13,6 +13,7 @@
#include "utils/list.h"
#include "ap_config.h"
Expand All @@ -39,8 +43,10 @@
enum hostapd_iface_state {
HAPD_IFACE_UNINITIALIZED,
HAPD_IFACE_DISABLED,
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
Index: hostapd-2017-08-24-c2d4f2eb/src/ap/hostapd.c
===================================================================
--- hostapd-2017-08-24-c2d4f2eb.orig/src/ap/hostapd.c
+++ hostapd-2017-08-24-c2d4f2eb/src/ap/hostapd.c
@@ -309,6 +309,7 @@ static void hostapd_free_hapd_data(struc
hapd->started = 0;

Expand Down Expand Up @@ -82,8 +88,10 @@
hostapd_interface_deinit(iface);
wpa_printf(MSG_DEBUG, "%s: driver=%p drv_priv=%p -> hapd_deinit",
__func__, driver, drv_priv);
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
Index: hostapd-2017-08-24-c2d4f2eb/src/ap/ieee802_11.c
===================================================================
--- hostapd-2017-08-24-c2d4f2eb.orig/src/ap/ieee802_11.c
+++ hostapd-2017-08-24-c2d4f2eb/src/ap/ieee802_11.c
@@ -1587,7 +1587,8 @@ ieee802_11_set_radius_info(struct hostap


Expand Down Expand Up @@ -201,8 +209,10 @@
ret = 1;
break;
case WLAN_FC_STYPE_DISASSOC:
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
Index: hostapd-2017-08-24-c2d4f2eb/src/ap/beacon.c
===================================================================
--- hostapd-2017-08-24-c2d4f2eb.orig/src/ap/beacon.c
+++ hostapd-2017-08-24-c2d4f2eb/src/ap/beacon.c
@@ -716,7 +716,7 @@ void sta_track_claim_taxonomy_info(struc

void handle_probe_req(struct hostapd_data *hapd,
Expand Down Expand Up @@ -241,8 +251,10 @@
/* TODO: verify that supp_rates contains at least one matching rate
* with AP configuration */

--- a/src/ap/beacon.h
+++ b/src/ap/beacon.h
Index: hostapd-2017-08-24-c2d4f2eb/src/ap/beacon.h
===================================================================
--- hostapd-2017-08-24-c2d4f2eb.orig/src/ap/beacon.h
+++ hostapd-2017-08-24-c2d4f2eb/src/ap/beacon.h
@@ -14,7 +14,7 @@ struct ieee80211_mgmt;

void handle_probe_req(struct hostapd_data *hapd,
Expand All @@ -252,8 +264,10 @@
int ieee802_11_set_beacon(struct hostapd_data *hapd);
int ieee802_11_set_beacons(struct hostapd_iface *iface);
int ieee802_11_update_beacons(struct hostapd_iface *iface);
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
Index: hostapd-2017-08-24-c2d4f2eb/src/ap/drv_callbacks.c
===================================================================
--- hostapd-2017-08-24-c2d4f2eb.orig/src/ap/drv_callbacks.c
+++ hostapd-2017-08-24-c2d4f2eb/src/ap/drv_callbacks.c
@@ -116,6 +116,10 @@ int hostapd_notif_assoc(struct hostapd_d
u16 reason = WLAN_REASON_UNSPECIFIED;
u16 status = WLAN_STATUS_SUCCESS;
Expand All @@ -278,8 +292,10 @@
#ifdef CONFIG_P2P
if (elems.p2p) {
wpabuf_free(sta->p2p_ie);
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
Index: hostapd-2017-08-24-c2d4f2eb/src/ap/sta_info.c
===================================================================
--- hostapd-2017-08-24-c2d4f2eb.orig/src/ap/sta_info.c
+++ hostapd-2017-08-24-c2d4f2eb/src/ap/sta_info.c
@@ -404,6 +404,7 @@ void ap_handle_timer(void *eloop_ctx, vo
HOSTAPD_LEVEL_INFO, "deauthenticated due to "
"local deauth request");
Expand All @@ -296,8 +312,18 @@
break;
}
}
--- a/src/ap/wpa_auth_glue.c
+++ b/src/ap/wpa_auth_glue.c
@@ -1212,6 +1214,7 @@ void ap_sta_set_authorized(struct hostap
buf, ip_addr);
} else {
wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED "%s", buf);
+ hostapd_ubus_notify(hapd, "disassoc", sta->addr);

if (hapd->msg_ctx_parent &&
hapd->msg_ctx_parent != hapd->msg_ctx)
Index: hostapd-2017-08-24-c2d4f2eb/src/ap/wpa_auth_glue.c
===================================================================
--- hostapd-2017-08-24-c2d4f2eb.orig/src/ap/wpa_auth_glue.c
+++ hostapd-2017-08-24-c2d4f2eb/src/ap/wpa_auth_glue.c
@@ -175,6 +175,7 @@ static void hostapd_wpa_auth_psk_failure
struct hostapd_data *hapd = ctx;
wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_POSSIBLE_PSK_MISMATCH MACSTR,
Expand Down
6 changes: 1 addition & 5 deletions package/network/services/hostapd/src/src/ap/ubus.c
Original file line number Diff line number Diff line change
Expand Up @@ -743,18 +743,14 @@ int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_req

void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *addr)
{
char mac[18];

if (!hapd->ubus.obj.has_subscribers)
return;

if (!addr)
return;

snprintf(mac, sizeof(mac), MACSTR, MAC2STR(addr));

blob_buf_init(&b, 0);
blobmsg_add_macaddr(&b, "address", mac);
blobmsg_add_macaddr(&b, "address", addr);

ubus_notify(ctx, &hapd->ubus.obj, type, b.head, -1);
}

0 comments on commit 21e59ee

Please sign in to comment.