dracut/0018-network-net-lib.sh-fix-ibft-interface-configuration.patch
Harald Hoyer f8c4a0f4e5 dracut-031-22.git20130809
- lsinitrd.sh: add old cpio signature
- dracut.sh: call find with -print0 and cpio with --null
- dracut.asc: small corrections
- systemd/dracut-initqueue.sh: continue to boot if finished failed
- dracut.sh/dracut-functions.sh: handle root on non-block device
- dracut-functions.sh: removed non dracut-install shell functions
- dracut-functions.sh: inst_multiple == dracut_install
- 51-dracut-rescue.install: fixed rescue image creation
- dracut.sh: do not strip in FIPS mode
Resolves: rhbz#990250
- dracut.sh: check the value of --kver
- crypt: Fix typo--/etc/crypttab not /etc/cryptab
- network/net-lib.sh: fix ibft interface configuration
- iscsi/module-setup.sh: install some modules regardless of hostonly
- multipath: need_shutdown if multipath devices exist
Resolves: rhbz#994913
- omit drivers fix
2013-08-09 14:21:29 +02:00

59 lines
2.3 KiB
Diff

From 0b11ea71996a7b804afbc38d1d5461fb0f4ef882 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 7 Aug 2013 16:05:03 +0200
Subject: [PATCH] network/net-lib.sh: fix ibft interface configuration
also skip ibft$num names, which have been already given
https://bugzilla.redhat.com/show_bug.cgi?id=989944
---
modules.d/40network/net-lib.sh | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
index 494960c..ca4b393 100644
--- a/modules.d/40network/net-lib.sh
+++ b/modules.d/40network/net-lib.sh
@@ -172,13 +172,20 @@ save_netinfo() {
}
set_ifname() {
- local name="$1" mac="$2" num=0 n=""
+ local name="$1" mac="$2" num=-1 n=""
# if it's already set, return the existing name
for n in $(getargs ifname=); do
strstr "$n" "$mac" && echo ${n%%:*} && return
done
# otherwise, pick a new name and use that
- while [ -e /sys/class/net/$name$num ]; do num=$(($num+1)); done
+ while :; do
+ num=$(($num+1));
+ [ -e /sys/class/net/$name$num ] && continue
+ for n in $(getargs ifname=); do
+ [ "$name$num" = "${n%%:*}" ] && continue 2
+ done
+ break
+ done
echo "ifname=$name$num:$mac" >> /etc/cmdline.d/45-ifname.conf
echo "$name$num"
}
@@ -205,6 +212,9 @@ ibft_to_cmdline() {
mac=$(read a < ${iface}/mac; echo $a)
[ -z "$mac" ] && continue
dev=$(set_ifname ibft $mac)
+
+ [ -e /tmp/net.${dev}.has_ibft_config ] && continue
+
[ -e ${iface}/dhcp ] && dhcp=$(read a < ${iface}/dhcp; echo $a)
if [ -e ${iface}/vlan ]; then
vlan=$(read a < ${iface}/vlan; echo $a)
@@ -215,6 +225,8 @@ ibft_to_cmdline() {
echo "ip=$dev:dhcp"
elif [ -e ${iface}/ip-addr ]; then
[ -e ${iface}/ip-addr ] && ip=$(read a < ${iface}/ip-addr; echo $a)
+ # skip not assigned ip adresses
+ [ "$ip" = "0.0.0.0" ] && continue
[ -e ${iface}/gateway ] && gw=$(read a < ${iface}/gateway; echo $a)
[ -e ${iface}/subnet-mask ] && mask=$(read a < ${iface}/subnet-mask; echo $a)
[ -e ${iface}/hostname ] && hostname=$(read a < ${iface}/hostname; echo $a)