Netdev List
 help / color / mirror / Atom feed
* [PATCH net 0/7] pull request: fixes for ovpn 2026-11-24
@ 2026-11-25  0:22 Antonio Quartulli
  2026-11-25  0:22 ` [PATCH net 1/7] ovpn: avoid sending UDP packets with source port 0 Antonio Quartulli
                   ` (7 more replies)
  0 siblings, 8 replies; 11+ messages in thread
From: Antonio Quartulli @ 2026-11-25  0:22 UTC (permalink / raw)
  To: netdev
  Cc: Antonio Quartulli, Sabrina Dubroca, Ralf Lici, Jakub Kicinski,
	Paolo Abeni, Andrew Lunn, David S. Miller, Eric Dumazet

Hi all!

v2 of the ovpn fixes PR, addressing the review on v1.

All patches fix code released since v6.16 and carry Cc: stable. Let me
know if these should rather go via net-next.

Patches 1-6 fix issues reported by Sashiko and confirmed by code
inspection; they are not triggered by OpenVPN userspace. Patch 7 fixes
a selftest crash we hit on musl.

Two of them fix crashes reachable by a CAP_NET_ADMIN user via netlink:

* NULL deref on TX: an IPv6 remote was accepted on an AF_INET UDP
  socket, and ip6_dst_lookup_flow() then dereferences inet6_sk(sk),
  which is NULL. Such remotes are now rejected and the socket family is
  rechecked on TX (patches 3-4).

* Out-of-bounds access: a raw socket with IPPROTO_UDP could be attached
  and used as a struct udp_sock. Only real UDP/TCP sockets are now
  accepted (patch 2).

The others avoid UDP packets with source port 0 and fix TX accounting:
TX bytes now account the same payload as RX, and locally dropped
packets are no longer counted as sent nor refresh the keepalive timer.

Changes since v1:
* patch 5: replaced, TX bytes are accounted like RX for UDP and TCP
* patch 6: also cover TCP packets dropped from the output queue
* patch 7: fixed Fixes: tag
* patch 3: clarified commit message
* rebased on current net

v1: https://lore.kernel.org/netdev/20261022121606.732029-1-antonio@openvpn.net/

Please pull or let me know of any issue!

Thanks,
	Antonio

The following changes since commit c5de2ce2fccdb7d3b48946179634eaa3d7ce2e7e:

  tcp: fix shift-out-of-bounds in inet_csk_rto_backoff() (2026-11-24 11:10:47 +0100)

are available in the Git repository at:

  https://github.com/OpenVPN/ovpn-net-next.git tags/ovpn-net-20261124

for you to fetch changes up to 8fca08ff62c9304549055290805f07add388816b:

  selftests: ovpn: avoid calling freeaddrinfo() on NULL (2026-11-24 15:55:18 +0100)

----------------------------------------------------------------
Included fixes:
* fix selftest tool segfault on musl caused by calling freeaddrinfo()
  on NULL
* fix TCP TX accounting, which counted packets dropped locally as sent,
  including those queued while the socket was owned by userspace, and
  refreshed the keepalive timer for them
* make TX byte counters account the same payload as RX: UDP relied on
  stale skb metadata, while TCP accounted the whole encrypted packet
* recheck the UDP socket family on TX, since userspace can still change
  it via IPV6_ADDRFORM or IPV6_V6ONLY, and tear the peer down on
  mismatch, ensuring the IPv6 TX path never sees a socket without IPv6
  state
* reject UDP remotes incompatible with the socket family, fixing a NULL
  pointer dereference on TX when an IPv6 remote is configured on an
  IPv4 UDP socket
* reject sockets that are not real UDP or TCP sockets, preventing e.g.
  a raw socket with IPPROTO_UDP from being treated as a udp_sock and
  accessed out of bounds
* avoid sending UDP packets with source port 0, and do not account
  locally dropped UDP packets as sent

----------------------------------------------------------------
Antonio Quartulli (2):
      ovpn: account TX bytes like RX
      selftests: ovpn: avoid calling freeaddrinfo() on NULL

Ralf Lici (5):
      ovpn: avoid sending UDP packets with source port 0
      ovpn: validate sockets before attaching peer transports
      ovpn: reject UDP remotes incompatible with socket family
      ovpn: recheck UDP socket family before transmit
      ovpn: fix TCP TX accounting for locally dropped packets

 drivers/net/ovpn/io.c                       |  18 ++--
 drivers/net/ovpn/netlink.c                  | 129 +++++++++++++++++++++-------
 drivers/net/ovpn/peer.c                     |  19 ++++
 drivers/net/ovpn/peer.h                     |   5 +-
 drivers/net/ovpn/skb.h                      |   2 +
 drivers/net/ovpn/socket.c                   |  16 ++--
 drivers/net/ovpn/tcp.c                      |  95 ++++++++++++--------
 drivers/net/ovpn/tcp.h                      |  10 +--
 drivers/net/ovpn/udp.c                      |  48 ++++++++---
 drivers/net/ovpn/udp.h                      |   4 +-
 tools/testing/selftests/net/ovpn/ovpn-cli.c |   3 +-
 11 files changed, 246 insertions(+), 103 deletions(-)

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

end of thread, other threads:[~2026-12-03 11:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25  0:22 [PATCH net 0/7] pull request: fixes for ovpn 2026-11-24 Antonio Quartulli
2026-11-25  0:22 ` [PATCH net 1/7] ovpn: avoid sending UDP packets with source port 0 Antonio Quartulli
2026-11-25  0:28   ` netdev-bot+sinfo
2026-12-01 13:31     ` Antonio Quartulli
2026-11-25  0:22 ` [PATCH net 2/7] ovpn: validate sockets before attaching peer transports Antonio Quartulli
2026-11-25  0:22 ` [PATCH net 3/7] ovpn: reject UDP remotes incompatible with socket family Antonio Quartulli
2026-11-25  0:22 ` [PATCH net 4/7] ovpn: recheck UDP socket family before transmit Antonio Quartulli
2026-11-25  0:22 ` [PATCH net 5/7] ovpn: account TX bytes like RX Antonio Quartulli
2026-11-25  0:22 ` [PATCH net 6/7] ovpn: fix TCP TX accounting for locally dropped packets Antonio Quartulli
2026-11-25  0:22 ` [PATCH net 7/7] selftests: ovpn: avoid calling freeaddrinfo() on NULL Antonio Quartulli
2026-12-03 11:19 ` [PATCH net 0/7] pull request: fixes for ovpn 2026-11-24 Paolo Abeni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox