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

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