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

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