]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Allow filename and server name to come from the lease group as well as the host group...
authorTed Lemon <source@isc.org>
Tue, 24 Nov 1998 23:12:39 +0000 (23:12 +0000)
committerTed Lemon <source@isc.org>
Tue, 24 Nov 1998 23:12:39 +0000 (23:12 +0000)
server/dhcp.c

index 3cbc0212e76a2f637eeb38e3728a20b425446c96..48fc56e62ff4fe549d1e68969fb861a57994c8ac 100644 (file)
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: dhcp.c,v 1.57.2.10 1998/06/29 22:46:44 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: dhcp.c,v 1.57.2.11 1998/11/24 23:12:39 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -626,6 +626,10 @@ void ack_lease (packet, lease, offer, when)
        else if (packet -> raw -> file [0])
                strncpy (state -> filename, packet -> raw -> file,
                         sizeof state -> filename);
+       else if (lease -> subnet -> group -> filename)
+               strncpy (state -> filename,
+                        lease -> subnet -> group -> filename,
+                        sizeof state -> filename);
        else
                strcpy (state -> filename, "");
 
@@ -636,6 +640,9 @@ void ack_lease (packet, lease, offer, when)
                state -> server_name = user_class -> group -> server_name;
        else if (vendor_class  && vendor_class -> group -> server_name)
                state -> server_name = vendor_class -> group -> server_name;
+       else if (lease -> subnet -> group -> server_name)
+               state -> server_name =
+                       lease -> subnet -> group -> server_name;
        else state -> server_name = (char *)0;
 
        /* At this point, we have a lease that we can offer the client.
@@ -707,8 +714,6 @@ void ack_lease (packet, lease, offer, when)
                lt.flags = BOOTP_LEASE;
        }
 
-       lt.timestamp = cur_time;
-
        /* Record the uid, if given... */
        i = DHO_DHCP_CLIENT_IDENTIFIER;
        if (packet -> options [i].len) {
@@ -989,11 +994,14 @@ void ack_lease (packet, lease, offer, when)
 
        /* If this is a DHCPOFFER, ping the lease address before actually
           sending the offer. */
-       if (offer == DHCPOFFER && !(lease -> flags & STATIC_LEASE)) {
+       if (offer == DHCPOFFER && !(lease -> flags & STATIC_LEASE) &&
+           cur_time - lease -> timestamp > 60) {
+               lease -> timestamp = cur_time;
                icmp_echorequest (&lease -> ip_addr);
                add_timeout (cur_time + 1, lease_ping_timeout, lease);
                ++outstanding_pings;
        } else {
+               lease -> timestamp = cur_time;
                dhcp_reply (lease);
        }
 }