1 # Copyright (C) 2006 OpenWrt.org
4 print "ifname=\"$WAN\""
5 print "[ -z \"$ifname\" ] && exit"
7 print "iptables -X input_$ifname 2>&- >&-"
8 print "iptables -N input_$ifname"
9 print "iptables -X forward_$ifname 2>&- >&-"
10 print "iptables -N forward_$ifname"
11 print "iptables -t nat -X prerouting_$ifname 2>&- >&-"
12 print "iptables -t nat -N prerouting_$ifname"
14 print "iptables -A input_rule -i \"$ifname\" -j input_$ifname"
15 print "iptables -A forwarding_rule -i \"$ifname\" -j forward_$ifname"
16 print "iptables -t nat -A prerouting_rule -i \"$ifname\" -j prerouting_$ifname"
21 ($
1 ==
"accept") || ($
1 ==
"drop") || ($
1 ==
"forward") {
24 if ((_l
["proto"] ==
"") && (_l
["sport"] _l
["dport"] != "")) {
35 print "iptables -t nat -A prerouting_$ifname" _opt
[o
] str2ipt
($
2) target
36 print "iptables -A input_$ifname " _opt
[o
] str2ipt
($
2) target
43 print "iptables -t nat -A prerouting_$ifname" _opt
[o
] str2ipt
($
2) " -j DROP"
49 target =
" -j DNAT --to " $
3
52 if ((_l
["proto"] ==
"tcp") || (_l
["proto"] ==
"udp") || (_l
["proto"] ==
"")) {
53 if (_l
["proto"] != "") fwopts =
" -p " _l
["proto"]
54 fwopts = fwopts
" --dport " $
4
55 target = target
":" $
4
60 print "iptables -t nat -A prerouting_$ifname" _opt
[o
] str2ipt
($
2) target
61 print "iptables -A forward_$ifname " _opt
[o
] " -d " $
3 fwopts
" -j ACCEPT"
This page took 0.046308 seconds and 5 git commands to generate.