From 76707d29ba6683e0755ac9771758d4ae04eef6f7 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Fri, 23 Sep 2011 14:44:01 -0700 Subject: [PATCH] Make find_first_interface_address() more lenient on IPv6 Signed-off-by: Tom Eastep --- Shorewall6/lib.common | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Shorewall6/lib.common b/Shorewall6/lib.common index 572e8fe1a..dac6d32ea 100644 --- a/Shorewall6/lib.common +++ b/Shorewall6/lib.common @@ -418,7 +418,7 @@ find_first_interface_address() # $1 = interface # # get the line of output containing the first IP address # - addr=$(${IP:-ip} -f inet6 addr show $1 2> /dev/null | grep 'inet6 .* global' | head -n1) + addr=$(${IP:-ip} -f inet6 addr show dev $1 2> /dev/null | fgrep 'inet6 ' | fgrep -v 'scope link' | head -n1) # # If there wasn't one, bail out now # @@ -435,7 +435,7 @@ find_first_interface_address_if_any() # $1 = interface # # get the line of output containing the first IP address # - addr=$(${IP:-ip} -f inet6 addr show $1 2> /dev/null | grep 'inet6 2.* global' | head -n1) + addr=$(${IP:-ip} -f inet6 addr show dev $1 2> /dev/null | fgrep 'inet6 ' | fgrep -v 'scope link' | head -n1) # # Strip off the trailing VLSM mask (or the peer IP in case of a P-t-P link) # along with everything else on the line