openwrtv3/package/network/config/firewall/files/firewall.init
John Crispin 2ae05c57f8 package/*: remove useless explicit set of function returncode
somebody started to set a function returncode in the validation
stuff and everybody copies it, e.g.

myfunction()
{
	fire_command

	return $?
}

a function automatically returns with the last returncode,
so we can safely remove the command 'return $?'. reference:

http://tldp.org/LDP/abs/html/exit-status.html
"The last command executed in the function or script determines the exit status."

Signed-off-by: Bastian Bittorf <bittorf@bluebottle.com>

SVN-Revision: 42278
2014-08-25 06:35:50 +00:00

61 lines
997 B
Bash
Executable file

#!/bin/sh /etc/rc.common
START=19
USE_PROCD=1
QUIET=""
validate_firewall_redirect()
{
uci_validate_section firewall redirect "${1}" \
'proto:or(uinteger, string)' \
'src:string' \
'src_ip:cidr' \
'src_dport:or(port, portrange)' \
'dest:string' \
'dest_ip:cidr' \
'dest_port:or(port, portrange)' \
'target:or("SNAT", "DNAT")'
}
validate_firewall_rule()
{
uci_validate_section firewall rule "${1}" \
'proto:or(uinteger, string)' \
'src:string' \
'dest:string' \
'src_port:or(port, portrange)' \
'dest_port:or(port, portrange)' \
'target:string'
}
service_triggers() {
procd_add_reload_trigger firewall
procd_open_validate
validate_firewall_redirect
validate_firewall_rule
procd_close_validate
}
restart() {
fw3 restart
}
start_service() {
fw3 ${QUIET} start
}
stop_service() {
fw3 flush
}
reload_service() {
fw3 reload
}
boot() {
# Be silent on boot, firewall might be started by hotplug already,
# so don't complain in syslog.
QUIET=-q
start
}