* [PATCH] wg-quick: avoid traffics from momentarily leaking into the tunnel
@ 2022-06-17 11:34 Tom Yan
2022-06-17 11:53 ` Jason A. Donenfeld
0 siblings, 1 reply; 2+ messages in thread
From: Tom Yan @ 2022-06-17 11:34 UTC (permalink / raw)
To: wireguard; +Cc: Tom Yan
The wireguard route table ip rule should stay as a NOP until the
`suppress_prefixlength 0 table main` rule is in effect. Therefore,
add the wireguard default route to its route table after the latter
rule is added.
Signed-off-by: Tom Yan <tom.ty89@gmail.com>
---
src/wg-quick/linux.bash | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/wg-quick/linux.bash b/src/wg-quick/linux.bash
index e4d4c4f..69e5bef 100755
--- a/src/wg-quick/linux.bash
+++ b/src/wg-quick/linux.bash
@@ -220,9 +220,9 @@ add_default() {
fi
local proto=-4 iptables=iptables pf=ip
[[ $1 == *:* ]] && proto=-6 iptables=ip6tables pf=ip6
- 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 table main suppress_prefixlength 0
+ cmd ip $proto route add "$1" dev "$INTERFACE" table $table
local marker="-m comment --comment \"wg-quick(8) rule for $INTERFACE\"" restore=$'*raw\n' nftable="wg-quick-$INTERFACE" nftcmd
printf -v nftcmd '%sadd table %s %s\n' "$nftcmd" "$pf" "$nftable"
--
2.36.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] wg-quick: avoid traffics from momentarily leaking into the tunnel
2022-06-17 11:34 [PATCH] wg-quick: avoid traffics from momentarily leaking into the tunnel Tom Yan
@ 2022-06-17 11:53 ` Jason A. Donenfeld
0 siblings, 0 replies; 2+ messages in thread
From: Jason A. Donenfeld @ 2022-06-17 11:53 UTC (permalink / raw)
To: Tom Yan; +Cc: wireguard
On Fri, Jun 17, 2022 at 07:34:19PM +0800, Tom Yan wrote:
> The wireguard route table ip rule should stay as a NOP until the
> `suppress_prefixlength 0 table main` rule is in effect. Therefore,
> add the wireguard default route to its route table after the latter
> rule is added.
>
> Signed-off-by: Tom Yan <tom.ty89@gmail.com>
Applied, thanks.
> ---
> src/wg-quick/linux.bash | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/wg-quick/linux.bash b/src/wg-quick/linux.bash
> index e4d4c4f..69e5bef 100755
> --- a/src/wg-quick/linux.bash
> +++ b/src/wg-quick/linux.bash
> @@ -220,9 +220,9 @@ add_default() {
> fi
> local proto=-4 iptables=iptables pf=ip
> [[ $1 == *:* ]] && proto=-6 iptables=ip6tables pf=ip6
> - 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 table main suppress_prefixlength 0
> + cmd ip $proto route add "$1" dev "$INTERFACE" table $table
>
> local marker="-m comment --comment \"wg-quick(8) rule for $INTERFACE\"" restore=$'*raw\n' nftable="wg-quick-$INTERFACE" nftcmd
> printf -v nftcmd '%sadd table %s %s\n' "$nftcmd" "$pf" "$nftable"
> --
> 2.36.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-06-17 11:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-17 11:34 [PATCH] wg-quick: avoid traffics from momentarily leaking into the tunnel Tom Yan
2022-06-17 11:53 ` Jason A. Donenfeld
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).