Netdev List
 help / color / mirror / Atom feed
From: Antonio Quartulli <antonio@openvpn.net>
To: netdev@vger.kernel.org
Cc: Antonio Quartulli <antonio@openvpn.net>,
	Sabrina Dubroca <sd@queasysnail.net>,
	Ralf Lici <ralf@mandelbit.com>, Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>
Subject: [PATCH net 0/7] pull request: fixes for ovpn 2026-11-24
Date: Wed, 25 Nov 2026 01:22:31 +0100	[thread overview]
Message-ID: <20261125002239.1191542-1-antonio@openvpn.net> (raw)

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

             reply	other threads:[~2026-11-25  0:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25  0:22 Antonio Quartulli [this message]
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-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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261125002239.1191542-1-antonio@openvpn.net \
    --to=antonio@openvpn.net \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ralf@mandelbit.com \
    --cc=sd@queasysnail.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox