File fcoe-utils-fcoe-setup-update-for-fipvlan of Package open-fcoe

From 8d8c1cd6068321eaa71094bf43cfa8121d176357 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 25 Mar 2010 14:15:51 +0100
Subject: [PATCH] Update fcoe-setup script to work with new fipvlan

fipvlan is now capable of creating VLAN interfaces,
so we don't have to do it anymore.

Signed-off-by: Hannes Reinecke <hare@suse.de>

diff --git a/contrib/fcoe-setup.sh b/contrib/fcoe-setup.sh
index ab23400..cce0af9 100644
--- a/contrib/fcoe-setup.sh
+++ b/contrib/fcoe-setup.sh
@@ -5,37 +5,9 @@
 # Create VLAN interface for FCoE
 #
 
-scan_vlan() {
-    local ifname=$1
-    local vlan=$2
-
-    cat /proc/net/vlan/config | tail +3 | while read vif s1 vid s2 if ; do
-	if [ "$if" = "$ifname" ] && [ "$vid" == "$vlan" ] ; then
-	    echo "$vif"
-	fi
-    done
-}
-
-create_vlan () {
-    local ifname=$1
-    local vlan=$2
-    local vif
-
-    vif=$(scan_vlan $ifname $vlan)
-
-    if [ -z "$vif" ] ; then
-	vconfig set_name_type DEV_PLUS_VID_NO_PAD
-	vconfig add $ifname $vlan > /dev/null
-	vif="$ifname.$vlan"
-    fi
-    ip link set $vif up
-    echo "$vif"
-}
-
 check_ifcfg () {
     local vif=$1
     local ifname=$2
-    local vid=$3
     local ifcfg=/etc/sysconfig/network/ifcfg-$vif
 
     if [ -f "$ifcfg" ] ; then
@@ -77,12 +49,11 @@ if [ ! -d /sys/class/net/$ifname ] ; then
     exit 2
 fi
 
-fipvlan -i $ifname | while read ifname vlan; do
-    echo "Found FCF forwarder on VLAN $vlan"
-    vif=$(create_vlan $ifname $vlan)
-    echo "Using VLAN interface $vif"
-    check_ifcfg $vif $ifname $vlan
-    check_fcoe $vif
-done
+modprobe 8021q
+ip link set $ifname up
+fipvlan -c -s $ifname
+vif=$(sed -n 's/\([^ ]*\) *.*eth2/\1/p' /proc/net/vlan/config)
+check_ifcfg $vif $ifname
+check_fcoe $vif
 
 exit 0
openSUSE Build Service is sponsored by