HomeFreeBSD

if_ovpn: Support multihomed server configurations

Description

if_ovpn: Support multihomed server configurations

In UDP server mode, openvpn implements the "multihome" option, which
makes it avoid binding to an address. Instead, the server socket is
bound to INADDR_ANY.

Today, when configuring a new peer and setting the source address,
sockaddr() returns the wildcard address, so the source address is
implicitly determined by the output interface. This doesn't work as one
would want if the WAN interface has multiple addresses and clients
connect to non-primary addresses.

Make multihome mode work properly: use the local address supplied by
openvpn in preference to that of the socket. We still fetch the port
number out of the socket.

PR: 273664
Reviewed by: kp
MFC after: 1 month
Sponsored by: Stormshield
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D51498

(cherry picked from commit 05b5d56c540335ed17acf843810901338bf862d5)

Details

Provenance
markjAuthored on Jul 25 2025, 1:15 PM
Reviewer
kp
Differential Revision
D51498: if_ovpn: Support multihomed server configurations
Parents
rG6bd8a7393f28: if_ovpn: Assert that udp_set_kernel_tunneling() succeeds
Branches
Unknown
Tags
Unknown