hw-test/scripts/scan-netdev

24 lines
541 B
Bash
Executable file

#!/bin/bash
if [[ -z $OUTPUT_DIR ]] ; then
source scan-dmidecode
fi
echo "#DEV MA:CA:DD:RE:SS" > $OUTPUT_DIR/netdev.lst
for DEV in \
`cat /proc/net/dev \
| grep -v bond \
| grep ':' \
| cut -d ':' -f 1`
do
ip link set $DEV up
MAC=`ethtool -P $DEV | cut -d ':' -f 2-9 | sed 's/\s\+//g'`
#MAC=`cat /sys/class/net/$DEV/address`
if [[ "$MAC" != "00:00:00:00:00:00" ]] ; then
#echo "$DEV $MAC"
echo "$DEV $MAC" >> $OUTPUT_DIR/netdev.lst
mkdir -p $OUTPUT_DIR/netdev
ethtool $DEV > $OUTPUT_DIR/netdev/$DEV.ethtool
fi
done