]> git.ipfire.org Git - thirdparty/openvpn.git/commit
Allow to set ifmode for existing DCO interfaces in FreeBSD
authorFranco Fichtner <franco@opnsense.org>
Tue, 28 May 2024 17:42:52 +0000 (17:42 +0000)
committerGert Doering <gert@greenie.muc.de>
Sun, 2 Jun 2024 12:43:07 +0000 (14:43 +0200)
commit82036c17c45d45c3fe8725f64b33720cb9c94dad
treefd02c47134462bfac57cddfbb033a25ba965b2d1
parentfbe3b49b373ea8e81aaa31a383258403a3bfcd07
Allow to set ifmode for existing DCO interfaces in FreeBSD

While prexisting devices work well TUN/TAP the DCO interfaces require
setting the ifmode which cannot be done by FreeBSD base tooling.  In
peer-to-peer mode this is not a problem because that is the default mode.
Subnet mode, however, will fail to be set and the resulting connection does
not start:

  Failed to create interface ovpns2 (SIOCSIFNAME): File exists (errno=17)
  DCO device ovpns2 already exists, won't be destroyed at shutdown
  /sbin/ifconfig ovpns2 10.1.8.1/24 mtu 1500 up
  ifconfig: in_exec_nl(): Empty IFA_LOCAL/IFA_ADDRESS
  ifconfig: ioctl (SIOCAIFADDR): Invalid argument
  FreeBSD ifconfig failed: external program exited with error status: 1
  Exiting due to fatal error

Slightly restructure the code to catch the specific error
condition and execute dco_set_ifmode() in this case as well.

Signed-off-by: Franco Fichtner <franco@opnsense.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <AE20A784-506C-488B-9302-2D3AE775B168@opnsense.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg28688.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/dco_freebsd.c