-if missing_program ip; then
- echo "$0: ip not found in $PATH" >&2
- exit 1
-fi
-
-if test "$#" = 0; then
- echo "# $0: no parameters given (use \"$0 --help\" for help)"
-fi
-
-devs=$*
-for dev in $devs; do
- state=`ip link show dev $dev` || continue
-
- echo "# $dev"
- # Link state (Ethernet addresses, up/down, ...)
- linkcmd=
- case $state in
- *"state UP"* | *[,\<]"UP"[,\>]* )
- linkcmd="$linkcmd up"
- ;;
- *"state DOWN"*)
- linkcmd="$linkcmd down"
- ;;
- esac
- if expr "$state" : '.*\bdynamic\b' > /dev/null; then
- linkcmd="$linkcmd dynamic"
- fi
- if qlen=`expr "$state" : '.*qlen \([0-9]+\)'`; then
- linkcmd="$linkcmd txqueuelen $qlen"
- fi
- if hwaddr=`expr "$state" : '.*link/ether \([^ ]*\)'`; then
- linkcmd="$linkcmd address $hwaddr"
- fi
- if brd=`expr "$state" : '.*brd \([^ ]*\)'`; then
- linkcmd="$linkcmd broadcast $brd"
- fi
- if mtu=`expr "$state" : '.*mtu \([0-9]+\)'`; then
- linkcmd="$linkcmd mtu $mtu"