mirror-linux/drivers/net
Jason A. Donenfeld 3173bfdf89 wireguard: netlink: send staged packets when setting initial private key
commit f58d0a9b4c upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-07-19 16:22:17 +02:00
..
appletalk
arcnet
bonding bonding: do not assume skb mac_header is set 2023-07-19 16:21:12 +02:00
caif
can can: kvaser_pciefd: Set hardware timestamp on transmitted packets 2023-07-19 16:21:11 +02:00
dsa net: dsa: sja1105: always enable the send_meta options 2023-07-19 16:22:06 +02:00
ethernet octeontx-af: fix hardware timestamp configuration 2023-07-19 16:22:06 +02:00
fddi
fjes
hamradio
hippi
hyperv
ieee802154 ieee802154: hwsim: Fix possible memory leaks 2023-06-28 11:12:27 +02:00
ipa
ipvlan ipvlan: Fix return value of ipvlan_queue_xmit() 2023-07-19 16:21:13 +02:00
mctp
mdio net: mdio: mvusb: Fix an error handling path in mvusb_mdio_probe() 2023-05-24 17:32:31 +01:00
netdevsim
pcs net: pcs: xpcs: fix C73 AN not getting enabled 2023-05-24 17:32:47 +01:00
phy Revert "net: phy: dp83867: perform soft reset and retain established link" 2023-06-28 11:12:33 +02:00
plip
ppp pptp: Fix fib lookup calls. 2023-07-19 16:22:06 +02:00
pse-pd
slip
team net: fix stack overflow when LRO is disabled for virtual interfaces 2023-05-30 14:03:20 +01:00
usb net: usb: qmi_wwan: add support for Compal RXM-G1 2023-06-21 16:00:56 +02:00
vmxnet3
vxlan
wan net: lapbether: only support ethernet devices 2023-06-21 16:01:02 +02:00
wireguard wireguard: netlink: send staged packets when setting initial private key 2023-07-19 16:22:17 +02:00
wireless wifi: mt76: mt7921e: fix init command fail with enabled device 2023-07-19 16:22:10 +02:00
wwan net: wwan: t7xx: Ensure init is completed before system sleep 2023-06-09 10:34:15 +02:00
xen-netback
Kconfig
LICENSE.SRC
Makefile
Space.c
amt.c
bareudp.c
dummy.c
eql.c
geneve.c
gtp.c gtp: Fix use-after-free in __gtp_encap_destroy(). 2023-07-19 16:21:12 +02:00
ifb.c
loopback.c
macsec.c net: macsec: fix double free of percpu stats 2023-06-21 16:01:02 +02:00
macvlan.c
macvtap.c
mdio.c
mhi_net.c
mii.c
net_failover.c
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
sungem_phy.c
tap.c net: add vlan_get_protocol_and_depth() helper 2023-05-24 17:32:32 +01:00
thunderbolt.c
tun.c tun: Fix memory leak for detached NAPI queue. 2023-05-24 17:32:47 +01:00
veth.c
virtio_net.c virtio_net: use control_buf for coalesce params 2023-06-14 11:15:28 +02:00
vrf.c
vsockmon.c
xen-netfront.c