[rdma: 2/3] Various updates that bring this package more in line with the RHEL version

Doug Ledford dledford at fedoraproject.org
Wed Feb 29 04:00:15 UTC 2012


commit c014a831a107543b4f022726b568f28359010cbd
Author: Doug Ledford <dledford at redhat.com>
Date:   Tue Feb 28 22:59:06 2012 -0500

    Various updates that bring this package more in line with the RHEL version
    
    Signed-off-by: Doug Ledford <dledford at redhat.com>

 rdma.90-rdma.rules |    7 --
 rdma.conf          |    2 +-
 rdma.ifdown-ib     |  169 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 rdma.ifup-ib       |   39 +++++++------
 rdma.init          |    3 +-
 rdma.spec          |   24 +++++---
 6 files changed, 208 insertions(+), 36 deletions(-)
---
diff --git a/rdma.conf b/rdma.conf
index 272e3a4..33749aa 100644
--- a/rdma.conf
+++ b/rdma.conf
@@ -5,7 +5,7 @@ SRP_LOAD=no
 # Load iSER module
 ISER_LOAD=no
 # Load RDS network protocol
-LOAD_RDS=yes
+RDS_LOAD=no
 # Should we modify the system mtrr registers?  We may need to do this if you
 # get messages from the ib_ipath driver saying that it couldn't enable
 # write combining for the PIO buffs on the card.
diff --git a/rdma.ifdown-ib b/rdma.ifdown-ib
new file mode 100644
index 0000000..5000548
--- /dev/null
+++ b/rdma.ifdown-ib
@@ -0,0 +1,169 @@
+#!/bin/bash
+# Network Interface Configuration System
+# Copyright (c) 1996-2009 Red Hat, Inc. all rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License, version 2,
+# as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+
+. /etc/init.d/functions
+
+cd /etc/sysconfig/network-scripts
+. ./network-functions
+
+[ -f ../network ] && . ../network
+
+CONFIG=${1}
+
+source_config
+
+. /etc/sysconfig/network
+
+# Check to make sure the device is actually up
+check_device_down ${DEVICE} && [ "$BOOTPROTO" != "dhcp" -a "$BOOTPROTO" != "bootp" ] && [ -n "$VLAN" -a "$VLAN" != "yes" ] && exit 0
+
+if [ "${SLAVE}" != "yes" -o -z "${MASTER}" ]; then
+if [ -n "${HWADDR}" -a -z "${MACADDR}" ]; then
+    HWADDR=$(echo $HWADDR | tail -c 24)
+    FOUNDMACADDR=$(get_hwaddr ${REALDEVICE} | tail -c 24)
+    if [ -n "${FOUNDMACADDR}" -a "${FOUNDMACADDR}" != "${HWADDR}" ]; then
+        NEWCONFIG=$(get_config_by_hwaddr ${FOUNDMACADDR})
+	if [ -n "${NEWCONFIG}" ]; then
+	   eval $(LANG=C grep -F "DEVICE=" $NEWCONFIG)
+	else
+	   net_log $"Device ${DEVICE} has MAC address ${FOUNDMACADDR}, instead of configured address ${HWADDR}. Ignoring."
+	   exit 1
+	fi
+	if [ -n "${NEWCONFIG}" -a "${NEWCONFIG##*/}" != "${CONFIG##*/}" -a "${DEVICE}" = "${REALDEVICE}" ]; then
+	   exec /sbin/ifdown ${NEWCONFIG}
+	else
+	   net_log $"Device ${DEVICE} has MAC address ${FOUNDMACADDR}, instead of configured address ${HWADDR}. Ignoring."
+	   exit 1
+	fi
+    fi
+fi
+fi
+
+if is_bonding_device ${DEVICE} ; then
+    for device in $(LANG=C egrep -l "^[[:space:]]*MASTER=\"?${DEVICE}\"?" /etc/sysconfig/network-scripts/ifcfg-*) ; do
+	is_ignored_file "$device" && continue
+	/sbin/ifdown ${device##*/}
+    done
+    for arg in $BONDING_OPTS ; do
+	key=${arg%%=*};
+	[[ "${key}" != "arp_ip_target" ]] || continue
+	value=${arg##*=};
+	if [ "${value:0:1}" != "" ]; then
+            OLDIFS=$IFS;
+            IFS=',';
+            for arp_ip in $value; do
+		if grep -q $arp_ip /sys/class/net/${DEVICE}/bonding/arp_ip_target; then
+                    echo "-$arp_ip" > /sys/class/net/${DEVICE}/bonding/arp_ip_target
+		fi
+            done
+            IFS=$OLDIFS;
+	else
+	    value=${value#+};
+	    if grep -q $value /sys/class/net/${DEVICE}/bonding/arp_ip_target; then
+                echo "-$value" > /sys/class/net/${DEVICE}/bonding/arp_ip_target
+	    fi
+	fi
+    done
+fi
+
+/etc/sysconfig/network-scripts/ifdown-ipv6 ${CONFIG}
+
+retcode=0
+[ -n "$(pidof -x dhclient)" ] && {
+   for VER in "" 6 ; do
+	if [ -f "/var/run/dhclient$VER-${DEVICE}.pid" ]; then
+		dhcpid=$(cat /var/run/dhclient$VER-${DEVICE}.pid)
+		if [[ "$DHCPRELEASE" = [yY1]* ]];  then
+			/sbin/dhclient -r -lf /var/lib/dhclient/dhclient$VER-${DEVICE}.leases -pf /var/run/dhclient-${DEVICE}.pid ${DEVICE} >/dev/null 2>&1
+			retcode=$?
+		else
+			kill $dhcpid >/dev/null 2>&1
+			retcode=$?
+			reason=STOP$VER interface=${DEVICE} /sbin/dhclient-script
+		fi
+		if [ -f "/var/run/dhclient$VER-${DEVICE}.pid" ]; then
+			rm -f /var/run/dhclient$VER-${DEVICE}.pid
+			kill $dhcpid >/dev/null 2>&1
+		fi	
+	fi
+    done
+}	
+# we can't just delete the configured address because that address
+# may have been changed in the config file since the device was
+# brought up.  Flush all addresses associated with this
+# instance instead.
+if [ -d "/sys/class/net/${REALDEVICE}" ]; then
+	if [ "${REALDEVICE}" = "${DEVICE}" ]; then
+		ip addr flush dev ${REALDEVICE} 2>/dev/null
+	else
+		ip addr flush dev ${REALDEVICE} label ${DEVICE} 2>/dev/null
+	fi
+	
+	if [ "${SLAVE}" = "yes" -a -n "${MASTER}" ]; then
+		echo "-${DEVICE}" > /sys/class/net/${MASTER}/bonding/slaves 2>/dev/null
+	fi
+
+	if [ "${REALDEVICE}" = "${DEVICE}" ]; then
+  		ip link set dev ${DEVICE} down 2>/dev/null
+	fi
+fi
+[ "$retcode" = "0" ] && retcode=$?
+
+if [ -n "${BRIDGE}" ] && [ -x /usr/sbin/brctl ]; then
+      /sbin/ip link set dev ${DEVICE} down
+      /usr/sbin/brctl delif ${BRIDGE} ${DEVICE}
+      # Upon removing a device from a bridge,
+      # it's necessary to make radvd reload its config
+      [ -r /var/run/radvd/radvd.pid ] && kill -HUP $(cat /var/run/radvd/radvd.pid)
+      if [ -d /sys/class/net/${BRIDGE}/brif ] && [ $(ls -1 /sys/class/net/${BRIDGE}/brif | wc -l) -eq 0 ]; then
+	  /usr/sbin/brctl delbr ${BRIDGE}
+      fi
+fi
+
+if [ "${TYPE}" = "Tap" ]; then
+	tunctl -d "${DEVICE}" >/dev/null
+fi
+
+# wait up to 5 seconds for device to actually come down...
+waited=0
+while ! check_device_down ${DEVICE} && [ "$waited" -lt 50 ] ; do
+    usleep 10000
+    waited=$(($waited+1))
+done
+
+# don't leave an outdated key sitting around
+if [ -n "${WIRELESS_ENC_KEY}" ] && [ -x /sbin/iwconfig ]; then
+    /sbin/iwconfig ${DEVICE} enc 0 >/dev/null 2>&1
+fi
+
+if [ "$retcode" = 0 ] ; then
+    /etc/sysconfig/network-scripts/ifdown-post $CONFIG
+    # do NOT use $? because ifdown should return whether or not
+    # the interface went down.
+fi
+
+if [ -n "$VLAN" ]; then
+    # 802.1q VLAN
+    if echo ${DEVICE} | LANG=C grep -Ev '(:)' | LANG=C grep -Eq '(eth|bond)[0-9][0-9]*\.[0-9][0-9]?[0-9]?[0-9]?' \
+	|| echo ${DEVICE} | LANG=C grep -Eq 'vlan[0-9][0-9]?[0-9]?[0-9]?' ; then
+	[ -f /proc/net/vlan/${DEVICE} ] && {
+	    ip link delete ${DEVICE} type vlan
+	}
+    fi
+fi
+
+exit $retcode
diff --git a/rdma.ifup-ib b/rdma.ifup-ib
index 1c86c45..9e7f55d 100644
--- a/rdma.ifup-ib
+++ b/rdma.ifup-ib
@@ -34,11 +34,12 @@ is_available ${REALDEVICE}
 # remap, if the device is bound with a MAC address and not the right device num
 # bail out, if the MAC does not fit
 if [ -n "${HWADDR}" ]; then
-    FOUNDMACADDR=`get_hwaddr ${REALDEVICE}`
+    HWADDR=$(echo $HWADDR | tail -c 24)
+    FOUNDMACADDR=`get_hwaddr ${REALDEVICE} | tail -c 24`
     if [ "${FOUNDMACADDR}" != "${HWADDR}" ]; then
         curdev=`get_device_by_hwaddr ${HWADDR}`
         if [ -n "$curdev" ]; then
-	  rename_device "${REALDEVICE}" "${HWADDR}" "${curdev}" || {
+	    ip link set dev "$curdev" name "${REALDEVICE}" || {
 	    echo $"Device ${DEVICE} has different MAC address than expected, ignoring."
 	    exit 1
 	  }
@@ -206,7 +207,7 @@ else
     fi
   
     expand_config
-    
+
     [ -n "${ARP}" ] && \
 	ip link set dev ${REALDEVICE} $(toggle_value arp $ARP)
    
@@ -233,26 +234,28 @@ else
        SRC=
     fi
     
-    if ! LC_ALL=C ip addr ls ${REALDEVICE} | LC_ALL=C grep -q "${IPADDR}/${PREFIX}" ; then
-	 if ! arping -q -c 2 -w 3 -D -I ${REALDEVICE} ${IPADDR} ; then
-	    echo $"Error, some other host already uses address ${IPADDR}."
-	    exit 1
-	 fi
-	 if ! ip addr add ${IPADDR}/${PREFIX} \
-	    brd ${BROADCAST:-+} dev ${REALDEVICE} ${SCOPE} label ${DEVICE}; then
-	    echo $"Error adding address ${IPADDR} for ${DEVICE}."
-	 fi
-    fi
+    i=0
+    while [ -n "${ipaddr[$i]}" ]; do
+        if ! LC_ALL=C ip addr ls ${REALDEVICE} | LC_ALL=C grep -q "${ipaddr[$i]}/${prefix[$i]}" ; then
+	    if ! arping -q -c 2 -w 3 -D -I ${REALDEVICE} ${ipaddr[$i]} ; then
+	        echo $"Error, some other host already uses address ${ipaddr[$i]}."
+	    elif ! ip addr add ${ipaddr[$i]}/${prefix[$i]} \
+		    brd ${broadcast[$i]} dev ${REALDEVICE} ${SCOPE} \
+		    label ${DEVICE}; then
+	        echo $"Error adding address ${ipaddr[$i]} for ${DEVICE}."
+	    else
+    	        # update ARP cache of neighboring computers
+                arping -q -A -c 1 -I ${REALDEVICE} ${ipaddr[$i]}
+    	        ( sleep 2; arping -q -U -c 1 -I ${REALDEVICE} ${ipaddr[$]} ) >/dev/null 2>&1 </dev/null &
+	    fi
+	fi
+	let i++
+    done
     
     if [ -n "$SRCADDR" ]; then
            sysctl -w "net.ipv4.conf.${REALDEVICE}.arp_filter=1" >/dev/null 2>&1
     fi
 
-    # update ARP cache of neighboring computers
-    arping -q -A -c 1 -I ${REALDEVICE} ${IPADDR}
-    ( sleep 2;
-      arping -q -U -c 1 -I ${REALDEVICE} ${IPADDR} ) > /dev/null 2>&1 < /dev/null &
-
     # Set a default route.
     if [ -z "${GATEWAYDEV}" -o "${GATEWAYDEV}" = "${REALDEVICE}" ]; then
 	# set up default gateway. replace if one already exists
diff --git a/rdma.init b/rdma.init
index 66fe9e7..9ffe94e 100644
--- a/rdma.init
+++ b/rdma.init
@@ -9,7 +9,8 @@
 ### BEGIN INIT INFO
 # Provides:       rdma
 # Default-Stop: 0 1 2 3 4 5 6
-# Required-Stop: $network $srpd $opensm $nfs-rdma
+# Required-Start:
+# Required-Stop:
 # Short-Description: Loads and unloads the InfiniBand and iWARP kernel modules
 # Description: Loads and unloads the InfiniBand and iWARP kernel modules
 ### END INIT INFO
diff --git a/rdma.spec b/rdma.spec
index fdc0082..fb94226 100644
--- a/rdma.spec
+++ b/rdma.spec
@@ -6,15 +6,14 @@
 Summary: Infiniband/iWARP Kernel Module Initializer
 Name: rdma
 Version: 1.0
-Release: 9%{?dist}
+Release: 10%{?dist}
 License: GPLv2+
 Group: System Environment/Base
 Source0: rdma.conf
 Source1: rdma.init
 Source2: rdma.fixup-mtrr.awk
-Source3: rdma.90-rdma.rules
 Source4: rdma.ifup-ib
-Source5: rdma.nfs-rdma.init
+Source5: rdma.ifdown-ib
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildArch: noarch
 Requires(post): chkconfig
@@ -31,15 +30,13 @@ User space initialization scripts for the kernel InfiniBand/iWARP drivers
 rm -rf ${RPM_BUILD_ROOT}
 install -d ${RPM_BUILD_ROOT}%{_initrddir}
 install -d ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}
-install -d ${RPM_BUILD_ROOT}%{_sysconfdir}/udev/rules.d
 install -d ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/network-scripts
 
 install -m 0644 %{SOURCE0} ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/%{name}.conf
 install -m 0755 %{SOURCE1} ${RPM_BUILD_ROOT}%{_initrddir}/%{name}
 install -m 0644 %{SOURCE2} ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/fixup-mtrr.awk
-install -m 0644 %{SOURCE3} ${RPM_BUILD_ROOT}%{_sysconfdir}/udev/rules.d/90-%{name}.rules
 install -m 0755 %{SOURCE4} %{buildroot}%{_sysconfdir}/sysconfig/network-scripts/ifup-ib
-install -m 0755 %{SOURCE5} %{buildroot}%{_initrddir}/nfs-rdma
+install -m 0755 %{SOURCE5} %{buildroot}%{_sysconfdir}/sysconfig/network-scripts/ifdown-ib
 
 %clean
 rm -rf ${RPM_BUILD_ROOT}
@@ -60,11 +57,20 @@ fi
 %config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
 %{_sysconfdir}/%{name}/fixup-mtrr.awk
 %{_initrddir}/%{name}
-%{_initrddir}/nfs-rdma
-%{_sysconfdir}/udev/rules.d/90-%{name}.rules
-%{_sysconfdir}/sysconfig/network-scripts/ifup-ib
+%{_sysconfdir}/sysconfig/network-scripts/*
 
 %changelog
+* Tue Feb 28 2012 Doug Ledford <dledford at redhat.com> - 1.0-10
+- Remove udev rules file, recent kernels create the proper devices without
+  need of the file
+- Remove the nfs-rdma init script so it can be taken over by the nfs-utils
+  package
+- Fix up some LSB header bogons in the init script (will convert to
+  systemd after this is tested and working and move sysv init script
+  to a sub-package)
+- Add ifdown-ib and update ifup-ib so we have more of the same capabilities
+  on IPoIB interfaces that RHEL has
+
 * Wed Feb 09 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.0-9
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
 


More information about the scm-commits mailing list