]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Handle 'allow bootp' and 'allow booting' correctly. Unicast if possible.
authorTed Lemon <source@isc.org>
Wed, 20 Oct 1999 16:47:04 +0000 (16:47 +0000)
committerTed Lemon <source@isc.org>
Wed, 20 Oct 1999 16:47:04 +0000 (16:47 +0000)
server/bootp.c

index 224e93e5d02215e82f8e015252e98e1f63bd743b..a5dce15b9ced7a10d4fe6193ddf1b4c379c7131f 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: bootp.c,v 1.55 1999/10/07 06:36:29 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: bootp.c,v 1.56 1999/10/20 16:47:04 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -134,22 +134,19 @@ void bootp (packet)
                                     hp -> group, subnet -> group);
        
        /* Drop the request if it's not allowed for this client. */
-       if (evaluate_boolean_option_cache (packet, lease,
-                                          packet -> options, options, 
-                                          lookup_option (&server_universe,
-                                                         options,
-                                                         SV_ALLOW_BOOTP))) {
+       if ((oc = lookup_option (&server_universe, options, SV_ALLOW_BOOTP)) &&
+           !evaluate_boolean_option_cache (packet, lease,
+                                           packet -> options, options, oc)) {
                log_info ("%s: bootp disallowed", msgbuf);
                option_state_dereference (&options, "bootrequest");
                static_lease_dereference (lease, "bootrequest");
                return;
        } 
 
-       if (evaluate_boolean_option_cache (packet, lease,
-                                          packet -> options, options, 
-                                          lookup_option (&server_universe,
-                                                         options,
-                                                         SV_ALLOW_BOOTING))) {
+       if ((oc = lookup_option (&server_universe,
+                                options, SV_ALLOW_BOOTING)) &&
+           !evaluate_boolean_option_cache (packet, lease,
+                                           packet -> options, options, oc)) {
                log_info ("%s: booting disallowed", msgbuf);
                option_state_dereference (&options, "bootrequest");
                static_lease_dereference (lease, "bootrequest");
@@ -317,6 +314,16 @@ void bootp (packet)
                                              from, &to, &hto);
                        return;
                }
+
+       /* If it comes from a client that already knows its address
+          and is not requesting a broadcast response, and we can
+          unicast to a client without using the ARP protocol, sent it
+          directly to that client. */
+       } else if (!(raw.flags & htons (BOOTP_BROADCAST)) &&
+                  can_unicast_without_arp (packet -> interface)) {
+               to.sin_addr = raw.yiaddr;
+               to.sin_port = remote_port;
+
        /* Otherwise, broadcast it on the local network. */
        } else {
                to.sin_addr = limited_broadcast;