network: fixed MAC address assignment
authorHarald Hoyer <harald@redhat.com>
Mon, 26 Nov 2012 12:49:38 +0000 (13:49 +0100)
committerHarald Hoyer <harald@redhat.com>
Mon, 26 Nov 2012 12:49:38 +0000 (13:49 +0100)
modules.d/40network/ifup.sh
modules.d/40network/net-lib.sh

index db233de..70bc161 100755 (executable)
@@ -96,10 +96,10 @@ do_ipv6auto() {
 do_static() {
     strstr $ip '*:*:*' && load_ipv6
 
-    ip link set $netif up
+    ip link set dev $netif up
     wait_for_if_up $netif
-    [ -n "$macaddr" ] && ip link set address $macaddr
-    [ -n "$mtu" ] && ip link set mtu $mtu
+    [ -n "$macaddr" ] && ip link set address $macaddr dev $netif
+    [ -n "$mtu" ] && ip link set mtu $mtu dev $netif
     if strstr $ip '*:*:*'; then
         # note no ip addr flush for ipv6
         ip addr add $ip/$mask dev $netif
index 10b630e..9b2f291 100644 (file)
@@ -1,4 +1,6 @@
 #!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
 
 get_ip() {
     local iface="$1" ip=""
@@ -272,7 +274,12 @@ ip_to_var() {
         2)  dev=$1; autoconf=$2 ;;
         3)  dev=$1; autoconf=$2; mtu=$3 ;;
         4)  dev=$1; autoconf=$2; mtu=$3; macaddr=$4 ;;
-        *)  ip=$1; srv=$2; gw=$3; mask=$4; hostname=$5; dev=$6; autoconf=$7; mtu=$8; macaddr=$9 ;;
+        *)  ip=$1; srv=$2; gw=$3; mask=$4;
+            hostname=$5; dev=$6; autoconf=$7; mtu=$8;
+            if [ -n "${9}" -a -n "${10}" -a -n "${11}" -a -n "${12}" -a -n "${13}" -a -n "${14}" ]; then
+                macaddr="${9}:${10}:${11}:${12}:${13}:${14}"
+            fi
+           ;;
     esac
     # anaconda-style argument cluster
     if strstr "$autoconf" "*.*.*.*"; then