/******************************************************************************
*
* Nagios check_dhcp plugin
*
* License: GPL
* Copyright (c) 2001-2004 Ethan Galstad (nagios@nagios.org)
* Copyright (c) 2001-2006 Nagios Plugin Development Team
*
* Last Modified: $Date: 2007-07-26 18:32:37 +0100 (Thu, 26 Jul 2007) $
*
* Description:
*
* This file contains the check_dhcp plugin
*
* This plugin tests the availability of DHCP servers on a network.
*
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: check_dhcp.c 1766 2007-07-26 17:32:37Z hweiss $
*
* ------------------------------------------------------------------------
* Unicast mode was originally implemented by Heiti of Boras Kommun with
* general improvements as well as usability fixes and "forward"-porting by
* Andreas Ericsson of OP5 AB.
* ------------------------------------------------------------------------
*
*****************************************************************************/
const char *progname = "check_dhcp";
const char *revision = "$Revision: 1766 $";
const char *copyright = "2001-2006";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
#include "netutils.h"
#include "utils.h"
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <getopt.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netdb.h>
#include <netinet/in.h>
#include <net/if.h>
#include <arpa/inet.h>
#if HAVE_SYS_SOCKIO_H
#include <sys/sockio.h>
#endif
#if defined( __linux__ )
#include <linux/if_ether.h>
#include <features.h>
#elif defined (__bsd__)
#include <netinet/if_ether.h>
#include <sys/param.h>
#include <sys/sysctl.h>
#include <net/if_dl.h>
#elif defined(__sun__) || defined(__solaris__) || defined(__hpux__)
#define INSAP 22
#define OUTSAP 24
#include <signal.h>
#include <ctype.h>
#include <sys/stropts.h>
#include <sys/poll.h>
#include <sys/dlpi.h>
#define bcopy(source, destination, length) memcpy(destination, source, length)
#define AREA_SZ 5000 /* buffer length in bytes */
static u_long ctl_area[AREA_SZ];
static u_long dat_area[AREA_SZ];
=1= |