From: Michael Tremer Date: Thu, 17 Jun 2010 22:15:27 +0000 (+0200) Subject: network: Speedup function mac_generate. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=60e827825ea92186296e2cccc7b0f878c8686b7b;p=ipfire-3.x.git network: Speedup function mac_generate. --- diff --git a/pkgs/core/network/src/functions.util b/pkgs/core/network/src/functions.util index e61a41b86..3023154a8 100644 --- a/pkgs/core/network/src/functions.util +++ b/pkgs/core/network/src/functions.util @@ -130,7 +130,8 @@ function enabled() { function mac_generate() { local mac=() for i in $(seq 0 5); do - mac[i]="0x$(uuid | cut -c 1-2)" + mac[i]="$(uuid)" + mac[i]="0x${mac[i]:0:2}" done # Remove multicast bit @@ -141,11 +142,11 @@ function mac_generate() { local output for i in ${mac[*]}; do - if [ -n "${output}" ]; then - output="${output}:" - fi + if [ -n "${output}" ]; then + output="${output}:" + fi - output="${output}$(printf "%02x" ${i})" + output="${output}$(printf "%02x" ${i})" done # Check if output is valid