wg-quick: linux: iptables-* -w is not widely supported

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2019-12-05 11:47:57 +01:00
parent faa55d8b19
commit 9eab3487cd
1 changed files with 2 additions and 2 deletions

View File

@ -190,7 +190,7 @@ remove_iptables() {
[[ $line == "-A"* ]] && found=1 [[ $line == "-A"* ]] && found=1
printf -v restore '%s\n%s' "$restore" "${line/#-A/-D}" printf -v restore '%s\n%s' "$restore" "${line/#-A/-D}"
done < <($iptables-save) done < <($iptables-save)
[[ $found -ne 1 ]] || echo "$restore" | cmd $iptables-restore -nw [[ $found -ne 1 ]] || echo "$restore" | cmd $iptables-restore -n
done done
} }
@ -217,7 +217,7 @@ add_default() {
done done
printf -v restore '%s\nCOMMIT\n*mangle\n-I POSTROUTING -m mark --mark %d -p udp -j CONNMARK --save-mark %s\n-I PREROUTING -p udp -j CONNMARK --restore-mark %s\nCOMMIT\n' "$restore" $table "$marker" "$marker" printf -v restore '%s\nCOMMIT\n*mangle\n-I POSTROUTING -m mark --mark %d -p udp -j CONNMARK --save-mark %s\n-I PREROUTING -p udp -j CONNMARK --restore-mark %s\nCOMMIT\n' "$restore" $table "$marker" "$marker"
[[ $proto == -4 ]] && cmd sysctl -q net.ipv4.conf.all.src_valid_mark=1 [[ $proto == -4 ]] && cmd sysctl -q net.ipv4.conf.all.src_valid_mark=1
echo "$restore" | cmd $iptables-restore -nw echo "$restore" | cmd $iptables-restore -n
HAVE_SET_IPTABLES=1 HAVE_SET_IPTABLES=1
return 0 return 0
} }