summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Lemon <source@isc.org>2000-10-10 22:31:41 +0000
committerTed Lemon <source@isc.org>2000-10-10 22:31:41 +0000
commit08921fe06cd7b99b571106a1ad6d0816f72ba03c (patch)
tree4f1dc4bbd9d9856c206e766841e5289a31f95ec4
parentae7bc13a2f18475ea9344419c0d6bb62baf3192d (diff)
downloadisc-dhcp-08921fe06cd7b99b571106a1ad6d0816f72ba03c.tar.gz
- Add initializer for interfaces.
- Don't register for I/O on interfaces on which we are not listening.
-rw-r--r--common/discover.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/common/discover.c b/common/discover.c
index 78b8bc53..67e9997b 100644
--- a/common/discover.c
+++ b/common/discover.c
@@ -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);