85 lines
3.2 KiB
Diff
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
|
||
|
|