diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2013-01-10 20:42:14 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2013-01-10 20:42:14 +0100 |
commit | 97d376fa590b8c8e7e89b622055d9d60ac6383c4 (patch) | |
tree | f174f593408b9716f3bc5cddd565d0841aaef84c | |
parent | 99662768bf3c6487fc0bd0465399fd2010fc2490 (diff) | |
download | net_if-97d376fa590b8c8e7e89b622055d9d60ac6383c4.tar.gz net_if-97d376fa590b8c8e7e89b622055d9d60ac6383c4.tar.bz2 net_if-97d376fa590b8c8e7e89b622055d9d60ac6383c4.zip |
enable autodetection of interfaces in groups
If the given interface on the command line is a group, all interfaces
in this group (that are up) are monitored. While you are using this
mechanism, you will never any warnings of down interfaces unless you
explicit specify the interface on the command line.
-rwxr-xr-x | net_if | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -39,12 +39,12 @@ sub get_if_status { } while (<IFCONFIG>) { - if ($_ =~ m/^$if: flags=([0-9]+)</) { - if ($1 & 1) { - push(@up, $if); + if ($_ =~ m/^([-a-v0-9]+): flags=([0-9]+)</) { + if ($2 & 1) { + push(@up, $1); } else { - push (@down, $if); + push (@down, $if) if $1 eq $if; } } } |