|
Harald Hoyer |
fe48c9 |
From f2cbd4cbd639df9b0f3d9320df491bf23c109edb Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
fe48c9 |
From: WANG Chao <chaowang@redhat.com>
|
|
Harald Hoyer |
fe48c9 |
Date: Wed, 4 Sep 2013 01:29:58 +0800
|
|
Harald Hoyer |
fe48c9 |
Subject: [PATCH] net-lib: ibft_to_cmdline() fixes
|
|
Harald Hoyer |
fe48c9 |
|
|
Harald Hoyer |
fe48c9 |
Fix 3 issues in ibft_to_cmdline():
|
|
Harald Hoyer |
fe48c9 |
- unset local variables at the beginning of each loop
|
|
Harald Hoyer |
fe48c9 |
- only write vlan.conf when we write out ip=xxx
|
|
Harald Hoyer |
fe48c9 |
- when vlan id is 0, don't write out vlan.conf. Because 0 means untagged
|
|
Harald Hoyer |
fe48c9 |
and we don't actually need vlan interface.
|
|
Harald Hoyer |
fe48c9 |
---
|
|
Harald Hoyer |
fe48c9 |
modules.d/40network/net-lib.sh | 15 +++++++++------
|
|
Harald Hoyer |
fe48c9 |
1 file changed, 9 insertions(+), 6 deletions(-)
|
|
Harald Hoyer |
fe48c9 |
|
|
Harald Hoyer |
fe48c9 |
diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
|
|
Harald Hoyer |
fe48c9 |
index ca4b393..82c4f72 100644
|
|
Harald Hoyer |
fe48c9 |
--- a/modules.d/40network/net-lib.sh
|
|
Harald Hoyer |
fe48c9 |
+++ b/modules.d/40network/net-lib.sh
|
|
Harald Hoyer |
fe48c9 |
@@ -203,11 +203,13 @@ fix_bootif() {
|
|
Harald Hoyer |
fe48c9 |
}
|
|
Harald Hoyer |
fe48c9 |
|
|
Harald Hoyer |
fe48c9 |
ibft_to_cmdline() {
|
|
Harald Hoyer |
fe48c9 |
- local iface="" mac="" dev=""
|
|
Harald Hoyer |
fe48c9 |
- local dhcp="" ip="" gw="" mask="" hostname=""
|
|
Harald Hoyer |
fe48c9 |
+ local iface=""
|
|
Harald Hoyer |
fe48c9 |
modprobe -q iscsi_ibft
|
|
Harald Hoyer |
fe48c9 |
(
|
|
Harald Hoyer |
fe48c9 |
for iface in /sys/firmware/ibft/ethernet*; do
|
|
Harald Hoyer |
fe48c9 |
+ local mac="" dev=""
|
|
Harald Hoyer |
fe48c9 |
+ local dhcp="" ip="" gw="" mask="" hostname=""
|
|
Harald Hoyer |
fe48c9 |
+
|
|
Harald Hoyer |
fe48c9 |
[ -e ${iface}/mac ] || continue
|
|
Harald Hoyer |
fe48c9 |
mac=$(read a < ${iface}/mac; echo $a)
|
|
Harald Hoyer |
fe48c9 |
[ -z "$mac" ] && continue
|
|
Harald Hoyer |
fe48c9 |
@@ -216,10 +218,6 @@ ibft_to_cmdline() {
|
|
Harald Hoyer |
fe48c9 |
[ -e /tmp/net.${dev}.has_ibft_config ] && continue
|
|
Harald Hoyer |
fe48c9 |
|
|
Harald Hoyer |
fe48c9 |
[ -e ${iface}/dhcp ] && dhcp=$(read a < ${iface}/dhcp; echo $a)
|
|
Harald Hoyer |
fe48c9 |
- if [ -e ${iface}/vlan ]; then
|
|
Harald Hoyer |
fe48c9 |
- vlan=$(read a < ${iface}/vlan; echo $a)
|
|
Harald Hoyer |
fe48c9 |
- echo "vlan=$vlan:$dev"
|
|
Harald Hoyer |
fe48c9 |
- fi
|
|
Harald Hoyer |
fe48c9 |
|
|
Harald Hoyer |
fe48c9 |
if [ -n "$dhcp" ]; then
|
|
Harald Hoyer |
fe48c9 |
echo "ip=$dev:dhcp"
|
|
Harald Hoyer |
fe48c9 |
@@ -244,6 +242,11 @@ ibft_to_cmdline() {
|
|
Harald Hoyer |
fe48c9 |
ls -l ${iface} | vinfo
|
|
Harald Hoyer |
fe48c9 |
fi
|
|
Harald Hoyer |
fe48c9 |
|
|
Harald Hoyer |
fe48c9 |
+ if [ -e ${iface}/vlan ]; then
|
|
Harald Hoyer |
fe48c9 |
+ vlan=$(read a < ${iface}/vlan; echo $a)
|
|
Harald Hoyer |
fe48c9 |
+ [ "$vlan" -ne "0" ] && echo "vlan=$vlan:$dev"
|
|
Harald Hoyer |
fe48c9 |
+ fi
|
|
Harald Hoyer |
fe48c9 |
+
|
|
Harald Hoyer |
fe48c9 |
echo $mac > /tmp/net.${dev}.has_ibft_config
|
|
Harald Hoyer |
fe48c9 |
done
|
|
Harald Hoyer |
fe48c9 |
) >> /etc/cmdline.d/40-ibft.conf
|