linux-stable/tools
Jason A. Donenfeld f58d0a9b4c wireguard: netlink: send staged packets when setting initial private key
Packets bound for peers can queue up prior to the device private key
being set. For example, if persistent keepalive is set, a packet is
queued up to be sent as soon as the device comes up. However, if the
private key hasn't been set yet, the handshake message never sends, and
no timer is armed to retry, since that would be pointless.

But, if a user later sets a private key, the expectation is that those
queued packets, such as a persistent keepalive, are actually sent. So
adjust the configuration logic to account for this edge case, and add a
test case to make sure this works.

Maxim noticed this with a wg-quick(8) config to the tune of:

    [Interface]
    PostUp = wg set %i private-key somefile

    [Peer]
    PublicKey = ...
    Endpoint = ...
    PersistentKeepalive = 25

Here, the private key gets set after the device comes up using a PostUp
script, triggering the bug.

Fixes: e7096c131e ("net: WireGuard secure network tunnel")
Cc: stable@vger.kernel.org
Reported-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Tested-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Link: https://lore.kernel.org/wireguard/87fs7xtqrv.fsf@gmail.com/
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2023-07-03 09:17:52 +01:00
..
accounting
arch - Remove the local symbols prefix of the get/put_user() exception 2023-06-27 12:25:42 -07:00
bootconfig
bpf
build
certs
cgroup
counter
debugging
edid
firewire
firmware
gpio
hv
iio
include Networking changes for 6.5. 2023-06-28 16:43:10 -07:00
io_uring
kvm/kvm_stat
laptop
leds
lib Networking changes for 6.5. 2023-06-28 16:43:10 -07:00
memory-model
mm
net/ynl tools: ynl: add display-hint support to ynl 2023-06-24 15:45:49 -07:00
objtool objtool changes for v6.5: 2023-06-27 15:05:41 -07:00
pci
pcmcia
perf Networking changes for 6.5. 2023-06-28 16:43:10 -07:00
power
rcu
scripts
spi
testing wireguard: netlink: send staged packets when setting initial private key 2023-07-03 09:17:52 +01:00
thermal
time
tracing
usb
verification
virtio
wmi
workqueue
Makefile