From ad573469dfde0eadb5645d3e982b5734eeb2c50e Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Fri, 23 Apr 2010 20:06:45 -0700 Subject: [PATCH] A better fix for find_first_interface_address() Signed-off-by: Tom Eastep --- Shorewall/lib.common | 4 ++-- Shorewall/shorewall | 2 -- Shorewall6/lib.common | 4 ++-- Shorewall6/shorewall6 | 2 -- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Shorewall/lib.common b/Shorewall/lib.common index 1c3d304c4..952d74abd 100644 --- a/Shorewall/lib.common +++ b/Shorewall/lib.common @@ -431,7 +431,7 @@ find_first_interface_address() # $1 = interface # # get the line of output containing the first IP address # - addr=$($IP -f inet addr show $1 2> /dev/null | grep 'inet .* global' | head -n1) + addr=$(${IP:-ip} -f inet addr show $1 2> /dev/null | grep 'inet .* global' | head -n1) # # If there wasn't one, bail out now # @@ -448,7 +448,7 @@ find_first_interface_address_if_any() # $1 = interface # # get the line of output containing the first IP address # - addr=$($IP -f inet addr show $1 2> /dev/null | grep 'inet .* global' | head -n1) + addr=$(${IP:-ip} -f inet addr show $1 2> /dev/null | grep 'inet .* global' | 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 diff --git a/Shorewall/shorewall b/Shorewall/shorewall index b83e1631a..e63278858 100755 --- a/Shorewall/shorewall +++ b/Shorewall/shorewall @@ -39,8 +39,6 @@ get_config() { ensure_config_path if [ "$1" = Yes ]; then - [ -n "${IP:=ip}" ] - params=$(find_file params) if [ -f $params ]; then diff --git a/Shorewall6/lib.common b/Shorewall6/lib.common index b33ccd0d7..f686d9a6f 100644 --- a/Shorewall6/lib.common +++ b/Shorewall6/lib.common @@ -375,7 +375,7 @@ find_first_interface_address() # $1 = interface # # get the line of output containing the first IP address # - addr=$($IP -f inet6 addr show $1 2> /dev/null | grep 'inet6 .* global' | head -n1) + addr=$(${IP:-ip} -f inet6 addr show $1 2> /dev/null | grep 'inet6 .* global' | head -n1) # # If there wasn't one, bail out now # @@ -392,7 +392,7 @@ find_first_interface_address_if_any() # $1 = interface # # get the line of output containing the first IP address # - addr=$($IP -f inet6 addr show $1 2> /dev/null | grep 'inet6 2.* global' | head -n1) + addr=$(${IP:-ip} -f inet6 addr show $1 2> /dev/null | grep 'inet6 2.* global' | 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 diff --git a/Shorewall6/shorewall6 b/Shorewall6/shorewall6 index 075b61ddb..65ab1d6ee 100755 --- a/Shorewall6/shorewall6 +++ b/Shorewall6/shorewall6 @@ -39,8 +39,6 @@ get_config() { ensure_config_path if [ "$1" = Yes ]; then - [ -n "${IP:=ip}" ] - params=$(find_file params) if [ -f $params ]; then