Allow IPv6 address entry in tools>ping - Loosens valid character check
[tomato/davidwu.git] / release / src / router / nocat / libexec / iptables / uninitialize.fw
blob52e82b363f2d0b09714fc9e2881a92934226589b
1 #!/bin/sh
2 ##
4 # initialize.fw: setup the default firewall rules
6 # *** NOTE ***
7 # Copy from dualwan code to erase all rules
8 # If you want to have local firewall rules in addition to what NoCat
9 # provides, add them at the bottom of this file. They will be recreated
10 # each time gateway is restarted.
13 # The current service classes by fwmark are:
15 # 1: Owner
16 # 2: Co-op
17 # 3: Public
18 # 4: Free
20 #NOTE: all NoCat Configuration items should be set in the environment before calling.
23 export PATH=$FirewallPath:/tmp/sbin:/tmp/bin:/bin:/usr/bin:/sbin:/usr/sbin
25 # match rule numbers in the $1 table, chain $2
26 rule_num() {
27 NUM=`iptables -t $1 -L $2 -n | sed -e '1,2d' | grep -n $3 | head -n 1 | cut -d : -f 1`
28 if [ -z "$NUM" ]; then echo "0"; else echo "$NUM"; fi
31 #Test for RE-initialization:
32 NOCAT_RULE_NR=`rule_num filter FORWARD 'NoCat '`
33 if [ $NOCAT_RULE_NR -gt 0 ]; then
34 #yes, now check if this a linksys specific re-initialization
35 iptables -t filter -D FORWARD -j NoCat
36 iptables -t filter -F NoCat
37 iptables -t filter -X NoCat
38 iptables -t filter -F NoCat_Download
39 iptables -t filter -X NoCat_Download
40 iptables -t filter -F NoCat_Upload
41 iptables -t filter -X NoCat_Upload
42 iptables -t filter -F NoCat_Ports
43 iptables -t filter -X NoCat_Ports
44 iptables -t filter -F NoCat_Inbound
45 iptables -t filter -X NoCat_Inbound
46 iptables -t nat -D PREROUTING -j NoCat_Capture
47 iptables -t nat -F NoCat_Capture
48 iptables -t nat -X NoCat_Capture
49 iptables -t nat -D POSTROUTING -j NoCat_NAT
50 iptables -t nat -F NoCat_NAT
51 iptables -t nat -X NoCat_NAT
52 iptables -t mangle -D PREROUTING -j NoCat
53 iptables -t mangle -F NoCat
54 iptables -t mangle -X NoCat