From 411d68d11842f8fad4a78df12b46bc044cfe50e1 Mon Sep 17 00:00:00 2001
From: Erik Alexandre Pucci <eap08@c3sl.ufpr.br>
Date: Mon, 28 Feb 2011 23:00:33 -0300
Subject: [PATCH] mac-address/number.string: Use the getNetworkInterface() to
 obtain the nic

This garantees the script is going to obtain the network interface in use,
even in case of there is more than one default route(1).

Signed-off-by: Erik Alexandre Pucci <eap08@c3sl.ufpr.br>
Signed-off-by: Josiney de Souza <josineys@c3sl.ufpr.br>
---
 scripts/collect/mac-address/number.string | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/scripts/collect/mac-address/number.string b/scripts/collect/mac-address/number.string
index e804d62..52abc3e 100755
--- a/scripts/collect/mac-address/number.string
+++ b/scripts/collect/mac-address/number.string
@@ -21,8 +21,13 @@
 
 PATH=${PATH}:/sbin:/usr/sbin
 
-INTERFACE=$(route | grep default | awk '{print $NF}')
-MACADDR=$(ifconfig ${INTERFACE} | head -n1 | awk '{print $NF}' 2> /dev/null)
+# Include getNetworkInterface()
+source ${PREFIX}/client/common.sh
+
+# Obtain the network interface in use
+getNetworkInterface
+
+MACADDR=$(ifconfig ${interface} | head -n1 | awk '{print $NF}' 2> /dev/null)
 MACEXPRESSION="^([a-f0-9]{2}:){5}[a-f0-9]{2}$"
 
 if test -n "$(egrep -i ${MACEXPRESSION} <<< ${MACADDR})"; then
-- 
GitLab