aboutsummaryrefslogtreecommitdiffstats
path: root/package/firewall/files/lib
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-05-30 23:49:47 +0000
committerJo-Philipp Wich <jow@openwrt.org>2010-05-30 23:49:47 +0000
commite25fbfccdf8c5650fbb697e5d5e6028d36738a22 (patch)
treedbf66b795bba989bc534103f08e3794ecf800ef1 /package/firewall/files/lib
parent261d41a906a8afa3d8167b091ac0b891217d8251 (diff)
downloadupstream-e25fbfccdf8c5650fbb697e5d5e6028d36738a22.tar.gz
upstream-e25fbfccdf8c5650fbb697e5d5e6028d36738a22.tar.bz2
upstream-e25fbfccdf8c5650fbb697e5d5e6028d36738a22.zip
firewall: fix support for netranges in redirect and rule sections
SVN-Revision: 21640
Diffstat (limited to 'package/firewall/files/lib')
-rw-r--r--package/firewall/files/lib/config.sh4
-rw-r--r--package/firewall/files/lib/core_redirect.sh6
-rw-r--r--package/firewall/files/lib/core_rule.sh4
3 files changed, 7 insertions, 7 deletions
diff --git a/package/firewall/files/lib/config.sh b/package/firewall/files/lib/config.sh
index 1c5e030961..c21391266a 100644
--- a/package/firewall/files/lib/config.sh
+++ b/package/firewall/files/lib/config.sh
@@ -87,8 +87,8 @@ config_get_ipaddr() {
local vers=
case "$addr" in
- *.*) vers=4 ;;
- *:*) vers=6 ;;
+ *.*) vers=4; mask="${mask:-32}" ;;
+ *:*) vers=6; mask="${mask:-128}" ;;
esac
export ${NO_EXPORT:+-n} -- "${varn}=${addr}"
diff --git a/package/firewall/files/lib/core_redirect.sh b/package/firewall/files/lib/core_redirect.sh
index c19c494084..87f584e37b 100644
--- a/package/firewall/files/lib/core_redirect.sh
+++ b/package/firewall/files/lib/core_redirect.sh
@@ -42,8 +42,8 @@ fw_load_redirect() {
for redirect_proto in $redirect_proto; do
fw add $mode n zone_${redirect_src}_prerouting DNAT $ { $redirect_src_ip $redirect_dest_ip } { \
${redirect_proto:+-p $redirect_proto} \
- ${redirect_src_ip:+-s $redirect_src_ip} \
- ${redirect_src_dip:+-d $redirect_src_dip} \
+ ${redirect_src_ip:+-s $redirect_src_ip/$redirect_src_ip_prefixlen} \
+ ${redirect_src_dip:+-d $redirect_src_dip/$redirect_src_dip_prefixlen} \
${redirect_src_port:+--sport $redirect_src_port} \
${redirect_src_dport:+--dport $redirect_src_dport} \
${redirect_src_mac:+-m mac --mac-source $redirect_src_mac} \
@@ -53,7 +53,7 @@ fw_load_redirect() {
fw add $mode f zone_${redirect_src}_forward ACCEPT ^ { $redirect_src_ip $redirect_dest_ip } { \
-d $redirect_dest_ip \
${redirect_proto:+-p $redirect_proto} \
- ${redirect_src_ip:+-s $redirect_src_ip} \
+ ${redirect_src_ip:+-s $redirect_src_ip/$redirect_src_ip_prefixlen} \
${redirect_src_port:+--sport $redirect_src_port} \
${fwd_dest_port:+--dport $fwd_dest_port} \
${redirect_src_mac:+-m mac --mac-source $redirect_src_mac} \
diff --git a/package/firewall/files/lib/core_rule.sh b/package/firewall/files/lib/core_rule.sh
index 7beb153ba7..f93d49ebcf 100644
--- a/package/firewall/files/lib/core_rule.sh
+++ b/package/firewall/files/lib/core_rule.sh
@@ -56,10 +56,10 @@ fw_load_rule() {
for rule_proto in $rule_proto; do
fw add $mode f $chain $target $rule_pos { $rule_src_ip $rule_dest_ip } { \
${rule_proto:+-p $rule_proto} \
- ${rule_src_ip:+-s $rule_src_ip} \
+ ${rule_src_ip:+-s $rule_src_ip/$rule_src_ip_prefixlen} \
${rule_src_port:+--sport $rule_src_port} \
${rule_src_mac:+-m mac --mac-source $rule_src_mac} \
- ${rule_dest_ip:+-d $rule_dest_ip} \
+ ${rule_dest_ip:+-d $rule_dest_ip/$rule_dest_ip_prefixlen} \
${rule_dest_port:+--dport $rule_dest_port} \
${rule_icmp_type:+--icmp-type $rule_icmp_type} \
}