600-ubus_support.patch 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. --- a/hostapd/Makefile
  2. +++ b/hostapd/Makefile
  3. @@ -166,6 +166,11 @@ OBJS += ../src/common/hw_features_common
  4. OBJS += ../src/eapol_auth/eapol_auth_sm.o
  5. +ifdef CONFIG_UBUS
  6. +CFLAGS += -DUBUS_SUPPORT
  7. +OBJS += ../src/ap/ubus.o
  8. +LIBS += -lubox -lubus
  9. +endif
  10. ifdef CONFIG_CODE_COVERAGE
  11. CFLAGS += -O0 -fprofile-arcs -ftest-coverage
  12. --- a/src/ap/hostapd.h
  13. +++ b/src/ap/hostapd.h
  14. @@ -17,6 +17,7 @@
  15. #include "utils/list.h"
  16. #include "ap_config.h"
  17. #include "drivers/driver.h"
  18. +#include "ubus.h"
  19. #define OCE_STA_CFON_ENABLED(hapd) \
  20. ((hapd->conf->oce & OCE_STA_CFON) && \
  21. @@ -80,7 +81,7 @@ struct hapd_interfaces {
  22. #ifdef CONFIG_CTRL_IFACE_UDP
  23. unsigned char ctrl_iface_cookie[CTRL_IFACE_COOKIE_LEN];
  24. #endif /* CONFIG_CTRL_IFACE_UDP */
  25. -
  26. + struct ubus_object ubus;
  27. };
  28. enum hostapd_chan_status {
  29. @@ -154,6 +155,7 @@ struct hostapd_data {
  30. struct hostapd_iface *iface;
  31. struct hostapd_config *iconf;
  32. struct hostapd_bss_config *conf;
  33. + struct hostapd_ubus_bss ubus;
  34. int interface_added; /* virtual interface added for this BSS */
  35. unsigned int started:1;
  36. unsigned int disabled:1;
  37. @@ -610,6 +612,7 @@ hostapd_alloc_bss_data(struct hostapd_if
  38. struct hostapd_bss_config *bss);
  39. int hostapd_setup_interface(struct hostapd_iface *iface);
  40. int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err);
  41. +void hostapd_set_own_neighbor_report(struct hostapd_data *hapd);
  42. void hostapd_interface_deinit(struct hostapd_iface *iface);
  43. void hostapd_interface_free(struct hostapd_iface *iface);
  44. struct hostapd_iface * hostapd_alloc_iface(void);
  45. --- a/src/ap/hostapd.c
  46. +++ b/src/ap/hostapd.c
  47. @@ -396,6 +396,7 @@ void hostapd_free_hapd_data(struct hosta
  48. hapd->beacon_set_done = 0;
  49. wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface);
  50. + hostapd_ubus_free_bss(hapd);
  51. accounting_deinit(hapd);
  52. hostapd_deinit_wpa(hapd);
  53. vlan_deinit(hapd);
  54. @@ -1422,6 +1423,8 @@ static int hostapd_setup_bss(struct host
  55. if (hapd->driver && hapd->driver->set_operstate)
  56. hapd->driver->set_operstate(hapd->drv_priv, 1);
  57. + hostapd_ubus_add_bss(hapd);
  58. +
  59. return 0;
  60. }
  61. @@ -2028,6 +2031,7 @@ static int hostapd_setup_interface_compl
  62. if (err)
  63. goto fail;
  64. + hostapd_ubus_add_iface(iface);
  65. wpa_printf(MSG_DEBUG, "Completing interface initialization");
  66. if (iface->freq) {
  67. #ifdef NEED_AP_MLME
  68. @@ -2225,6 +2229,7 @@ dfs_offload:
  69. fail:
  70. wpa_printf(MSG_ERROR, "Interface initialization failed");
  71. + hostapd_ubus_free_iface(iface);
  72. hostapd_set_state(iface, HAPD_IFACE_DISABLED);
  73. wpa_msg(hapd->msg_ctx, MSG_INFO, AP_EVENT_DISABLED);
  74. #ifdef CONFIG_FST
  75. @@ -2700,6 +2705,7 @@ void hostapd_interface_deinit_free(struc
  76. (unsigned int) iface->conf->num_bss);
  77. driver = iface->bss[0]->driver;
  78. drv_priv = iface->bss[0]->drv_priv;
  79. + hostapd_ubus_free_iface(iface);
  80. hostapd_interface_deinit(iface);
  81. wpa_printf(MSG_DEBUG, "%s: driver=%p drv_priv=%p -> hapd_deinit",
  82. __func__, driver, drv_priv);
  83. --- a/src/ap/ieee802_11.c
  84. +++ b/src/ap/ieee802_11.c
  85. @@ -3553,13 +3553,18 @@ static void handle_auth(struct hostapd_d
  86. u16 auth_alg, auth_transaction, status_code;
  87. u16 resp = WLAN_STATUS_SUCCESS;
  88. struct sta_info *sta = NULL;
  89. - int res, reply_res;
  90. + int res, reply_res, ubus_resp;
  91. u16 fc;
  92. const u8 *challenge = NULL;
  93. u8 resp_ies[2 + WLAN_AUTH_CHALLENGE_LEN];
  94. size_t resp_ies_len = 0;
  95. u16 seq_ctrl;
  96. struct radius_sta rad_info;
  97. + struct hostapd_ubus_request req = {
  98. + .type = HOSTAPD_UBUS_AUTH_REQ,
  99. + .mgmt_frame = mgmt,
  100. + .ssi_signal = rssi,
  101. + };
  102. if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.auth)) {
  103. wpa_printf(MSG_INFO, "handle_auth - too short payload (len=%lu)",
  104. @@ -3727,6 +3732,13 @@ static void handle_auth(struct hostapd_d
  105. resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
  106. goto fail;
  107. }
  108. + ubus_resp = hostapd_ubus_handle_event(hapd, &req);
  109. + if (ubus_resp) {
  110. + wpa_printf(MSG_DEBUG, "Station " MACSTR " rejected by ubus handler.\n",
  111. + MAC2STR(mgmt->sa));
  112. + resp = ubus_resp > 0 ? (u16) ubus_resp : WLAN_STATUS_UNSPECIFIED_FAILURE;
  113. + goto fail;
  114. + }
  115. if (res == HOSTAPD_ACL_PENDING)
  116. return;
  117. @@ -5445,7 +5457,7 @@ static void handle_assoc(struct hostapd_
  118. int resp = WLAN_STATUS_SUCCESS;
  119. u16 reply_res = WLAN_STATUS_UNSPECIFIED_FAILURE;
  120. const u8 *pos;
  121. - int left, i;
  122. + int left, i, ubus_resp;
  123. struct sta_info *sta;
  124. u8 *tmp = NULL;
  125. #ifdef CONFIG_FILS
  126. @@ -5658,6 +5670,11 @@ static void handle_assoc(struct hostapd_
  127. left = res;
  128. }
  129. #endif /* CONFIG_FILS */
  130. + struct hostapd_ubus_request req = {
  131. + .type = HOSTAPD_UBUS_ASSOC_REQ,
  132. + .mgmt_frame = mgmt,
  133. + .ssi_signal = rssi,
  134. + };
  135. /* followed by SSID and Supported rates; and HT capabilities if 802.11n
  136. * is used */
  137. @@ -5756,6 +5773,13 @@ static void handle_assoc(struct hostapd_
  138. }
  139. #endif /* CONFIG_FILS */
  140. + ubus_resp = hostapd_ubus_handle_event(hapd, &req);
  141. + if (ubus_resp) {
  142. + wpa_printf(MSG_DEBUG, "Station " MACSTR " assoc rejected by ubus handler.\n",
  143. + MAC2STR(mgmt->sa));
  144. + resp = ubus_resp > 0 ? (u16) ubus_resp : WLAN_STATUS_UNSPECIFIED_FAILURE;
  145. + goto fail;
  146. + }
  147. fail:
  148. /*
  149. @@ -5849,6 +5873,7 @@ static void handle_disassoc(struct hosta
  150. wpa_printf(MSG_DEBUG, "disassocation: STA=" MACSTR " reason_code=%d",
  151. MAC2STR(mgmt->sa),
  152. le_to_host16(mgmt->u.disassoc.reason_code));
  153. + hostapd_ubus_notify(hapd, "disassoc", mgmt->sa);
  154. sta = ap_get_sta(hapd, mgmt->sa);
  155. if (sta == NULL) {
  156. @@ -5918,6 +5943,8 @@ static void handle_deauth(struct hostapd
  157. /* Clear the PTKSA cache entries for PASN */
  158. ptksa_cache_flush(hapd->ptksa, mgmt->sa, WPA_CIPHER_NONE);
  159. + hostapd_ubus_notify(hapd, "deauth", mgmt->sa);
  160. +
  161. sta = ap_get_sta(hapd, mgmt->sa);
  162. if (sta == NULL) {
  163. wpa_msg(hapd->msg_ctx, MSG_DEBUG, "Station " MACSTR " trying "
  164. --- a/src/ap/beacon.c
  165. +++ b/src/ap/beacon.c
  166. @@ -823,6 +823,12 @@ void handle_probe_req(struct hostapd_dat
  167. u16 csa_offs[2];
  168. size_t csa_offs_len;
  169. struct radius_sta rad_info;
  170. + struct hostapd_ubus_request req = {
  171. + .type = HOSTAPD_UBUS_PROBE_REQ,
  172. + .mgmt_frame = mgmt,
  173. + .ssi_signal = ssi_signal,
  174. + .elems = &elems,
  175. + };
  176. if (hapd->iconf->rssi_ignore_probe_request && ssi_signal &&
  177. ssi_signal < hapd->iconf->rssi_ignore_probe_request)
  178. @@ -1009,6 +1015,12 @@ void handle_probe_req(struct hostapd_dat
  179. }
  180. #endif /* CONFIG_P2P */
  181. + if (hostapd_ubus_handle_event(hapd, &req)) {
  182. + wpa_printf(MSG_DEBUG, "Probe request for " MACSTR " rejected by ubus handler.\n",
  183. + MAC2STR(mgmt->sa));
  184. + return;
  185. + }
  186. +
  187. /* TODO: verify that supp_rates contains at least one matching rate
  188. * with AP configuration */
  189. --- a/src/ap/drv_callbacks.c
  190. +++ b/src/ap/drv_callbacks.c
  191. @@ -145,6 +145,10 @@ int hostapd_notif_assoc(struct hostapd_d
  192. u16 reason = WLAN_REASON_UNSPECIFIED;
  193. int status = WLAN_STATUS_SUCCESS;
  194. const u8 *p2p_dev_addr = NULL;
  195. + struct hostapd_ubus_request req = {
  196. + .type = HOSTAPD_UBUS_ASSOC_REQ,
  197. + .addr = addr,
  198. + };
  199. if (addr == NULL) {
  200. /*
  201. @@ -237,6 +241,12 @@ int hostapd_notif_assoc(struct hostapd_d
  202. goto fail;
  203. }
  204. + if (hostapd_ubus_handle_event(hapd, &req)) {
  205. + wpa_printf(MSG_DEBUG, "Station " MACSTR " assoc rejected by ubus handler.\n",
  206. + MAC2STR(req.addr));
  207. + goto fail;
  208. + }
  209. +
  210. #ifdef CONFIG_P2P
  211. if (elems.p2p) {
  212. wpabuf_free(sta->p2p_ie);
  213. --- a/src/ap/sta_info.c
  214. +++ b/src/ap/sta_info.c
  215. @@ -458,6 +458,7 @@ void ap_handle_timer(void *eloop_ctx, vo
  216. hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
  217. HOSTAPD_LEVEL_INFO, "deauthenticated due to "
  218. "local deauth request");
  219. + hostapd_ubus_notify(hapd, "local-deauth", sta->addr);
  220. ap_free_sta(hapd, sta);
  221. return;
  222. }
  223. @@ -613,6 +614,7 @@ skip_poll:
  224. mlme_deauthenticate_indication(
  225. hapd, sta,
  226. WLAN_REASON_PREV_AUTH_NOT_VALID);
  227. + hostapd_ubus_notify(hapd, "inactive-deauth", sta->addr);
  228. ap_free_sta(hapd, sta);
  229. break;
  230. }
  231. @@ -1329,6 +1331,7 @@ void ap_sta_set_authorized(struct hostap
  232. buf, ip_addr, keyid_buf);
  233. } else {
  234. wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED "%s", buf);
  235. + hostapd_ubus_notify(hapd, "disassoc", sta->addr);
  236. if (hapd->msg_ctx_parent &&
  237. hapd->msg_ctx_parent != hapd->msg_ctx)
  238. --- a/src/ap/wpa_auth_glue.c
  239. +++ b/src/ap/wpa_auth_glue.c
  240. @@ -265,6 +265,7 @@ static void hostapd_wpa_auth_psk_failure
  241. struct hostapd_data *hapd = ctx;
  242. wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_POSSIBLE_PSK_MISMATCH MACSTR,
  243. MAC2STR(addr));
  244. + hostapd_ubus_notify(hapd, "key-mismatch", addr);
  245. }
  246. --- a/wpa_supplicant/Makefile
  247. +++ b/wpa_supplicant/Makefile
  248. @@ -176,6 +176,12 @@ ifdef CONFIG_EAPOL_TEST
  249. CFLAGS += -Werror -DEAPOL_TEST
  250. endif
  251. +ifdef CONFIG_UBUS
  252. +CFLAGS += -DUBUS_SUPPORT
  253. +OBJS += ubus.o
  254. +LIBS += -lubox -lubus
  255. +endif
  256. +
  257. ifdef CONFIG_CODE_COVERAGE
  258. CFLAGS += -O0 -fprofile-arcs -ftest-coverage
  259. LIBS += -lgcov
  260. @@ -959,6 +965,9 @@ ifdef CONFIG_CTRL_IFACE_MIB
  261. CFLAGS += -DCONFIG_CTRL_IFACE_MIB
  262. endif
  263. OBJS += ../src/ap/ctrl_iface_ap.o
  264. +ifdef CONFIG_UBUS
  265. +OBJS += ../src/ap/ubus.o
  266. +endif
  267. endif
  268. CFLAGS += -DEAP_SERVER -DEAP_SERVER_IDENTITY
  269. --- a/wpa_supplicant/wpa_supplicant.c
  270. +++ b/wpa_supplicant/wpa_supplicant.c
  271. @@ -7017,6 +7017,8 @@ struct wpa_supplicant * wpa_supplicant_a
  272. }
  273. #endif /* CONFIG_P2P */
  274. + wpas_ubus_add_bss(wpa_s);
  275. +
  276. return wpa_s;
  277. }
  278. @@ -7043,6 +7045,8 @@ int wpa_supplicant_remove_iface(struct w
  279. struct wpa_supplicant *parent = wpa_s->parent;
  280. #endif /* CONFIG_MESH */
  281. + wpas_ubus_free_bss(wpa_s);
  282. +
  283. /* Remove interface from the global list of interfaces */
  284. prev = global->ifaces;
  285. if (prev == wpa_s) {
  286. @@ -7346,8 +7350,12 @@ int wpa_supplicant_run(struct wpa_global
  287. eloop_register_signal_terminate(wpa_supplicant_terminate, global);
  288. eloop_register_signal_reconfig(wpa_supplicant_reconfig, global);
  289. + wpas_ubus_add(global);
  290. +
  291. eloop_run();
  292. + wpas_ubus_free(global);
  293. +
  294. return 0;
  295. }
  296. --- a/wpa_supplicant/wpa_supplicant_i.h
  297. +++ b/wpa_supplicant/wpa_supplicant_i.h
  298. @@ -19,6 +19,7 @@
  299. #include "wps/wps_defs.h"
  300. #include "config_ssid.h"
  301. #include "wmm_ac.h"
  302. +#include "ubus.h"
  303. extern const char *const wpa_supplicant_version;
  304. extern const char *const wpa_supplicant_license;
  305. @@ -321,6 +322,8 @@ struct wpa_global {
  306. #endif /* CONFIG_WIFI_DISPLAY */
  307. struct psk_list_entry *add_psk; /* From group formation */
  308. +
  309. + struct ubus_object ubus_global;
  310. };
  311. @@ -605,6 +608,7 @@ struct wpa_supplicant {
  312. unsigned char own_addr[ETH_ALEN];
  313. unsigned char perm_addr[ETH_ALEN];
  314. char ifname[100];
  315. + struct wpas_ubus_bss ubus;
  316. #ifdef CONFIG_MATCH_IFACE
  317. int matched;
  318. #endif /* CONFIG_MATCH_IFACE */
  319. --- a/wpa_supplicant/wps_supplicant.c
  320. +++ b/wpa_supplicant/wps_supplicant.c
  321. @@ -33,6 +33,7 @@
  322. #include "p2p/p2p.h"
  323. #include "p2p_supplicant.h"
  324. #include "wps_supplicant.h"
  325. +#include "ubus.h"
  326. #ifndef WPS_PIN_SCAN_IGNORE_SEL_REG
  327. @@ -392,6 +393,8 @@ static int wpa_supplicant_wps_cred(void
  328. wpa_hexdump_key(MSG_DEBUG, "WPS: Received Credential attribute",
  329. cred->cred_attr, cred->cred_attr_len);
  330. + wpas_ubus_notify(wpa_s, cred);
  331. +
  332. if (wpa_s->conf->wps_cred_processing == 1)
  333. return 0;
  334. --- a/hostapd/main.c
  335. +++ b/hostapd/main.c
  336. @@ -895,6 +895,7 @@ int main(int argc, char *argv[])
  337. }
  338. hostapd_global_ctrl_iface_init(&interfaces);
  339. + hostapd_ubus_add(&interfaces);
  340. if (hostapd_global_run(&interfaces, daemonize, pid_file)) {
  341. wpa_printf(MSG_ERROR, "Failed to start eloop");
  342. @@ -904,6 +905,7 @@ int main(int argc, char *argv[])
  343. ret = 0;
  344. out:
  345. + hostapd_ubus_free(&interfaces);
  346. hostapd_global_ctrl_iface_deinit(&interfaces);
  347. /* Deinitialize all interfaces */
  348. for (i = 0; i < interfaces.count; i++) {
  349. --- a/wpa_supplicant/main.c
  350. +++ b/wpa_supplicant/main.c
  351. @@ -203,7 +203,7 @@ int main(int argc, char *argv[])
  352. for (;;) {
  353. c = getopt(argc, argv,
  354. - "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuv::W");
  355. + "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:nNo:O:p:P:qsTtuv::W");
  356. if (c < 0)
  357. break;
  358. switch (c) {
  359. @@ -271,6 +271,9 @@ int main(int argc, char *argv[])
  360. params.conf_p2p_dev = optarg;
  361. break;
  362. #endif /* CONFIG_P2P */
  363. + case 'n':
  364. + iface_count = 0;
  365. + break;
  366. case 'o':
  367. params.override_driver = optarg;
  368. break;
  369. --- a/src/ap/rrm.c
  370. +++ b/src/ap/rrm.c
  371. @@ -89,6 +89,9 @@ static void hostapd_handle_beacon_report
  372. return;
  373. wpa_msg(hapd->msg_ctx, MSG_INFO, BEACON_RESP_RX MACSTR " %u %02x %s",
  374. MAC2STR(addr), token, rep_mode, report);
  375. + if (len < sizeof(struct rrm_measurement_beacon_report))
  376. + return;
  377. + hostapd_ubus_notify_beacon_report(hapd, addr, token, rep_mode, (struct rrm_measurement_beacon_report*) pos, len);
  378. }
  379. --- a/src/ap/vlan_init.c
  380. +++ b/src/ap/vlan_init.c
  381. @@ -22,6 +22,7 @@
  382. static int vlan_if_add(struct hostapd_data *hapd, struct hostapd_vlan *vlan,
  383. int existsok)
  384. {
  385. + bool vlan_exists = iface_exists(vlan->ifname);
  386. int ret;
  387. #ifdef CONFIG_WEP
  388. int i;
  389. @@ -36,7 +37,7 @@ static int vlan_if_add(struct hostapd_da
  390. }
  391. #endif /* CONFIG_WEP */
  392. - if (!iface_exists(vlan->ifname))
  393. + if (!vlan_exists)
  394. ret = hostapd_vlan_if_add(hapd, vlan->ifname);
  395. else if (!existsok)
  396. return -1;
  397. @@ -51,6 +52,9 @@ static int vlan_if_add(struct hostapd_da
  398. if (hapd->wpa_auth)
  399. ret = wpa_auth_ensure_group(hapd->wpa_auth, vlan->vlan_id);
  400. + if (!ret && !vlan_exists)
  401. + hostapd_ubus_add_vlan(hapd, vlan);
  402. +
  403. if (ret == 0)
  404. return ret;
  405. @@ -77,6 +81,8 @@ int vlan_if_remove(struct hostapd_data *
  406. "WPA deinitialization for VLAN %d failed (%d)",
  407. vlan->vlan_id, ret);
  408. + hostapd_ubus_remove_vlan(hapd, vlan);
  409. +
  410. return hostapd_vlan_if_remove(hapd, vlan->ifname);
  411. }
  412. --- a/src/ap/dfs.c
  413. +++ b/src/ap/dfs.c
  414. @@ -1193,6 +1193,8 @@ int hostapd_dfs_radar_detected(struct ho
  415. "freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d",
  416. freq, ht_enabled, chan_offset, chan_width, cf1, cf2);
  417. + hostapd_ubus_notify_radar_detected(iface, freq, chan_width, cf1, cf2);
  418. +
  419. /* Proceed only if DFS is not offloaded to the driver */
  420. if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD)
  421. return 0;
  422. --- a/src/ap/airtime_policy.c
  423. +++ b/src/ap/airtime_policy.c
  424. @@ -112,8 +112,14 @@ static void set_sta_weights(struct hosta
  425. {
  426. struct sta_info *sta;
  427. - for (sta = hapd->sta_list; sta; sta = sta->next)
  428. - sta_set_airtime_weight(hapd, sta, weight);
  429. + for (sta = hapd->sta_list; sta; sta = sta->next) {
  430. + unsigned int sta_weight = weight;
  431. +
  432. + if (sta->dyn_airtime_weight)
  433. + sta_weight = (weight * sta->dyn_airtime_weight) / 256;
  434. +
  435. + sta_set_airtime_weight(hapd, sta, sta_weight);
  436. + }
  437. }
  438. @@ -244,7 +250,10 @@ int airtime_policy_new_sta(struct hostap
  439. unsigned int weight;
  440. if (hapd->iconf->airtime_mode == AIRTIME_MODE_STATIC) {
  441. - weight = get_weight_for_sta(hapd, sta->addr);
  442. + if (sta->dyn_airtime_weight)
  443. + weight = sta->dyn_airtime_weight;
  444. + else
  445. + weight = get_weight_for_sta(hapd, sta->addr);
  446. if (weight)
  447. return sta_set_airtime_weight(hapd, sta, weight);
  448. }
  449. --- a/src/ap/sta_info.h
  450. +++ b/src/ap/sta_info.h
  451. @@ -324,6 +324,7 @@ struct sta_info {
  452. #endif /* CONFIG_TESTING_OPTIONS */
  453. #ifdef CONFIG_AIRTIME_POLICY
  454. unsigned int airtime_weight;
  455. + unsigned int dyn_airtime_weight;
  456. struct os_reltime backlogged_until;
  457. #endif /* CONFIG_AIRTIME_POLICY */
  458. --- a/src/ap/wnm_ap.c
  459. +++ b/src/ap/wnm_ap.c
  460. @@ -463,7 +463,7 @@ static void ieee802_11_rx_bss_trans_mgmt
  461. size_t len)
  462. {
  463. u8 dialog_token, status_code, bss_termination_delay;
  464. - const u8 *pos, *end;
  465. + const u8 *pos, *end, *target_bssid = NULL;
  466. int enabled = hapd->conf->bss_transition;
  467. struct sta_info *sta;
  468. @@ -510,6 +510,7 @@ static void ieee802_11_rx_bss_trans_mgmt
  469. wpa_printf(MSG_DEBUG, "WNM: not enough room for Target BSSID field");
  470. return;
  471. }
  472. + target_bssid = pos;
  473. sta->agreed_to_steer = 1;
  474. eloop_cancel_timeout(ap_sta_reset_steer_flag_timer, hapd, sta);
  475. eloop_register_timeout(2, 0, ap_sta_reset_steer_flag_timer,
  476. @@ -529,6 +530,10 @@ static void ieee802_11_rx_bss_trans_mgmt
  477. MAC2STR(addr), status_code, bss_termination_delay);
  478. }
  479. + hostapd_ubus_notify_bss_transition_response(hapd, sta->addr, dialog_token,
  480. + status_code, bss_termination_delay,
  481. + target_bssid, pos, end - pos);
  482. +
  483. wpa_hexdump(MSG_DEBUG, "WNM: BSS Transition Candidate List Entries",
  484. pos, end - pos);
  485. }