Bug 255008 - Modification of the SoftEther VPN 5 (Developer Edition) rc script for initial configure TAP interface
Summary: Modification of the SoftEther VPN 5 (Developer Edition) rc script for initial...
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Koichiro Iwao
Depends on:
Reported: 2021-04-12 16:36 UTC by shrdlu19
Modified: 2021-04-25 10:00 UTC (History)
2 users (show)

See Also:
shrdlu19: maintainer-feedback?

softether_server modified rc script (1.78 KB, application/x-shellscript)
2021-04-12 16:36 UTC, shrdlu19
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description shrdlu19 2021-04-12 16:36:52 UTC
Created attachment 224055 [details]
softether_server modified rc script


I experimented with SoftEther VPN 5 Developer Edition (https://www.freshports.org/security/softether5/), and tried configuring Local Bridge using a virtual TAP interface. I was able to start the server with these settings, but for normal operation I need to manually run ifconfig to configure the ip-address on the created virtual interface, and these settings disappear after OS reboot or server restart.
I tried to modify the script that starts the Softether vpn server to fix this flaw. This works fine for me. I want to invite you to take a look at the changes I made.

First, I added three additional configuration parameters to the /usr/local/etc/rc.d/softether_server script:

# modified by shrdlu - added config options
# - tap_iface - TAP interface name for ifconfig command
# - tap_addr - TAP interface IP address for ifconfig command,
#   may be in CIDR format (a.b.c.d/x) or IP-address with netmask
#   (a.b.c.d netmask e.f.g.h)
# - tap_idle - delay before run ifconfig command for setup IP address on TAP interface

Secondly, I have defined a command to run after softether_server starts:

# modified by shrdlu - added command, running after softether-server started

And I wrote a function that configures the virtual TAP interface:

# modified by shrdlu - postcmd - running ifconfig after softether-server started
# with new configuration parameters
        if [ "${softether_server_tap_iface}" != none ]; then
                echo "Waiting ${softether_server_tap_idle} sec to create TAP interface"
                sleep ${softether_server_tap_idle}
                ifconfig ${softether_server_tap_iface} inet ${softether_server_tap_addr}

If people find these modifications correct and useful, then it might be worth checking out and including them in one of the next versions of the port. It is possible that some corrections need to be made. 

I have attached the my modified script to this report.