Code

Tracker:1109261 This was an alignment problem on Solaris. Linux kernel fixes alignm...
authorHarper Mann <harpermann@users.sourceforge.net>
Tue, 25 Jan 2005 18:11:21 +0000 (18:11 +0000)
committerHarper Mann <harpermann@users.sourceforge.net>
Tue, 25 Jan 2005 18:11:21 +0000 (18:11 +0000)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1105 f882894a-f735-0410-b71e-b25c423dba1c

plugins/check_dhcp.c

index 6703c57c3b203e4007133d69912e4264f7fcd396..a3e0c53c58198aa60d19a628d7b5d63e9c5adcf8 100644 (file)
@@ -770,12 +770,21 @@ int add_dhcp_offer(struct in_addr source,dhcp_packet *offer_packet){
                        printf("Option: %d (0x%02X)\n",option_type,option_length);
 
                /* get option data */
-               if(option_type==DHCP_OPTION_LEASE_TIME)
-                       dhcp_lease_time=ntohl(*((u_int32_t *)&offer_packet->options[x]));
-               if(option_type==DHCP_OPTION_RENEWAL_TIME)
-                       dhcp_renewal_time=ntohl(*((u_int32_t *)&offer_packet->options[x]));
-               if(option_type==DHCP_OPTION_REBINDING_TIME)
-                       dhcp_rebinding_time=ntohl(*((u_int32_t *)&offer_packet->options[x]));
+        if(option_type==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));
+            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));
+            dhcp_rebinding_time = ntohl(dhcp_rebinding_time);
+        }
 
                /* skip option data we're ignoring */
                else