summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2013-01-10 20:42:14 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2013-01-10 20:42:14 +0100
commit97d376fa590b8c8e7e89b622055d9d60ac6383c4 (patch)
treef174f593408b9716f3bc5cddd565d0841aaef84c
parent99662768bf3c6487fc0bd0465399fd2010fc2490 (diff)
downloadnet_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-xnet_if8
1 files changed, 4 insertions, 4 deletions
diff --git a/net_if b/net_if
index e7825ec..8d6f71d 100755
--- a/net_if
+++ b/net_if
@@ -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;
}
}
}