Unify portrange-support in firewall rule generator fixes #4404
authorSteven Barth <cyrus@openwrt.org>
Thu, 1 Jan 2009 13:05:16 +0000 (13:05 +0000)
committerSteven Barth <cyrus@openwrt.org>
Thu, 1 Jan 2009 13:05:16 +0000 (13:05 +0000)
SVN-Revision: 13791

package/firewall/files/uci_firewall.sh

index 41b2b5f76c399274fb871673c5ad3fd36549358a..93259fc96247213328375e8339814979334f0172 100755 (executable)
@@ -217,6 +217,16 @@ fw_rule() {
        config_get proto $1 proto
        config_get target $1 target
        config_get ruleset $1 ruleset
+
+       src_port_first=${src_port%-*}
+       src_port_last=${src_port#*-}
+       [ "$src_port_first" -ne "$src_port_last" ] && { \
+               src_port="$src_port_first:$src_port_last"; }
+
+       dest_port_first=${dest_port%-*}
+       dest_port_last=${dest_port#*-}
+       [ "$dest_port_first" -ne "$dest_port_last" ] && { \
+               dest_port="$dest_port_first:$dest_port_last"; }
        
        ZONE=input
        TARGET=$target