HomeFreeBSD

netinet: allow UDP tunnels to be removed

Description

netinet: allow UDP tunnels to be removed

udp_set_kernel_tunneling() rejects new callbacks if one is already set.
Allow callbacks to be cleared. The use case for this is OpenVPN DCO,
where the socket is opened by userspace and then adopted by the kernel
to run the tunnel. If the DCO interface is removed but userspace does
not close the socket (something the kernel cannot prevent) the installed
callbacks could be called with an invalidated context.

Allow new functions to be set, but only if they're NULL (i.e. allow the
callback functions to be cleared).

Reviewed by: tuexen
MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D34288

Details

Provenance
kpAuthored on Feb 15 2022, 10:49 AM
Reviewer
tuexen
Differential Revision
D34288: netinet: allow UDP tunnels to be removed
Parents
rGc4f52f71de98: LinuxKPI: pci.h add more defines
Branches
Unknown
Tags
Unknown