From 79336ef9b3f81d2e96006ef776c28fdbd3a3cd37 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Fri, 8 Sep 2023 11:59:13 +0200 Subject: [PATCH] Collect information about network devices via ethtool --- grml-hwinfo | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/grml-hwinfo b/grml-hwinfo index 0281e39..6583080 100755 --- a/grml-hwinfo +++ b/grml-hwinfo @@ -160,6 +160,17 @@ disk_info() { disklist=$(lsblk -nd -o NAME -e 7,11) } +# return list of all network devices in array "${niclist[@]}" +get_network_devices() { + local interface + niclist=() + for interface in /sys/class/net/* ; do + [ -e "${interface}" ] || continue + interface=$(basename "${interface}") + # [ "${interface}" = "lo" ] && continue + niclist+=("${interface}") + done +} cd "${OUTDIR}" || exit 1 ( @@ -236,6 +247,23 @@ cd "${OUTDIR}" || exit 1 exectest ifconfig && ifconfig -v -a > ./ifconfig exectest route && route -n > ./route + # net stuff, ethtool + if exectest ethtool ; then + get_network_devices + for dev in "${niclist[@]}" ; do + ethtool "${dev}" > ethtool_"${dev}" + case "${dev}" in + "lo") + # skip the loopback device, `ethtool --driver lo` fails with: + # "Cannot get driver information: Operation not supported" + ;; + *) + ethtool --driver "${dev}" > ethtool_"${dev}_driver" + ;; + esac + done + fi + # net stuff, iproute: exectest ip && ip addrlabel list > ip_addrlabel exectest ip && ip addr show > ip_addr -- 2.1.4