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:
@@ -408,13 +408,13 @@ cmd_remove() {
|
||||
local tmp
|
||||
tmp="$(mktemp)"
|
||||
awk -v pk="$client_pubkey" '
|
||||
BEGIN {in=0; block=""; keep=1}
|
||||
BEGIN {inside=0; block=""; keep=1}
|
||||
/^\[Peer\]/ {
|
||||
if (in && keep) printf "%s", block
|
||||
in=1; block=$0 ORS; keep=1; next
|
||||
if (inside && keep) printf "%s", block
|
||||
inside=1; block=$0 ORS; keep=1; next
|
||||
}
|
||||
{
|
||||
if (in) {
|
||||
if (inside) {
|
||||
block = block $0 ORS
|
||||
if ($0 ~ /^PublicKey[[:space:]]*=/) {
|
||||
line=$0
|
||||
@@ -426,7 +426,7 @@ cmd_remove() {
|
||||
print
|
||||
}
|
||||
END {
|
||||
if (in && keep) printf "%s", block
|
||||
if (inside && keep) printf "%s", block
|
||||
}
|
||||
' "$WG_CONF" > "$tmp"
|
||||
mv "$tmp" "$WG_CONF"
|
||||
|
||||
Reference in New Issue
Block a user