Accepting request 356477 from home:pwieczorkiewicz:branches:Base:System

- Add 0169-network_set_mtu_macaddr_for_dhcp.patch:
   - Set MTU and LLADDR for DHCP if specified (boo#959803)

OBS-URL: https://build.opensuse.org/request/show/356477
OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=249
This commit is contained in:
Thomas Renninger 2016-01-28 13:55:23 +00:00 committed by Git OBS Bridge
parent 233f49d9a7
commit 6b2814703f
3 changed files with 100 additions and 0 deletions

View File

@ -0,0 +1,91 @@
Index: dracut-044/modules.d/40network/ifup.sh
===================================================================
--- dracut-044.orig/modules.d/40network/ifup.sh
+++ dracut-044/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

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Jan 28 10:18:18 UTC 2016 - pwieczorkiewicz@suse.com
- Add 0169-network_set_mtu_macaddr_for_dhcp.patch:
- Set MTU and LLADDR for DHCP if specified (boo#959803)
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Jan 27 09:19:18 UTC 2016 - fvogt@suse.com Wed Jan 27 09:19:18 UTC 2016 - fvogt@suse.com

View File

@ -51,6 +51,7 @@ Patch142: 0142-40network-Don-t-report-error-for-etc-sysconfig-netwo.patch
Patch145: 0145-40network-handle-ip-ifname-static-correctly.patch Patch145: 0145-40network-handle-ip-ifname-static-correctly.patch
Patch159: 0159-network-Try-to-load-xennet.patch Patch159: 0159-network-Try-to-load-xennet.patch
Patch162: 0162-network-Request-DHCP-lease-instead-of-getting-applyi.patch Patch162: 0162-network-Request-DHCP-lease-instead-of-getting-applyi.patch
Patch169: 0169-network_set_mtu_macaddr_for_dhcp.patch
#S390 #S390
Patch16: 0016-Add-new-s390x-specific-rule-files.patch Patch16: 0016-Add-new-s390x-specific-rule-files.patch
@ -250,6 +251,8 @@ chmod a+x modules.d/91zipl/install_zipl_cmdline.sh
%patch163 -p1 %patch163 -p1
%patch164 -p1 %patch164 -p1
%patch168 -p1 %patch168 -p1
%patch169 -p1
%patch180 -p1 %patch180 -p1
# disabled, as it breaks encrypted / on LVM - dimstar, 20151001 # disabled, as it breaks encrypted / on LVM - dimstar, 20151001
#patch181 -p1 #patch181 -p1