fix(server): rename awk variable 'in' to 'inside' in wg-peerctl remove

'in' became a reserved keyword in GNU awk 5.x causing syntax errors
when removing peers. Peer deletion silently failed as a result.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-06 10:29:35 +03:00
parent 0aead8c3ad
commit 75b47e2404
+5 -5
View File
@@ -408,13 +408,13 @@ cmd_remove() {
local tmp local tmp
tmp="$(mktemp)" tmp="$(mktemp)"
awk -v pk="$client_pubkey" ' awk -v pk="$client_pubkey" '
BEGIN {in=0; block=""; keep=1} BEGIN {inside=0; block=""; keep=1}
/^\[Peer\]/ { /^\[Peer\]/ {
if (in && keep) printf "%s", block if (inside && keep) printf "%s", block
in=1; block=$0 ORS; keep=1; next inside=1; block=$0 ORS; keep=1; next
} }
{ {
if (in) { if (inside) {
block = block $0 ORS block = block $0 ORS
if ($0 ~ /^PublicKey[[:space:]]*=/) { if ($0 ~ /^PublicKey[[:space:]]*=/) {
line=$0 line=$0
@@ -426,7 +426,7 @@ cmd_remove() {
print print
} }
END { END {
if (in && keep) printf "%s", block if (inside && keep) printf "%s", block
} }
' "$WG_CONF" > "$tmp" ' "$WG_CONF" > "$tmp"
mv "$tmp" "$WG_CONF" mv "$tmp" "$WG_CONF"