firewall3: update init.d script to make use of procd
add validation data Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 39617
This commit is contained in:
		@@ -1,25 +1,65 @@
 | 
				
			|||||||
#!/bin/sh /etc/rc.common
 | 
					#!/bin/sh /etc/rc.common
 | 
				
			||||||
 | 
					
 | 
				
			||||||
START=19
 | 
					START=19
 | 
				
			||||||
 | 
					USE_PROCD=1
 | 
				
			||||||
 | 
					QUIET=""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
boot() {
 | 
					validate_firewall_redirect()
 | 
				
			||||||
	# Be silent on boot, firewall might be started by hotplug already,
 | 
					{
 | 
				
			||||||
	# so don't complain in syslog.
 | 
						uci_validate_section firewall redirect "${1}" \
 | 
				
			||||||
	fw3 -q start
 | 
							'proto:or("tcp", "udp", "tcpudp")' \
 | 
				
			||||||
 | 
							'src:string' \
 | 
				
			||||||
 | 
							'src_ip:ipaddr' \
 | 
				
			||||||
 | 
							'src_dport:string' \
 | 
				
			||||||
 | 
							'dest:string' \
 | 
				
			||||||
 | 
							'dest_ip:ipaddr' \
 | 
				
			||||||
 | 
							'dest_port:string' \
 | 
				
			||||||
 | 
							'target:or("SNAT", "DNAT")'
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						return $?
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
start() {
 | 
					validate_firewall_rule()
 | 
				
			||||||
	fw3 start
 | 
					{
 | 
				
			||||||
 | 
						uci_validate_section firewall rule "${1}" \
 | 
				
			||||||
 | 
							'proto:string' \
 | 
				
			||||||
 | 
							'src:string' \
 | 
				
			||||||
 | 
							'dest:string' \
 | 
				
			||||||
 | 
							'src_port:string' \
 | 
				
			||||||
 | 
							'dest_port:string' \
 | 
				
			||||||
 | 
							'target:string'
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						return $?
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
stop() {
 | 
					service_triggers() {
 | 
				
			||||||
	fw3 flush
 | 
						procd_add_reload_trigger firewall	
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						procd_open_validate
 | 
				
			||||||
 | 
						validate_firewall_redirect
 | 
				
			||||||
 | 
						validate_firewall_rule
 | 
				
			||||||
 | 
						procd_close_validate
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
restart() {
 | 
					restart() {
 | 
				
			||||||
	fw3 restart
 | 
						fw3 restart
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
reload() {
 | 
					start_service() {
 | 
				
			||||||
 | 
						fw3 ${QUIET} start
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					stop_service() {
 | 
				
			||||||
 | 
						fw3 flush
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					reload_service() {
 | 
				
			||||||
	fw3 reload
 | 
						fw3 reload
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					boot() {
 | 
				
			||||||
 | 
						# Be silent on boot, firewall might be started by hotplug already,
 | 
				
			||||||
 | 
						# so don't complain in syslog.
 | 
				
			||||||
 | 
						QUIET=1
 | 
				
			||||||
 | 
						start
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user