ocserv: cleaned up startup script
Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
This commit is contained in:
parent
f2a42f6380
commit
1f9fe8b0b1
1 changed files with 5 additions and 7 deletions
|
@ -6,27 +6,26 @@ START=50
|
||||||
|
|
||||||
setup_firewall() {
|
setup_firewall() {
|
||||||
local port fw
|
local port fw
|
||||||
config_get port $1 port
|
config_get port $1 port
|
||||||
test -z "$port" && return
|
test -z "$port" && return
|
||||||
|
|
||||||
config_get fwport $1 "fwport"
|
config_get fwport $1 fwport
|
||||||
test "$fwport" = "$port" && return
|
test "$fwport" = "$port" && return
|
||||||
|
|
||||||
|
logger -t ocserv "opening port $port..."
|
||||||
#can we remove the old rule?
|
#can we remove the old rule?
|
||||||
uci add firewall rule
|
uci add firewall rule
|
||||||
uci set firewall.@rule[-1].src=wan
|
uci set firewall.@rule[-1].src=wan
|
||||||
|
uci set firewall.@rule[-1].name="ocserv-ext-port"
|
||||||
uci set firewall.@rule[-1].target=ACCEPT
|
uci set firewall.@rule[-1].target=ACCEPT
|
||||||
uci set firewall.@rule[-1].proto=tcpudp
|
uci set firewall.@rule[-1].proto=tcpudp
|
||||||
uci set firewall.@rule[-1].dest_port=$port
|
uci set firewall.@rule[-1].dest_port=$port
|
||||||
uci commit firewall
|
uci commit firewall
|
||||||
/etc/init.d/firewall restart
|
|
||||||
|
|
||||||
uci set ocserv.config.fwport="$port"
|
uci set ocserv.config.fwport="$port"
|
||||||
uci commit ocserv
|
uci commit ocserv
|
||||||
}
|
|
||||||
|
|
||||||
clear_firewall() {
|
/etc/init.d/firewall restart
|
||||||
iptables-save | grep -v ocserv-rule | iptables-restore
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_config() {
|
setup_config() {
|
||||||
|
@ -178,7 +177,6 @@ start() {
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
service_stop /usr/sbin/ocserv
|
service_stop /usr/sbin/ocserv
|
||||||
clear_firewall
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reload() {
|
reload() {
|
||||||
|
|
Loading…
Reference in a new issue