From 08c45deb2efa42a121064056526b8715bccdee37 Mon Sep 17 00:00:00 2001 From: teastep Date: Mon, 23 Jun 2003 23:04:50 +0000 Subject: [PATCH] Make new code work on lesser shells git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@613 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall/firewall | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Shorewall/firewall b/Shorewall/firewall index bee287921..8db5f75f7 100755 --- a/Shorewall/firewall +++ b/Shorewall/firewall @@ -2869,11 +2869,11 @@ decodeaddr() { encodeaddr() { addr=$1 local x - local y=$(($addr % 256)) + local y=$(($addr & 255)) - for (( x=3 ; $x ; x-- )); do + for x in 1 2 3 ; do addr=$(($addr >> 8)) - y=$(($addr % 256)).$y + y=$(($addr & 255)).$y done echo $y @@ -2898,7 +2898,7 @@ ip_range() { # Netmask from CIDR # ip_netmask() { - echo $(( $(( 0xffffffff << $((32 - ${1#*/})) )) & 0xffffffff )) + echo $(( -1 << $((32 - ${1#*/})) )) } # # Network address from CIDR @@ -2916,7 +2916,7 @@ broadcastaddress() { local decodedaddr=`decodeaddr ${1%/*}` local netmask=`ip_netmask $1` - echo `encodeaddr $(( $(($decodedaddr & $netmask)) | $(( $netmask ^ 0xffffffff )) ))` + echo `encodeaddr $(( $(($decodedaddr & $netmask)) | $(( $netmask ^ -1 )) ))` } # # Test for subnet membership