hostapd: ubus: add notification for BSS transition response
authorDavid Bauer <[email protected]>
Wed, 21 Oct 2020 18:50:01 +0000 (20:50 +0200)
committerDavid Bauer <[email protected]>
Mon, 26 Oct 2020 01:39:24 +0000 (02:39 +0100)
Signed-off-by: David Bauer <[email protected]>
package/network/services/hostapd/patches/600-ubus_support.patch
package/network/services/hostapd/src/src/ap/ubus.c
package/network/services/hostapd/src/src/ap/ubus.h

index 74108797ff7f7bfa42377c9b2885f4e34edc78d0..ff88b35070981d40790487218dda0d90793a0c0a 100644 (file)
  }
  
  
+--- a/src/ap/wnm_ap.c
++++ b/src/ap/wnm_ap.c
+@@ -461,7 +461,7 @@ static void ieee802_11_rx_bss_trans_mgmt
+                                             size_t len)
+ {
+       u8 dialog_token, status_code, bss_termination_delay;
+-      const u8 *pos, *end;
++      const u8 *pos, *end, *target_bssid;
+       int enabled = hapd->conf->bss_transition;
+       struct sta_info *sta;
+@@ -508,6 +508,7 @@ static void ieee802_11_rx_bss_trans_mgmt
+                       wpa_printf(MSG_DEBUG, "WNM: not enough room for Target BSSID field");
+                       return;
+               }
++              target_bssid = pos;
+               sta->agreed_to_steer = 1;
+               eloop_cancel_timeout(ap_sta_reset_steer_flag_timer, hapd, sta);
+               eloop_register_timeout(2, 0, ap_sta_reset_steer_flag_timer,
+@@ -527,6 +528,10 @@ static void ieee802_11_rx_bss_trans_mgmt
+                       MAC2STR(addr), status_code, bss_termination_delay);
+       }
++      hostapd_ubus_notify_bss_transition_response(hapd, sta->addr, dialog_token,
++                                                  status_code, bss_termination_delay,
++                                                  target_bssid, pos, end - pos);
++
+       wpa_hexdump(MSG_DEBUG, "WNM: BSS Transition Candidate List Entries",
+                   pos, end - pos);
+ }
index acc735ca5471fecdf43170b58a77fa0ad5d9b777..1f3062eb9eefc95ec9b22c89931db96ce64333a3 100644 (file)
@@ -1582,3 +1582,22 @@ void hostapd_ubus_notify_beacon_report(
 
        ubus_notify(ctx, &hapd->ubus.obj, "beacon-report", b.head, -1);
 }
+
+void hostapd_ubus_notify_bss_transition_response(
+       struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 status_code,
+       u8 bss_termination_delay)
+{
+       if (!hapd->ubus.obj.has_subscribers)
+               return;
+
+       if (!addr)
+               return;
+
+       blob_buf_init(&b, 0);
+       blobmsg_add_macaddr(&b, "address", addr);
+       blobmsg_add_u8(&b, "dialog-token", dialog_token);
+       blobmsg_add_u8(&b, "status-code", status_code);
+       blobmsg_add_u8(&b, "bss-termination-delay", bss_termination_delay);
+
+       ubus_notify(ctx, &hapd->ubus.obj, "bss-transition-response", b.head, -1);
+}
index be7938aebedafc2b988d53fdfc46cf2fa8aae571..8ef421d1ce3c2b8e684e6d6cee5e3d1b67e4ad68 100644 (file)
@@ -52,7 +52,9 @@ void hostapd_ubus_notify_beacon_report(struct hostapd_data *hapd,
                                       const u8 *addr, u8 token, u8 rep_mode,
                                       struct rrm_measurement_beacon_report *rep,
                                       size_t len);
-
+void hostapd_ubus_notify_bss_transition_response(
+       struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 status_code,
+       u8 bss_termination_delay);
 void hostapd_ubus_add(struct hapd_interfaces *interfaces);
 void hostapd_ubus_free(struct hapd_interfaces *interfaces);
 
@@ -93,6 +95,12 @@ static inline void hostapd_ubus_notify_beacon_report(struct hostapd_data *hapd,
 {
 }
 
+static inline void hostapd_ubus_notify_bss_transition_response(
+       struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 status_code,
+       u8 bss_termination_delay)
+{
+}
+
 static inline void hostapd_ubus_add(struct hapd_interfaces *interfaces)
 {
 }