From 8b982ddefa4d940990a35653f9989558a0fdfe01 Mon Sep 17 00:00:00 2001 From: Doug Ledford Date: May 22 2013 19:57:52 +0000 Subject: Minor updates Add support for P_Key interfaces (IPoIB version of VLANs) Add sample 60-persistent-ipoib.rules file Signed-off-by: Doug Ledford --- diff --git a/rdma.ifdown-ib b/rdma.ifdown-ib index 5000548..f412722 100644 --- a/rdma.ifdown-ib +++ b/rdma.ifdown-ib @@ -1,6 +1,6 @@ #!/bin/bash # Network Interface Configuration System -# Copyright (c) 1996-2009 Red Hat, Inc. all rights reserved. +# Copyright (c) 1996-2013 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, @@ -13,7 +13,7 @@ # # 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 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. . /etc/init.d/functions @@ -29,7 +29,33 @@ 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 +check_device_down ${DEVICE} && exit 0 + +# If we are a PKey device, we need to munge a few things +if [ "${VLAN}" = yes ]; then + [ -z "${VLAN_ID}" ] && { + echo "VLAN=yes requires a VLAN_ID" + exit 1 + } + # Normalize our VLAN_ID to have the high bit set + NEW_VLAN_ID=`printf "0x%04x" $(( 0x8000 | ${VLAN_ID} ))` + NEW_VLAN_NAME=`printf "%04x" ${NEW_VLAN_ID}` + [ "${DEVICE}" != "${REALDEVICE}.${NEW_VLAN_NAME}" ] && { + echo "The high bit of the VLAN_ID must be set and the DEVICE=" + echo "entry in the config file must be the same as the PARENTDEVICE.VLAN_ID" + echo "Configured DEVICE=$DEVICE" + echo "Configured PARENTDEVICE=$PARENTDEVICE" + echo "Calculated REALDEVICE=$REALDEVICE" + echo "Configured VLAN_ID=$VLAN_ID" + echo "Calculated VLAN_ID=$NEW_VLAN_ID" + exit 1 + } + [ -d "/sys/class/net/${DEVICE}" ] || exit 0 + # When we get to downing the IP address, we need REALDEVICE to + # point to our PKey VLAN device + REALDEVICE="${DEVICE}" +fi + if [ "${SLAVE}" != "yes" -o -z "${MASTER}" ]; then if [ -n "${HWADDR}" -a -z "${MACADDR}" ]; then @@ -54,13 +80,13 @@ fi fi if is_bonding_device ${DEVICE} ; then - for device in $(LANG=C egrep -l "^[[:space:]]*MASTER=\"?${DEVICE}\"?" /etc/sysconfig/network-scripts/ifcfg-*) ; do + for device in $(LANG=C grep -l "^[[:space:]]*MASTER=\"\?${DEVICE}\"\?\([[:space:]#]\|$\)" /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 + [[ "${key}" != "arp_ip_target" ]] && continue value=${arg##*=}; if [ "${value:0:1}" != "" ]; then OLDIFS=$IFS; @@ -87,8 +113,9 @@ retcode=0 for VER in "" 6 ; do if [ -f "/var/run/dhclient$VER-${DEVICE}.pid" ]; then dhcpid=$(cat /var/run/dhclient$VER-${DEVICE}.pid) + generate_lease_file_name $VER 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 + /sbin/dhclient -r -lf ${LEASEFILE} -pf /var/run/dhclient$VER-${DEVICE}.pid ${DEVICE} >/dev/null 2>&1 retcode=$? else kill $dhcpid >/dev/null 2>&1 @@ -108,9 +135,9 @@ retcode=0 # instance instead. if [ -d "/sys/class/net/${REALDEVICE}" ]; then if [ "${REALDEVICE}" = "${DEVICE}" ]; then - ip addr flush dev ${REALDEVICE} 2>/dev/null + ip addr flush dev ${REALDEVICE} scope global 2>/dev/null else - ip addr flush dev ${REALDEVICE} label ${DEVICE} 2>/dev/null + ip addr flush dev ${REALDEVICE} label ${DEVICE} scope global 2>/dev/null fi if [ "${SLAVE}" = "yes" -a -n "${MASTER}" ]; then @@ -123,21 +150,6 @@ if [ -d "/sys/class/net/${REALDEVICE}" ]; then 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 @@ -145,11 +157,6 @@ while ! check_device_down ${DEVICE} && [ "$waited" -lt 50 ] ; do 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 @@ -157,13 +164,8 @@ if [ "$retcode" = 0 ] ; then 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 + # PKey VLAN + echo "$NEW_VLAN_ID" > /sys/class/net/${PARENTDEVICE}/delete_child fi exit $retcode diff --git a/rdma.ifup-ib b/rdma.ifup-ib index 1cfb169..621324a 100644 --- a/rdma.ifup-ib +++ b/rdma.ifup-ib @@ -1,13 +1,19 @@ #!/bin/bash # Network Interface Configuration System -# Copyright (c) 1996-2005 Red Hat, Inc. all rights reserved. +# Copyright (c) 1996-2013 Red Hat, Inc. all rights reserved. # -# This software may be freely redistributed under the terms of the GNU -# public license. +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. . /etc/init.d/functions @@ -16,13 +22,12 @@ cd /etc/sysconfig/network-scripts [ -f ../network ] && . ../network -CONFIG=${1} +CONFIG="${1}" -need_config ${CONFIG} +need_config "${CONFIG}" source_config -# InfiniBand doesn't support dhcp...yet if [ "${BOOTPROTO}" = "dhcp" ]; then DYNCONFIG=true fi @@ -31,32 +36,56 @@ fi # /sbin/modprobe ${REALDEVICE} 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 - 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 - ip link set dev "$curdev" name "${REALDEVICE}" || { - echo $"Device ${DEVICE} has different MAC address than expected, ignoring." - exit 1 - } + FOUNDMACADDR=$(get_hwaddr ${REALDEVICE}) + if [ "${FOUNDMACADDR}" != "${HWADDR}" -a "${FOUNDMACADDR}" != "${MACADDR}" ]; then + net_log $"Device ${DEVICE} has different MAC address than expected, ignoring." + exit 1 fi - fi fi # now check the real state is_available ${REALDEVICE} || { if [ -n "$alias" ]; then - echo $"$alias device ${DEVICE} does not seem to be present, delaying initialization." + net_log $"$alias device ${DEVICE} does not seem to be present, delaying initialization." else - echo $"Device ${DEVICE} does not seem to be present, delaying initialization." + net_log $"Device ${DEVICE} does not seem to be present, delaying initialization." fi exit 1 } +# if we are a pkey device, create the device if needed +if [ "${VLAN}" = yes ]; then + [ -z "${VLAN_ID}" ] && { + echo "VLAN=yes requires a VLAN_ID" + exit 1 + } + # Normalize our VLAN_ID to have the high bit set + NEW_VLAN_ID=`printf "0x%04x" $(( 0x8000 | ${VLAN_ID} ))` + NEW_VLAN_NAME=`printf "%04x" ${NEW_VLAN_ID}` + [ "${DEVICE}" != "${REALDEVICE}.${NEW_VLAN_NAME}" ] && { + echo "The high bit of the VLAN_ID must be set and the DEVICE=" + echo "entry in the config file must be the same as the PARENTDEVICE.VLAN_ID" + echo "Configured DEVICE=$DEVICE" + echo "Configured PARENTDEVICE=$PARENTDEVICE" + echo "Calculated REALDEVICE=$REALDEVICE" + echo "Configured VLAN_ID=$VLAN_ID" + echo "Calculated VLAN_ID=$NEW_VLAN_ID" + exit 1 + } + [ -d "/sys/class/net/${DEVICE}" ] || + echo "${NEW_VLAN_ID}" > "/sys/class/net/${REALDEVICE}/create_child" + [ -d "/sys/class/net/${DEVICE}" ] || { + echo "Failed to create child device $NEW_VLAN_ID of $REALDEVICE" + exit 1 + } + # When we get to setting up the IP address, we need REALDEVICE to + # point to our new VLAN device + REALDEVICE="${DEVICE}" +fi + + # this isn't the same as the MAC in the configuration filename. It is # available as a configuration option in the config file, forcing the kernel # to think an ethernet card has a different MAC address than it really has. @@ -87,14 +116,12 @@ fi # slave device? if [ "${SLAVE}" = yes -a "${ISALIAS}" = no -a "${MASTER}" != "" ]; then - grep -wq "${DEVICE}" /sys/class/net/${MASTER}/bonding/slaves || { + install_bonding_driver ${MASTER} + grep -wq "${DEVICE}" /sys/class/net/${MASTER}/bonding/slaves 2>/dev/null || { /sbin/ip link set dev ${DEVICE} down echo "+${DEVICE}" > /sys/class/net/${MASTER}/bonding/slaves 2>/dev/null } - - if [ -n "$ETHTOOL_OPTS" ] ; then - /sbin/ethtool -s ${REALDEVICE} $ETHTOOL_OPTS - fi + ethtool_set exit 0 fi @@ -102,32 +129,15 @@ fi # Bonding initialization. For DHCP, we need to enslave the devices early, # so it can actually get an IP. if [ "$ISALIAS" = no ] && is_bonding_device ${DEVICE} ; then - - /sbin/ip link set dev ${DEVICE} down - - # add the bits to setup driver parameters here - for arg in $BONDING_OPTS ; do - key=${arg%%=*}; - value=${arg##*=}; - if [ "${key}" = "arp_ip_target" ]; then - OLDIFS=$IFS; - IFS=','; - for arp_ip in $value; do - echo +$arp_ip > /sys/class/net/${DEVICE}/bonding/$key - done - IFS=$OLDIFS; - else - echo $value > /sys/class/net/${DEVICE}/bonding/$key - fi - done - + install_bonding_driver ${DEVICE} /sbin/ip link set dev ${DEVICE} up - [ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY} - for device in `LANG=C grep -l "^[[:space:]]*MASTER=${DEVICE}" /etc/sysconfig/network-scripts/ifcfg-*` ; do + for device in $(LANG=C grep -l "^[[:space:]]*MASTER=\"\?${DEVICE}\"\?\([[:space:]#]\|$\)" /etc/sysconfig/network-scripts/ifcfg-*) ; do is_ignored_file "$device" && continue /sbin/ifup ${device##*/} done + [ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY} + # add the bits to setup the needed post enslavement parameters for arg in $BONDING_OPTS ; do key=${arg%%=*}; @@ -139,74 +149,45 @@ if [ "$ISALIAS" = no ] && is_bonding_device ${DEVICE} ; then fi -if [ -n "${DYNCONFIG}" -a -x /sbin/dhclient ]; then - # Remove any temporary references which were previously added to dhclient config - if [ -w /etc/dhclient-${DEVICE}.conf ] ; then - LC_ALL=C grep -v "# temporary RHL ifup addition" /etc/dhclient-${DEVICE}.conf > /etc/dhclient-${DEVICE}.conf.ifupnew 2> /dev/null - cat /etc/dhclient-${DEVICE}.conf.ifupnew > /etc/dhclient-${DEVICE}.conf - rm -f /etc/dhclient-${DEVICE}.conf.ifupnew - fi +if [ -n "${DYNCONFIG}" ] && [ -x /sbin/dhclient ]; then if [[ "${PERSISTENT_DHCLIENT}" = [yY1]* ]]; then ONESHOT=""; else ONESHOT="-1"; fi; - if [ -n "${DHCP_HOSTNAME}" ]; then - # Send a host-name to the DHCP server (requ. by some dhcp servers). - if [ -w /etc/dhclient-${DEVICE}.conf ] ; then - if ! LC_ALL=C grep "send *host-name *\"${DHCP_HOSTNAME}\"" /etc/dhclient-${DEVICE}.conf > /dev/null 2>&1 ; then - echo "send host-name \"${DHCP_HOSTNAME}\"; # temporary RHL ifup addition" >> /etc/dhclient-${DEVICE}.conf - fi - elif ! [ -e /etc/dhclient-${DEVICE}.conf ] ; then - echo "send host-name \"${DHCP_HOSTNAME}\"; # temporary RHL ifup addition" >> /etc/dhclient-${DEVICE}.conf - fi - fi - # allow users to use generic '/etc/dhclient.conf' (as documented in manpage!) - # if per-device file doesn't exist or is empty - if [ -s /etc/dhclient-${DEVICE}.conf ]; then - DHCLIENTCONF="-cf /etc/dhclient-${DEVICE}.conf"; - else - DHCLIENTCONF=''; - fi; - # copy any lease obtained by the initrd - if [ -f /dev/.dhclient-${DEVICE}.leases ] ; then - mv -f /dev/.dhclient-${DEVICE}.leases /var/lib/dhclient/dhclient-${DEVICE}.leases - [ -x /sbin/restorecon ] && restorecon /var/lib/dhclient/dhclient-${DEVICE}.leases > /dev/null 2>&1 - fi - DHCLIENTARGS="${DHCLIENTARGS} ${ONESHOT} -q ${DHCLIENTCONF} -lf /var/lib/dhclient/dhclient-${DEVICE}.leases -pf /var/run/dhclient-${DEVICE}.pid" + generate_config_file_name + generate_lease_file_name + DHCLIENTARGS="${DHCLIENTARGS} -H ${DHCP_HOSTNAME:-${HOSTNAME%%.*}} ${ONESHOT} -q ${DHCLIENTCONF} -lf ${LEASEFILE} -pf /var/run/dhclient-${DEVICE}.pid" echo echo -n $"Determining IP information for ${DEVICE}..." - if check_link_down ${DEVICE}; then + if [[ "${PERSISTENT_DHCLIENT}" != [yY1]* ]] && check_link_down ${DEVICE}; then echo $" failed; no link present. Check cable?" - ip link set dev ${DEVICE} down >/dev/null 2>&1 exit 1 fi - if [ -n "$ETHTOOL_OPTS" ] ; then - /sbin/ethtool -s ${REALDEVICE} $ETHTOOL_OPTS - fi + ethtool_set if /sbin/dhclient ${DHCLIENTARGS} ${DEVICE} ; then echo $" done." + dhcpipv4="good" else echo $" failed." - exit 1 + if [[ "${IPV4_FAILURE_FATAL}" = [Yy1]* ]] ; then + exit 1 + fi + if [[ "$IPV6INIT" != [yY1]* && "$DHCPV6C" != [yY1]* ]] ; then + exit 1 + fi + net_log "Unable to obtain IPv4 DHCP address ${DEVICE}." warning fi # end dynamic device configuration else - if [ -z "${IPADDR}" ]; then + if [ -z "${IPADDR}" -a -z "${IPADDR0}" -a -z "${IPADDR1}" -a -z "${IPADDR2}" ]; then # enable device without IP, useful for e.g. PPPoE ip link set dev ${REALDEVICE} up - if [ -n "$ETHTOOL_OPTS" ] ; then - /sbin/ethtool -s ${REALDEVICE} $ETHTOOL_OPTS - fi + ethtool_set [ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY} - - if [ "${NETWORKING_IPV6}" = "yes" ]; then - /etc/sysconfig/network-scripts/ifup-ipv6 ${CONFIG} - fi - exec /etc/sysconfig/network-scripts/ifup-post ${CONFIG} ${2} - fi + else expand_config @@ -214,13 +195,11 @@ else ip link set dev ${REALDEVICE} $(toggle_value arp $ARP) if ! ip link set dev ${REALDEVICE} up ; then - echo $"Failed to bring up ${DEVICE}." + net_log $"Failed to bring up ${DEVICE}." exit 1 fi - if [ -n "$ETHTOOL_OPTS" ] ; then - /sbin/ethtool -s ${REALDEVICE} $ETHTOOL_OPTS - fi + ethtool_set [ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY} @@ -236,55 +215,82 @@ else SRC= 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 2>&1 - fi + fi + + # update ARP cache of neighboring computers + if [ "${REALDEVICE}" != "lo" ]; then + /sbin/arping -q -A -c 1 -I ${REALDEVICE} ${ipaddr[$idx]} + ( sleep 2; + /sbin/arping -q -U -c 1 -I ${REALDEVICE} ${ipaddr[$idx]} ) > /dev/null 2>&1 < /dev/null & + fi + done # Set a default route. - if [ -z "${GATEWAYDEV}" -o "${GATEWAYDEV}" = "${REALDEVICE}" ]; then + if [ "${DEFROUTE}" != "no" ] && [ -z "${GATEWAYDEV}" -o "${GATEWAYDEV}" = "${REALDEVICE}" ]; then # set up default gateway. replace if one already exists - if [ -n "${GATEWAY}" -a "`ipcalc --network ${GATEWAY} ${NETMASK} 2>/dev/null`" = "NETWORK=${NETWORK}" ]; then + if [ -n "${GATEWAY}" ] && [ "$(ipcalc --network ${GATEWAY} ${netmask[0]} 2>/dev/null)" = "NETWORK=${NETWORK}" ]; then ip route replace default ${METRIC:+metric $METRIC} \ via ${GATEWAY} ${WINDOW:+window $WINDOW} ${SRC} \ - ${GATEWAYDEV:+dev $GATEWAYDEV} + ${GATEWAYDEV:+dev $GATEWAYDEV} || + net_log $"Error adding default gateway ${GATEWAY} for ${DEVICE}." elif [ "${GATEWAYDEV}" = "${DEVICE}" ]; then ip route replace default ${METRIC:+metric $METRIC} \ - ${SRC} ${WINDOW:+window $WINDOW} dev ${REALDEVICE} + ${SRC} ${WINDOW:+window $WINDOW} dev ${REALDEVICE} || + net_log $"Erorr adding default gateway for ${REALDEVICE}." fi fi + fi fi # Add Zeroconf route. if [ -z "${NOZEROCONF}" -a "${ISALIAS}" = "no" -a "${REALDEVICE}" != "lo" ]; then - ip route replace 169.254.0.0/16 dev ${REALDEVICE} + ip route add 169.254.0.0/16 dev ${REALDEVICE} metric $((1000 + $(cat /sys/class/net/${REALDEVICE}/ifindex))) scope link +fi + +# Inform firewall which network zone (empty means default) this interface belongs to +if [ -x /usr/bin/firewall-cmd -a "${REALDEVICE}" != "lo" ]; then + /usr/bin/firewall-cmd --zone="${ZONE}" --change-interface="${DEVICE}" > /dev/null 2>&1 fi # IPv6 initialisation? -if [ "${NETWORKING_IPV6}" = "yes" ]; then - /etc/sysconfig/network-scripts/ifup-ipv6 ${CONFIG} - if [[ "${DHCPV6C}" = [Yy1]* ]] && [ -x /sbin/dhcp6c ]; then - /sbin/dhcp6c ${DEVICE}; - dhcp6_pid=(`/bin/ps -eo 'pid,args' | /bin/grep "dhcp6c ${DEVICE}" | egrep -v grep`); - echo ${dhcp6_pid[0]} > /var/run/dhcp6c_${DEVICE}.pid - fi; +/etc/sysconfig/network-scripts/ifup-ipv6 ${CONFIG} +if [[ "${DHCPV6C}" = [Yy1]* ]] && [ -x /sbin/dhclient ]; then + generate_config_file_name 6 + generate_lease_file_name 6 + echo + echo -n $"Determining IPv6 information for ${DEVICE}..." + if /sbin/dhclient -6 -1 ${DHCPV6C_OPTIONS} ${DHCLIENTCONF} -lf ${LEASEFILE} -pf /var/run/dhclient6-${DEVICE}.pid -H ${DHCP_HOSTNAME:-${HOSTNAME%%.*}} ${DEVICE} ; then + echo $" done." + else + echo $" failed." + if [ "${dhcpipv4}" = "good" -o -n "${IPADDR}" ]; then + net_log "Unable to obtain IPv6 DHCP address ${DEVICE}." warning + else + exit 1 + fi + fi fi exec /etc/sysconfig/network-scripts/ifup-post ${CONFIG} ${2} diff --git a/rdma.spec b/rdma.spec index 85aaa14..173c956 100644 --- a/rdma.spec +++ b/rdma.spec @@ -6,10 +6,11 @@ Summary: Infiniband/iWARP Kernel Module Initializer Name: rdma Version: 2.0 -Release: 8%{?dist} +Release: 9%{?dist} License: GPLv2+ Group: System Environment/Base Source0: rdma.conf +Source1: rdma.udev-ipoib-naming.rules Source2: rdma.fixup-mtrr.awk Source4: rdma.ifup-ib Source5: rdma.ifdown-ib @@ -34,6 +35,7 @@ User space initialization scripts for the kernel InfiniBand/iWARP drivers %install rm -rf %{buildroot} install -d %{buildroot}%{_sysconfdir}/%{name} +install -d %{buildroot}%{_sysconfdir}/udev/rules.d install -d %{buildroot}%{_sysconfdir}/sysconfig/network-scripts install -d %{buildroot}%{_sbindir} install -d %{buildroot}%{_unitdir} @@ -41,6 +43,7 @@ install -d %{buildroot}/lib/udev/rules.d # Stuff to go into the base package install -m 0644 %{SOURCE0} %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf +install -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/udev/rules.d/60-persistent-ipoib.rules install -m 0644 %{SOURCE6} %{buildroot}%{_unitdir}/rdma.service install -m 0755 %{SOURCE7} %{buildroot}%{_sbindir}/rdma-init-kernel install -m 0644 %{SOURCE2} %{buildroot}%{_sbindir}/rdma-fixup-mtrr.awk @@ -64,6 +67,7 @@ rm -rf %{buildroot} %defattr(-,root,root,-) %dir %{_sysconfdir}/%{name} %config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf +%config(noreplace) %{_sysconfdir}/udev/rules.d/* %{_unitdir}/%{name}.service %{_sbindir}/rdma-init-kernel %{_sbindir}/rdma-fixup-mtrr.awk @@ -71,6 +75,10 @@ rm -rf %{buildroot} /lib/udev/rules.d/* %changelog +* Wed May 22 2013 Doug Ledford - 2.0-9 +- Add support for P_Key interfaces (IPoIB version of VLANs) +- Add sample 60-persistent-ipoib.rules file + * Mon Mar 25 2013 Doug Ledford - 2.0-8 - Drop the sysv package - Add the SRPT module to the conf file and startup script diff --git a/rdma.udev-ipoib-naming.rules b/rdma.udev-ipoib-naming.rules new file mode 100644 index 0000000..cd7f501 --- /dev/null +++ b/rdma.udev-ipoib-naming.rules @@ -0,0 +1,10 @@ +# This is a sample udev rules file that demonstrates how to get udev to +# set the name of IPoIB interfaces to whatever you wish. There is a +# 16 character limit on network device names though, so don't go too nuts +# +# Important items to note: ATTR{type}=="32" is IPoIB interfaces, and the +# ATTR{address} match must start with ?* and only reference the last 8 +# bytes of the address or else the address might not match on any given +# start of the IPoIB stack +# +# ACTION=="add", SUBSYSTEM=="net", DRIVERS=="?*", ATTR{type}=="32", ATTR{address}=="?*00:02:c9:03:00:31:78:f2", NAME="mlx4_ib3"