]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
- Add initializer for interfaces.
authorTed Lemon <source@isc.org>
Tue, 10 Oct 2000 22:31:41 +0000 (22:31 +0000)
committerTed Lemon <source@isc.org>
Tue, 10 Oct 2000 22:31:41 +0000 (22:31 +0000)
- Don't register for I/O on interfaces on which we are not listening.

common/discover.c

index 78b8bc539c742b561b76421cd013e296431132d2..67e9997bcba877a55ecf239e5436eeb28f7d6778 100644 (file)
@@ -43,7 +43,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: discover.c,v 1.33 2000/09/29 18:12:16 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: discover.c,v 1.34 2000/10/10 22:31:41 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -69,6 +69,14 @@ omapi_object_type_t *dhcp_type_interface;
 
 OMAPI_OBJECT_ALLOC (interface, struct interface_info, dhcp_type_interface)
 
+isc_result_t interface_initialize (omapi_object_t *ipo,
+                                  const char *file, int line)
+{
+       struct interface_info *ip = (struct interface_info *)ipo;
+       ip -> rfdesc = ip -> wfdesc = -1;
+       return ISC_R_SUCCESS;
+}
+
 /* Use the SIOCGIFCONF ioctl to get a list of all the attached interfaces.
    For each interface that's of type INET and not the loopback interface,
    register that interface with the network I/O software, figure out what
@@ -103,7 +111,8 @@ void discover_interfaces (state)
                         interface_set_value, interface_get_value,
                         interface_destroy, interface_signal_handler,
                         interface_stuff_values, 0, 0, 0, 0, 0, 0,
-                        sizeof (struct interface_info));
+                        sizeof (struct interface_info),
+                        interface_initialize);
                if (status != ISC_R_SUCCESS)
                        log_fatal ("Can't create interface object type: %s",
                                   isc_result_totext (status));
@@ -569,6 +578,8 @@ void discover_interfaces (state)
                /* not if it's been registered before */
                if (tmp -> flags & INTERFACE_RUNNING)
                        continue;
+               if (tmp -> rfdesc == -1)
+                       continue;
                status = omapi_register_io_object ((omapi_object_t *)tmp,
                                                   if_readsocket, 0,
                                                   got_one, 0, 0);