Commit 5cefe5e5 authored by Ted Lemon's avatar Ted Lemon
Browse files

- Do what people expect when they don't declare the subnet to which an

  interface is attached.
parent da411127
......@@ -47,7 +47,7 @@
#ifndef lint
static char copyright[] =
"$Id: bpf.c,v 1.41 2000/07/27 09:02:29 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
"$Id: bpf.c,v 1.42 2000/09/01 23:03:31 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
......@@ -517,6 +517,12 @@ int can_receive_unicast_unconfigured (ip)
return 1;
}
int supports_multiple_interfaces (ip)
struct interface_info *ip;
{
return 1;
}
void maybe_setup_fallback ()
{
isc_result_t status;
......
......@@ -43,7 +43,7 @@
#ifndef lint
static char copyright[] =
"$Id: discover.c,v 1.30 2000/07/06 22:37:39 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
"$Id: discover.c,v 1.31 2000/09/01 23:03:33 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
......@@ -489,10 +489,27 @@ void discover_interfaces (state)
if (!tmp -> shared_network && (state == DISCOVER_SERVER)) {
log_error ("No subnet declaration for %s (%s).",
tmp -> name, inet_ntoa (foo.sin_addr));
log_error ("Please write a subnet declaration in %s",
"your dhcpd.conf file for the");
log_fatal ("network segment to which interface %s %s",
tmp -> name, "is attached.");
if (supports_multiple_interfaces (tmp)) {
log_error ("Ignoring requests on %s.",
tmp -> name);
log_error ("If this is not what you want, %s",
"please write");
log_error ("a subnet declaration in your %s",
"dhcpd.conf file for");
log_error ("the network segment to %s %s %s",
"which interface",
tmp -> name, "is attached.");
goto next;
} else {
log_error ("You must write a subnet %s",
" declaration for this");
log_error ("subnet. You cannot prevent %s",
"the DHCP server");
log_error ("from listening on this subnet %s",
"because your");
log_fatal ("operating system does not %s.",
"support this capability");
}
}
/* Find subnets that don't have valid interface
......@@ -523,6 +540,7 @@ void discover_interfaces (state)
tmp -> name);
}
#endif
next:
interface_dereference (&tmp, MDL);
if (next)
interface_reference (&tmp, next, MDL);
......
......@@ -84,7 +84,7 @@
#ifndef lint
static char copyright[] =
"$Id: dlpi.c,v 1.22 2000/07/27 09:02:31 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
"$Id: dlpi.c,v 1.23 2000/09/01 23:03:34 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
......@@ -1311,6 +1311,12 @@ int can_receive_unicast_unconfigured (ip)
return 1;
}
int supports_multiple_interfaces (ip)
struct interface_info *ip;
{
return 1;
}
void maybe_setup_fallback ()
{
isc_result_t status;
......
......@@ -37,7 +37,7 @@
#ifndef lint
static char copyright[] =
"$Id: lpf.c,v 1.26 2000/07/27 09:02:33 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
"$Id: lpf.c,v 1.27 2000/09/01 23:03:35 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
......@@ -388,6 +388,12 @@ int can_receive_unicast_unconfigured (ip)
return 1;
}
int supports_multiple_interfaces (ip)
struct interface_info *ip;
{
return 1;
}
void maybe_setup_fallback ()
{
isc_result_t status;
......
......@@ -44,7 +44,7 @@
#ifndef lint
static char copyright[] =
"$Id: nit.c,v 1.31 2000/07/27 09:02:34 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
"$Id: nit.c,v 1.32 2000/09/01 23:03:37 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
......@@ -404,6 +404,12 @@ int can_receive_unicast_unconfigured (ip)
return 1;
}
int supports_multiple_interfaces (ip)
struct interface_info *ip;
{
return 1;
}
void maybe_setup_fallback ()
{
isc_result_t status;
......
......@@ -51,7 +51,7 @@
#ifndef lint
static char copyright[] =
"$Id: socket.c,v 1.51 2000/07/20 03:15:00 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
"$Id: socket.c,v 1.52 2000/09/01 23:03:38 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
......@@ -131,9 +131,12 @@ int if_register_socket (info)
(char *)&flag, sizeof flag) < 0)
log_fatal ("Can't set SO_REUSEADDR option on dhcp socket: %m");
/* Set the BROADCAST option so that we can broadcast DHCP responses. */
if (setsockopt (sock, SOL_SOCKET, SO_BROADCAST,
(char *)&flag, sizeof flag) < 0)
/* Set the BROADCAST option so that we can broadcast DHCP responses.
We shouldn't do this for fallback devices, and we can detect that
a device is a fallback because it has no ifp structure. */
if (info -> ifp &&
(setsockopt (sock, SOL_SOCKET, SO_BROADCAST,
(char *)&flag, sizeof flag) < 0))
log_fatal ("Can't set SO_BROADCAST option on dhcp socket: %m");
/* Bind the socket to this interface's IP address. */
......@@ -334,6 +337,16 @@ int can_receive_unicast_unconfigured (ip)
#endif
}
int supports_multiple_interfaces (ip)
struct interface_info *ip;
{
#if defined (SO_BINDTODEVICE)
return 1;
#else
return 0;
#endif
}
/* If we have SO_BINDTODEVICE, set up a fallback interface; otherwise,
do not. */
......
......@@ -43,7 +43,7 @@
#ifndef lint
static char copyright[] =
"$Id: upf.c,v 1.20 2000/07/27 09:02:38 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
"$Id: upf.c,v 1.21 2000/09/01 23:03:39 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
......@@ -358,6 +358,12 @@ int can_receive_unicast_unconfigured (ip)
return 1;
}
int supports_multiple_interfaces (ip)
struct interface_info *ip;
{
return 1;
}
void maybe_setup_fallback ()
{
isc_result_t status;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment