From: Ted Lemon Date: Mon, 12 Feb 2001 21:00:02 +0000 (+0000) Subject: - Add tracing hooks. X-Git-Tag: V3-BETA-2-PATCH-18~58 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27e90ede571e942ad4b4f8b1ed223b02cad94717;p=thirdparty%2Fdhcp.git - Add tracing hooks. - Fix a bug in handling of DHCPNAK that would make the server act like it wasn't authoritative. --- diff --git a/server/dhcp.c b/server/dhcp.c index 46418a3b4..c3c88ea9d 100644 --- a/server/dhcp.c +++ b/server/dhcp.c @@ -43,7 +43,7 @@ #ifndef lint static char copyright[] = -"$Id: dhcp.c,v 1.180 2001/01/26 05:57:35 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n"; +"$Id: dhcp.c,v 1.181 2001/02/12 21:00:02 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -52,6 +52,10 @@ int outstanding_pings; static char dhcp_message [256]; +#if defined (TRACING) +# define send_packet trace_packet_send +#endif + void dhcp (packet) struct packet *packet; { @@ -380,6 +384,8 @@ void dhcprequest (packet, ms_nulltp, ip_lease) #if defined (FAILOVER_PROTOCOL) dhcp_failover_state_t *peer; #endif + int have_server_identifier = 0; + int have_requested_addr = 0; oc = lookup_option (&dhcp_universe, packet -> options, DHO_DHCP_REQUESTED_ADDRESS); @@ -392,6 +398,7 @@ void dhcprequest (packet, ms_nulltp, ip_lease) cip.len = 4; memcpy (cip.iabuf, data.data, 4); data_string_forget (&data, MDL); + have_requested_addr = 1; } else { oc = (struct option_cache *)0; cip.len = 4; @@ -427,6 +434,7 @@ void dhcprequest (packet, ms_nulltp, ip_lease) memcpy (sip.iabuf, data.data, 4); data_string_forget (&data, MDL); sprintf (smbuf, " (%s)", piaddr (sip)); + have_server_identifier = 1; } else smbuf [0] = 0; @@ -517,7 +525,7 @@ void dhcprequest (packet, ms_nulltp, ip_lease) if (!packet -> shared_network || (packet -> raw -> ciaddr.s_addr && packet -> raw -> giaddr.s_addr) || - (oc && !packet -> raw -> ciaddr.s_addr)) { + (have_requested_addr && !packet -> raw -> ciaddr.s_addr)) { /* If we don't know where it came from but we do know where it claims to have come from, it didn't come