From: Ted Lemon Date: Thu, 6 Mar 1997 18:40:22 +0000 (+0000) Subject: Add a message to abandon_lease; ping before sending DHCPREQUEST. X-Git-Tag: DHCP-970328~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b7df7078cd1a8b32572ac2737a41d17fcdbb410;p=thirdparty%2Fdhcp.git Add a message to abandon_lease; ping before sending DHCPREQUEST. --- diff --git a/server/dhcp.c b/server/dhcp.c index 9fe909ea1..38ed3d9af 100644 --- a/server/dhcp.c +++ b/server/dhcp.c @@ -42,11 +42,13 @@ #ifndef lint static char copyright[] = -"$Id: dhcp.c,v 1.43 1997/03/06 07:02:00 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: dhcp.c,v 1.44 1997/03/06 18:40:22 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" +int outstanding_pings; + static unsigned char dhcp_message [256]; void dhcp (packet) @@ -304,10 +306,9 @@ void dhcpdecline (packet) ? inet_ntoa (packet -> raw -> giaddr) : packet -> interface -> name); - /* If we found a lease, mark it as unusable and complain. */ if (lease) { - abandon_lease (lease); + abandon_lease (lease, "declined."); } } @@ -824,7 +825,16 @@ void ack_lease (packet, lease, offer, when) #endif lease -> state = state; - dhcp_reply (lease); + + /* If this is a DHCPOFFER, ping the lease address before actually + sending the offer. */ + if (offer == DHCPOFFER) { + icmp_echorequest (&lease -> ip_addr); + add_timeout (cur_time + 1, lease_ping_timeout, lease); + ++outstanding_pings; + } else { + dhcp_reply (lease); + } } void dhcp_reply (lease)