File 0132-40network-fixup-static-network-configuration.patch of Package dracut.16003

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-044/modules.d/40network/ifup.sh
===================================================================
--- dracut-044.orig/modules.d/40network/ifup.sh
+++ dracut-044/modules.d/40network/ifup.sh
@@ -263,6 +263,19 @@ if strglobin $ip '*:*:*'; then
     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-044/modules.d/40network/module-setup.sh
===================================================================
--- dracut-044.orig/modules.d/40network/module-setup.sh
+++ dracut-044/modules.d/40network/module-setup.sh
@@ -60,6 +60,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.*" \