From 16d0957092bf3ad8d54f67dce43fa79383869154 Mon Sep 17 00:00:00 2001 From: Ted Lemon Date: Thu, 8 Apr 1999 21:39:34 +0000 Subject: [PATCH] Send subnet mask from subnet declaration if no explicit option is provided. --- server/bootp.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/server/bootp.c b/server/bootp.c index d9a9edf9e..173175507 100644 --- a/server/bootp.c +++ b/server/bootp.c @@ -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. */ -- 2.47.3