developer | 3f10c67 | 2023-11-21 14:30:53 +0800 | [diff] [blame] | 1 | diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile |
| 2 | index 61410069b6f..089c073011b 100644 |
| 3 | --- a/package/network/services/hostapd/Makefile |
| 4 | +++ b/package/network/services/hostapd/Makefile |
| 5 | @@ -79,7 +79,7 @@ ifneq ($(CONFIG_DRIVER_11AX_SUPPORT),) |
| 6 | HOSTAPD_IEEE80211AX:=y |
| 7 | endif |
| 8 | |
| 9 | -CORE_DEPENDS = +ucode +libubus +libucode +ucode-mod-fs +ucode-mod-nl80211 +ucode-mod-rtnl +ucode-mod-ubus +ucode-mod-uloop +libblobmsg-json +libudebug |
| 10 | +CORE_DEPENDS = +ucode +libubus +libucode +ucode-mod-fs +ucode-mod-nl80211 +ucode-mod-rtnl +ucode-mod-ubus +ucode-mod-uloop +libblobmsg-json |
| 11 | OPENSSL_DEPENDS = +PACKAGE_$(1):libopenssl |
| 12 | |
| 13 | DRIVER_MAKEOPTS= \ |
| 14 | @@ -583,7 +583,7 @@ TARGET_CPPFLAGS := \ |
| 15 | -D_GNU_SOURCE \ |
| 16 | $(if $(CONFIG_WPA_MSG_MIN_PRIORITY),-DCONFIG_MSG_MIN_PRIORITY=$(CONFIG_WPA_MSG_MIN_PRIORITY)) |
| 17 | |
| 18 | -TARGET_LDFLAGS += -lubox -lubus -lblobmsg_json -lucode -lm -lnl-tiny -ludebug |
| 19 | +TARGET_LDFLAGS += -lubox -lubus -lblobmsg_json -lucode -lm -lnl-tiny |
| 20 | |
| 21 | ifdef CONFIG_WPA_ENABLE_WEP |
| 22 | DRIVER_MAKEOPTS += CONFIG_WEP=y |
| 23 | diff --git a/package/network/services/hostapd/files/hostapd.uc b/package/network/services/hostapd/files/hostapd.uc |
| 24 | index 84138f29a58..750fd535a4a 100644 |
| 25 | --- a/package/network/services/hostapd/files/hostapd.uc |
| 26 | +++ b/package/network/services/hostapd/files/hostapd.uc |
| 27 | @@ -782,33 +782,8 @@ let main_obj = { |
| 28 | }, |
| 29 | }; |
| 30 | |
| 31 | -function handle_debug_config(cfg) { |
| 32 | - hostapd.printf(`handle_debug_config: ${cfg}\n`); |
| 33 | - if (!cfg) |
| 34 | - return; |
| 35 | - |
| 36 | - let data = cfg.service; |
| 37 | - if (!data) |
| 38 | - return; |
| 39 | - |
| 40 | - data = data.hostapd; |
| 41 | - if (!data) |
| 42 | - return; |
| 43 | - |
| 44 | - hostapd.udebug_set(!!+data.enabled); |
| 45 | -} |
| 46 | - |
| 47 | hostapd.data.ubus = ubus; |
| 48 | hostapd.data.obj = ubus.publish("hostapd", main_obj); |
| 49 | -hostapd.data.debug_sub = ubus.subscriber((req) => { |
| 50 | - if (req.type != "config") |
| 51 | - return; |
| 52 | - |
| 53 | - handle_debug_config(req.data); |
| 54 | -}); |
| 55 | - |
| 56 | -hostapd.data.debug_sub.subscribe("udebug"); |
| 57 | -handle_debug_config(ubus.call("udebug", "get_config", {})); |
| 58 | |
| 59 | function bss_event(type, name, data) { |
| 60 | let ubus = hostapd.data.ubus; |
| 61 | diff --git a/package/network/services/hostapd/files/wpa_supplicant.uc b/package/network/services/hostapd/files/wpa_supplicant.uc |
| 62 | index aac144b3399..d624f27cddc 100644 |
| 63 | --- a/package/network/services/hostapd/files/wpa_supplicant.uc |
| 64 | +++ b/package/network/services/hostapd/files/wpa_supplicant.uc |
| 65 | @@ -244,32 +244,8 @@ let main_obj = { |
| 66 | }, |
| 67 | }; |
| 68 | |
| 69 | -function handle_debug_config(cfg) { |
| 70 | - if (!cfg) |
| 71 | - return; |
| 72 | - |
| 73 | - let data = cfg.service; |
| 74 | - if (!data) |
| 75 | - return; |
| 76 | - |
| 77 | - data = data.wpa_supplicant; |
| 78 | - if (!data) |
| 79 | - return; |
| 80 | - |
| 81 | - wpas.udebug_set(!!+data.enabled); |
| 82 | -} |
| 83 | - |
| 84 | wpas.data.ubus = ubus; |
| 85 | wpas.data.obj = ubus.publish("wpa_supplicant", main_obj); |
| 86 | -wpas.data.debug_sub = ubus.subscriber((req) => { |
| 87 | - if (req.type != "config") |
| 88 | - return; |
| 89 | - |
| 90 | - handle_debug_config(req.data); |
| 91 | -}); |
| 92 | - |
| 93 | -wpas.data.debug_sub.subscribe("udebug"); |
| 94 | -handle_debug_config(ubus.call("udebug", "get_config", {})); |
| 95 | |
| 96 | function iface_event(type, name, data) { |
| 97 | let ubus = wpas.data.ubus; |
| 98 | diff --git a/package/network/services/hostapd/files/wpad_acl.json b/package/network/services/hostapd/files/wpad_acl.json |
| 99 | index 7532953cabd..d00fd945ba5 100644 |
| 100 | --- a/package/network/services/hostapd/files/wpad_acl.json |
| 101 | +++ b/package/network/services/hostapd/files/wpad_acl.json |
| 102 | @@ -9,12 +9,8 @@ |
| 103 | }, |
| 104 | "hostapd": { |
| 105 | "methods": [ "apsta_state" ] |
| 106 | - }, |
| 107 | - "udebug": { |
| 108 | - "methods": [ "get_config" ] |
| 109 | } |
| 110 | }, |
| 111 | - "subscribe": [ "udebug" ], |
| 112 | "publish": [ "hostapd", "hostapd.*", "wpa_supplicant", "wpa_supplicant.*" ], |
| 113 | "send": [ "bss.*", "wps_credentials" ] |
| 114 | } |
| 115 | diff --git a/package/network/services/hostapd/patches/601-ucode_support.patch b/package/network/services/hostapd/patches/601-ucode_support.patch |
| 116 | index cfdb51f356c..23f535b6852 100644 |
| 117 | --- a/package/network/services/hostapd/patches/601-ucode_support.patch |
| 118 | +++ b/package/network/services/hostapd/patches/601-ucode_support.patch |
| 119 | @@ -196,7 +196,7 @@ |
| 120 | |
| 121 | #ifdef CONFIG_BGSCAN |
| 122 | if (state == WPA_COMPLETED && wpa_s->current_ssid != wpa_s->bgscan_ssid) |
| 123 | -@@ -7594,6 +7595,7 @@ struct wpa_supplicant * wpa_supplicant_a |
| 124 | +@@ -7596,6 +7597,7 @@ struct wpa_supplicant * wpa_supplicant_a |
| 125 | #endif /* CONFIG_P2P */ |
| 126 | |
| 127 | wpas_ubus_add_bss(wpa_s); |
| 128 | @@ -204,7 +204,7 @@ |
| 129 | |
| 130 | return wpa_s; |
| 131 | } |
| 132 | -@@ -7621,6 +7623,7 @@ int wpa_supplicant_remove_iface(struct w |
| 133 | +@@ -7623,6 +7625,7 @@ int wpa_supplicant_remove_iface(struct w |
| 134 | struct wpa_supplicant *parent = wpa_s->parent; |
| 135 | #endif /* CONFIG_MESH */ |
| 136 | |
| 137 | @@ -212,7 +212,7 @@ |
| 138 | wpas_ubus_free_bss(wpa_s); |
| 139 | |
| 140 | /* Remove interface from the global list of interfaces */ |
| 141 | -@@ -7931,6 +7934,7 @@ struct wpa_global * wpa_supplicant_init( |
| 142 | +@@ -7933,6 +7936,7 @@ struct wpa_global * wpa_supplicant_init( |
| 143 | |
| 144 | eloop_register_timeout(WPA_SUPPLICANT_CLEANUP_INTERVAL, 0, |
| 145 | wpas_periodic, global, NULL); |
| 146 | @@ -220,7 +220,7 @@ |
| 147 | |
| 148 | return global; |
| 149 | } |
| 150 | -@@ -7969,12 +7973,8 @@ int wpa_supplicant_run(struct wpa_global |
| 151 | +@@ -7971,12 +7975,8 @@ int wpa_supplicant_run(struct wpa_global |
| 152 | eloop_register_signal_terminate(wpa_supplicant_terminate, global); |
| 153 | eloop_register_signal_reconfig(wpa_supplicant_reconfig, global); |
| 154 | |
| 155 | @@ -233,7 +233,7 @@ |
| 156 | return 0; |
| 157 | } |
| 158 | |
| 159 | -@@ -8007,6 +8007,8 @@ void wpa_supplicant_deinit(struct wpa_gl |
| 160 | +@@ -8009,6 +8009,8 @@ void wpa_supplicant_deinit(struct wpa_gl |
| 161 | |
| 162 | wpas_notify_supplicant_deinitialized(global); |
| 163 | |
| 164 | @@ -395,60 +395,7 @@ |
| 165 | { |
| 166 | --- a/src/drivers/driver_nl80211.c |
| 167 | +++ b/src/drivers/driver_nl80211.c |
| 168 | -@@ -73,6 +73,16 @@ enum nlmsgerr_attrs { |
| 169 | - |
| 170 | - #endif /* ANDROID */ |
| 171 | - |
| 172 | -+static void handle_nl_debug_hook(struct nl_msg *msg, int tx) |
| 173 | -+{ |
| 174 | -+ const struct nlmsghdr *nlh; |
| 175 | -+ |
| 176 | -+ if (!wpa_netlink_hook) |
| 177 | -+ return; |
| 178 | -+ |
| 179 | -+ nlh = nlmsg_hdr(msg); |
| 180 | -+ wpa_netlink_hook(tx, nlh, nlh->nlmsg_len); |
| 181 | -+} |
| 182 | - |
| 183 | - static struct nl_sock * nl_create_handle(struct nl_cb *cb, const char *dbg) |
| 184 | - { |
| 185 | -@@ -379,6 +389,11 @@ static int no_seq_check(struct nl_msg *m |
| 186 | - return NL_OK; |
| 187 | - } |
| 188 | - |
| 189 | -+static int debug_handler(struct nl_msg *msg, void *arg) |
| 190 | -+{ |
| 191 | -+ handle_nl_debug_hook(msg, 0); |
| 192 | -+ return NL_OK; |
| 193 | -+} |
| 194 | - |
| 195 | - static void nl80211_nlmsg_clear(struct nl_msg *msg) |
| 196 | - { |
| 197 | -@@ -415,6 +430,7 @@ static int send_and_recv(struct nl80211_ |
| 198 | - if (!msg) |
| 199 | - return -ENOMEM; |
| 200 | - |
| 201 | -+ handle_nl_debug_hook(msg, 1); |
| 202 | - cb = nl_cb_clone(global->nl_cb); |
| 203 | - if (!cb) |
| 204 | - goto out; |
| 205 | -@@ -443,6 +459,7 @@ static int send_and_recv(struct nl80211_ |
| 206 | - |
| 207 | - err = 1; |
| 208 | - |
| 209 | -+ nl_cb_set(cb, NL_CB_MSG_IN, NL_CB_CUSTOM, debug_handler, NULL); |
| 210 | - nl_cb_err(cb, NL_CB_CUSTOM, error_handler, &err); |
| 211 | - nl_cb_set(cb, NL_CB_FINISH, NL_CB_CUSTOM, finish_handler, &err); |
| 212 | - if (ack_handler_custom) { |
| 213 | -@@ -919,6 +936,7 @@ nl80211_get_wiphy_data_ap(struct i802_bs |
| 214 | - os_free(w); |
| 215 | - return NULL; |
| 216 | - } |
| 217 | -+ nl_cb_set(w->nl_cb, NL_CB_MSG_IN, NL_CB_CUSTOM, debug_handler, NULL); |
| 218 | - nl_cb_set(w->nl_cb, NL_CB_SEQ_CHECK, NL_CB_CUSTOM, |
| 219 | - no_seq_check, NULL); |
| 220 | - nl_cb_set(w->nl_cb, NL_CB_VALID, NL_CB_CUSTOM, |
| 221 | -@@ -1333,7 +1351,7 @@ static void wpa_driver_nl80211_event_rtm |
| 222 | +@@ -1333,7 +1333,7 @@ static void wpa_driver_nl80211_event_rtm |
| 223 | } |
| 224 | wpa_printf(MSG_DEBUG, "nl80211: Interface down (%s/%s)", |
| 225 | namebuf, ifname); |
| 226 | @@ -457,7 +404,7 @@ |
| 227 | wpa_printf(MSG_DEBUG, |
| 228 | "nl80211: Not the main interface (%s) - do not indicate interface down", |
| 229 | drv->first_bss->ifname); |
| 230 | -@@ -1369,7 +1387,7 @@ static void wpa_driver_nl80211_event_rtm |
| 231 | +@@ -1369,7 +1369,7 @@ static void wpa_driver_nl80211_event_rtm |
| 232 | } |
| 233 | wpa_printf(MSG_DEBUG, "nl80211: Interface up (%s/%s)", |
| 234 | namebuf, ifname); |
| 235 | @@ -466,23 +413,7 @@ |
| 236 | wpa_printf(MSG_DEBUG, |
| 237 | "nl80211: Not the main interface (%s) - do not indicate interface up", |
| 238 | drv->first_bss->ifname); |
| 239 | -@@ -1992,6 +2010,7 @@ static int wpa_driver_nl80211_init_nl_gl |
| 240 | - /* Continue without vendor events */ |
| 241 | - } |
| 242 | - |
| 243 | -+ nl_cb_set(global->nl_cb, NL_CB_MSG_IN, NL_CB_CUSTOM, debug_handler, NULL); |
| 244 | - nl_cb_set(global->nl_cb, NL_CB_SEQ_CHECK, NL_CB_CUSTOM, |
| 245 | - no_seq_check, NULL); |
| 246 | - nl_cb_set(global->nl_cb, NL_CB_VALID, NL_CB_CUSTOM, |
| 247 | -@@ -2160,6 +2179,7 @@ static int nl80211_init_bss(struct i802_ |
| 248 | - if (!bss->nl_cb) |
| 249 | - return -1; |
| 250 | - |
| 251 | -+ nl_cb_set(bss->nl_cb, NL_CB_MSG_IN, NL_CB_CUSTOM, debug_handler, NULL); |
| 252 | - nl_cb_set(bss->nl_cb, NL_CB_SEQ_CHECK, NL_CB_CUSTOM, |
| 253 | - no_seq_check, NULL); |
| 254 | - nl_cb_set(bss->nl_cb, NL_CB_VALID, NL_CB_CUSTOM, |
| 255 | -@@ -8432,6 +8452,7 @@ static void *i802_init(struct hostapd_da |
| 256 | +@@ -8432,6 +8432,7 @@ static void *i802_init(struct hostapd_da |
| 257 | char master_ifname[IFNAMSIZ]; |
| 258 | int ifindex, br_ifindex = 0; |
| 259 | int br_added = 0; |
| 260 | @@ -490,7 +421,7 @@ |
| 261 | |
| 262 | bss = wpa_driver_nl80211_drv_init(hapd, params->ifname, |
| 263 | params->global_priv, 1, |
| 264 | -@@ -8491,21 +8512,17 @@ static void *i802_init(struct hostapd_da |
| 265 | +@@ -8491,21 +8492,17 @@ static void *i802_init(struct hostapd_da |
| 266 | (params->num_bridge == 0 || !params->bridge[0])) |
| 267 | add_ifidx(drv, br_ifindex, drv->ifindex); |
| 268 | |
| 269 | @@ -522,7 +453,7 @@ |
| 270 | } |
| 271 | |
| 272 | if (drv->capa.flags2 & WPA_DRIVER_FLAGS2_CONTROL_PORT_RX) { |
| 273 | -@@ -8875,6 +8892,50 @@ static int wpa_driver_nl80211_if_remove( |
| 274 | +@@ -8875,6 +8872,50 @@ static int wpa_driver_nl80211_if_remove( |
| 275 | return 0; |
| 276 | } |
| 277 | |
| 278 | @@ -573,7 +504,7 @@ |
| 279 | |
| 280 | static int cookie_handler(struct nl_msg *msg, void *arg) |
| 281 | { |
| 282 | -@@ -10513,6 +10574,37 @@ static int driver_nl80211_if_remove(void |
| 283 | +@@ -10513,6 +10554,37 @@ static int driver_nl80211_if_remove(void |
| 284 | } |
| 285 | |
| 286 | |
| 287 | @@ -611,7 +542,7 @@ |
| 288 | static int driver_nl80211_send_mlme(void *priv, const u8 *data, |
| 289 | size_t data_len, int noack, |
| 290 | unsigned int freq, |
| 291 | -@@ -13697,6 +13789,8 @@ const struct wpa_driver_ops wpa_driver_n |
| 292 | +@@ -13697,6 +13769,8 @@ const struct wpa_driver_ops wpa_driver_n |
| 293 | .set_acl = wpa_driver_nl80211_set_acl, |
| 294 | .if_add = wpa_driver_nl80211_if_add, |
| 295 | .if_remove = driver_nl80211_if_remove, |
| 296 | @@ -620,52 +551,3 @@ |
| 297 | .send_mlme = driver_nl80211_send_mlme, |
| 298 | .get_hw_feature_data = nl80211_get_hw_feature_data, |
| 299 | .sta_add = wpa_driver_nl80211_sta_add, |
| 300 | ---- a/src/utils/wpa_debug.c |
| 301 | -+++ b/src/utils/wpa_debug.c |
| 302 | -@@ -26,6 +26,10 @@ static FILE *wpa_debug_tracing_file = NU |
| 303 | - #define WPAS_TRACE_PFX "wpas <%d>: " |
| 304 | - #endif /* CONFIG_DEBUG_LINUX_TRACING */ |
| 305 | - |
| 306 | -+void (*wpa_printf_hook)(int level, const char *fmt, va_list ap); |
| 307 | -+void (*wpa_hexdump_hook)(int level, const char *title, const void *buf, |
| 308 | -+ size_t len); |
| 309 | -+void (*wpa_netlink_hook)(int tx, const void *data, size_t len); |
| 310 | - |
| 311 | - int wpa_debug_level = MSG_INFO; |
| 312 | - int wpa_debug_show_keys = 0; |
| 313 | -@@ -210,6 +214,12 @@ void _wpa_printf(int level, const char * |
| 314 | - { |
| 315 | - va_list ap; |
| 316 | - |
| 317 | -+ if (wpa_printf_hook) { |
| 318 | -+ va_start(ap, fmt); |
| 319 | -+ wpa_printf_hook(level, fmt, ap); |
| 320 | -+ va_end(ap); |
| 321 | -+ } |
| 322 | -+ |
| 323 | - if (level >= wpa_debug_level) { |
| 324 | - #ifdef CONFIG_ANDROID_LOG |
| 325 | - va_start(ap, fmt); |
| 326 | -@@ -260,6 +270,9 @@ void _wpa_hexdump(int level, const char |
| 327 | - { |
| 328 | - size_t i; |
| 329 | - |
| 330 | -+ if (wpa_hexdump_hook) |
| 331 | -+ wpa_hexdump_hook(level, title, buf, len); |
| 332 | -+ |
| 333 | - #ifdef CONFIG_DEBUG_LINUX_TRACING |
| 334 | - if (wpa_debug_tracing_file != NULL) { |
| 335 | - fprintf(wpa_debug_tracing_file, |
| 336 | ---- a/src/utils/wpa_debug.h |
| 337 | -+++ b/src/utils/wpa_debug.h |
| 338 | -@@ -11,6 +11,10 @@ |
| 339 | - |
| 340 | - #include "wpabuf.h" |
| 341 | - |
| 342 | -+extern void (*wpa_printf_hook)(int level, const char *fmt, va_list ap); |
| 343 | -+extern void (*wpa_hexdump_hook)(int level, const char *title, |
| 344 | -+ const void *buf, size_t len); |
| 345 | -+extern void (*wpa_netlink_hook)(int tx, const void *data, size_t len); |
| 346 | - extern int wpa_debug_level; |
| 347 | - extern int wpa_debug_show_keys; |
| 348 | - extern int wpa_debug_timestamp; |
| 349 | diff --git a/package/network/services/hostapd/src/src/ap/ucode.c b/package/network/services/hostapd/src/src/ap/ucode.c |
| 350 | index 16d1b515360..af97091be55 100644 |
| 351 | --- a/package/network/services/hostapd/src/src/ap/ucode.c |
| 352 | +++ b/package/network/services/hostapd/src/src/ap/ucode.c |
| 353 | @@ -711,7 +711,6 @@ int hostapd_ucode_init(struct hapd_interfaces *ifaces) |
| 354 | { "freq_info", uc_wpa_freq_info }, |
| 355 | { "add_iface", uc_hostapd_add_iface }, |
| 356 | { "remove_iface", uc_hostapd_remove_iface }, |
| 357 | - { "udebug_set", uc_wpa_udebug_set }, |
| 358 | }; |
| 359 | static const uc_function_list_t bss_fns[] = { |
| 360 | { "ctrl", uc_hostapd_bss_ctrl }, |
| 361 | diff --git a/package/network/services/hostapd/src/src/utils/ucode.c b/package/network/services/hostapd/src/src/utils/ucode.c |
| 362 | index 14fd6bc5ec9..2beeb9a7ff6 100644 |
| 363 | --- a/package/network/services/hostapd/src/src/utils/ucode.c |
| 364 | +++ b/package/network/services/hostapd/src/src/utils/ucode.c |
| 365 | @@ -4,20 +4,12 @@ |
| 366 | #include "crypto/crypto.h" |
| 367 | #include "crypto/sha1.h" |
| 368 | #include "common/ieee802_11_common.h" |
| 369 | -#include <linux/netlink.h> |
| 370 | -#include <linux/genetlink.h> |
| 371 | -#include <linux/nl80211.h> |
| 372 | #include <libubox/uloop.h> |
| 373 | #include <ucode/compiler.h> |
| 374 | -#include <udebug.h> |
| 375 | |
| 376 | static uc_value_t *registry; |
| 377 | static uc_vm_t vm; |
| 378 | static struct uloop_timeout gc_timer; |
| 379 | -static struct udebug ud; |
| 380 | -static struct udebug_buf ud_log, ud_nl[3]; |
| 381 | - |
| 382 | -#define UDEBUG_FLAG_RX_FRAME (1ULL << 0) |
| 383 | |
| 384 | static void uc_gc_timer(struct uloop_timeout *timeout) |
| 385 | { |
| 386 | @@ -259,115 +251,6 @@ int wpa_ucode_call_prepare(const char *fname) |
| 387 | return 0; |
| 388 | } |
| 389 | |
| 390 | -static void udebug_printf_hook(int level, const char *fmt, va_list ap) |
| 391 | -{ |
| 392 | - udebug_entry_init(&ud_log); |
| 393 | - udebug_entry_vprintf(&ud_log, fmt, ap); |
| 394 | - udebug_entry_add(&ud_log); |
| 395 | -} |
| 396 | - |
| 397 | -static void udebug_hexdump_hook(int level, const char *title, |
| 398 | - const void *data, size_t len) |
| 399 | -{ |
| 400 | - char *buf; |
| 401 | - |
| 402 | - udebug_entry_init(&ud_log); |
| 403 | - udebug_entry_printf(&ud_log, "%s - hexdump:", title); |
| 404 | - buf = udebug_entry_append(&ud_log, NULL, 3 * len); |
| 405 | - for (size_t i = 0; i < len; i++) |
| 406 | - buf += sprintf(buf, " %02x", *(uint8_t *)(data + i)); |
| 407 | - udebug_entry_add(&ud_log); |
| 408 | -} |
| 409 | - |
| 410 | -static void udebug_netlink_hook(int tx, const void *data, size_t len) |
| 411 | -{ |
| 412 | - struct { |
| 413 | - uint16_t pkttype; |
| 414 | - uint16_t arphdr; |
| 415 | - uint16_t _pad[5]; |
| 416 | - uint16_t proto; |
| 417 | - } hdr = { |
| 418 | - .pkttype = host_to_be16(tx ? 7 : 6), |
| 419 | - .arphdr = host_to_be16(824), |
| 420 | - .proto = host_to_be16(16), |
| 421 | - }; |
| 422 | - const struct nlmsghdr *nlh = data; |
| 423 | - const struct genlmsghdr *gnlh = data + NLMSG_HDRLEN; |
| 424 | - struct udebug_buf *buf = &ud_nl[!!tx]; |
| 425 | - |
| 426 | - if (nlh->nlmsg_type == 0x10) |
| 427 | - buf = &ud_nl[2]; |
| 428 | - else if (!tx && gnlh->cmd == NL80211_CMD_FRAME && |
| 429 | - !(udebug_buf_flags(buf) & UDEBUG_FLAG_RX_FRAME)) |
| 430 | - return; |
| 431 | - |
| 432 | - udebug_entry_init(buf); |
| 433 | - udebug_entry_append(buf, &hdr, sizeof(hdr)); |
| 434 | - udebug_entry_append(buf, data, len); |
| 435 | - udebug_entry_add(buf); |
| 436 | -} |
| 437 | - |
| 438 | -uc_value_t *uc_wpa_udebug_set(uc_vm_t *vm, size_t nargs) |
| 439 | -{ |
| 440 | - static const struct udebug_buf_meta meta_log = { |
| 441 | - .name = "wpa_log", |
| 442 | - .format = UDEBUG_FORMAT_STRING, |
| 443 | - }; |
| 444 | - static const struct udebug_buf_meta meta_nl_ll = { |
| 445 | - .name = "wpa_nl_ctrl", |
| 446 | - .format = UDEBUG_FORMAT_PACKET, |
| 447 | - .sub_format = UDEBUG_DLT_NETLINK, |
| 448 | - }; |
| 449 | - static const struct udebug_buf_meta meta_nl_tx = { |
| 450 | - .name = "wpa_nl_tx", |
| 451 | - .format = UDEBUG_FORMAT_PACKET, |
| 452 | - .sub_format = UDEBUG_DLT_NETLINK, |
| 453 | - }; |
| 454 | - static const struct udebug_buf_flag rx_flags[] = { |
| 455 | - { "rx_frame", UDEBUG_FLAG_RX_FRAME }, |
| 456 | - }; |
| 457 | - static const struct udebug_buf_meta meta_nl_rx = { |
| 458 | - .name = "wpa_nl_rx", |
| 459 | - .format = UDEBUG_FORMAT_PACKET, |
| 460 | - .sub_format = UDEBUG_DLT_NETLINK, |
| 461 | - .flags = rx_flags, |
| 462 | - .n_flags = ARRAY_SIZE(rx_flags), |
| 463 | - }; |
| 464 | - bool val = ucv_is_truish(uc_fn_arg(0)); |
| 465 | - static bool enabled = false; |
| 466 | - |
| 467 | - if (enabled == val) |
| 468 | - return ucv_boolean_new(true); |
| 469 | - |
| 470 | - enabled = val; |
| 471 | - if (val) { |
| 472 | - udebug_init(&ud); |
| 473 | - udebug_auto_connect(&ud, NULL); |
| 474 | - udebug_buf_init(&ud_log, 1024, 64 * 1024); |
| 475 | - udebug_buf_add(&ud, &ud_log, &meta_log); |
| 476 | - udebug_buf_init(&ud_nl[0], 1024, 256 * 1024); |
| 477 | - udebug_buf_add(&ud, &ud_nl[0], &meta_nl_rx); |
| 478 | - udebug_buf_init(&ud_nl[1], 1024, 64 * 1024); |
| 479 | - udebug_buf_add(&ud, &ud_nl[1], &meta_nl_tx); |
| 480 | - udebug_buf_init(&ud_nl[2], 256, 32 * 1024); |
| 481 | - udebug_buf_add(&ud, &ud_nl[2], &meta_nl_ll); |
| 482 | - |
| 483 | - wpa_printf_hook = udebug_printf_hook; |
| 484 | - wpa_hexdump_hook = udebug_hexdump_hook; |
| 485 | - wpa_netlink_hook = udebug_netlink_hook; |
| 486 | - } else { |
| 487 | - for (size_t i = 0; i < ARRAY_SIZE(ud_nl); i++) |
| 488 | - udebug_buf_free(&ud_nl[i]); |
| 489 | - udebug_buf_free(&ud_log); |
| 490 | - udebug_free(&ud); |
| 491 | - wpa_printf_hook = NULL; |
| 492 | - wpa_hexdump_hook = NULL; |
| 493 | - wpa_netlink_hook = NULL; |
| 494 | - } |
| 495 | - |
| 496 | - return ucv_boolean_new(true); |
| 497 | -} |
| 498 | - |
| 499 | uc_value_t *wpa_ucode_global_init(const char *name, uc_resource_type_t *global_type) |
| 500 | { |
| 501 | uc_value_t *global = uc_resource_new(global_type, NULL); |
| 502 | diff --git a/package/network/services/hostapd/src/src/utils/ucode.h b/package/network/services/hostapd/src/src/utils/ucode.h |
| 503 | index c083241e079..2c1886976ee 100644 |
| 504 | --- a/package/network/services/hostapd/src/src/utils/ucode.h |
| 505 | +++ b/package/network/services/hostapd/src/src/utils/ucode.h |
| 506 | @@ -21,7 +21,6 @@ int wpa_ucode_registry_add(uc_value_t *reg, uc_value_t *val); |
| 507 | uc_value_t *wpa_ucode_registry_get(uc_value_t *reg, int idx); |
| 508 | uc_value_t *wpa_ucode_registry_remove(uc_value_t *reg, int idx); |
| 509 | |
| 510 | -uc_value_t *uc_wpa_udebug_set(uc_vm_t *vm, size_t nargs); |
| 511 | uc_value_t *uc_wpa_printf(uc_vm_t *vm, size_t nargs); |
| 512 | uc_value_t *uc_wpa_getpid(uc_vm_t *vm, size_t nargs); |
| 513 | uc_value_t *uc_wpa_sha1(uc_vm_t *vm, size_t nargs); |
| 514 | diff --git a/package/network/services/hostapd/src/wpa_supplicant/ucode.c b/package/network/services/hostapd/src/wpa_supplicant/ucode.c |
| 515 | index 397f85bde7f..6cba73dcd53 100644 |
| 516 | --- a/package/network/services/hostapd/src/wpa_supplicant/ucode.c |
| 517 | +++ b/package/network/services/hostapd/src/wpa_supplicant/ucode.c |
| 518 | @@ -262,7 +262,6 @@ int wpas_ucode_init(struct wpa_global *gl) |
| 519 | { "getpid", uc_wpa_getpid }, |
| 520 | { "add_iface", uc_wpas_add_iface }, |
| 521 | { "remove_iface", uc_wpas_remove_iface }, |
| 522 | - { "udebug_set", uc_wpa_udebug_set }, |
| 523 | }; |
| 524 | static const uc_function_list_t iface_fns[] = { |
| 525 | { "status", uc_wpas_iface_status }, |