Also showing bridge IP addresses

This commit is contained in:
Igor Pečovnik 2018-02-15 19:27:41 +01:00 committed by GitHub
parent 180112d72d
commit 5c7ee75adc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -105,8 +105,8 @@ function get_ip_addresses() {
local ips=()
for f in /sys/class/net/*; do
local intf=$(basename $f)
# match only interface names starting with e (Ethernet), w (wireless), r (some Ralink drivers use ra<number> format)
if [[ $intf =~ ^[ewr].* ]]; then
# match only interface names starting with e (Ethernet), b (bridge), w (wireless), r (some Ralink drivers use ra<number> format)
if [[ $intf =~ ^[ebwr].* ]]; then
local tmp=$(ip -4 addr show dev $intf | awk '/inet/ {print $2}' | cut -d'/' -f1)
# add both name and IP - can be informative but becomes ugly with long persistent/predictable device names
#[[ -n $tmp ]] && ips+=("$intf: $tmp")