aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts/network-functions
diff options
context:
space:
mode:
Diffstat (limited to 'sysconfig/network-scripts/network-functions')
-rw-r--r--sysconfig/network-scripts/network-functions18
1 files changed, 8 insertions, 10 deletions
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index 462d141c..733215a1 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -9,16 +9,14 @@ export PATH
get_hwaddr ()
{
- {
- if [ -f /sys/class/net/${1}/address ]; then
- cat /sys/class/net/${1}/address
- elif [ -d "/sys/class/net/${1}" ]; then
- LC_ALL= LANG= ip -o link show ${1} 2>/dev/null | \
- sed 's/.*link\/[^ ]* \([[:alnum:]:]*\).*/\1/'
- fi
- } | \
- awk '{ print toupper($0) }'
-}
+ if [ -f /sys/class/net/${1}/address ]; then
+ awk '{ print toupper($0) }' < /sys/class/net/${1}/address
+ elif [ -d "/sys/class/net/${1}" ]; then
+ LC_ALL= LANG= ip -o link show ${1} 2>/dev/null | \
+ awk '{ print toupper(gensub(/.*link\/[^ ]* ([[:alnum:]:]*).*/,
+ "\\1", 1)); }'
+ fi
+}
get_config_by_hwaddr ()
{