dracut/0169-network_set_mtu_macaddr_for_dhcp.patch
Hannes Reinecke 3ca4ad45d0 Accepting request 431190 from home:hreinecke:branches:Base:System
- 90multipath: parse commandline option 'multipath=off' (bsc#1001691)
  *add 0307-90multipath-parse-kernel-commandline-option-multipat.patch

- 95fcoe: do not start fcoemon twice (bsc#1001512)
  *add 0225-95fcoe-do-not-start-fcoemon-twice.patch

- Reformat patch headers:
  *modify 0199-rd-iscsi-waitnet-default-false.patch
  *modify 0200-dracut_fix_multipath_without_config.patch
  *modify 0210-add_fcoe_uefi_check.patch
  *modify 0212-fcoe_reorder_init_path.patch
- Rediff patches to apply cleanly:
  *modify 0124-40network-Update-iBFT-scanning-code-to-handle-IPv6.patch
  *modify 0133-Allow-multiple-configurations-per-network-interface-.patch
  *modify 0170-iscsi-skip-ibft-invalid-dhcp.patch
  *modify 0218-40network-allow-persistent-interface-names.patch
- Remove spurious whitespaces:
  *modify 0169-network_set_mtu_macaddr_for_dhcp.patch
- 40network: print out correct prefix (bsc#996141)
  *modify 0125-40network-separate-mask-and-prefix.patch
- 95iscsi: setup bnx2i offload connection correctly (bsc#997598)
  *add 0224-95iscsi-setup-bnx2i-offload-connections-properly.patch
- Rename patches to match sequence number:
  *old: 0019-40network-Fix-race-condition-when-wait-for-networks.patch
  *new: 0012-40network-Fix-race-condition-when-wait-for-networks.patch
  *old: 0066-40network-always-start-netroot-in-ifup.sh.patch
  *new: 0013-40network-always-start-netroot-in-ifup.sh.patch

- rd.iscsi.waitnet should default to false in order for dracut to
  wait for the network devices (bsc#997598)

OBS-URL: https://build.opensuse.org/request/show/431190
OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=267
2016-10-07 08:44:57 +00:00

107 lines
3.4 KiB
Diff

From b27ca9cfcb5df2066e87f673cb5c060bcf4016fa 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..3b92854 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