dracut/0169-network_set_mtu_macaddr_for_dhcp.patch
Marcus Meissner 0f203926a1 Accepting request 422869 from home:hreinecke:branches:Base:System
- Rename patch:
  * From 0211-fix_multipath_check_hostonly.patch
    to 0303-fix_multipath_check_hostonly.patch
- Rename patch:
  * From 0213-10i18n-keymap-find.patch
    to 0213-Fix-wrong-keymap-inclusion.patch

- 95fcoe: Do not complain about missing /etc/hba.conf (bsc#980539)
  * Add 0215-95fcoe-Do-not-complain-about-missing-etc-hba.conf.patch
- 95fcoe: silence lldpad warnings
  * Add 0216-95fcoe-silence-lldpad-warnings.patch
- 95fcoe: Allow to specify the FCoE mode via the fcoe= parameter
  * Add 0217-95fcoe-Allow-to-specify-the-FCoE-mode-via-the-fcoe-p.patch
- 40network: allow persistent interface names (bsc#995284)
  * Add 0218-40network-allow-persistent-interface-names.patch
- 95fcoe: use interface names instead of MAC addresses
  * Add 0219-95fcoe-use-interface-names-instead-of-MAC-addresses.patch
- 95fcoe: always set AUTO_VLAN for fcoemon (bsc#995019)
  * Add 0220-95fcoe-always-set-AUTO_VLAN-for-fcoemon.patch
- 95fcoe: Add shutdown script (bsc#994860)
  * Add 0221-95fcoe-Add-shutdown-script.patch
- 90dm: Fixup shutdown script (bsc#994860)
  * Add 0222-90dm-Fixup-shutdown-script.patch
- 90dm: fixup dependency cycle between MD and DM shutdown (bsc#994860)
  * Add 0223-90dm-fixup-dependency-cycle-between-MD-and-DM-shutdo.patch
- 90multipath: Start daemon after udev settle (bsc#986734)
  * Add 0304-90multipath-Start-daemon-after-udev-settle.patch
- 90multipath: load dm_multipath module during startup
  * Add 0305-90multipath-load-dm_multipath-module-during-startup.patch
- 90multipath: add shutdown script (bsc#994860)

OBS-URL: https://build.opensuse.org/request/show/422869
OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=263
2016-09-01 11:57:40 +00:00

107 lines
3.4 KiB
Diff

From 36691b5e707fca03d8a31b0c8a30e498465fbc1c Mon Sep 17 00:00:00 2001
From: Pawel Wieczorkiewicz <pwieczorkiewicz@suse.de>
Date: Tue, 23 Aug 2016 12:29:03 +0200
Subject: Set MTU and LLADDR for DHCP if specified
References: boo#959803
Signed-off-by: Pawel Wieczorkiewicz <pwieczorkiewicz@suse.de>
---
modules.d/40network/ifup.sh | 52 ++++++++++++++++++++++++++++-----------------
1 file changed, 32 insertions(+), 20 deletions(-)
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
index 0aaea72..e101b52 100755
--- a/modules.d/40network/ifup.sh
+++ b/modules.d/40network/ifup.sh
@@ -90,7 +90,7 @@ else
fi
dhcp_apply() {
- unset IPADDR INTERFACE BROADCAST NETWORK PREFIXLEN ROUTES GATEWAYS HOSTNAME DNSDOMAIN DNSSEARCH DNSSERVERS
+ unset IPADDR INTERFACE BROADCAST NETWORK PREFIXLEN ROUTES GATEWAYS MTU HOSTNAME DNSDOMAIN DNSSEARCH DNSSERVERS
if [ -f /tmp/leaseinfo.${netif}.dhcp.ipv${1:1:1} ]; then
. /tmp/leaseinfo.${netif}.dhcp.ipv${1:1:1}
else
@@ -128,6 +128,9 @@ dhcp_apply() {
done
fi
+ # Set MTU
+ [ -n "${MTU}" ] && ip $1 link set mtu "$MTU" dev "$INTERFACE"
+
# Setup hostname
[ -n "${HOSTNAME}" ] && hostname "$HOSTNAME"
@@ -167,6 +170,25 @@ dhcp_apply() {
return 0
}
+read_ifcfg() {
+ unset PREFIXLEN LLADDR MTU REMOTE_IPADDR GATEWAY BOOTPROTO
+
+ if [ -e /etc/sysconfig/network/ifcfg-${netif} ] ; then
+ # Pull in existing configuration
+ . /etc/sysconfig/network/ifcfg-${netif}
+
+ # The first configuration can be anything
+ [ -n "$PREFIXLEN" ] && prefix=${PREFIXLEN}
+ [ -n "$LLADDR" ] && macaddr=${LLADDR}
+ [ -n "$MTU" ] && mtu=${MTU}
+ [ -n "$REMOTE_IPADDR" ] && server=${REMOTE_IPADDR}
+ [ -n "$GATEWAY" ] && gw=${GATEWAY}
+ [ -n "$BOOTPROTO" ] && autoconf=${BOOTPROTO}
+ return 0
+ fi
+ return 1
+}
+
# Run dhclient
do_dhcp() {
# dhclient-script will mark the netif up and generate the online
@@ -197,14 +219,14 @@ do_dhcp() {
dhclient="wickedd-dhcp4 --test"
fi
- if ! iface_has_link $netif; then
- warn "No carrier detected"
- warn "Trying to set $netif up..."
- ip $1 link set dev "$netif" up
- if ! iface_has_link $netif; then
- warn "Failed..."
- return 1
- fi
+ if ! linkup $netif; then
+ warn "Could not bring interface $netif up!"
+ return 1
+ fi
+
+ if read_ifcfg ; then
+ [ -n "$macaddr" ] && ip $1 link set address $macaddr dev $netif
+ [ -n "$mtu" ] && ip $1 link set mtu $mtu dev $netif
fi
$dhclient --test-format leaseinfo --test-output /tmp/leaseinfo.${netif}.dhcp.ipv${1:1:1} --test-request - $netif << EOF
@@ -245,17 +267,7 @@ do_ipv6auto() {
# Handle ip configuration via ifcfg files
do_ifcfg() {
- if [ "$autoconf" = "static" ] &&
- [ -e /etc/sysconfig/network/ifcfg-${netif} ] ; then
- # Pull in existing static configuration
- . /etc/sysconfig/network/ifcfg-${netif}
-
- # The first configuration can be anything
- [ -n "$PREFIXLEN" ] && prefix=${PREFIXLEN}
- [ -n "$MTU" ] && mtu=${MTU}
- [ -n "$REMOTE_IPADDR" ] && server=${REMOTE_IPADDR}
- [ -n "$GATEWAY" ] && gw=${GATEWAY}
- [ -n "$BOOTPROTO" ] && autoconf=${BOOTPROTO}
+ if [ "$autoconf" = "static" ] && read_ifcfg; then
case "$autoconf" in
dhcp6)
load_ipv6
--
2.6.6