From 61711e0e6bb2651abad72a5fd92dd195da060b77 Mon Sep 17 00:00:00 2001 From: d4nn13 Date: Sun, 19 Apr 2026 20:06:58 +0200 Subject: [PATCH] fix wirecon-mtu-probe unbound-variable under set -u Bash expands all arithmetic substitutions on a `local` line before the preceding assignments take effect, so `local mtu=$1 payload=$((mtu-28))` triggered "mtu: unbound variable" under set -u. Split into two lines. Also updated the printed "apply on both peers" hint from the old systemd-era `systemctl restart wg-quick@wg0` to the OpenRC form `rc-service wg-quick.wg0 restart` that matches this project. Co-Authored-By: Claude Opus 4.7 --- lxc/usr/local/bin/wirecon-mtu-probe.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lxc/usr/local/bin/wirecon-mtu-probe.sh b/lxc/usr/local/bin/wirecon-mtu-probe.sh index 87079a4..329e8ec 100755 --- a/lxc/usr/local/bin/wirecon-mtu-probe.sh +++ b/lxc/usr/local/bin/wirecon-mtu-probe.sh @@ -29,7 +29,8 @@ echo "probing PMTU toward $target (range $MTU_MIN..$MTU_MAX)" >&2 # ICMP payload = mtu - 28 (IP+ICMP headers) probe_ok() { - local mtu=$1 payload=$((mtu - 28)) + local mtu=$1 + local payload=$((mtu - 28)) ping -M do -s "$payload" -c 1 -W 2 -n "$target" >/dev/null 2>&1 } @@ -61,5 +62,5 @@ echo "path MTU: $best" echo "recommended WG MTU: $wg_mtu" echo echo "apply on both peers:" -echo " sudo sed -i 's/^MTU = .*/MTU = ${wg_mtu}/' /etc/wireguard/wg0.conf" -echo " sudo systemctl restart wg-quick@wg0" +echo " sed -i 's/^MTU = .*/MTU = ${wg_mtu}/' /etc/wireguard/wg0.conf" +echo " rc-service wg-quick.wg0 restart"