hostapd: use new udebug ubus api to make debug rings configurable
[openwrt/staging/hauke.git] / package / network / services / hostapd / files / hostapd.uc
index 84138f29a58c177f66635b6436ff3299851726dc..b85f523b352fec118a3b8a614ae77db42db8b882 100644 (file)
@@ -782,33 +782,9 @@ let main_obj = {
        },
 };
 
-function handle_debug_config(cfg) {
-       hostapd.printf(`handle_debug_config: ${cfg}\n`);
-       if (!cfg)
-               return;
-
-       let data = cfg.service;
-       if (!data)
-               return;
-
-       data = data.hostapd;
-       if (!data)
-               return;
-
-       hostapd.udebug_set(!!+data.enabled);
-}
-
 hostapd.data.ubus = ubus;
 hostapd.data.obj = ubus.publish("hostapd", main_obj);
-hostapd.data.debug_sub = ubus.subscriber((req) => {
-       if (req.type != "config")
-               return;
-
-       handle_debug_config(req.data);
-});
-
-hostapd.data.debug_sub.subscribe("udebug");
-handle_debug_config(ubus.call("udebug", "get_config", {}));
+hostapd.udebug_set("hostapd", hostapd.data.ubus);
 
 function bss_event(type, name, data) {
        let ubus = hostapd.data.ubus;
@@ -823,6 +799,7 @@ return {
        shutdown: function() {
                for (let phy in hostapd.data.config)
                        iface_set_config(phy, null);
+               hostapd.udebug_set(null);
                hostapd.ubus.disconnect();
        },
        bss_add: function(name, obj) {