diff --git a/nix/pkgs/openwrt/uci-config.nix b/nix/pkgs/openwrt/uci-config.nix index 7619721..7e147b2 100644 --- a/nix/pkgs/openwrt/uci-config.nix +++ b/nix/pkgs/openwrt/uci-config.nix @@ -272,6 +272,7 @@ in ${concatMapStrings (ssid: let ssidConfig = radioConfig.ssids.${ssid}; + netConfig = config.site.net.${ssidConfig.net}; # mapping our option to openwrt/hostapd setting encryption = { @@ -286,6 +287,11 @@ in then ssidConfig.ifname else "${ifPrefix}-${ssidConfig.net}"; + pad = len: prefix: s: + if builtins.stringLength s < len + then pad len prefix "${prefix}${s}" + else s; + in '' uci add wireless wifi-iface uci set wireless.@wifi-iface[-1].ifname=${ifname} @@ -316,7 +322,15 @@ in uci set wireless.@wifi-iface[-1].ieee80211r=1 uci set wireless.@wifi-iface[-1].ft_over_ds=1 uci set wireless.@wifi-iface[-1].ft_psk_generate_local=1 - uci set wireless.@wifi-iface[-1].ieee80211v=1 + uci set wireless.@wifi-iface[-1].nasid='${pad 12 "0" ( + toString ((lib.toInt (lib.removePrefix "ap" hostName)) * 65536 + index) + )}' + ${lib.optionalString (netConfig.vlan != null) '' + uci set wireless.@wifi-iface[-1].mobility_domain='${ + pad 4 "0" (lib.toHexString (49920 + netConfig.vlan)) + }' + ''} + uci set wireless.@wifi-iface[-1].bss_transition=1 uci set wireless.@wifi-iface[-1].ft_bridge=${mgmtInterface} '' ) (builtins.attrNames radioConfig.ssids)}