diff options
Diffstat (limited to 'scripts/vyatta_net_name')
-rwxr-xr-x | scripts/vyatta_net_name | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/scripts/vyatta_net_name b/scripts/vyatta_net_name index a7e7be8e..9820d00f 100755 --- a/scripts/vyatta_net_name +++ b/scripts/vyatta_net_name @@ -21,6 +21,7 @@ # # **** End License **** +progname=${0##*/} debug= match= attr_address=0:0:0:0:0:0 @@ -99,6 +100,15 @@ declare -a cfg_net_hwid=( $( sed -ne ' } }' $BOOTFILE )) +finish () +{ + local cmd=$1 name=$2 address=$3 + + echo $name + touch /tmp/${progname}_${cmd}_${name}_${address} &> /dev/null + exit $? +} + for name_hwid in ${cfg_net_hwid[@]} ; do name=${name_hwid%=*} hwid=${name_hwid#*=} @@ -106,16 +116,8 @@ for name_hwid in ${cfg_net_hwid[@]} ; do [[ $ethn -gt $last_ethn ]] && \ last_ethn=$ethn if [ "$hwid" == "$attr_address" ] ; then - echo $name # we mod the config file interface sub-clock in case it is missing - if [[ "$BOOTFILE" != *test_* ]] && touch $BOOTFILE &> /dev/null ; then - ${vyatta_sbindir}/${cmd}_bootfile_eth_hwid \ - $BOOTFILE \ - $name \ - $attr_address \ - 2>&1 | logger - fi - exit 0 + finish mod $name $attr_address fi [ "$name" == "$kname" ] && \ match=$name_hwid @@ -128,13 +130,11 @@ done if [ -z "$match" ] ; then # the kernel interface name isnot in config # so, we might as well use it - name=$kname - cmd=add + finish add $kname $attr_address elif [ -z "${match#*=}" ] ; then # the config has this interface but the sub-block is missing the hwid # so again, we might as well use the kernel name - name=$kname - cmd=mod + finish mod $kname $attr_address else # The device mac address is not in the config but the config # has another hwid associated with the device name. This @@ -142,18 +142,7 @@ else # detected earlier than the device configured with this name. # Since this is non-deterministic, we make a new name. (( ethn = last_ethn + 1 )) - name=eth$ethn - cmd=add -fi - -echo $name - -if [[ "$BOOTFILE" != *test_* ]] && touch $BOOTFILE &> /dev/null ; then - ${vyatta_sbindir}/${cmd}_bootfile_eth_hwid \ - $BOOTFILE \ - $name \ - $attr_address \ - 2>&1 | logger + finish add eth$ethn $attr_address fi # Local Variables: |