summaryrefslogtreecommitdiffstats
path: root/plugins-root
diff options
context:
space:
mode:
Diffstat (limited to 'plugins-root')
-rw-r--r--plugins-root/check_dhcp.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c
index ac89274..b02ee49 100644
--- a/plugins-root/check_dhcp.c
+++ b/plugins-root/check_dhcp.c
@@ -141,7 +141,7 @@ typedef struct dhcp_packet_struct{
141 u_int16_t flags; /* flags */ 141 u_int16_t flags; /* flags */
142 struct in_addr ciaddr; /* IP address of this machine (if we already have one) */ 142 struct in_addr ciaddr; /* IP address of this machine (if we already have one) */
143 struct in_addr yiaddr; /* IP address of this machine (offered by the DHCP server) */ 143 struct in_addr yiaddr; /* IP address of this machine (offered by the DHCP server) */
144 struct in_addr siaddr; /* IP address of DHCP server */ 144 struct in_addr siaddr; /* IP address of next server */
145 struct in_addr giaddr; /* IP address of DHCP relay */ 145 struct in_addr giaddr; /* IP address of DHCP relay */
146 unsigned char chaddr [MAX_DHCP_CHADDR_LENGTH]; /* hardware address of this machine */ 146 unsigned char chaddr [MAX_DHCP_CHADDR_LENGTH]; /* hardware address of this machine */
147 char sname [MAX_DHCP_SNAME_LENGTH]; /* name of DHCP server */ 147 char sname [MAX_DHCP_SNAME_LENGTH]; /* name of DHCP server */
@@ -587,11 +587,6 @@ int get_dhcp_offer(int sock){
587 /* Save a copy of "source" into "via" even if it's via itself */ 587 /* Save a copy of "source" into "via" even if it's via itself */
588 memcpy(&via,&source,sizeof(source)) ; 588 memcpy(&via,&source,sizeof(source)) ;
589 589
590 /* If siaddr is non-zero, set "source" to siaddr */
591 if(offer_packet.siaddr.s_addr != 0L){
592 source.sin_addr.s_addr = offer_packet.siaddr.s_addr ;
593 }
594
595 if(verbose){ 590 if(verbose){
596 printf(_("DHCPOFFER from IP address %s"),inet_ntoa(source.sin_addr)); 591 printf(_("DHCPOFFER from IP address %s"),inet_ntoa(source.sin_addr));
597 printf(_(" via %s\n"),inet_ntoa(via.sin_addr)); 592 printf(_(" via %s\n"),inet_ntoa(via.sin_addr));
@@ -904,9 +899,9 @@ int add_dhcp_offer(struct in_addr source,dhcp_packet *offer_packet){
904 * the next bootstrap service (e.g., delivery of an operating system 899 * the next bootstrap service (e.g., delivery of an operating system
905 * executable image). A DHCP server always returns its own address in 900 * executable image). A DHCP server always returns its own address in
906 * the 'server identifier' option." 'serv_ident' is the 'server 901 * the 'server identifier' option." 'serv_ident' is the 'server
907 * identifier' option, 'source' is the 'siaddr' field or (if 'siaddr' 902 * identifier' option, 'source' is the IP address we received the
908 * wasn't available) the IP address we received the DHCPOFFER from. If 903 * DHCPOFFER from. If 'serv_ident' isn't available for some reason, we
909 * 'serv_ident' isn't available for some reason, we use 'source'. 904 * use 'source'.
910 */ 905 */
911 new_offer->server_address=serv_ident.s_addr?serv_ident:source; 906 new_offer->server_address=serv_ident.s_addr?serv_ident:source;
912 new_offer->offered_address=offer_packet->yiaddr; 907 new_offer->offered_address=offer_packet->yiaddr;