46 lines
954 B
Bash
Executable File
46 lines
954 B
Bash
Executable File
#!/bin/sh /etc/rc.common
|
|
#
|
|
# Copyright (C) 2015 OpenWrt-dist
|
|
# Copyright (C) 2016 Chen RuiWei <crwbak@gmail.com>
|
|
# Copyright (C) 2018-2019 Lienol
|
|
#
|
|
# This is free software, licensed under the GNU General Public License v3.
|
|
# See /LICENSE for more information.
|
|
#
|
|
|
|
START=99
|
|
STOP=10
|
|
|
|
CONFIG=softethervpn
|
|
|
|
get_config()
|
|
{
|
|
config_get_bool enable $1 enable 0
|
|
}
|
|
|
|
uci_get_by_type() {
|
|
local index=0
|
|
if [ -n $4 ]; then
|
|
index=$4
|
|
fi
|
|
local ret=$(uci get $CONFIG.@$1[$index].$2 2>/dev/null)
|
|
echo ${ret:=$3}
|
|
}
|
|
|
|
start()
|
|
{
|
|
config_load softethervpn
|
|
config_foreach get_config softether
|
|
[ $enable -ne 1 ] && exit 0
|
|
logger -t 'softethervpn' "Starting softether vpnserver service."
|
|
/usr/bin/env LANG=en_US.UTF-8 /usr/libexec/softethervpn/vpnserver start > /dev/null 2>&1
|
|
fw3 reload
|
|
}
|
|
|
|
stop()
|
|
{
|
|
logger -t 'softethervpn' "Stopping softether vpnserver service."
|
|
/usr/bin/env LANG=en_US.UTF-8 /usr/libexec/softethervpn/vpnserver stop > /dev/null 2>&1
|
|
fw3 reload
|
|
}
|