diff options
author | Harper Mann <harpermann@users.sourceforge.net> | 2005-01-25 18:11:21 +0000 |
---|---|---|
committer | Harper Mann <harpermann@users.sourceforge.net> | 2005-01-25 18:11:21 +0000 |
commit | 60780d270fd4ea626023209ae6b159040699f860 (patch) | |
tree | 498b29bca77ababf0c205633326e974f8fdf728b | |
parent | 13411c14f4512edcbc4da82f8202e57a7658208f (diff) | |
download | monitoring-plugins-60780d270fd4ea626023209ae6b159040699f860.tar.gz |
Tracker:1109261 This was an alignment problem on Solaris. Linux kernel fixes alignment so this was not seen there. Memcpy takes care of proper alignment. Tested on RHEL V3 U3, RHEL V4, FreeBSD 4.10 (Thanks Stanley!) and Solaris 9 with the GNU env.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1105 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r-- | plugins/check_dhcp.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/plugins/check_dhcp.c b/plugins/check_dhcp.c index 6703c57c..a3e0c53c 100644 --- a/plugins/check_dhcp.c +++ b/plugins/check_dhcp.c | |||
@@ -770,12 +770,21 @@ int add_dhcp_offer(struct in_addr source,dhcp_packet *offer_packet){ | |||
770 | printf("Option: %d (0x%02X)\n",option_type,option_length); | 770 | printf("Option: %d (0x%02X)\n",option_type,option_length); |
771 | 771 | ||
772 | /* get option data */ | 772 | /* get option data */ |
773 | if(option_type==DHCP_OPTION_LEASE_TIME) | 773 | if(option_type==DHCP_OPTION_LEASE_TIME) { |
774 | dhcp_lease_time=ntohl(*((u_int32_t *)&offer_packet->options[x])); | 774 | memcpy(&dhcp_lease_time, &offer_packet->options[x], |
775 | if(option_type==DHCP_OPTION_RENEWAL_TIME) | 775 | sizeof(dhcp_lease_time)); |
776 | dhcp_renewal_time=ntohl(*((u_int32_t *)&offer_packet->options[x])); | 776 | dhcp_lease_time = ntohl(dhcp_lease_time); |
777 | if(option_type==DHCP_OPTION_REBINDING_TIME) | 777 | } |
778 | dhcp_rebinding_time=ntohl(*((u_int32_t *)&offer_packet->options[x])); | 778 | if(option_type==DHCP_OPTION_RENEWAL_TIME) { |
779 | memcpy(&dhcp_renewal_time, &offer_packet->options[x], | ||
780 | sizeof(dhcp_renewal_time)); | ||
781 | dhcp_renewal_time = ntohl(dhcp_renewal_time); | ||
782 | } | ||
783 | if(option_type==DHCP_OPTION_REBINDING_TIME) { | ||
784 | memcpy(&dhcp_rebinding_time, &offer_packet->options[x], | ||
785 | sizeof(dhcp_rebinding_time)); | ||
786 | dhcp_rebinding_time = ntohl(dhcp_rebinding_time); | ||
787 | } | ||
779 | 788 | ||
780 | /* skip option data we're ignoring */ | 789 | /* skip option data we're ignoring */ |
781 | else | 790 | else |