Development discussion of WireGuard
 help / color / mirror / Atom feed
* [bug] No keep-alives sent when private is set via PostUp
@ 2023-05-15 18:04 Maxim Cournoyer
  2023-05-18  1:17 ` Jason A. Donenfeld
  0 siblings, 1 reply; 4+ messages in thread
From: Maxim Cournoyer @ 2023-05-15 18:04 UTC (permalink / raw)
  To: WireGuard mailing list

Hello,

I've encountered an edge case where no keep alives would be sent
following recreating a connection with

--8<---------------cut here---------------start------------->8---
wg-quick down my-config-file
wg-quick up my-config-file
--8<---------------cut here---------------end--------------->8---

Where my-config-file contains something like:

--8<---------------cut here---------------start------------->8---
cat /gnu/store/zilv4f0jqa8nz8apqv8y3a6g0ifymxhc-wireguard-config/wg0.conf 
[Interface]
Address = 10.0.0.7/32
Table = auto

PostUp = /gnu/store/4cnl0h79zc599xryr5jh66d7yq643zk4-wireguard-tools-1.0.20210914/bin/wg set %i private-key /etc/wireguard/private.key

ListenPort = 51820

[Peer] #apteryx
PublicKey = JPWIbC9qMlnTkWfqGp0plOxWJ/ewOO/C9BuxIJles28=
AllowedIPs = 10.0.1.1/32
Endpoint = apteryx.duckdns.org:51820
PersistentKeepalive = 25
--8<---------------cut here---------------end--------------->8---

The following command on that machine:
--8<---------------cut here---------------start------------->8---
tcpdump -n -i any port 51820
--8<---------------cut here---------------end--------------->8---

wouldn't show any traffic.

Discussing this on #wireguard (libera.chat IRC), the another| user
thinks the problem could be triggered because of setting the private key
in using a PostUp directive; more specifically it is believed the
problem would happen when "no private key is defined when the interface
comes up".

-- 
Thanks,
Maxim

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [bug] No keep-alives sent when private is set via PostUp
  2023-05-15 18:04 [bug] No keep-alives sent when private is set via PostUp Maxim Cournoyer
@ 2023-05-18  1:17 ` Jason A. Donenfeld
  2023-05-18  1:22   ` Jason A. Donenfeld
  0 siblings, 1 reply; 4+ messages in thread
From: Jason A. Donenfeld @ 2023-05-18  1:17 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: WireGuard mailing list

Hi Maxim,

Thanks for the bug report! I think indeed you're right about this. Can
you test if this commit fixes the issue for you?

https://git.zx2c4.com/wireguard-linux/commit/?id=3ac1bf099766f1e9735883d5127148054cd5b30a

It at least satisfies the test case I added.

Until this patch hits stable kernels, you can probably work around
this by changing your PostUp into a PreUp. I adjusted the man page
here:

https://git.zx2c4.com/wireguard-tools/commit/?id=9d42bd1ab9d707f7a72162d36c9b37cc9bdf480e

Jason

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [bug] No keep-alives sent when private is set via PostUp
  2023-05-18  1:17 ` Jason A. Donenfeld
@ 2023-05-18  1:22   ` Jason A. Donenfeld
  2023-05-18  2:04     ` Maxim Cournoyer
  0 siblings, 1 reply; 4+ messages in thread
From: Jason A. Donenfeld @ 2023-05-18  1:22 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: WireGuard mailing list

On Thu, May 18, 2023 at 3:17 AM Jason A. Donenfeld <Jason@zx2c4.com> wrote:
> Until this patch hits stable kernels, you can probably work around
> this by changing your PostUp into a PreUp. I adjusted the man page
> here:
>
> https://git.zx2c4.com/wireguard-tools/commit/?id=9d42bd1ab9d707f7a72162d36c9b37cc9bdf480e

Er, nevermind about this part. PreUp executes before the interface is added.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [bug] No keep-alives sent when private is set via PostUp
  2023-05-18  1:22   ` Jason A. Donenfeld
@ 2023-05-18  2:04     ` Maxim Cournoyer
  0 siblings, 0 replies; 4+ messages in thread
From: Maxim Cournoyer @ 2023-05-18  2:04 UTC (permalink / raw)
  To: Jason A. Donenfeld; +Cc: WireGuard mailing list

Hi,

"Jason A. Donenfeld" <Jason@zx2c4.com> writes:

> On Thu, May 18, 2023 at 3:17 AM Jason A. Donenfeld <Jason@zx2c4.com> wrote:
>> Until this patch hits stable kernels, you can probably work around
>> this by changing your PostUp into a PreUp. I adjusted the man page
>> here:
>>
>> https://git.zx2c4.com/wireguard-tools/commit/?id=9d42bd1ab9d707f7a72162d36c9b37cc9bdf480e
>
> Er, nevermind about this part. PreUp executes before the interface is added.

Does that mean that the example bit changed in the man page needs to be
reverted?

-- 
Thanks,
Maxim

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-18  2:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-15 18:04 [bug] No keep-alives sent when private is set via PostUp Maxim Cournoyer
2023-05-18  1:17 ` Jason A. Donenfeld
2023-05-18  1:22   ` Jason A. Donenfeld
2023-05-18  2:04     ` Maxim Cournoyer

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).