Merge 3.0b2pl24

This commit is contained in:
mellon 2001-04-06 17:08:51 +00:00
parent f9a2f32ef8
commit 9cc24a09b7
13 changed files with 418 additions and 104 deletions

View File

@ -1,6 +1,6 @@
Internet Software Consortium DHCP Distribution
Version 3, Beta 2, Patchlevel 23
March 22, 2001
Version 3, Beta 2, Patchlevel 24
April 5, 2001
README FILE
@ -142,14 +142,14 @@ information. On Digital Unix, type ``man pfilt''.
To build the DHCP Distribution, unpack the compressed tar file using
the tar utility and the gzip command - type something like:
zcat dhcp-3.0b2pl23.tar.gz |tar xvf -
zcat dhcp-3.0b2pl24.tar.gz |tar xvf -
On BSD/OS, you have to type gzcat, not zcat, and you may run into
similar problems on other operating systems.
CONFIGURING IT
Now, cd to the dhcp-3.0b2pl23 subdirectory that you've just
Now, cd to the dhcp-3.0b2pl24 subdirectory that you've just
created and configure the source tree by typing:
./configure

View File

@ -1,6 +1,6 @@
Internet Software Consortium DHCP Distribution
Version 3, Beta 2, Patchlevel 23
March 22, 2001
Version 3, Beta 2, Patchlevel 24
April 5, 2001
Release Notes
@ -43,11 +43,48 @@ the README file.
The Dynamic DNS Update support is a descendent of an implementation
done by Lans Carstensen and Brian Dols at Rose-Hulman Institute of
Technology, Jim Watt at Perkin-Elmer, Irina Goble at Integrated
Measurement Systems, and Brian Murrell at BC Tel Advanced
Communications. I'd like to express my thanks to all of these good
people here, both for working on the code and for prodding me into
improving it.
Technology, Jim Watt at Applied Biosystems, Irina Goble at Integrated
Measurement Systems, Igor Sharfmesser at Kazakh Telecom, and Brian
Murrell at BC Tel Advanced Communications. I'd like to express my
thanks to all of these good people here, both for working on the code
and for prodding me into improving it.
Changes since 3.0 Beta 2 Patchlevel 23
- Fix a bug in the DNS update code where a status code was not being
checked. This may have been causing core dumps.
- When parsing the lease file, if a lease declaration includes a
billing class statement, and the lease already has a billing class,
unbill the old class.
- When processing failover transactions, where acks will be deferred,
process the state transition immediately.
- Don't try to use the new SIOCGIFCONF buffer size detection code on
Linux 2.0, which doesn't provide this functionality.
- Apply a patch suggested by Tuan Uong for a problem in dlpi.c.
- Fix a problem in using the which command in the configure script.
- Fix a parse error in the client when setting up an omapi listener.
- Document the -n and -g flags to the client.
- Make sure there is always a stdin and stdout on startup. This
prevents shell scripts from accidentally writing error messages into
configuration files that happen to be opened as stderr.
- If an interface is removed, the client will now notice that it is
gone rather than spinning. This has only been tested on NetBSD.
- The client will attempt to get an address even if it can't create a
lease file.
- Don't overwrite tracefiles.
- Fix some memory allocation bugs in failover.
Changes since 3.0 Beta 2 Patchlevel 22

View File

@ -43,7 +43,7 @@
#ifndef lint
static char copyright[] =
"$Id: clparse.c,v 1.10 2001/04/02 23:45:53 mellon Exp $ Copyright (c) 1996-2001 The Internet Software Consortium. All rights reserved.\n";
"$Id: clparse.c,v 1.11 2001/04/06 17:08:52 mellon Exp $ Copyright (c) 1996-2001 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -408,6 +408,7 @@ void parse_client_statement (cfile, ip, config)
return;
case OMAPI:
token = next_token (&val, (unsigned *)0, cfile);
token = next_token (&val, (unsigned *)0, cfile);
if (token != PORT) {
parse_warn (cfile,

View File

@ -60,6 +60,13 @@ dhclient - Dynamic Host Configuration Protocol (DHCP) Client
server
]
[
.B -g
relay
]
[
.B -n
]
[
.B -w
]
[
@ -160,6 +167,12 @@ be specified with the
.B -s
flag, followed by the IP address or domain name of the destination.
.PP
For testing purposes, the giaddr field of all packets that the client
sends can be set using the
.B -g
flag, followed by the IP address to send. This is only useful for testing,
and should not be expected to work in any consistent or useful way.
.PP
The DHCP client will normally run in the foreground until it has
configured an interface, and then will revert to running in the
background. To run force dhclient to always run as a foreground
@ -226,10 +239,17 @@ broadcast interface may be added after system startup. The
.B -w
flag can be used to cause the client not to exit when it doesn't find
any such interfaces. The
.B dhcpccp (8)
.B omshell (8)
program can then be used to notify the client when a network interface
has been added or removed, so that the client can configure an IP
has been added or removed, so that the client can attempt to configure an IP
address on that interface.
.PP
The DHCP client can be directed not to attempt to configure any interfaces
using the
.B -n
flag. This is most likely to be useful in combination with the
.B -w
flag.
.SH CONFIGURATION
The syntax of the dhclient.conf(5) file is discussed seperately.
.SH FILES

View File

@ -41,7 +41,7 @@
#ifndef lint
static char ocopyright[] =
"$Id: dhclient.c,v 1.35 2001/04/02 23:45:53 mellon Exp $ Copyright (c) 1995-2001 Internet Software Consortium. All rights reserved.\n";
"$Id: dhclient.c,v 1.36 2001/04/06 17:08:52 mellon Exp $ Copyright (c) 1995-2001 Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -112,6 +112,16 @@ int main (argc, argv, envp)
int no_dhclient_script = 0;
char *s;
/* Make sure we have stdin, stdout and stderr. */
i = open ("/dev/null", O_RDWR);
if (i == 0)
i = open ("/dev/null", O_RDWR);
if (i == 1) {
i = open ("/dev/null", O_RDWR);
log_perror = 0; /* No sense logging to /dev/null. */
} else if (i != -1)
close (i);
#ifdef SYSLOG_4_2
openlog ("dhclient", LOG_NDELAY);
log_priority = LOG_DAEMON;
@ -135,6 +145,7 @@ int main (argc, argv, envp)
dhcp_interface_discovery_hook = dhclient_interface_discovery_hook;
dhcp_interface_shutdown_hook = dhclient_interface_shutdown_hook;
dhcp_interface_startup_hook = dhclient_interface_startup_hook;
for (i = 1; i < argc; i++) {
if (!strcmp (argv [i], "-r")) {
@ -1681,7 +1692,6 @@ void send_release (cpp)
destination.sin_len = sizeof destination;
#endif
/* Set the lease to end now, so that we don't accidentally
reuse it if we restart before the old expiry time. */
client -> active -> expiry =
@ -2066,8 +2076,10 @@ void rewrite_client_leases ()
if (leaseFile)
fclose (leaseFile);
leaseFile = fopen (path_dhclient_db, "w");
if (!leaseFile)
log_fatal ("can't create %s: %m", path_dhclient_db);
if (!leaseFile) {
log_error ("can't create %s: %m", path_dhclient_db);
return;
}
/* Write out all the leases attached to configured interfaces that
we know about. */
@ -2159,8 +2171,10 @@ int write_client_lease (client, lease, rewrite, makesure)
if (!leaseFile) { /* XXX */
leaseFile = fopen (path_dhclient_db, "w");
if (!leaseFile)
log_fatal ("can't create %s: %m", path_dhclient_db);
if (!leaseFile) {
log_error ("can't create %s: %m", path_dhclient_db);
return 0;
}
}
errno = 0;
@ -2681,6 +2695,7 @@ void client_location_changed ()
case S_INIT:
case S_REBINDING:
case S_STOPPED:
break;
}
client -> state = S_INIT;
@ -2695,9 +2710,7 @@ void do_release(client)
struct data_string ds;
struct option_cache *oc;
/* make_request doesn't initialize xid because it normally comes
from the DHCPDISCOVER, but we haven't sent a DHCPDISCOVER,
so pick an xid now. */
/* Pick a random xid. */
client -> xid = random ();
/* is there even a lease to release? */
@ -2742,13 +2755,19 @@ void do_release(client)
script_go (client);
}
/* remove the timeouts for this client */
cancel_timeout (0, client);
/* Cancel any timeouts. */
cancel_timeout (state_bound, client);
cancel_timeout (send_discover, client);
cancel_timeout (state_init, client);
cancel_timeout (send_request, client);
cancel_timeout (state_reboot, client);
client -> state = S_STOPPED;
}
int dhclient_interface_shutdown_hook (struct interface_info *interface)
{
do_release (interface -> client);
return 1;
}
@ -2795,6 +2814,58 @@ int dhclient_interface_discovery_hook (struct interface_info *tmp)
return 1;
}
isc_result_t dhclient_interface_startup_hook (struct interface_info *interface)
{
struct interface_info *ip;
struct client_state *client;
/* This code needs some rethinking. It doesn't test against
a signal name, and it just kind of bulls into doing something
that may or may not be appropriate. */
if (interfaces) {
interface_reference (&interface -> next, interfaces, MDL);
interface_dereference (&interfaces, MDL);
}
interface_reference (&interfaces, interface, MDL);
discover_interfaces (DISCOVER_UNCONFIGURED);
for (ip = interfaces; ip; ip = ip -> next) {
/* If interfaces were specified, don't configure
interfaces that weren't specified! */
if (ip -> flags & INTERFACE_RUNNING ||
(ip -> flags & (INTERFACE_REQUESTED |
INTERFACE_AUTOMATIC)) !=
INTERFACE_REQUESTED)
continue;
script_init (ip -> client,
"PREINIT", (struct string_list *)0);
if (ip -> client -> alias)
script_write_params (ip -> client, "alias_",
ip -> client -> alias);
script_go (ip -> client);
}
discover_interfaces (interfaces_requested
? DISCOVER_REQUESTED
: DISCOVER_RUNNING);
for (ip = interfaces; ip; ip = ip -> next) {
if (ip -> flags & INTERFACE_RUNNING)
continue;
ip -> flags |= INTERFACE_RUNNING;
for (client = ip -> client; client; client = client -> next) {
client -> state = S_INIT;
/* Set up a timeout to start the initialization
process. */
add_timeout (cur_time + random () % 5,
state_reboot, client, 0, 0);
}
}
return ISC_R_SUCCESS;
}
/* The client should never receive a relay agent information option,
so if it does, log it and discard it. */

View File

@ -47,7 +47,7 @@
#ifndef lint
static char copyright[] =
"$Id: bpf.c,v 1.8 2001/04/02 23:45:54 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
"$Id: bpf.c,v 1.9 2001/04/06 17:08:53 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -254,7 +254,7 @@ void if_register_receive (info)
if (v.bv_major != BPF_MAJOR_VERSION ||
v.bv_minor < BPF_MINOR_VERSION)
log_fatal ("Kernel BPF version out of range - recompile dhcpd!");
log_fatal ("BPF version mismatch - recompile DHCP!");
/* Set immediate mode so that reads return as soon as a packet
comes in, rather than waiting for the input buffer to fill with
@ -422,8 +422,14 @@ ssize_t receive_packet (interface, buf, len, from, hfrom)
length = read (interface -> rfdesc,
interface -> rbuf,
interface -> rbuf_max);
if (length <= 0)
if (length <= 0) {
if (errno == EIO) {
dhcp_interface_remove
((omapi_object_t *)interface,
(omapi_object_t *)0);
}
return length;
}
interface -> rbuf_offset = 0;
interface -> rbuf_len = BPF_WORDALIGN (length);
}

View File

@ -3,7 +3,7 @@
Network input dispatcher... */
/*
* Copyright (c) 1995-2000 Internet Software Consortium.
* Copyright (c) 1995-2001 Internet Software Consortium.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -43,7 +43,7 @@
#ifndef lint
static char copyright[] =
"$Id: discover.c,v 1.11 2001/04/02 23:45:55 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
"$Id: discover.c,v 1.12 2001/04/06 17:08:53 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -56,6 +56,7 @@ u_int16_t local_port;
u_int16_t remote_port;
int (*dhcp_interface_setup_hook) (struct interface_info *, struct iaddr *);
int (*dhcp_interface_discovery_hook) (struct interface_info *);
isc_result_t (*dhcp_interface_startup_hook) (struct interface_info *);
int (*dhcp_interface_shutdown_hook) (struct interface_info *);
struct in_addr limited_broadcast;
@ -846,55 +847,24 @@ isc_result_t dhcp_interface_signal_handler (omapi_object_t *h,
if (h -> type != dhcp_type_interface)
return ISC_R_INVALIDARG;
/* This code needs some rethinking. It doesn't test against
a signal name, and it just kind of bulls into doing something
that may or may not be appropriate. */
#if 0
interface = (struct interface_info *)h;
if (interfaces) {
interface_reference (&interface -> next, interfaces, MDL);
interface_dereference (&interfaces, MDL);
}
interface_reference (&interfaces, interface, MDL);
/* If it's an update signal, see if the interface is dead right
now, or isn't known at all, and if that's the case, revive it. */
if (!strcmp (name, "update")) {
for (ip = dummy_interfaces; ip; ip = ip -> next)
if (ip == interface)
break;
if (ip && dhcp_interface_startup_hook)
return (*dhcp_interface_startup_hook) (ip);
discover_interfaces (DISCOVER_UNCONFIGURED);
for (ip = interfaces; ip; ip = ip -> next) {
/* If interfaces were specified, don't configure
interfaces that weren't specified! */
if (ip -> flags & INTERFACE_RUNNING ||
(ip -> flags & (INTERFACE_REQUESTED |
INTERFACE_AUTOMATIC)) !=
INTERFACE_REQUESTED)
continue;
script_init (ip -> client,
"PREINIT", (struct string_list *)0);
if (ip -> client -> alias)
script_write_params (ip -> client, "alias_",
ip -> client -> alias);
script_go (ip -> client);
for (ip = interfaces; ip; ip = ip -> next)
if (ip == interface)
break;
if (!ip && dhcp_interface_startup_hook)
return (*dhcp_interface_startup_hook) (ip);
}
discover_interfaces (interfaces_requested
? DISCOVER_REQUESTED
: DISCOVER_RUNNING);
for (ip = interfaces; ip; ip = ip -> next) {
if (ip -> flags & INTERFACE_RUNNING)
continue;
ip -> flags |= INTERFACE_RUNNING;
for (client = ip -> client; client; client = client -> next) {
client -> state = S_INIT;
/* Set up a timeout to start the initialization
process. */
add_timeout (cur_time + random () % 5,
state_reboot, client, 0, 0);
}
}
return ISC_R_SUCCESS;
#endif
/* Try to find some inner object that can take the value. */
if (h -> inner && h -> inner -> type -> get_value) {
status = ((*(h -> inner -> type -> signal_handler))
@ -966,13 +936,38 @@ isc_result_t dhcp_interface_lookup (omapi_object_t **ip,
/* Now look for an interface name. */
status = omapi_get_value_str (ref, id, "name", &tv);
if (status == ISC_R_SUCCESS) {
char *s;
unsigned len;
for (interface = interfaces; interface;
interface = interface -> next) {
if (strncmp (interface -> name,
(char *)tv -> value -> u.buffer.value,
tv -> value -> u.buffer.len) == 0)
s = memchr (interface -> name, 0, IFNAMSIZ);
if (s)
len = s - &interface -> name [0];
else
len = IFNAMSIZ;
if ((tv -> value -> u.buffer.len == len &&
!memcmp (interface -> name,
(char *)tv -> value -> u.buffer.value,
len)))
break;
}
if (!interface) {
for (interface = dummy_interfaces;
interface; interface = interface -> next) {
s = memchr (interface -> name, 0, IFNAMSIZ);
if (s)
len = s - &interface -> name [0];
else
len = IFNAMSIZ;
if ((tv -> value -> u.buffer.len == len &&
!memcmp (interface -> name,
(char *)
tv -> value -> u.buffer.value,
len)))
break;
}
}
omapi_value_dereference (&tv, MDL);
if (*ip && *ip != (omapi_object_t *)interface) {
omapi_object_dereference (ip, MDL);
@ -982,8 +977,6 @@ isc_result_t dhcp_interface_lookup (omapi_object_t **ip,
omapi_object_dereference (ip, MDL);
return ISC_R_NOTFOUND;
} else if (!*ip)
/* XXX fix so that hash lookup itself creates
XXX the reference. */
omapi_object_reference (ip,
(omapi_object_t *)interface,
MDL);

View File

@ -625,7 +625,8 @@ enum dhcp_state {
S_REQUESTING = 4,
S_BOUND = 5,
S_RENEWING = 6,
S_REBINDING = 7
S_REBINDING = 7,
S_STOPPED = 8
};
/* Authentication and BOOTP policy possibilities (not all values work
@ -1650,6 +1651,7 @@ extern u_int16_t remote_port;
extern int (*dhcp_interface_setup_hook) (struct interface_info *,
struct iaddr *);
extern int (*dhcp_interface_discovery_hook) (struct interface_info *);
isc_result_t (*dhcp_interface_startup_hook) (struct interface_info *);
extern void (*bootp_packet_handler) PROTO ((struct interface_info *,
struct dhcp_packet *, unsigned,
@ -1811,6 +1813,7 @@ void client_location_changed PROTO ((void));
void do_release PROTO ((struct client_state *));
int dhclient_interface_shutdown_hook (struct interface_info *);
int dhclient_interface_discovery_hook (struct interface_info *);
isc_result_t dhclient_interface_startup_hook (struct interface_info *);
/* db.c */
int write_lease PROTO ((struct lease *));
@ -2182,6 +2185,24 @@ isc_result_t dhcp_class_create (omapi_object_t **,
omapi_object_t *);
isc_result_t dhcp_class_remove (omapi_object_t *,
omapi_object_t *);
isc_result_t dhcp_subclass_set_value (omapi_object_t *, omapi_object_t *,
omapi_data_string_t *,
omapi_typed_data_t *);
isc_result_t dhcp_subclass_get_value (omapi_object_t *, omapi_object_t *,
omapi_data_string_t *,
omapi_value_t **);
isc_result_t dhcp_subclass_destroy (omapi_object_t *, const char *, int);
isc_result_t dhcp_subclass_signal_handler (omapi_object_t *,
const char *, va_list);
isc_result_t dhcp_subclass_stuff_values (omapi_object_t *,
omapi_object_t *,
omapi_object_t *);
isc_result_t dhcp_subclass_lookup (omapi_object_t **,
omapi_object_t *, omapi_object_t *);
isc_result_t dhcp_subclass_create (omapi_object_t **,
omapi_object_t *);
isc_result_t dhcp_subclass_remove (omapi_object_t *,
omapi_object_t *);
isc_result_t dhcp_shared_network_set_value (omapi_object_t *,
omapi_object_t *,
omapi_data_string_t *,
@ -2215,22 +2236,6 @@ isc_result_t dhcp_subnet_lookup (omapi_object_t **,
omapi_object_t *, omapi_object_t *);
isc_result_t dhcp_subnet_create (omapi_object_t **,
omapi_object_t *);
isc_result_t dhcp_class_set_value (omapi_object_t *, omapi_object_t *,
omapi_data_string_t *,
omapi_typed_data_t *);
isc_result_t dhcp_class_get_value (omapi_object_t *, omapi_object_t *,
omapi_data_string_t *,
omapi_value_t **);
isc_result_t dhcp_class_destroy (omapi_object_t *, const char *, int);
isc_result_t dhcp_class_signal_handler (omapi_object_t *,
const char *, va_list);
isc_result_t dhcp_class_stuff_values (omapi_object_t *,
omapi_object_t *,
omapi_object_t *);
isc_result_t dhcp_class_lookup (omapi_object_t **,
omapi_object_t *, omapi_object_t *);
isc_result_t dhcp_class_create (omapi_object_t **,
omapi_object_t *);
isc_result_t dhcp_interface_set_value (omapi_object_t *,
omapi_object_t *,
omapi_data_string_t *,

View File

@ -1,3 +1,3 @@
/* Current version of ISC DHCP Distribution. */
#define DHCP_VERSION "V3.0b2pl23"
#define DHCP_VERSION "V3.0b2pl24"

View File

@ -3,7 +3,7 @@
DHCP/BOOTP Relay Agent. */
/*
* Copyright (c) 1997-2000 Internet Software Consortium.
* Copyright (c) 1997-2001 Internet Software Consortium.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -43,7 +43,7 @@
#ifndef lint
static char ocopyright[] =
"$Id: dhcrelay.c,v 1.9 2001/04/02 23:45:59 mellon Exp $ Copyright (c) 1997-2000 Internet Software Consortium. All rights reserved.\n";
"$Id: dhcrelay.c,v 1.10 2001/04/06 17:08:55 mellon Exp $ Copyright (c) 1997-2000 Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -124,6 +124,16 @@ int main (argc, argv, envp)
isc_result_t status;
char *s;
/* Make sure we have stdin, stdout and stderr. */
i = open ("/dev/null", O_RDWR);
if (i == 0)
i = open ("/dev/null", O_RDWR);
if (i == 1) {
i = open ("/dev/null", O_RDWR);
log_perror = 0; /* No sense logging to /dev/null. */
} else if (i != -1)
close (i);
#ifdef SYSLOG_4_2
openlog ("dhcrelay", LOG_NDELAY);
log_priority = LOG_DAEMON;

View File

@ -43,7 +43,7 @@
#ifndef lint
static char copyright[] =
"$Id: confpars.c,v 1.7 2001/04/02 23:46:00 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
"$Id: confpars.c,v 1.8 2001/04/06 17:08:55 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -2635,6 +2635,9 @@ int parse_lease_declaration (struct lease **lp, struct parse *cfile)
token = BILLING;
break;
}
if (lease -> billing_class)
unbill_class (lease,
lease -> billing_class);
find_class (&lease -> billing_class, val, MDL);
if (!lease -> billing_class)
parse_warn (cfile,
@ -2642,8 +2645,8 @@ int parse_lease_declaration (struct lease **lp, struct parse *cfile)
parse_semi (cfile);
} else if (token == SUBCLASS) {
if (lease -> billing_class)
class_dereference
(&lease -> billing_class, MDL);
unbill_class (lease,
lease -> billing_class);
parse_class_declaration
(&lease -> billing_class,
cfile, (struct group *)0, 3);

View File

@ -43,7 +43,7 @@
#ifndef lint
static char ocopyright[] =
"$Id: dhcpd.c,v 1.24 2001/04/02 23:46:00 mellon Exp $ Copyright 1995-2001 Internet Software Consortium.";
"$Id: dhcpd.c,v 1.25 2001/04/06 17:08:56 mellon Exp $ Copyright 1995-2001 Internet Software Consortium.";
#endif
static char copyright[] =
@ -215,6 +215,16 @@ int main (argc, argv, envp)
char *traceoutfile = (char *)0;
#endif
/* Make sure we have stdin, stdout and stderr. */
status = open ("/dev/null", O_RDWR);
if (status == 0)
status = open ("/dev/null", O_RDWR);
if (status == 1) {
status = open ("/dev/null", O_RDWR);
log_perror = 0; /* No sense logging to /dev/null. */
} else if (status != -1)
close (status);
/* Set up the client classification system. */
classification_setup ();

View File

@ -50,7 +50,7 @@
#ifndef lint
static char copyright[] =
"$Id: omapi.c,v 1.7 2001/04/02 23:46:01 mellon Exp $ Copyright (c) 1999-2000 The Internet Software Consortium. All rights reserved.\n";
"$Id: omapi.c,v 1.8 2001/04/06 17:08:56 mellon Exp $ Copyright (c) 1999-2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -59,6 +59,7 @@ static char copyright[] =
omapi_object_type_t *dhcp_type_lease;
omapi_object_type_t *dhcp_type_pool;
omapi_object_type_t *dhcp_type_class;
omapi_object_type_t *dhcp_type_subclass;
omapi_object_type_t *dhcp_type_host;
#if defined (FAILOVER_PROTOCOL)
omapi_object_type_t *dhcp_type_failover_state;
@ -107,6 +108,21 @@ void dhcp_db_objects_setup ()
log_fatal ("Can't register class object type: %s",
isc_result_totext (status));
status = omapi_object_type_register (&dhcp_type_subclass,
"subclass",
dhcp_subclass_set_value,
dhcp_subclass_get_value,
dhcp_subclass_destroy,
dhcp_subclass_signal_handler,
dhcp_subclass_stuff_values,
dhcp_subclass_lookup,
dhcp_subclass_create,
dhcp_subclass_remove, 0, 0, 0,
sizeof (struct class), 0);
if (status != ISC_R_SUCCESS)
log_fatal ("Can't register subclass object type: %s",
isc_result_totext (status));
status = omapi_object_type_register (&dhcp_type_pool,
"pool",
dhcp_pool_set_value,
@ -1647,4 +1663,146 @@ isc_result_t dhcp_class_remove (omapi_object_t *lp,
return ISC_R_NOTIMPLEMENTED;
}
isc_result_t dhcp_subclass_set_value (omapi_object_t *h,
omapi_object_t *id,
omapi_data_string_t *name,
omapi_typed_data_t *value)
{
struct subclass *subclass;
isc_result_t status;
int foo;
if (h -> type != dhcp_type_subclass)
return ISC_R_INVALIDARG;
subclass = (struct subclass *)h;
/* No values to set yet. */
/* Try to find some inner object that can take the value. */
if (h -> inner && h -> inner -> type -> set_value) {
status = ((*(h -> inner -> type -> set_value))
(h -> inner, id, name, value));
if (status == ISC_R_SUCCESS || status == ISC_R_UNCHANGED)
return status;
}
return ISC_R_NOTFOUND;
}
isc_result_t dhcp_subclass_get_value (omapi_object_t *h, omapi_object_t *id,
omapi_data_string_t *name,
omapi_value_t **value)
{
struct subclass *subclass;
isc_result_t status;
if (h -> type != dhcp_type_subclass)
return ISC_R_INVALIDARG;
subclass = (struct subclass *)h;
/* No values to get yet. */
/* Try to find some inner object that can provide the value. */
if (h -> inner && h -> inner -> type -> get_value) {
status = ((*(h -> inner -> type -> get_value))
(h -> inner, id, name, value));
if (status == ISC_R_SUCCESS)
return status;
}
return ISC_R_NOTFOUND;
}
isc_result_t dhcp_subclass_destroy (omapi_object_t *h,
const char *file, int line)
{
struct subclass *subclass;
isc_result_t status;
if (h -> type != dhcp_type_subclass)
return ISC_R_INVALIDARG;
subclass = (struct subclass *)h;
/* Can't destroy subclasss yet. */
return ISC_R_SUCCESS;
}
isc_result_t dhcp_subclass_signal_handler (omapi_object_t *h,
const char *name, va_list ap)
{
struct subclass *subclass;
isc_result_t status;
int updatep = 0;
if (h -> type != dhcp_type_subclass)
return ISC_R_INVALIDARG;
subclass = (struct subclass *)h;
/* Can't write subclasss yet. */
/* Try to find some inner object that can take the value. */
if (h -> inner && h -> inner -> type -> get_value) {
status = ((*(h -> inner -> type -> signal_handler))
(h -> inner, name, ap));
if (status == ISC_R_SUCCESS)
return status;
}
if (updatep)
return ISC_R_SUCCESS;
return ISC_R_NOTFOUND;
}
isc_result_t dhcp_subclass_stuff_values (omapi_object_t *c,
omapi_object_t *id,
omapi_object_t *h)
{
struct subclass *subclass;
isc_result_t status;
if (h -> type != dhcp_type_subclass)
return ISC_R_INVALIDARG;
subclass = (struct subclass *)h;
/* Can't stuff subclass values yet. */
/* Write out the inner object, if any. */
if (h -> inner && h -> inner -> type -> stuff_values) {
status = ((*(h -> inner -> type -> stuff_values))
(c, id, h -> inner));
if (status == ISC_R_SUCCESS)
return status;
}
return ISC_R_SUCCESS;
}
isc_result_t dhcp_subclass_lookup (omapi_object_t **lp,
omapi_object_t *id, omapi_object_t *ref)
{
omapi_value_t *tv = (omapi_value_t *)0;
isc_result_t status;
struct subclass *subclass;
/* Can't look up subclasss yet. */
/* If we get to here without finding a subclass, no valid key was
specified. */
if (!*lp)
return ISC_R_NOKEYS;
return ISC_R_SUCCESS;
}
isc_result_t dhcp_subclass_create (omapi_object_t **lp,
omapi_object_t *id)
{
return ISC_R_NOTIMPLEMENTED;
}
isc_result_t dhcp_subclass_remove (omapi_object_t *lp,
omapi_object_t *id)
{
return ISC_R_NOTIMPLEMENTED;
}
/* vim: set tabstop=8: */