Per the conversation thread here:
http://www.mail-archive.com/[EMAIL PROTECTED]/msg04331.html and specifically in 
this message: http://www.mail-archive.com/[EMAIL PROTECTED]/msg04415.html find 
below the aforementioned patch that will never be integrated into shorewall and 
that we will have to carry forward until busybox is able to handle huge 
integers.

Signed-off-by:  Brian J. Murrell <[EMAIL PROTECTED]>

--- /dev/null   2008-04-20 11:31:37.000000000 -0400
+++ feeds/packages/net/shorewall-lite/patches/000-bc.patch      2008-06-18 
08:28:00.000000000 -0400
@@ -0,0 +1,69 @@
+Index: lib.base
+===================================================================
+--- before/lib.base    (revision 7931)
++++ after/lib.base     (working copy)
+@@ -455,6 +455,14 @@
+     echo $y
+ }
+ 
++addr_comp() {
++    test $(bc <<EOF
++$1 > $2
++EOF
++) -eq 1
++
++}
++
+ #
+ # Enumerate the members of an IP range -- When using a shell supporting only
+ # 32-bit signed arithmetic, the range cannot span 128.0.0.0.
+@@ -488,19 +496,19 @@
+     first=$(decodeaddr ${1%-*})
+     last=$(decodeaddr ${1#*-})
+ 
+-    if [ $first -gt $last ]; then
++    if addr_comp $first $last; then
+       fatal_error "Invalid IP address range: $1"
+     fi
+ 
+     l=$(( $last + 1 ))
+ 
+-    while [ $first -le $last ]; do
++    while addr_comp $last $first; do
+       vlsm=
+       x=31
+       y=2
+       z=1
+ 
+-      while [ $(( $first % $y )) -eq 0 -a $(( $first + $y )) -le $l ]; do
++      while [ $(( $first % $y )) -eq 0 ] && addr_comp $l $(( $first + $y )) ; 
do
+           vlsm=/$x
+           x=$(( $x - 1 ))
+           z=$y
+@@ -527,11 +535,11 @@
+     first=$(decodeaddr ${1%-*})
+     last=$(decodeaddr ${1#*-})
+ 
+-    if [ $first -gt $last ]; then
++    if addr_comp $first $last; then
+       fatal_error "Invalid IP address range: $1"
+     fi
+ 
+-    while [ $first -le $last ]; do
++    while ! addr_comp $first $last; do
+       echo $(encodeaddr $first)
+       first=$(($first + 1))
+     done
+@@ -583,8 +591,10 @@
+ in_network() # $1 = IP address, $2 = CIDR network
+ {
+     local netmask=$(ip_netmask $2)
+-
+-    test $(( $(decodeaddr $1) & $netmask)) -eq $(( $(decodeaddr ${2%/*}) & 
$netmask ))
++    #
++    # We compare the values as strings rather than integers to work around 
broken BusyBox ash on OpenWRT
++    #
++    test $(( $(decodeaddr $1) & $netmask)) = $(( $(decodeaddr ${2%/*}) & 
$netmask ))
+ }
+ 
+ #

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
openwrt-devel mailing list
[email protected]
http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to