]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
- Do what people expect when they don't declare the subnet to which an
authorTed Lemon <source@isc.org>
Fri, 1 Sep 2000 23:03:39 +0000 (23:03 +0000)
committerTed Lemon <source@isc.org>
Fri, 1 Sep 2000 23:03:39 +0000 (23:03 +0000)
  interface is attached.

common/bpf.c
common/discover.c
common/dlpi.c
common/lpf.c
common/nit.c
common/socket.c
common/upf.c

index f55d7754f047ab87f3eade9bd629bdf68386841a..7f883019bc6929daf0b926c6035888442ffd95c5 100644 (file)
@@ -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;
index c0c9c5cea9ae18881521f8f911919ad7d80a8fab..3075cbca13bd329541a8a07bd92cf71c7d5a4da7 100644 (file)
@@ -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);
index 90a62ebda1c4d789996ca92404bc2a84f7d686ba..e8cd1cc0a2d896ecce5c0e63b0860cf75ded965f 100644 (file)
@@ -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;
index 21a2fa93d46635218c0905eaea88c3171f9f05b6..ebafb592025e46b8c8bfd097aa3bf7f86901defd 100644 (file)
@@ -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;
index c42be38bd4c59900a44b7c479aa49a1081420bc9..c21ac7926299a23cbbb5adaa9acad617ac2e0982 100644 (file)
@@ -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;
index d85af0da7c6db8f642fc0b92b8fbac5266155486..216bf2c7d37c21380d9fa272221f959e351235ba 100644 (file)
@@ -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. */
 
index 78ac5b3ccacadc300450d92af61f19c37db3201c..a737d57ab10c748d8edba67e7d180f7e7f6ea67b 100644 (file)
@@ -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;