add tpc change from #1949
[openwrt-10.03/.git] / package / iptables / files / firewall.awk
index 1a201a0bce56efb38fa99e29ee64b9fcdcb6efa8..31dbae0f33cf0ce20286a8ffee1fdc86f7646c9e 100644 (file)
@@ -1,21 +1,6 @@
+# Copyright (C) 2006 OpenWrt.org
+
 BEGIN {
-       print ". /etc/config/network"
-       print "proto=\"$wan_proto\""
-       print "[ -z \"$proto\" -o \"$proto\" = \"none\" ] && exit"
-       print "ifname=\"$wan_ifname\""
-       print "[ -z \"$ifname\" ] && exit"
-       print ""
-       print "iptables -X input_$ifname 2>&- >&-"
-       print "iptables -N input_$ifname"
-       print "iptables -X forward_$ifname 2>&- >&-"
-       print "iptables -N forward_$ifname"
-       print "iptables -t nat -X prerouting_$ifname 2>&- >&-"
-       print "iptables -t nat -N prerouting_$ifname"
-       print ""
-       print "iptables -A input_rule -i \"$ifname\" -j input_$ifname"
-       print "iptables -A forwarding_rule -i \"$ifname\" -j forward_$ifname"
-       print "iptables -t nat -A prerouting_rule -i \"$ifname\" -j prerouting_$ifname"
-       print ""
        FS=":"
 }
 
@@ -33,15 +18,15 @@ BEGIN {
 ($1 == "accept") {
        target = " -j ACCEPT"
        for (o in _opt) {
-               print "iptables -t nat -A prerouting_$ifname" _opt[o] str2ipt($2) target
-               print "iptables        -A input_$ifname     " _opt[o] str2ipt($2) target
+               print "iptables -t nat -A prerouting_wan" _opt[o] str2ipt($2) target
+               print "iptables        -A input_wan     " _opt[o] str2ipt($2) target
                print ""
        }
 }
 
 ($1 == "drop") {
        for (o in _opt) {
-               print "iptables -t nat -A prerouting_$ifname" _opt[o] str2ipt($2) " -j DROP"
+               print "iptables -t nat -A prerouting_wan" _opt[o] str2ipt($2) " -j DROP"
                print ""
        }
 }
@@ -58,8 +43,8 @@ BEGIN {
                else fwopts = ""
        }
        for (o in _opt) {
-               print "iptables -t nat -A prerouting_$ifname" _opt[o] str2ipt($2) target
-               print "iptables        -A forward_$ifname   " _opt[o] " -d " $3 fwopts " -j ACCEPT"
+               print "iptables -t nat -A prerouting_wan" _opt[o] str2ipt($2) target
+               print "iptables        -A forwarding_wan   " _opt[o] " -d " $3 fwopts " -j ACCEPT"
                print ""
        }
 }