7beb153ba79aef0650646c180d5a0fe93373e23a
1 # Copyright (C) 2009-2010 OpenWrt.org
4 [ "${rule_NAME}" != "$1" ] ||
return
5 fw_config_get_section
"$1" rule
{ \
17 string proto
"tcpudp" \
21 [ -n "$rule_name" ] || rule_name
=$rule__name
22 [ "$rule_proto" == "icmp" ] || rule_icmp_type
=
26 fw_config_get_rule
"$1"
30 rule_src_port
=$
(fw_get_port_range
$rule_src_port)
31 rule_dest_port
=$
(fw_get_port_range
$rule_dest_port)
34 [ -n "$rule_src" ] && {
35 [ -z "$rule_dest" ] && {
36 chain
=zone_
${rule_src}
38 chain
=zone_
${rule_src}_forward
42 local target
=$rule_target
47 target
=zone_
${rule_dest}_
${target}
50 local mode
=$
(fw_get_family_mode
${rule_family:-x} $rule_src I
)
53 eval 'rule_pos=$((++FW__RULE_COUNT_'$mode'_'$chain'))'
55 [ "$rule_proto" == "tcpudp" ] && rule_proto
="tcp udp"
56 for rule_proto
in $rule_proto; do
57 fw add
$mode f
$chain $target $rule_pos { $rule_src_ip $rule_dest_ip } { \
58 ${rule_proto:+-p $rule_proto} \
59 ${rule_src_ip:+-s $rule_src_ip} \
60 ${rule_src_port:+--sport $rule_src_port} \
61 ${rule_src_mac:+-m mac --mac-source $rule_src_mac} \
62 ${rule_dest_ip:+-d $rule_dest_ip} \
63 ${rule_dest_port:+--dport $rule_dest_port} \
64 ${rule_icmp_type:+--icmp-type $rule_icmp_type} \
This page took 0.04277 seconds and 3 git commands to generate.