[ewg] [PATCH] OFED scripts: Get rid of ifconfig
sebastien dugue
sebastien.dugue at bull.net
Tue Feb 22 00:51:46 PST 2011
On Tue, 22 Feb 2011 10:37:02 +0200
Vladimir Sokolovsky <vlad at dev.mellanox.co.il> wrote:
> On 02/21/2011 06:18 PM, sebastien dugue wrote:
> >
> > As ifconfig is obsolete and cannot cope with IB link layer addresses,
> > replace all instances of ifconfig with the corresponding(s) ip commands
> > in ofed_scripts.
> >
> > Signed-off-by: Sebastien Dugue<sebastien.dugue at bull.net>
> > ---
>
> Hi Sebastien,
> ipcalc is not installed on SLES10/SLES11.
> So, this patch cannot be applied on openibd.
Ah OK, I just checked, it does not exists under debian as well.
I'll try to think of something else.
Thanks,
Sébastien.
>
> Regards,
> Vladimir
>
> > ofed_scripts/ibdev2netdev | 2 +-
> > ofed_scripts/openibd | 10 +++++++---
> > 2 files changed, 8 insertions(+), 4 deletions(-)
> >
> > diff --git a/ofed_scripts/ibdev2netdev b/ofed_scripts/ibdev2netdev
> > index 7cffa7e..9faa4e3 100755
> > --- a/ofed_scripts/ibdev2netdev
> > +++ b/ofed_scripts/ibdev2netdev
> > @@ -130,7 +130,7 @@ function find_mac()
> > done
> > }
> >
> > -ifcs=$(ifconfig -a | egrep '^eth|^ib' | gawk '{print $1}')
> > +ifcs=$(/sbin/ip -o link | awk -F ": " '{print $2}' | egrep '^eth|^ib')
> >
> > for ifc in $ifcs; do
> > len=$(cat /sys/class/net/$ifc/addr_len)
> > diff --git a/ofed_scripts/openibd b/ofed_scripts/openibd
> > index 99b8131..1cd7419 100644
> > --- a/ofed_scripts/openibd
> > +++ b/ofed_scripts/openibd
> > @@ -762,7 +762,9 @@ bring_up()
> > else
> > . ${NETWORK_CONF_DIR}/ifcfg-${i}
> > if [ ! -z ${IPADDR} ]&& [ ! -z ${NETMASK} ]&& [ ! -z ${BROADCAST} ]; then
> > - /sbin/ifconfig ${i} ${IPADDR} netmask ${NETMASK} broadcast ${BROADCAST}> /dev/null 2>&1
> > + eval $(/bin/ipcalc --prefix ${IPADDR} ${NETMASK})
> > + /sbin/ip addr add ${IPADDR}/${PREFIX} broadcast ${BROADCAST} dev ${i}> /dev/null 2>&1
> > + /sbin/ip link set ${i} up> /dev/null 2>&1
> > else
> > /sbin/ifup ${i}
> > fi
> > @@ -770,12 +772,14 @@ bring_up()
> > ;;
> > SuSE)
> > if [ "$KPREFIX" == "26" ]; then
> > - ifconfig ${i} up> /dev/null 2>&1
> > + /sbin/ip link set ${i} up> /dev/null 2>&1
> > fi
> > # Workaround for ifup issue: two devices with the same IP address
> > . ${NETWORK_CONF_DIR}/ifcfg-${i}
> > if [ ! -z ${IPADDR} ]&& [ ! -z ${NETMASK} ]&& [ ! -z ${BROADCAST} ]; then
> > - /sbin/ifconfig ${i} ${IPADDR} netmask ${NETMASK} broadcast ${BROADCAST}> /dev/null 2>&1
> > + eval $(/bin/ipcalc --prefix ${IPADDR} ${NETMASK})
> > + /sbin/ip addr add ${IPADDR}/${PREFIX} broadcast ${BROADCAST} dev ${i}> /dev/null 2>&1
> > + /sbin/ip link set ${i} up> /dev/null 2>&1
> > else
> > /sbin/ifup ${i}
> > fi
>
>
More information about the ewg
mailing list