/usr/sbin/ibhosts is in infiniband-diags 2.0.0-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | #!/bin/bash
IBPATH=${IBPATH:-/usr/sbin}
usage() {
echo Usage: `basename $0` "[-h] [<topology-file> | -y mkey" \
"-C ca_name -P ca_port -t timeout_ms]"
exit -1
}
topofile=""
ca_info=""
mkey="0"
while [ "$1" ]; do
case $1 in
-h | --help)
usage
;;
-y | --m_key)
case $2 in
-*)
usage
;;
esac
if [ x$2 = x ] ; then
usage
fi
shift
mkey="$1"
;;
-P | --Port | -C | --Ca | -t | --timeout)
case $2 in
-*)
usage
;;
esac
if [ x$2 = x ] ; then
usage
fi
ca_info="$ca_info $1 $2"
shift
;;
-*)
usage
;;
*)
if [ "$topofile" ]; then
usage
fi
topofile="$1"
;;
esac
shift
done
if [ "$topofile" ]; then
netcmd="cat $topofile"
else
netcmd="$IBPATH/ibnetdiscover -y $mkey $ca_info"
fi
text="`eval $netcmd`"
rv=$?
echo "$text" | awk '
/^Ca/ {print $1 "\t: 0x" substr($3, 4, 16) " ports " $2 " "\
substr($0, match($0, "#[ \t]*")+RLENGTH)}
/^ib/ {print $0; next}
/ibpanic:/ {print $0}
/ibwarn:/ {print $0}
/iberror:/ {print $0}
'
exit $rv
|