From 39f4885b20b8e47973c113f29f9ea750729cc0f3 Mon Sep 17 00:00:00 2001 From: teastep Date: Fri, 16 Nov 2007 16:53:02 +0000 Subject: [PATCH] Improve MAC detection git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@7676 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall-perl/prog.header | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Shorewall-perl/prog.header b/Shorewall-perl/prog.header index f3fc09f7e..569e1ec45 100644 --- a/Shorewall-perl/prog.header +++ b/Shorewall-perl/prog.header @@ -912,11 +912,17 @@ find_mac() # $1 = IP address, $2 = interface { qt ping -nc 1 -t 2 -I $2 $1 - local result=$(arp -na | awk "/[(]$1[)].* on $2$/ {print \$4}") + local result=$(arp -na | awk "/[(]$1[)].* $2$/ {print \$4}") - [ -n "$result" -a "$result" != "" ] || fatal_error "Cannot determine the MAC address of $1 through $2" + case $result in + \<*\>) + ;; + *) + [ -n "$result" ] && echo $result && return + ;; + esac - echo $result + fatal_error "Cannot determine the MAC address of $1 through $2" } ################################################################################