From: Ted Lemon Date: Sun, 19 Apr 1998 23:34:43 +0000 (+0000) Subject: Do client classification. If user supplies a dhcp-lease-time or related option... X-Git-Tag: carrel-2~118 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5941275aac6bbaadbb41df57c719c9d7f9d41db6;p=thirdparty%2Fdhcp.git Do client classification. If user supplies a dhcp-lease-time or related option, print a warning when issuing a lease. --- diff --git a/server/dhcp.c b/server/dhcp.c index 49b97d6b9..eb9bd4f99 100644 --- a/server/dhcp.c +++ b/server/dhcp.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: dhcp.c,v 1.62 1998/04/09 04:41:52 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: dhcp.c,v 1.63 1998/04/19 23:34:43 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -86,9 +86,12 @@ void dhcp (packet) void dhcpdiscover (packet) struct packet *packet; { - struct lease *lease = find_lease (packet, packet -> shared_network, 0); + struct lease *lease; struct host_decl *hp; + /* Classify the client. */ + classify_client (packet); + note ("DHCPDISCOVER from %s via %s", print_hw_addr (packet -> raw -> htype, packet -> raw -> hlen, @@ -97,6 +100,8 @@ void dhcpdiscover (packet) ? inet_ntoa (packet -> raw -> giaddr) : packet -> interface -> name); + lease = find_lease (packet, packet -> shared_network, 0); + /* Sourceless packets don't make sense here. */ if (!packet -> shared_network) { note ("Packet from unknown subnet: %s", @@ -901,6 +906,9 @@ void ack_lease (packet, lease, offer, when) putULong ((unsigned char *)&state -> expiry, offered_lease_time); i = DHO_DHCP_LEASE_TIME; + if (state -> options [i]) + warn ("dhcp-lease-time option for %s overridden.", + inet_ntoa (state -> ciaddr)); state -> options [i] = new_tree_cache ("lease-expiry"); state -> options [i] -> flags = TC_TEMPORARY; state -> options [i] -> value = @@ -915,6 +923,9 @@ void ack_lease (packet, lease, offer, when) putULong ((unsigned char *)&state -> renewal, offered_lease_time); i = DHO_DHCP_RENEWAL_TIME; + if (state -> options [i]) + warn ("dhcp-renewal-time option for %s overridden.", + inet_ntoa (state -> ciaddr)); state -> options [i] = new_tree_cache ("renewal-time"); state -> options [i] -> flags = TC_TEMPORARY; state -> options [i] -> value = @@ -931,6 +942,9 @@ void ack_lease (packet, lease, offer, when) putULong ((unsigned char *)&state -> rebind, offered_lease_time); i = DHO_DHCP_REBINDING_TIME; + if (state -> options [i]) + warn ("dhcp-rebinding-time option for %s overridden.", + inet_ntoa (state -> ciaddr)); state -> options [i] = new_tree_cache ("rebind-time"); state -> options [i] -> flags = TC_TEMPORARY; state -> options [i] -> value =