dracut/0132-40network-fixup-static-network-configuration.patch
Thomas Renninger 9f28177407 Accepting request 293267 from home:trenn:branches:Base:System
- Update to dracut mainline version 041.
  Half of the patches got integrated mainline.
  Some others have been merged together when it made sense some have
  been left out, but are still in the repository as they need some special
  treating and mainline discussion whether/how they get added. These are
  also not urgently needed, but are debugging patches.
  I broke the rule here to mention every added/deleted/modified patch as
  every patch is touched and every 2nd  got removed (mainline integrated).
  I also re-ordered the patches in the PatchXY: area for easier merging them
  and get them discussed and posted mainline easier, topic by topic.

OBS-URL: https://build.opensuse.org/request/show/293267
OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=214
2015-03-31 14:12:12 +00:00

82 lines
3.5 KiB
Diff

From 6fd2c01a1cd2dcbd7d2fc3bbe6e62c7d8336bf24 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 31 Jul 2014 09:21:14 +0200
Subject: 40network: fixup static network configuration
The static network configuration was broken; the 'gateway' was
written as the complete 'ip' command line, but simply sourced
later on.
The patch fixes the gateway registration that the '.gw' file
holds entire 'ip route' command lines, which just needs to
be evaluated later on.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
modules.d/40network/ifup.sh | 13 +++++++++++++
modules.d/40network/module-setup.sh | 2 ++
modules.d/40network/net-lib.sh | 6 +++++-
3 files changed, 20 insertions(+), 1 deletion(-)
Index: dracut-041/modules.d/40network/ifup.sh
===================================================================
--- dracut-041.orig/modules.d/40network/ifup.sh 2015-03-18 12:03:26.848727065 +0100
+++ dracut-041/modules.d/40network/ifup.sh 2015-03-18 12:04:02.246720640 +0100
@@ -241,6 +241,19 @@
fi
[ -n "$gw" ] && echo ip route replace default via $gw dev $netif > /tmp/net.$netif.gw
+
+ for ifroute in /etc/sysconfig/network/ifroute-${netif} /etc/sysconfig/netwrk/routes ; do
+ [ -e ${ifroute} ] || continue
+ # Pull in existing routing configuration
+ read ifr_dest ifr_gw ifr_mask ifr_if < ${ifroute}
+ [ -z "$ifr_dest" -o -z "$ifr_gw" ] && continue
+ if [ "$ifr_if" = "-" ] ; then
+ echo ip route add $ifr_dest via $ifr_gw >> /tmp/net.$netif.gw
+ else
+ echo ip route add $ifr_dest via $ifr_gw dev $ifr_if >> /tmp/net.$netif.gw
+ fi
+ done
+
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
return 0
Index: dracut-041/modules.d/40network/module-setup.sh
===================================================================
--- dracut-041.orig/modules.d/40network/module-setup.sh 2015-03-18 12:03:21.864446201 +0100
+++ dracut-041/modules.d/40network/module-setup.sh 2015-03-18 12:03:26.856727409 +0100
@@ -101,6 +101,8 @@
[[ $hostonly ]] && {
inst_multiple /etc/sysconfig/network/ifcfg-*
+ inst_multiple /etc/sysconfig/network/ifroute-*
+ inst_simple /etc/sysconfig/network/routes
}
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
Index: dracut-041/modules.d/40network/net-lib.sh
===================================================================
--- dracut-041.orig/modules.d/40network/net-lib.sh 2015-03-18 12:03:21.872446652 +0100
+++ dracut-041/modules.d/40network/net-lib.sh 2015-03-18 12:03:26.860727590 +0100
@@ -123,7 +123,6 @@
[ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces
[ -z "$IFACES" ] && IFACES="$netif"
# run the scripts written by ifup
- [ -e /tmp/net.$netif.gw ] && . /tmp/net.$netif.gw
[ -e /tmp/net.$netif.hostname ] && . /tmp/net.$netif.hostname
[ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override
[ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
@@ -150,6 +149,11 @@
# Note: This assumes that if no router is present the
# root server is on the same subnet.
+ if [ -e /tmp/net.$netif.gw ] ; then
+ while read line ; do
+ eval $line
+ done < /tmp/net.$netif.gw
+ fi
# Get DHCP-provided router IP, or the cmdline-provided "gw=" argument
[ -n "$new_routers" ] && gw_ip=${new_routers%%,*}
[ -n "$gw" ] && gw_ip=$gw