wg-quick: linux: only touch net.ipv4 for v4

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2019-11-21 10:53:45 +01:00
parent cf7ec31d2d
commit a59aa6c404

View file

@ -194,9 +194,11 @@ add_default() {
cmd ip $proto route add "$1" dev "$INTERFACE" table $table cmd ip $proto route add "$1" dev "$INTERFACE" table $table
cmd ip $proto rule add not fwmark $table table $table cmd ip $proto rule add not fwmark $table table $table
cmd ip $proto rule add table main suppress_prefixlength 0 cmd ip $proto rule add table main suppress_prefixlength 0
while read -r key _ value; do if [[ $proto == -4 ]]; then
[[ $value -eq 1 ]] && sysctl -q "$key=2" while read -r key _ value; do
done < <(sysctl -a -r '^net\.ipv4.conf\.[^ .=]+\.rp_filter$') [[ $value -eq 1 ]] && sysctl -q "$key=2"
done < <(sysctl -a -r '^net\.ipv4.conf\.[^ .=]+\.rp_filter$')
fi
return 0 return 0
} }