]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Send subnet mask from subnet declaration if no explicit option is provided.
authorTed Lemon <source@isc.org>
Thu, 8 Apr 1999 21:39:34 +0000 (21:39 +0000)
committerTed Lemon <source@isc.org>
Thu, 8 Apr 1999 21:39:34 +0000 (21:39 +0000)
server/bootp.c

index d9a9edf9e05dfbb01a5b6e7b7e33149c20c67375..1731755076edf8d701bca2ccbf53a1de9497782c 100644 (file)
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: bootp.c,v 1.28.2.5 1999/04/06 15:15:00 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: bootp.c,v 1.28.2.6 1999/04/08 21:39:34 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -240,6 +240,8 @@ void bootp (packet)
                        packet -> raw -> options, DHCP_OPTION_LEN);
                outgoing.packet_length = BOOTP_MIN_LEN;
        } else {
+               struct tree_cache netmask_tree;   /*  -- RBF */
+
                /* Come up with a list of options that we want to send
                   to this client.  Start with the per-subnet options,
                   and then override those with client-specific
@@ -252,6 +254,18 @@ void bootp (packet)
                                options [i] = hp -> group -> options [i];
                }
 
+               /* Use the subnet mask from the subnet declaration if no other
+                  mask has been provided. */
+               if (!options [DHO_SUBNET_MASK]) {
+                       options [DHO_SUBNET_MASK] = &netmask_tree;
+                       netmask_tree.flags = TC_TEMPORARY;
+                       netmask_tree.value = lease -> subnet -> netmask.iabuf;
+                       netmask_tree.len = lease -> subnet -> netmask.len;
+                       netmask_tree.buf_size = lease -> subnet -> netmask.len;
+                       netmask_tree.timeout = 0xFFFFFFFF;
+                       netmask_tree.tree = (struct tree *)0;
+               }
+
                /* Pack the options into the buffer.  Unlike DHCP, we
                   can't pack options into the filename and server
                   name buffers. */