1 # Filename: net-functions
2 # Purpose: network related functions for use in shellscripts
3 # Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
4 # Bug-Reports: see http://grml.org/bugs/
5 # License: This file is licensed under the GPL v2.
6 # Latest change: Don Okt 12 09:41:32 CEST 2006 [mika]
7 ################################################################################
10 ip r s | awk '/^default/ {print $5}'
14 ignore="vmnet lo sit $(brctl show | awk '{ if(NR >1 ) print $1 }' | xargs)"
15 filter=$(for mask in $ignore; do echo -n '&& $1 !~ /^'$mask/; done)
16 awk 'FS=":" {gsub(" ", ""); if(NR>2 '"$filter"' ) print $1 | "sort" } ' /proc/net/dev
20 awk 'FS=":" {gsub(" ", ""); if(NR>2 ) print $1 | "sort" } ' /proc/net/wireless
23 # getLanDriver deviceName
26 echo $DEVICE | grep -q ath && DEVICE=$(echo $DEVICE | sed 's/ath/wifi/')
27 ethtool -i $DEVICE 2>/dev/null | awk '/^driver:/{print $2}'
30 ## END OF FILE #################################################################