mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-08-30 22:05:23 +00:00
- Add initializer for interfaces.
- Don't register for I/O on interfaces on which we are not listening.
This commit is contained in:
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
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 */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include "dhcpd.h"
|
#include "dhcpd.h"
|
||||||
@@ -69,6 +69,14 @@ omapi_object_type_t *dhcp_type_interface;
|
|||||||
|
|
||||||
OMAPI_OBJECT_ALLOC (interface, struct interface_info, 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.
|
/* 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,
|
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
|
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_set_value, interface_get_value,
|
||||||
interface_destroy, interface_signal_handler,
|
interface_destroy, interface_signal_handler,
|
||||||
interface_stuff_values, 0, 0, 0, 0, 0, 0,
|
interface_stuff_values, 0, 0, 0, 0, 0, 0,
|
||||||
sizeof (struct interface_info));
|
sizeof (struct interface_info),
|
||||||
|
interface_initialize);
|
||||||
if (status != ISC_R_SUCCESS)
|
if (status != ISC_R_SUCCESS)
|
||||||
log_fatal ("Can't create interface object type: %s",
|
log_fatal ("Can't create interface object type: %s",
|
||||||
isc_result_totext (status));
|
isc_result_totext (status));
|
||||||
@@ -569,6 +578,8 @@ void discover_interfaces (state)
|
|||||||
/* not if it's been registered before */
|
/* not if it's been registered before */
|
||||||
if (tmp -> flags & INTERFACE_RUNNING)
|
if (tmp -> flags & INTERFACE_RUNNING)
|
||||||
continue;
|
continue;
|
||||||
|
if (tmp -> rfdesc == -1)
|
||||||
|
continue;
|
||||||
status = omapi_register_io_object ((omapi_object_t *)tmp,
|
status = omapi_register_io_object ((omapi_object_t *)tmp,
|
||||||
if_readsocket, 0,
|
if_readsocket, 0,
|
||||||
got_one, 0, 0);
|
got_one, 0, 0);
|
||||||
|
Reference in New Issue
Block a user