1 # Copyright (C) 2009-2010 OpenWrt.org
4 [ "${rule_NAME}" != "$1" ] ||
return
5 fw_config_get_section
"$1" rule
{ \
16 string proto
"tcpudp" \
20 [ -n "$rule_name" ] || rule_name
=$rule__name
21 [ "$rule_proto" == "icmp" ] || rule_icmp_type
=
25 fw_config_get_rule
"$1"
29 rule_src_port
=$
(fw_get_port_range
$rule_src_port)
30 rule_dest_port
=$
(fw_get_port_range
$rule_dest_port)
33 [ -n "$rule_src" ] && {
34 [ -z "$rule_dest" ] && {
35 chain
=zone_
${rule_src}
37 chain
=zone_
${rule_src}_forward
41 local target
=$rule_target
46 target
=zone_
${rule_dest}_
${target}
49 local mode
=$
(fw_get_family_mode
${rule_family:-x} $rule_src I
)
52 eval 'rule_pos=$((++FW__RULE_COUNT_'$mode'_'$chain'))'
54 [ "$rule_proto" == "tcpudp" ] && rule_proto
="tcp udp"
55 for rule_proto
in $rule_proto; do
56 fw add
$mode f
$chain $target $rule_pos { $rule_src_ip $rule_dest_ip } { \
57 ${rule_proto:+-p $rule_proto} \
58 ${rule_src_ip:+-s $rule_src_ip/$rule_src_ip_prefixlen} \
59 ${rule_src_port:+--sport $rule_src_port} \
60 ${rule_src_mac:+-m mac --mac-source $rule_src_mac} \
61 ${rule_dest_ip:+-d $rule_dest_ip/$rule_dest_ip_prefixlen} \
62 ${rule_dest_port:+--dport $rule_dest_port} \
63 ${rule_icmp_type:+--icmp-type $rule_icmp_type} \
This page took 0.044054 seconds and 5 git commands to generate.