From: John Crispin Date: Sat, 21 Oct 2017 20:02:31 +0000 (+0200) Subject: hostapd: fix up ubus support X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=21e59ee3a2310ba1ec80b07614991318c014610e;p=openwrt%2Fstaging%2Fstintel.git hostapd: fix up ubus support Signed-off-by: John Crispin --- diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch index 31e3e79995..b63d99a57d 100644 --- a/package/network/services/hostapd/patches/600-ubus_support.patch +++ b/package/network/services/hostapd/patches/600-ubus_support.patch @@ -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 @@ -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" @@ -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; @@ -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 @@ -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, @@ -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, @@ -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; @@ -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"); @@ -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, diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c index bc773930d4..beb4388f7c 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.c +++ b/package/network/services/hostapd/src/src/ap/ubus.c @@ -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); }