From 676c017ecfced2e37aeec176f8aa6b9df90024f3 Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 5 Apr 2006 02:09:22 +0000 Subject: large init script cleanup and merge of whiterussian changes, new dnsmasq config handling git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@3588 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/iptables/files/firewall.awk | 64 +++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 package/iptables/files/firewall.awk (limited to 'package/iptables/files/firewall.awk') diff --git a/package/iptables/files/firewall.awk b/package/iptables/files/firewall.awk new file mode 100644 index 000000000..1b63f8386 --- /dev/null +++ b/package/iptables/files/firewall.awk @@ -0,0 +1,64 @@ +BEGIN { + 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=":" +} + +($1 == "accept") || ($1 == "drop") || ($1 == "forward") { + delete _opt + str2data($2) + if ((_l["proto"] == "") && (_l["sport"] _l["dport"] != "")) { + _opt[0] = " -p tcp" + _opt[1] = " -p udp" + } else { + _opt[0] = "" + } +} + +($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 "" + } +} + +($1 == "drop") { + for (o in _opt) { + print "iptables -t nat -A prerouting_$ifname" _opt[o] str2ipt($2) " -j DROP" + print "" + } +} + +($1 == "forward") { + target = " -j DNAT --to " $3 + fwopts = "" + if ($4 != "") { + if ((_l["proto"] == "tcp") || (_l["proto"] == "udp") || (_l["proto"] == "")) { + if (_l["proto"] != "") fwopts = " -p " _l["proto"] + fwopts = fwopts " --dport " $4 + target = target ":" $4 + } + 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 "" + } +} -- cgit v1.2.3 From be8ad0190d689eb7f797bdc0618d7e87892a831d Mon Sep 17 00:00:00 2001 From: nbd Date: Tue, 30 May 2006 19:38:38 +0000 Subject: resync with kamikaze git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@3844 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/iptables/files/firewall.awk | 1 + 1 file changed, 1 insertion(+) (limited to 'package/iptables/files/firewall.awk') diff --git a/package/iptables/files/firewall.awk b/package/iptables/files/firewall.awk index 1b63f8386..1a201a0bc 100644 --- a/package/iptables/files/firewall.awk +++ b/package/iptables/files/firewall.awk @@ -1,4 +1,5 @@ BEGIN { + print ". /etc/config/network" print "proto=\"$wan_proto\"" print "[ -z \"$proto\" -o \"$proto\" = \"none\" ] && exit" print "ifname=\"$wan_ifname\"" -- cgit v1.2.3 From fabc9e7893e9cab508e753172fa82028aad2f5a0 Mon Sep 17 00:00:00 2001 From: nbd Date: Tue, 27 Jun 2006 23:53:48 +0000 Subject: add missing copyright notices git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4097 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/iptables/files/firewall.awk | 2 ++ 1 file changed, 2 insertions(+) (limited to 'package/iptables/files/firewall.awk') diff --git a/package/iptables/files/firewall.awk b/package/iptables/files/firewall.awk index 1a201a0bc..537833004 100644 --- a/package/iptables/files/firewall.awk +++ b/package/iptables/files/firewall.awk @@ -1,3 +1,5 @@ +# Copyright (C) 2006 OpenWrt.org + BEGIN { print ". /etc/config/network" print "proto=\"$wan_proto\"" -- cgit v1.2.3 From c4f3575368c5aeef4134d82125df2814d688cc2a Mon Sep 17 00:00:00 2001 From: nbd Date: Sun, 30 Jul 2006 03:09:09 +0000 Subject: rewrite of the network scripts and configuration git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4323 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/iptables/files/firewall.awk | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'package/iptables/files/firewall.awk') diff --git a/package/iptables/files/firewall.awk b/package/iptables/files/firewall.awk index 537833004..902c7b188 100644 --- a/package/iptables/files/firewall.awk +++ b/package/iptables/files/firewall.awk @@ -1,10 +1,7 @@ # 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 "ifname=\"$WAN\"" print "[ -z \"$ifname\" ] && exit" print "" print "iptables -X input_$ifname 2>&- >&-" -- cgit v1.2.3