From 0b0ab57b66b4b7a781f5c8cea4a0573add36617f Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sat, 4 Feb 2012 10:30:34 -0800 Subject: [PATCH] Correct mask generation in get_routed_networks() Signed-off-by: Tom Eastep --- Shorewall/lib.core | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Shorewall/lib.core b/Shorewall/lib.core index 31f006bf6..1d9ede88e 100644 --- a/Shorewall/lib.core +++ b/Shorewall/lib.core @@ -196,6 +196,10 @@ get_routed_networks() # $1 = interface name, $2-n = Fatal error message { local address local rest + local mask + + [ $g_family -eq 4 ] && mask=32 || mask=128 + $IP -$g_family route show dev $1 2> /dev/null | while read address rest; do @@ -211,12 +215,12 @@ get_routed_networks() # $1 = interface name, $2-n = Fatal error message multicast|broadcast|prohibit|nat|throw|nexthop) ;; [2-3]*) - [ "$address" = "${address%/*}" ] && address="${address}/128" + [ "$address" = "${address%/*}" ] && address="${address}/${mask}" echo $address ;; *) if [ $g_family -eq 4 ]; then - [ "$address" = "${address%/*}" ] && address="${address}/128" + [ "$address" = "${address%/*}" ] && address="${address}/${mask}" echo $address fi ;;