From: Ted Lemon Date: Fri, 6 Nov 1998 02:59:11 +0000 (+0000) Subject: Classify all incoming dhcp packets. Process class scopes. X-Git-Tag: carrel-2~25 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b3f15965cccaf133bc74d49684c5e91a3fb9dfac;p=thirdparty%2Fdhcp.git Classify all incoming dhcp packets. Process class scopes. --- diff --git a/server/dhcp.c b/server/dhcp.c index 5bd0ed7f5..bd43c073f 100644 --- a/server/dhcp.c +++ b/server/dhcp.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: dhcp.c,v 1.69 1998/11/06 01:04:32 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n"; +"$Id: dhcp.c,v 1.70 1998/11/06 02:59:11 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -57,6 +57,9 @@ void dhcp (packet) if (!locate_network (packet) && packet -> packet_type != DHCPREQUEST) return; + /* Classify the client. */ + classify_client (packet); + switch (packet -> packet_type) { case DHCPDISCOVER: dhcpdiscover (packet); @@ -88,9 +91,6 @@ void dhcpdiscover (packet) { struct lease *lease; - /* Classify the client. */ - classify_client (packet); - note ("DHCPDISCOVER from %s via %s", print_hw_addr (packet -> raw -> htype, packet -> raw -> hlen, @@ -544,8 +544,6 @@ void ack_lease (packet, lease, offer, when) return; } - /* XXX Process class restrictions. */ - /* Allocate a lease state structure... */ state = new_lease_state ("ack_lease"); if (!state) @@ -599,7 +597,12 @@ void ack_lease (packet, lease, offer, when) /* Vendor and user classes are only supported for DHCP clients. */ if (state -> offer) { - /* XXX process class stuff here. */ + for (i = packet -> class_count; i > 0; i--) { + execute_statements_in_scope + (packet, &state -> options, + packet -> classes [i - 1] -> group, + (struct group *)0); + } } /* If we have a host_decl structure, run the options associated