From 0b0f98c44cdc51459d986c9f1610d3fd5054be0d Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Mon, 4 Feb 2013 21:50:26 +0100 Subject: [PATCH] adapt if_err_.c suggest to the mainline plugin Previously it would only detect specific interfaces. Now detecting bios named devices should work. --- tools/munin-plugins-busybox/if_err_.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/tools/munin-plugins-busybox/if_err_.c b/tools/munin-plugins-busybox/if_err_.c index 9bb62570..f4fe8174 100644 --- a/tools/munin-plugins-busybox/if_err_.c +++ b/tools/munin-plugins-busybox/if_err_.c @@ -37,20 +37,18 @@ int if_err_(int argc, char **argv) { for(s=buff;*s == ' ';++s) ; i = 0; - if(!strncmp(s, "eth", 3)) - i = 3; - else if(!strncmp(s, "wlan", 4)) - i = 4; - else if(!strncmp(s, "ath", 3)) - i = 3; - else if(!strncmp(s, "ra", 2)) - i = 2; - if(i == 0) + if(!strncmp(s, "lo:", 3)) continue; - while(isdigit(s[i])) + if(!strncmp(s, "sit", 3)) { + for(i=3; isdigit(s[i]); ++i) + ; + if(s[i] == ':') + continue; + } + while(s[i] != ':' && s[i] != '\0') ++i; if(s[i] != ':') - continue; + continue; /* a header line */ s[i] = '\0'; puts(s); }