summaryrefslogtreecommitdiffstats
path: root/plugins-root/check_dhcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins-root/check_dhcp.c')
-rw-r--r--plugins-root/check_dhcp.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c
index b02ee49c..42eedec8 100644
--- a/plugins-root/check_dhcp.c
+++ b/plugins-root/check_dhcp.c
@@ -372,11 +372,16 @@ int get_hardware_address(int sock,char *interface_name){
372 char *p; 372 char *p;
373 int unit; 373 int unit;
374 374
375 for(p = interface_name; *p && isalpha(*p); p++) 375 /* get last number from interfacename, eg lnc0, e1000g0*/
376 /* no-op */ ; 376 int i;
377 if( p != '\0' ){ 377 p = interface_name + strlen(interface_name) -1;
378 for(i = strlen(interface_name) -1; i > 0; p--) {
379 if(isalpha(*p))
380 break;
381 }
382 p++;
383 if( p != interface_name ){
378 unit = atoi(p) ; 384 unit = atoi(p) ;
379 *p = '\0' ;
380 strncat(dev, interface_name, 6) ; 385 strncat(dev, interface_name, 6) ;
381 } 386 }
382 else{ 387 else{