diff options
author | Ted Lemon <source@isc.org> | 2000-09-01 23:03:39 +0000 |
---|---|---|
committer | Ted Lemon <source@isc.org> | 2000-09-01 23:03:39 +0000 |
commit | 5cefe5e556a4d29eaa50d87b5157adb365b0cc8f (patch) | |
tree | 0c1c6dbe98f79be178418442651a0d60a994bbc4 | |
parent | da411127514925955d868378ec1293168c8a72ae (diff) | |
download | isc-dhcp-5cefe5e556a4d29eaa50d87b5157adb365b0cc8f.tar.gz |
- Do what people expect when they don't declare the subnet to which an
interface is attached.
-rw-r--r-- | common/bpf.c | 8 | ||||
-rw-r--r-- | common/discover.c | 28 | ||||
-rw-r--r-- | common/dlpi.c | 8 | ||||
-rw-r--r-- | common/lpf.c | 8 | ||||
-rw-r--r-- | common/nit.c | 8 | ||||
-rw-r--r-- | common/socket.c | 21 | ||||
-rw-r--r-- | common/upf.c | 8 |
7 files changed, 75 insertions, 14 deletions
diff --git a/common/bpf.c b/common/bpf.c index f55d7754..7f883019 100644 --- a/common/bpf.c +++ b/common/bpf.c @@ -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; diff --git a/common/discover.c b/common/discover.c index c0c9c5ce..3075cbca 100644 --- a/common/discover.c +++ b/common/discover.c @@ -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); diff --git a/common/dlpi.c b/common/dlpi.c index 90a62ebd..e8cd1cc0 100644 --- a/common/dlpi.c +++ b/common/dlpi.c @@ -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; diff --git a/common/lpf.c b/common/lpf.c index 21a2fa93..ebafb592 100644 --- a/common/lpf.c +++ b/common/lpf.c @@ -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; diff --git a/common/nit.c b/common/nit.c index c42be38b..c21ac792 100644 --- a/common/nit.c +++ b/common/nit.c @@ -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; diff --git a/common/socket.c b/common/socket.c index d85af0da..216bf2c7 100644 --- a/common/socket.c +++ b/common/socket.c @@ -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. */ diff --git a/common/upf.c b/common/upf.c index 78ac5b3c..a737d57a 100644 --- a/common/upf.c +++ b/common/upf.c @@ -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; |