hostapd: add missing return code for the bss_mgmt_enable ubus method
[openwrt/staging/noltari.git] / package / network / services / hostapd / src / src / ap / ubus.c
index 182aae7d05ee549657d65d7491e42d73e5de618e..ddd86447eb13712a94095f7aabbdea5b9add774d 100644 (file)
@@ -318,6 +318,10 @@ hostapd_bss_get_clients(struct ubus_context *ctx, struct ubus_object *obj,
                        blobmsg_add_u8(&b, sta_flags[i].name,
                                       !!(sta->flags & sta_flags[i].flag));
 
+#ifdef CONFIG_MBO
+               blobmsg_add_u8(&b, "mbo", !!(sta->cell_capa));
+#endif
+
                r = blobmsg_open_array(&b, "rrm");
                for (i = 0; i < ARRAY_SIZE(sta->rrm_enabled_capa); i++)
                        blobmsg_add_u32(&b, "", sta->rrm_enabled_capa[i]);
@@ -386,32 +390,6 @@ hostapd_bss_get_features(struct ubus_context *ctx, struct ubus_object *obj,
        return 0;
 }
 
-/* Imported from iw/util.c
- *  https://git.kernel.org/pub/scm/linux/kernel/git/jberg/iw.git/tree/util.c?id=4b25ae3537af48dbf9d0abf94132e5ba01b32c18#n200
- */
-int ieee80211_frequency_to_channel(int freq)
-{
-       /* see 802.11-2007 17.3.8.3.2 and Annex J */
-       if (freq == 2484)
-               return 14;
-       /* see 802.11ax D6.1 27.3.23.2 and Annex E */
-       else if (freq == 5935)
-               return 2;
-       else if (freq < 2484)
-               return (freq - 2407) / 5;
-       else if (freq >= 4910 && freq <= 4980)
-               return (freq - 4000) / 5;
-       else if (freq < 5950)
-               return (freq - 5000) / 5;
-       else if (freq <= 45000) /* DMG band lower limit */
-               /* see 802.11ax D6.1 27.3.23.2 */
-               return (freq - 5950) / 5;
-       else if (freq >= 58320 && freq <= 70200)
-               return (freq - 56160) / 2160;
-       else
-               return 0;
-}
-
 static int
 hostapd_bss_get_status(struct ubus_context *ctx, struct ubus_object *obj,
                       struct ubus_request_data *req, const char *method,
@@ -1106,6 +1084,8 @@ hostapd_bss_mgmt_enable(struct ubus_context *ctx, struct ubus_object *obj,
        }
 
        __hostapd_bss_mgmt_enable(hapd, flags);
+
+       return 0;
 }
 
 
@@ -1979,6 +1959,20 @@ void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *
        ubus_notify(ctx, &hapd->ubus.obj, type, b.head, -1);
 }
 
+void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta,
+                                   const char *auth_alg)
+{
+       if (!hapd->ubus.obj.has_subscribers)
+               return;
+
+       blob_buf_init(&b, 0);
+       blobmsg_add_macaddr(&b, "address", sta->addr);
+       if (auth_alg)
+               blobmsg_add_string(&b, "auth-alg", auth_alg);
+
+       ubus_notify(ctx, &hapd->ubus.obj, "sta-authorized", b.head, -1);
+}
+
 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)
@@ -2001,6 +1995,7 @@ void hostapd_ubus_notify_beacon_report(
        blobmsg_add_macaddr(&b, "bssid", rep->bssid);
        blobmsg_add_u16(&b, "antenna-id", rep->antenna_id);
        blobmsg_add_u16(&b, "parent-tsf", rep->parent_tsf);
+       blobmsg_add_u16(&b, "rep-mode", rep_mode);
 
        ubus_notify(ctx, &hapd->ubus.obj, "beacon-report", b.head, -1);
 }