Skip to content

FreeBSD: Make sure to destroy tap device for bridge#1863

Merged
chipitsine merged 5 commits into
SoftEtherVPN:masterfrom
metalefty:bsdunixvlan-bridge
Jul 3, 2023
Merged

FreeBSD: Make sure to destroy tap device for bridge#1863
chipitsine merged 5 commits into
SoftEtherVPN:masterfrom
metalefty:bsdunixvlan-bridge

Conversation

@metalefty

Copy link
Copy Markdown
Contributor

This PR applies the same fix as well as #1859 for the bridge destination tap interface.

Behaviour after this PR

  1. No tap interfaces before starting vpnbridge.
root@freebsd:~/SoftEtherVPN/build # ifconfig -a -g tap
root@freebsd:~/SoftEtherVPN/build #
  1. Bridge tap device is created after starting vpnbridge.
root@freebsd:~/SoftEtherVPN/build # ./vpnbridge start
root@freebsd:~/SoftEtherVPN/build # ./vpncmd /server localhost /cmd:bridgelist
BridgeList command - Get List of Local Bridge Connection
Number|Virtual Hub Name|Network Adapter or Tap Device Name|Status
------+----------------+----------------------------------+---------
1     |BRIDGE          |bridge                            |Operating                        
The command completed successfully.         

root@freebsd:~/SoftEtherVPN/build # ifconfig -a -g tap
tap_bridge: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        description: SoftEther Virtual Network Adapter
        options=80000<LINKSTATE>
        ether 5e:d5:70:50:52:7d
        hwaddr 58:9c:fc:10:34:2a
        groups: tap
        media: Ethernet autoselect
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        Opened by PID 757
  1. All tap devices created by SoftEther are properly cleaned up after shutting down vpnbridge.
root@freebsd:~/SoftEtherVPN/build # ./vpnbridge stop
root@freebsd:~/SoftEtherVPN/build # ifconfig -a -g tap
root@freebsd:~/SoftEtherVPN/build #

Behaviour before this PR (e6123d3)

Tap device for bridge destination is not properly destroyed, remains after shutting down vpnbridge.

root@freebsd:~/SoftEtherVPN/build # ./vpnbridge start
root@freebsd:~/SoftEtherVPN/build # ifconfig -a -g tap
tap_bridge: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=80000<LINKSTATE>
        ether 5e:d5:70:50:52:7d
        hwaddr 58:9c:fc:10:34:2a
        inet 0.0.0.0 netmask 0xff000000 broadcast 255.255.255.255
        groups: tap
        media: Ethernet autoselect
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        Opened by PID 1187

root@freebsd:~/SoftEtherVPN/build # ./vpnbridge stop
root@freebsd:~/SoftEtherVPN/build # ifconfig -a -g tap
tap_bridge: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=80000<LINKSTATE>
        ether 5e:d5:70:50:52:7d
        hwaddr 58:9c:fc:10:34:2a
        groups: tap
        media: Ethernet autoselect
        status: no carrier
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

Also, rename NewTap/FreeTap to NewBridgeTap/FreeBridgeTap because these
functions are used to create/destroy tap device used for bridge
destination.
UNIX_VLAN_BRDEST_IFACE_PREFIX -> UNIX_VLAN_BRIDGE_IFACE_PREFIX
Comment thread src/Cedar/VLanUnix.c
Comment thread src/Cedar/VLanUnix.c Outdated
@metalefty

Copy link
Copy Markdown
Contributor Author

I've done what I'm going to do with this PR.

@chipitsine
chipitsine merged commit 8ac021a into SoftEtherVPN:master Jul 3, 2023
@metalefty
metalefty deleted the bsdunixvlan-bridge branch August 25, 2025 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants