ap: add explicit ifname for ssids of duplicate nets

This commit is contained in:
Astro 2022-09-16 19:19:24 +02:00
parent 0002456abf
commit 70f63609f6
3 changed files with 21 additions and 10 deletions

View File

@ -1159,7 +1159,7 @@
htmode = "VHT80"; htmode = "VHT80";
ssids = { ssids = {
"ZW public" = { net = "pub"; encryption = "none"; }; "ZW public" = { net = "pub"; encryption = "none"; };
"Datenspuren" = { net = "pub"; encryption = "owe"; }; "Datenspuren" = { net = "pub"; encryption = "owe"; ifname = "wlan5-owe"; };
"ZW stage" = { net = "priv25"; }; "ZW stage" = { net = "priv25"; };
}; };
}; };
@ -1197,7 +1197,7 @@
htmode = "VHT80"; htmode = "VHT80";
ssids = { ssids = {
"ZW public" = { net = "pub"; encryption = "none"; }; "ZW public" = { net = "pub"; encryption = "none"; };
"Datenspuren" = { net = "pub"; encryption = "owe"; }; "Datenspuren" = { net = "pub"; encryption = "owe"; ifname = "wlan5-owe"; };
"ZW stage" = { net = "priv25"; }; "ZW stage" = { net = "priv25"; };
}; };
}; };
@ -1238,7 +1238,7 @@
ssids = { ssids = {
EWW = { net = "priv36"; }; EWW = { net = "priv36"; };
"ZW public" = { net = "pub"; encryption = "none"; }; "ZW public" = { net = "pub"; encryption = "none"; };
"Datenspuren" = { net = "pub"; encryption = "owe"; }; "Datenspuren" = { net = "pub"; encryption = "owe"; ifname = "wlan5-owe"; };
"ZW stage" = { net = "priv25"; }; "ZW stage" = { net = "priv25"; };
}; };
}; };
@ -1276,7 +1276,7 @@
htmode = "VHT80"; htmode = "VHT80";
ssids = { ssids = {
"ZW public" = { net = "pub"; encryption = "none"; }; "ZW public" = { net = "pub"; encryption = "none"; };
"Datenspuren" = { net = "pub"; encryption = "owe"; }; "Datenspuren" = { net = "pub"; encryption = "owe"; ifname = "wlan5-owe"; };
"ZW stage" = { net = "priv25"; }; "ZW stage" = { net = "priv25"; };
}; };
}; };
@ -1314,7 +1314,7 @@
htmode = "VHT80"; htmode = "VHT80";
ssids = { ssids = {
"ZW public" = { net = "pub"; encryption = "none"; }; "ZW public" = { net = "pub"; encryption = "none"; };
"Datenspuren" = { net = "pub"; encryption = "owe"; }; "Datenspuren" = { net = "pub"; encryption = "owe"; ifname = "wlan5-owe"; };
"ZW stage" = { net = "priv25"; }; "ZW stage" = { net = "priv25"; };
}; };
}; };
@ -1352,7 +1352,7 @@
htmode = "VHT80"; htmode = "VHT80";
ssids = { ssids = {
"ZW public" = { net = "pub"; encryption = "none"; }; "ZW public" = { net = "pub"; encryption = "none"; };
"Datenspuren" = { net = "pub"; encryption = "owe"; }; "Datenspuren" = { net = "pub"; encryption = "owe"; ifname = "wlan5-owe"; };
"ZW stage" = { net = "priv25"; }; "ZW stage" = { net = "priv25"; };
}; };
}; };
@ -1424,7 +1424,7 @@
htmode = "VHT80"; htmode = "VHT80";
ssids = { ssids = {
"ZW public" = { net = "pub"; encryption = "none"; }; "ZW public" = { net = "pub"; encryption = "none"; };
"Datenspuren" = { net = "pub"; encryption = "owe"; }; "Datenspuren" = { net = "pub"; encryption = "owe"; ifname = "wlan5-owe"; };
"ZW stage" = { net = "priv25"; }; "ZW stage" = { net = "priv25"; };
}; };
}; };
@ -1502,7 +1502,7 @@
htmode = "VHT80"; htmode = "VHT80";
ssids = { ssids = {
"ZW public" = { net = "pub"; encryption = "none"; }; "ZW public" = { net = "pub"; encryption = "none"; };
"Datenspuren" = { net = "pub"; encryption = "owe"; }; "Datenspuren" = { net = "pub"; encryption = "owe"; ifname = "wlan5-owe"; };
"ZW stage" = { net = "priv25"; }; "ZW stage" = { net = "priv25"; };
}; };
}; };

View File

@ -462,6 +462,10 @@ let
type = enum [ "ap" "sta" ]; type = enum [ "ap" "sta" ];
default = "ap"; default = "ap";
}; };
ifname = mkOption {
type = nullOr str;
default = null;
};
}; };
})); }));
}; };

View File

@ -265,16 +265,23 @@ in
${concatMapStrings (ssid: ${concatMapStrings (ssid:
let let
ssidConfig = radioConfig.ssids.${ssid}; ssidConfig = radioConfig.ssids.${ssid};
# mapping our option to openwrt/hostapd setting # mapping our option to openwrt/hostapd setting
encryption = { encryption = {
none = "none"; none = "none";
owe = "owe"; owe = "owe";
wpa2 = "psk2"; wpa2 = "psk2";
wpa3 = "sae-mixed"; wpa3 = "sae-mixed";
}.${radioConfig.ssids.${ssid}.encryption}; }.${ssidConfig.encryption};
ifname =
if ssidConfig.ifname != null
then ssidConfig.ifname
else "${ifPrefix}-${ssidConfig.net}";
in '' in ''
uci add wireless wifi-iface uci add wireless wifi-iface
uci set wireless.@wifi-iface[-1].ifname=${ifPrefix}-${ssidConfig.net} uci set wireless.@wifi-iface[-1].ifname=${ifname}
uci set wireless.@wifi-iface[-1].device=radio${toString index} uci set wireless.@wifi-iface[-1].device=radio${toString index}
uci set wireless.@wifi-iface[-1].ssid='${ssid}' uci set wireless.@wifi-iface[-1].ssid='${ssid}'
uci set wireless.@wifi-iface[-1].mode=${ssidConfig.mode} uci set wireless.@wifi-iface[-1].mode=${ssidConfig.mode}