9fd4bf22aa
- dracut.sh: check for logfile (--logfile option) and create it if necessary Add 0139-dracut.sh-check-for-logfile-logfile-option-and-creat.patch - Avoid duplicate names in host_devs Add 0140-dracut.sh-Avoid-duplicate-devices-in-host_devs.patch - iscsi: Avoid bad ip route call on empty address Add 0141-iscsi-Avoid-bad-ip-route-call-on-empty-address.patch - 40network: Don't report error for .../ifroute-* during module setup Add 0142-40network-Don-t-report-error-for-etc-sysconfig-netwo.patch - iscsi: Fix up ipv6 in brackets , iterate over all needed iscsi mounts Add 0143-iscsi-Fix-up-ipv6-in-brackets-iterate-over-all-possi.patch - 90crypt: Fixed crypttab_contains() to also work with device in /etc/crypttab Add 0144-90crypt-Fixed-crypttab_contains-to-also-work-with-de.patch - 40network: handle 'ip=ifname:static' correctly (bnc#892801) Add 0145-40network-handle-ip-ifname-static-correctly.patch OBS-URL: https://build.opensuse.org/request/show/245581 OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=180
109 lines
3.3 KiB
Diff
109 lines
3.3 KiB
Diff
From 4b0e5841ce7dbeca5186e0d47f8835b00007cd6e Mon Sep 17 00:00:00 2001
|
|
From: Hannes Reinecke <hare@suse.de>
|
|
Date: Thu, 21 Aug 2014 12:46:45 +0200
|
|
Subject: 40network: handle 'ip=ifname:static' correctly
|
|
|
|
'static' configuration means 'apply the settings from the ifcfg file'.
|
|
Which might be either static or dhcp.
|
|
And for multiple configurations the first configuration can be
|
|
either dhcp or static; only the following configurations must
|
|
be static.
|
|
|
|
References: bnc#892801
|
|
|
|
Signed-off-by: Hannes Reinecke <hare@suse.de>
|
|
---
|
|
modules.d/40network/ifup.sh | 40 ++++++++++++++++++++++++++++++----------
|
|
1 file changed, 30 insertions(+), 10 deletions(-)
|
|
|
|
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
|
|
index 0362287..5cd4f68 100755
|
|
--- a/modules.d/40network/ifup.sh
|
|
+++ b/modules.d/40network/ifup.sh
|
|
@@ -178,11 +178,13 @@ do_dhcp() {
|
|
|
|
info "Preparation for DHCP transaction"
|
|
|
|
+ [ -d /var/lib/wicked ] || mkdir -p /var/lib/wicked
|
|
+
|
|
local dhclient=''
|
|
- if [ "$1" = "-4" ] ; then
|
|
- dhclient="wickedd-dhcp4"
|
|
- elif [ "$1" = "-6" ] ; then
|
|
+ if [ "$1" = "-6" ] ; then
|
|
dhclient="wickedd-dhcp6"
|
|
+ else
|
|
+ dhclient="wickedd-dhcp4"
|
|
fi
|
|
|
|
if ! iface_has_link $netif; then
|
|
@@ -226,33 +228,49 @@ do_ipv6auto() {
|
|
return 0
|
|
}
|
|
|
|
-# Handle static ip configuration
|
|
-do_static() {
|
|
+# 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}
|
|
+ case "$autoconf" in
|
|
+ dhcp6)
|
|
+ load_ipv6
|
|
+ do_dhcp -6 ;;
|
|
+ dhcp*)
|
|
+ do_dhcp -4 ;;
|
|
+ *)
|
|
+ do_static ;;
|
|
+ esac
|
|
# loop over all configurations in ifcfg-$netif (IPADDR*) and apply
|
|
for conf in ${!IPADDR@}; do
|
|
ip=${!conf}
|
|
[ -z "$ip" ] && continue
|
|
ext=${conf#IPADDR}
|
|
- concat="PREFIXLEN$ext" && [ -n "${!concat}" ] && mtu=${!concat}
|
|
+ concat="PREFIXLEN$ext" && [ -n "${!concat}" ] && prefix=${!concat}
|
|
concat="MTU$ext" && [ -n "${!concat}" ] && mtu=${!concat}
|
|
concat="REMOTE_IPADDR$ext" && [ -n "${!concat}" ] && server=${!concat}
|
|
concat="GATEWAY$ext" && [ -n "${!concat}" ] && gw=${!concat}
|
|
- concat="BOOTPROTO$ext" && [ -n "${!concat}" ] && autoconf=${!concat}
|
|
- do_static_setup
|
|
+ # Additional configurations must be static
|
|
+ do_static
|
|
done
|
|
else
|
|
- do_static_setup
|
|
+ do_static
|
|
fi
|
|
|
|
return 0
|
|
}
|
|
|
|
-do_static_setup() {
|
|
+# Handle static ip configuration
|
|
+do_static() {
|
|
strglobin $ip '*:*:*' && load_ipv6
|
|
|
|
linkup $netif
|
|
@@ -475,6 +493,8 @@ for p in $(getargs ip=); do
|
|
do_dhcp -6 ;;
|
|
auto6)
|
|
do_ipv6auto ;;
|
|
+ static)
|
|
+ do_ifcfg ;;
|
|
*)
|
|
do_static ;;
|
|
esac
|
|
--
|
|
1.8.4.5
|
|
|