Blame SOURCES/0410-network-set-MTU-and-MACADDR-for-dhcp-and-auto6.patch

712866
From 61b5ee6d1d5708c0b41497facd8b97681f9729fb Mon Sep 17 00:00:00 2001
712866
From: Harald Hoyer <harald@redhat.com>
712866
Date: Wed, 29 Jun 2016 15:12:24 +0200
712866
Subject: [PATCH] network: set MTU and MACADDR for dhcp and auto6
712866
712866
---
712866
 modules.d/40network/ifup.sh      | 7 ++++++-
712866
 modules.d/45ifcfg/write-ifcfg.sh | 7 +++----
712866
 2 files changed, 9 insertions(+), 5 deletions(-)
712866
712866
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
5c6c2a
index f681336e..37f51b9d 100755
712866
--- a/modules.d/40network/ifup.sh
712866
+++ b/modules.d/40network/ifup.sh
712866
@@ -110,6 +110,9 @@ do_dhcp() {
712866
         return 1
712866
     fi
712866
 
712866
+    [ -n "$macaddr" ] && ip link set address $macaddr dev $netif
712866
+    [ -n "$mtu" ] && ip link set mtu $mtu dev $netif
712866
+
712866
     while [ $_COUNT -lt $_DHCPRETRY ]; do
712866
         info "Starting dhcp for interface $netif"
712866
         dhclient "$@" \
712866
@@ -144,6 +147,8 @@ do_ipv6auto() {
712866
     echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_ra
712866
     echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_redirects
712866
     linkup $netif
712866
+    [ -n "$macaddr" ] && ip link set address $macaddr dev $netif
712866
+    [ -n "$mtu" ] && ip link set mtu $mtu dev $netif
712866
     wait_for_ipv6_auto $netif
712866
 
712866
     [ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
712866
@@ -388,7 +393,7 @@ for p in $(getargs ip=); do
712866
     done
712866
 
712866
     # Store config for later use
712866
-    for i in ip srv gw mask hostname macaddr dns1 dns2; do
712866
+    for i in ip srv gw mask hostname macaddr dns1 dns2 mtu; do
712866
         eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
712866
     done > /tmp/net.$netif.override
712866
 
712866
diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh
5c6c2a
index a5114be1..cab74772 100755
712866
--- a/modules.d/45ifcfg/write-ifcfg.sh
712866
+++ b/modules.d/45ifcfg/write-ifcfg.sh
712866
@@ -144,6 +144,7 @@ for netup in /tmp/net.*.did-setup ; do
712866
 
712866
     [ -e /tmp/bond.${netif}.info ] && . /tmp/bond.${netif}.info
712866
     [ -e /tmp/team.${netif}.info ] && . /tmp/team.${netif}.info
712866
+    [ -e /tmp/net.${netif}.override ] && . /tmp/net.${netif}.override
712866
 
712866
     uuid=$(cat /proc/sys/kernel/random/uuid)
712866
     if [ "$netif" = "$bridgename" ]; then
712866
@@ -178,8 +179,6 @@ for netup in /tmp/net.*.did-setup ; do
712866
             fi
712866
             cp /tmp/dhclient.$netif.lease /tmp/ifcfg-leases/dhclient-$uuid-$netif.lease
712866
         else
712866
-            # If we've booted with static ip= lines, the override file is there
712866
-            [ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override
712866
             if strstr "$ip" '*:*:*'; then
712866
                 echo "IPV6INIT=yes"
712866
                 echo "IPV6_AUTOCONF=no"
712866
@@ -245,7 +244,7 @@ for netup in /tmp/net.*.did-setup ; do
712866
                 echo "MASTER=\"$netif\""
712866
                 echo "UUID=\"$(cat /proc/sys/kernel/random/uuid)\""
712866
                 unset macaddr
712866
-                [ -e /tmp/net.$slave.override ] && . /tmp/net.$slave.override
712866
+                [ -e /tmp/net.${slave}.override ] && . /tmp/net.${slave}.override
712866
                 interface_bind "$slave" "$macaddr"
712866
             ) >> /tmp/ifcfg/ifcfg-$slave
712866
         done
712866
@@ -268,7 +267,7 @@ for netup in /tmp/net.*.did-setup ; do
712866
                 echo "BRIDGE=\"$bridgename\""
712866
                 echo "UUID=\"$(cat /proc/sys/kernel/random/uuid)\""
712866
                 unset macaddr
712866
-                [ -e /tmp/net.$slave.override ] && . /tmp/net.$slave.override
712866
+                [ -e /tmp/net.${slave}.override ] && . /tmp/net.${slave}.override
712866
                 interface_bind "$slave" "$macaddr"
712866
             ) >> /tmp/ifcfg/ifcfg-$slave
712866
         done