2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-30 13:57:50 +00:00

Don't listen on an OMAPI port unless one is specified in the config file.

This commit is contained in:
Ted Lemon
2000-06-24 06:02:01 +00:00
parent 67e3490a34
commit 40a59753f0

View File

@@ -41,7 +41,7 @@
#ifndef lint
static char ocopyright[] =
"$Id: dhclient.c,v 1.105 2000/06/02 21:26:57 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 Internet Software Consortium. All rights reserved.\n";
"$Id: dhclient.c,v 1.106 2000/06/24 06:02:01 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -103,6 +103,7 @@ int main (argc, argv, envp)
omapi_object_t *listener;
isc_result_t result;
int persist = 0;
int omapi_port;
#ifdef SYSLOG_4_2
openlog ("dhclient", LOG_NDELAY);
@@ -370,16 +371,20 @@ int main (argc, argv, envp)
return 0;
/* Start up a listener for the object management API protocol. */
listener = (omapi_object_t *)0;
result = omapi_generic_new (&listener, MDL);
if (result != ISC_R_SUCCESS)
log_fatal ("Can't allocate new generic object: %s\n",
isc_result_totext (result));
result = omapi_protocol_listen (listener,
OMAPI_PROTOCOL_PORT + 1, 1);
if (result != ISC_R_SUCCESS)
log_fatal ("Can't start OMAPI protocol: %s",
isc_result_totext (result));
if (top_level_config.omapi_port != -1) {
listener = (omapi_object_t *)0;
result = omapi_generic_new (&listener, MDL);
if (result != ISC_R_SUCCESS)
log_fatal ("Can't allocate new generic object: %s\n",
isc_result_totext (result));
result = omapi_protocol_listen (listener,
(unsigned)
top_level_config.omapi_port,
1);
if (result != ISC_R_SUCCESS)
log_fatal ("Can't start OMAPI protocol: %s",
isc_result_totext (result));
}
/* Set up the bootp packet handler... */
bootp_packet_handler = do_packet;