Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 3, 2023

Conversation

metalefty
Copy link
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
@metalefty
Copy link
Contributor Author

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

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