Template hostapd interface/SSIDs/5GHz radio lines; guard against other-host hardcodes

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KqhjP7nud5gdBg25zCiRk9
This commit is contained in:
2026-09-23 14:48:22 -04:00
co-authored by Claude Sonnet 5
parent a39fd5a654
commit ac897799e6
8 changed files with 62 additions and 11 deletions
+36
View File
@@ -52,6 +52,12 @@ r() { VANLINK_CONF="hosts/$1.conf" ./deploy.sh render "$2"; }
expect() { # expect <host> <file> <fixed string that must appear>
if r "$1" "$2" | grep -qF -- "$3"; then ok "$1: $2 has '$3'"; else bad "$1: $2 lacks '$3'"; fi
}
expect_line() { # expect_line <host> <file> <whole line that must appear>
if r "$1" "$2" | grep -qxF -- "$3"; then ok "$1: $2 has line '$3'"; else bad "$1: $2 lacks line '$3'"; fi
}
expect_absent() { # expect_absent <host> <file> <fixed string that must NOT appear>
if r "$1" "$2" | grep -qF -- "$3"; then bad "$1: $2 must not contain '$3'"; else ok "$1: $2 has no '$3'"; fi
}
expect van ap/nftables.conf 'ip saddr 10.42.1.0/24'
expect wan ap/nftables.conf 'ip saddr 10.42.0.0/24'
expect van ap/van-br0-setup.service 'brctl addif br0 enP1p17s0'
@@ -63,6 +69,19 @@ expect van ap/van-ap-unmanaged.conf 'interface-name:enP1p17s0'
expect wan ap/van-ap-unmanaged.conf 'interface-name:enx00e04c331140;interface-name:eth0'
expect wan ap/23-van-lan-eth0.network 'Name=eth0'
expect van power/nvme-watch-config.json '"nvme_device": ""'
expect wan ap/hostapd.conf 'interface=wlxc83a35a4ee55'
expect van ap/hostapd.conf 'interface=wlp1s0'
expect wan ap/hostapd-2g.conf 'interface=wlxf4f26d1760a7'
expect van ap/hostapd-2g.conf 'interface=wlx3c3332002066'
expect_line wan ap/hostapd.conf 'ssid=VanLink'
expect_line van ap/hostapd.conf 'ssid=VanLink2'
expect_line wan ap/hostapd-2g.conf 'ssid=VanLink'
expect_line van ap/hostapd-2g.conf 'ssid=VanLink2-2G'
expect_line wan ap/hostapd.conf 'vht_oper_chwidth=1'
expect_line wan ap/hostapd.conf 'he_oper_centr_freq_seg0_idx=155'
expect_line wan ap/hostapd.conf 'ieee80211h=0'
expect_line van ap/hostapd.conf 'he_su_beamformee=1'
expect_absent van ap/hostapd.conf 'vht_oper_chwidth'
if r van ap/van-ap-unmanaged.conf | grep -q 'eth0'; then
bad "van: unmanaged-devices must not mention eth0 (ONBOARD_LAN_IFACE is empty)"
else
@@ -114,5 +133,22 @@ if out=$(./deploy.sh --diff hosts/van.conf 2>&1) && echo "$out" | grep -qE '^(NE
else
bad "deploy.sh --diff hosts/van.conf"; echo "$out" | sed 's/^/ /'
fi
if echo "$out" | grep -qE '^(NEW|CHANGED) +/etc/systemd/system/van-ap-dnsmasq\.service$'; then
ok "--diff covers plain-install files"
else
bad "--diff does not list plain-install file van-ap-dnsmasq.service"
fi
# 9. no interface name of one host hardcoded in a shipped file (the hostapd-2g.conf class of bug)
for c in hosts/*.conf; do
for v in WIFI_5G_IFACE WIFI_2G_IFACE LAN_IFACE STARLINK_IFACE; do
val=$(unset "$v"; . "./$c"; echo "${!v}")
if hits=$(git grep -nF -- "$val" -- . ':!hosts' ':!docs' ':!tests' ':!*.md' ':!*.bak'); then
bad "$c: $v value '$val' is hardcoded outside hosts/"; echo "$hits" | sed 's/^/ /'
else
ok "$c: $v value '$val' appears only in hosts/"
fi
done
done
exit "$fail"