From 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 30 Sep 2013 00:03:24 +0200 Subject: Import Nagios Plugins site Import the Nagios Plugins web site, Cronjobs, infrastructure scripts, and configuration files. --- web/attachments/217472-check_dhcp.c.patch | 93 +++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 web/attachments/217472-check_dhcp.c.patch (limited to 'web/attachments/217472-check_dhcp.c.patch') diff --git a/web/attachments/217472-check_dhcp.c.patch b/web/attachments/217472-check_dhcp.c.patch new file mode 100644 index 0000000..d9b69e0 --- /dev/null +++ b/web/attachments/217472-check_dhcp.c.patch @@ -0,0 +1,93 @@ +--- nagios-plugins-HEAD-200702121300/plugins-root/check_dhcp.c 2007-01-28 22:46:41.000000000 +0100 ++++ nagios-plugins-HEAD-200702121300/plugins-root/check_dhcp.c 2007-02-23 22:36:30.200102288 +0100 +@@ -182,6 +182,7 @@ typedef struct requested_server_struct{ + #define DHCP_OPTION_BROADCAST_ADDRESS 28 + #define DHCP_OPTION_REQUESTED_ADDRESS 50 + #define DHCP_OPTION_LEASE_TIME 51 ++#define DHCP_OPTION_SERVER_IDENTIFIER 54 + #define DHCP_OPTION_RENEWAL_TIME 58 + #define DHCP_OPTION_REBINDING_TIME 59 + +@@ -768,6 +769,7 @@ int add_dhcp_offer(struct in_addr source + int y; + unsigned option_type; + unsigned option_length; ++ struct in_addr serv_ident = {0}; + + if(offer_packet==NULL) + return ERROR; +@@ -789,23 +791,27 @@ int add_dhcp_offer(struct in_addr source + printf("Option: %d (0x%02X)\n",option_type,option_length); + + /* get option data */ +- if(option_type==DHCP_OPTION_LEASE_TIME){ +- memcpy(&dhcp_lease_time, &offer_packet->options[x],sizeof(dhcp_lease_time)); ++ switch(option_type) { ++ case DHCP_OPTION_LEASE_TIME: ++ memcpy(&dhcp_lease_time,offer_packet->options+x,sizeof dhcp_lease_time); + dhcp_lease_time = ntohl(dhcp_lease_time); +- } +- if(option_type==DHCP_OPTION_RENEWAL_TIME){ +- memcpy(&dhcp_renewal_time, &offer_packet->options[x],sizeof(dhcp_renewal_time)); ++ break; ++ case DHCP_OPTION_RENEWAL_TIME: ++ memcpy(&dhcp_renewal_time,offer_packet->options+x,sizeof dhcp_renewal_time); + dhcp_renewal_time = ntohl(dhcp_renewal_time); +- } +- if(option_type==DHCP_OPTION_REBINDING_TIME){ +- memcpy(&dhcp_rebinding_time, &offer_packet->options[x],sizeof(dhcp_rebinding_time)); ++ break; ++ case DHCP_OPTION_REBINDING_TIME: ++ memcpy(&dhcp_rebinding_time,offer_packet->options+x,sizeof dhcp_rebinding_time); + dhcp_rebinding_time = ntohl(dhcp_rebinding_time); +- } +- ++ break; ++ case DHCP_OPTION_SERVER_IDENTIFIER: ++ memcpy(&serv_ident.s_addr,offer_packet->options+x,sizeof serv_ident.s_addr); ++ break; ++ } + /* skip option data we're ignoring */ +- else +- for(y=0;yserver_address=source; ++ new_offer->server_address=serv_ident.s_addr?serv_ident:source; + new_offer->offered_address=offer_packet->yiaddr; + new_offer->lease_time=dhcp_lease_time; + new_offer->renewal_time=dhcp_renewal_time; +@@ -836,14 +842,14 @@ int add_dhcp_offer(struct in_addr source + if(verbose){ + printf(_("Added offer from server @ %s"),inet_ntoa(new_offer->server_address)); + printf(_(" of IP address %s\n"),inet_ntoa(new_offer->offered_address)); +- } ++ } + + /* add new offer to head of list */ + new_offer->next=dhcp_offer_list; + dhcp_offer_list=new_offer; + + return OK; +- } ++} + + + /* frees memory allocated to DHCP OFFER list */ -- cgit v1.2.3-74-g34f1