Am 15.12.2024 um 16:01 schrieb Felix Fietkau:
On 14.12.24 20:56, e9hack wrote:
Am 14.12.2024 um 12:02 schrieb Felix Fietkau:
On 14.12.24 11:47, e9hack wrote:
Hi,

it looks like that data.macaddr_base is always true even if no macaddr_base is 
set:

Which context does this happen in - hostapd, wpa_supplicant, wdev.uc or all of 
the above?

- Felix

It occurs with hostapd. The mac addresses are set correctly, but the config 
file contains something like this:

Does this help? https://nbd.name/p/9c3a2a8f

It doesn't help. It looks like that the pipe must be create without parameter 
macaddr_base if it is not set:

$ diff -u iface.uc.bak iface.uc
--- iface.uc.bak        2024-12-15 16:20:43.000000000 +0100
+++ iface.uc    2024-12-15 16:32:25.657917200 +0100
@@ -180,7 +180,10 @@
 let mac_idx = 0;
 export function prepare(data, phy, num_global_macaddr, macaddr_base) {
        if (!data.macaddr) {
-               let pipe = fs.popen(`ucode /usr/share/hostap/wdev.uc ${phy} 
get_macaddr id=${mac_idx} num_global=${num_global_macaddr} mbssid=${data.mbssid 
?? 0} macaddr_base=${macaddr_base}`);
+               let cmd = `ucode /usr/share/hostap/wdev.uc ${phy} get_macaddr 
id=${mac_idx} num_global=${num_global_macaddr} mbssid=${data.mbssid ?? 0}`;
+               if (macaddr_base)
+                       cmd += ` macaddr_base=${macaddr_base}`;
+               let pipe = fs.popen(cmd);

                data.macaddr = trim(pipe.read("all"), '\n');
                pipe.close();

I add some test code to common.uc:

$ diff -u common.uc.bak common.uc
--- common.uc.bak       2024-12-14 20:32:53.000000000 +0100
+++ common.uc   2024-12-15 16:18:04.000000000 +0100
@@ -204,6 +204,9 @@
                let mbssid = int(data.mbssid ?? 0) > 0;
                let num_global = int(data.num_global ?? 1);
                let use_global = !mbssid && idx < num_global;
+               let len = length(data.macaddr_base);
+
+               system(`logger "====> macaddr_generate: data=${data} 
data.macaddr_base=${data.macaddr_base} len=${len} <===="`);

                let base_addr = phy_sysfs_file(phy, "macaddress");
                if (!base_addr)

iface.uc unmodified:

Sun Dec 15 16:49:06 2024 user.notice root: ====> macaddr_generate: data={ id: 0, 
num_global: 1, mbssid: 0, macaddr_base: null } data.macaddr_base=null len=4 <====

your proposal:

Sun Dec 15 16:50:50 2024 user.notice root: ====> macaddr_generate: data={ id: 0, 
num_global: 1, mbssid: 0, macaddr_base:  } data.macaddr_base= len=0 <====

my proposal:

Sun Dec 15 16:51:46 2024 user.notice root: ====> macaddr_generate: data={ id: 0, 
num_global: 1, mbssid: 0 } data.macaddr_base=null len=null <====

In the last one is the null a real null and not a string.

Regards,
Hartmut


_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to