diff options
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/check_dhcp.c | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/plugins/check_dhcp.c b/plugins/check_dhcp.c index f668a880..623636c8 100644 --- a/plugins/check_dhcp.c +++ b/plugins/check_dhcp.c | |||
| @@ -291,10 +291,7 @@ int get_hardware_address(int sock,char *interface_name){ | |||
| 291 | memcpy(&client_hardware_address[0],&ifr.ifr_hwaddr.sa_data,6); | 291 | memcpy(&client_hardware_address[0],&ifr.ifr_hwaddr.sa_data,6); |
| 292 | 292 | ||
| 293 | #elif defined(__bsd__) | 293 | #elif defined(__bsd__) |
| 294 | 294 | /* King 2004 see ACKNOWLEDGEMENTS */ | |
| 295 | /* Code from getmac.c posted at http://lists.freebsd.org/pipermail/freebsd-hackers/2004-June/007415.html | ||
| 296 | * by Alecs King based on Unix Network programming Ch 17 | ||
| 297 | */ | ||
| 298 | 295 | ||
| 299 | int mib[6], len; | 296 | int mib[6], len; |
| 300 | char *buf; | 297 | char *buf; |
| @@ -332,20 +329,11 @@ int get_hardware_address(int sock,char *interface_name){ | |||
| 332 | sdl = (struct sockaddr_dl *)(ifm + 1); | 329 | sdl = (struct sockaddr_dl *)(ifm + 1); |
| 333 | ptr = (unsigned char *)LLADDR(sdl); | 330 | ptr = (unsigned char *)LLADDR(sdl); |
| 334 | memcpy(&client_hardware_address[0], ptr, 6) ; | 331 | memcpy(&client_hardware_address[0], ptr, 6) ; |
| 332 | /* King 2004 */ | ||
| 335 | 333 | ||
| 336 | #elif defined(__sun__) || defined(__solaris__) | 334 | #elif defined(__sun__) || defined(__solaris__) |
| 337 | 335 | ||
| 338 | /* | 336 | /* Kompf 2000-2003 see ACKNOWLEDGEMENTS */ |
| 339 | * Lifted from | ||
| 340 | * | ||
| 341 | * mac_addr_dlpi.c | ||
| 342 | * | ||
| 343 | * Copyright @2000, 2003 Martin Kompf, martin@kompf.de | ||
| 344 | * | ||
| 345 | * Return the MAC (ie, ethernet hardware) address by using the dlpi api. | ||
| 346 | * | ||
| 347 | */ | ||
| 348 | |||
| 349 | long stat; | 337 | long stat; |
| 350 | char dev[20] = "/dev/"; | 338 | char dev[20] = "/dev/"; |
| 351 | char *p; | 339 | char *p; |
| @@ -369,11 +357,6 @@ int get_hardware_address(int sock,char *interface_name){ | |||
| 369 | 357 | ||
| 370 | #elif defined(__hpux__) | 358 | #elif defined(__hpux__) |
| 371 | 359 | ||
| 372 | /* Martin Kompf again | ||
| 373 | * | ||
| 374 | * Nagios plugins thank you sincerely | ||
| 375 | */ | ||
| 376 | |||
| 377 | long stat; | 360 | long stat; |
| 378 | char dev[20] = "/dev/dlpi" ; | 361 | char dev[20] = "/dev/dlpi" ; |
| 379 | int unit = 0; | 362 | int unit = 0; |
| @@ -383,6 +366,7 @@ int get_hardware_address(int sock,char *interface_name){ | |||
| 383 | printf("Error: can't read MAC address from DLPI streams interface for device %s unit %d.\n", dev, unit); | 366 | printf("Error: can't read MAC address from DLPI streams interface for device %s unit %d.\n", dev, unit); |
| 384 | exit(STATE_UNKNOWN); | 367 | exit(STATE_UNKNOWN); |
| 385 | } | 368 | } |
| 369 | /* Kompf 2000-2003 */ | ||
| 386 | 370 | ||
| 387 | #else | 371 | #else |
| 388 | printf("Error: can't get MAC address for this architecture.\n"); | 372 | printf("Error: can't get MAC address for this architecture.\n"); |
| @@ -1156,12 +1140,7 @@ int validate_arguments(void){ | |||
| 1156 | 1140 | ||
| 1157 | #if defined(__sun__) || defined(__solaris__) || defined(__hpux__) | 1141 | #if defined(__sun__) || defined(__solaris__) || defined(__hpux__) |
| 1158 | 1142 | ||
| 1159 | 1143 | /* Kompf 2000-2003 see ACKNOWLEDGEMENTS */ | |
| 1160 | /* | ||
| 1161 | * Copyright @2000, 2003 Martin Kompf, martin@kompf.de | ||
| 1162 | * | ||
| 1163 | * Nagios plugins thanks Martin for this code. | ||
| 1164 | */ | ||
| 1165 | 1144 | ||
| 1166 | /* get a message from a stream; return type of message */ | 1145 | /* get a message from a stream; return type of message */ |
| 1167 | static int get_msg(int fd) | 1146 | static int get_msg(int fd) |
| @@ -1289,4 +1268,5 @@ long mac_addr_dlpi( const char *dev, int unit, u_char *addr) { | |||
| 1289 | } | 1268 | } |
| 1290 | 1269 | ||
| 1291 | #endif | 1270 | #endif |
| 1271 | /* Kompf 2000-2003 */ | ||
| 1292 | 1272 | ||
