dracut/0132-40network-fixup-static-network-configuration.patch
Thomas Renninger fba84bc647 Accepting request 243695 from home:trenn:branches:Base:System
- 99base: Increase initqueue timeout in non systemd case (bnc#887402)
  * Add: 0127-99base-Increase-initqueue-timeout-in-non-systemd-cas.patch
- 90lvm: Install dm-snapshot module (bnc#888530)
  * Add: 0128-90lvm-Install-dm-snapshot-module.patch
- Revert commit 6ecab258710d158a7a6 and only do not wait for swap via
 parameter (bnc#882812)
  * Add: 0129-Revert-commit-6ecab258710d158a7a6-and-only-do-not-wa.patch
- nfs: Always add all kernel modules for kdump (bnc#887906)
  * Add: 0130-nfs-Always-add-all-kernel-modules-for-kdump.patch
- 40network: handle prefixed IP addresses correctly (bnc#880108)
  * Add: 0131-40network-handle-prefixed-IP-addresses-correctly.patch
- 40network: fixup static network configuration
  * Add: 0132-40network-fixup-static-network-configuration.patch
- Remove 70-persistent-net.rules
  * Add: 0133-Remove-70-persistent-net.rules.patch

OBS-URL: https://build.opensuse.org/request/show/243695
OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=176
2014-08-05 15:24:31 +00:00

85 lines
3.2 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(-)
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
index 0a485ec..84dc530 100755
--- a/modules.d/40network/ifup.sh
+++ b/modules.d/40network/ifup.sh
@@ -242,6 +242,19 @@ do_static() {
fi
[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
+
+ for ifroute in /etc/sysconfig/network/ifroute-${netif} /etc/sysconfig/network/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
diff --git a/modules.d/40network/module-setup.sh b/modules.d/40network/module-setup.sh
index 690ff08..9194b1a 100755
--- a/modules.d/40network/module-setup.sh
+++ b/modules.d/40network/module-setup.sh
@@ -103,6 +103,8 @@ install() {
[[ $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.*" \
diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
index a3b5030..fce845a 100755
--- a/modules.d/40network/net-lib.sh
+++ b/modules.d/40network/net-lib.sh
@@ -124,7 +124,6 @@ setup_net() {
[ -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
@@ -137,6 +136,11 @@ setup_net() {
# 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
--
1.8.4.5