diff options
author | Harald Hoyer <harald@redhat.com> | 2013-08-07 16:05:03 +0200 |
---|---|---|
committer | Harald Hoyer <harald@redhat.com> | 2013-08-07 16:05:59 +0200 |
commit | 0b11ea71996a7b804afbc38d1d5461fb0f4ef882 (patch) | |
tree | 9e7b20da4a0d2d11907b9b5cf804ecf499657b48 | |
parent | 7deba0428a23b3f410a7cf8cac7cf8355e4dc150 (diff) | |
download | dracut-0b11ea71996a7b804afbc38d1d5461fb0f4ef882.tar.gz dracut-0b11ea71996a7b804afbc38d1d5461fb0f4ef882.tar.bz2 dracut-0b11ea71996a7b804afbc38d1d5461fb0f4ef882.zip |
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
-rw-r--r-- | modules.d/40network/net-lib.sh | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh index 494960c2..ca4b3933 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) |