3
Definitions for dhcpd... */
6
* Copyright (c) 2004-2011 by Internet Systems Consortium, Inc. ("ISC")
7
* Copyright (c) 1996-2003 by Internet Software Consortium
9
* Permission to use, copy, modify, and distribute this software for any
10
* purpose with or without fee is hereby granted, provided that the above
11
* copyright notice and this permission notice appear in all copies.
13
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
14
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
16
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
19
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21
* Internet Systems Consortium, Inc.
23
* Redwood City, CA 94063
25
* https://www.isc.org/
27
* This software has been written for Internet Systems Consortium
28
* by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
29
* To learn more about Internet Systems Consortium, see
30
* ``https://www.isc.org/''. To learn more about Vixie Enterprises,
31
* see ``http://www.vix.com''. To learn more about Nominum, Inc., see
32
* ``http://www.nominum.com''.
38
#include <sys/types.h>
39
#include <netinet/in.h>
40
#include <sys/socket.h>
42
#include <arpa/inet.h>
47
#define fd_set cygwin_fd_set
48
#include <sys/types.h>
63
#include <net/route.h>
64
#include <net/if_arp.h>
66
# include <net/if_dl.h>
74
#include "arpa/nameser.h"
79
typedef struct hash_table group_hash_t;
80
typedef struct hash_table universe_hash_t;
81
typedef struct hash_table option_name_hash_t;
82
typedef struct hash_table option_code_hash_t;
83
typedef struct hash_table dns_zone_hash_t;
84
typedef struct hash_table lease_ip_hash_t;
85
typedef struct hash_table lease_id_hash_t;
86
typedef struct hash_table host_hash_t;
87
typedef struct hash_table class_hash_t;
95
#include <omapip/isclib.h>
96
#include <omapip/result.h>
100
#include "statement.h"
103
#include "dhctoken.h"
105
#include <omapip/omapip_p.h>
107
#if defined(LDAP_CONFIGURATION)
109
# include <sys/utsname.h> /* for uname() */
112
#if !defined (BYTE_NAME_HASH_SIZE)
113
# define BYTE_NAME_HASH_SIZE 401 /* Default would be ridiculous. */
115
#if !defined (BYTE_CODE_HASH_SIZE)
116
# define BYTE_CODE_HASH_SIZE 254 /* Default would be ridiculous. */
119
/* Although it is highly improbable that a 16-bit option space might
120
* actually use 2^16 actual defined options, it is the worst case
121
* scenario we must prepare for. Having 4 options per bucket in this
122
* case is pretty reasonable.
124
#if !defined (WORD_NAME_HASH_SIZE)
125
# define WORD_NAME_HASH_SIZE 20479
127
#if !defined (WORD_CODE_HASH_SIZE)
128
# define WORD_CODE_HASH_SIZE 16384
131
/* Not only is it improbable that the 32-bit spaces might actually use 2^32
132
* defined options, it is infeasible. It would be best for this kind of
133
* space to be dynamically sized. Instead we size it at the word hash's
136
#if !defined (QUAD_NAME_HASH_SIZE)
137
# define QUAD_NAME_HASH_SIZE WORD_NAME_HASH_SIZE
139
#if !defined (QUAD_CODE_HASH_SIZE)
140
# define QUAD_CODE_HASH_SIZE WORD_CODE_HASH_SIZE
143
#if !defined (DNS_HASH_SIZE)
144
# define DNS_HASH_SIZE 0 /* Default. */
147
/* Default size to use for name/code hashes on user-defined option spaces. */
148
#if !defined (DEFAULT_SPACE_HASH_SIZE)
149
# define DEFAULT_SPACE_HASH_SIZE 11
152
#if !defined (NWIP_HASH_SIZE)
153
# define NWIP_HASH_SIZE 17 /* A really small table. */
156
#if !defined (FQDN_HASH_SIZE)
157
# define FQDN_HASH_SIZE 13 /* A ridiculously small table. */
160
/* I really doubt a given installation is going to have more than a few
161
* hundred vendors involved.
163
#if !defined (VIVCO_HASH_SIZE)
164
# define VIVCO_HASH_SIZE 127
167
#if !defined (VIVSO_HASH_SIZE)
168
# define VIVSO_HASH_SIZE VIVCO_HASH_SIZE
171
#if !defined (VSIO_HASH_SIZE)
172
# define VSIO_HASH_SIZE VIVCO_HASH_SIZE
175
#if !defined (VIV_ISC_HASH_SIZE)
176
# define VIV_ISC_HASH_SIZE 3 /* An incredulously small table. */
179
#if !defined (UNIVERSE_HASH_SIZE)
180
# define UNIVERSE_HASH_SIZE 13 /* A really small table. */
183
#if !defined (GROUP_HASH_SIZE)
184
# define GROUP_HASH_SIZE 0 /* Default. */
187
/* At least one person has indicated they use ~20k host records.
189
#if !defined (HOST_HASH_SIZE)
190
# define HOST_HASH_SIZE 22501
193
/* We have user reports of use of ISC DHCP numbering leases in the 200k's.
195
* We also have reports of folks using 10.0/8 as a dynamic range. The
196
* following is something of a compromise between the two. At the ~2-3
197
* hundred thousand leases, there's ~2-3 leases to search in each bucket.
199
#if !defined (LEASE_HASH_SIZE)
200
# define LEASE_HASH_SIZE 100003
203
/* It is not known what the worst case subclass hash size is. We estimate
206
#if !defined (SCLASS_HASH_SIZE)
207
# define SCLASS_HASH_SIZE 12007
210
#if !defined (AGENT_HASH_SIZE)
211
# define AGENT_HASH_SIZE 11 /* A really small table. */
214
/* The server hash size is used for both names and codes. There aren't
215
* many (roughly 50 at the moment), so we use a smaller table. If we
216
* use a 1:1 table size, then we get name collisions due to poor name
217
* hashing. So we use double the space we need, which drastically
218
* reduces collisions.
220
#if !defined (SERVER_HASH_SIZE)
221
# define SERVER_HASH_SIZE (2*(sizeof(server_options) / sizeof(struct option)))
225
/* How many options are likely to appear in a single packet? */
226
#if !defined (OPTION_HASH_SIZE)
227
# define OPTION_HASH_SIZE 17
228
# define OPTION_HASH_PTWO 32 /* Next power of two above option hash. */
229
# define OPTION_HASH_EXP 5 /* The exponent for that power of two. */
232
#define compute_option_hash(x) \
233
(((x) & (OPTION_HASH_PTWO - 1)) + \
234
(((x) >> OPTION_HASH_EXP) & \
235
(OPTION_HASH_PTWO - 1))) % OPTION_HASH_SIZE;
237
enum dhcp_shutdown_state {
239
shutdown_omapi_connections,
240
shutdown_drop_omapi_connections,
245
/* Client FQDN option, failover FQDN option, etc. */
252
#include "failover.h"
254
/* A parsing context. */
266
* In order to give nice output when we have a parsing error
267
* in our file, we keep track of where we are in the line so
268
* that we can show the user.
270
* We need to keep track of two lines, because we can look
271
* ahead, via the "peek" function, to the next line sometimes.
273
* The "line1" and "line2" variables act as buffers for this
274
* information. The "lpos" variable tells us where we are in the
277
* When we "put back" a character from the parsing context, we
278
* do not want to have the character appear twice in the error
279
* output. So, we set a flag, the "ugflag", which the
280
* get_char() function uses to check for this condition.
288
enum dhcp_token token;
294
int warnings_occurred;
297
size_t bufix, buflen;
300
struct parse *saved_state;
302
#if defined(LDAP_CONFIGURATION)
304
* LDAP configuration uses a call-back to iteratively read config
305
* off of the LDAP repository.
306
* XXX: The token stream can not be rewound reliably, so this must
307
* be addressed for DHCPv6 support.
309
int (*read_function)(struct parse *);
313
/* Variable-length array of data. */
316
struct string_list *next;
320
/* A name server, from /etc/resolv.conf. */
322
struct name_server *next;
323
struct sockaddr_in addr;
327
/* A domain search list element. */
328
struct domain_search_list {
329
struct domain_search_list *next;
334
/* Option tag structures are used to build chains of option tags, for
335
when we're sure we're not going to have enough of them to justify
336
maintaining an array. */
339
struct option_tag *next;
343
/* An agent option structure. We need a special structure for the
344
Relay Agent Information option because if more than one appears in
345
a message, we have to keep them separate. */
347
struct agent_options {
348
struct agent_options *next;
350
struct option_tag *first;
353
struct option_cache {
355
struct option_cache *next;
356
struct expression *expression;
357
struct option *option;
358
struct data_string data;
360
#define OPTION_HAD_NULLS 0x00000001
364
struct option_state {
372
/* A dhcp packet and the pointers to its option values. */
374
struct dhcp_packet *raw;
376
unsigned packet_length;
379
unsigned char dhcpv6_msg_type; /* DHCPv6 message type */
381
/* DHCPv6 transaction ID */
382
unsigned char dhcpv6_transaction_id[3];
384
/* DHCPv6 relay information */
385
unsigned char dhcpv6_hop_count;
386
struct in6_addr dhcpv6_link_address;
387
struct in6_addr dhcpv6_peer_address;
389
/* DHCPv6 packet containing this one, or NULL if none */
390
struct packet *dhcpv6_container_packet;
394
struct iaddr client_addr;
395
struct interface_info *interface; /* Interface on which packet
397
struct hardware *haddr; /* Physical link address
398
of local sender (maybe gateway). */
400
/* Information for relay agent options (see
401
draft-ietf-dhc-agent-options-xx.txt). */
402
u_int8_t *circuit_id; /* Circuit ID of client connection. */
404
u_int8_t *remote_id; /* Remote ID of client. */
407
int got_requested_address; /* True if client sent the
408
dhcp-requested-address option. */
410
struct shared_network *shared_network;
411
struct option_state *options;
413
#if !defined (PACKET_MAX_CLASSES)
414
# define PACKET_MAX_CLASSES 5
417
struct class *classes [PACKET_MAX_CLASSES];
422
/* If we stash agent options onto the packet option state, to pretend
423
* options we got in a previous exchange were still there, we need
424
* to signal this in a reliable way.
426
isc_boolean_t agent_options_stashed;
429
* ISC_TRUE if packet received unicast (as opposed to multicast).
430
* Only used in DHCPv6.
432
isc_boolean_t unicast;
435
/* A network interface's MAC address. */
442
#if defined(LDAP_CONFIGURATION)
443
# define LDAP_BUFFER_SIZE 8192
444
# define LDAP_METHOD_STATIC 0
445
# define LDAP_METHOD_DYNAMIC 1
446
#if defined (LDAP_USE_SSL)
447
# define LDAP_SSL_OFF 0
448
# define LDAP_SSL_ON 1
449
# define LDAP_SSL_TLS 2
450
# define LDAP_SSL_LDAPS 3
453
/* This is a tree of the current configuration we are building from LDAP */
454
struct ldap_config_stack {
455
LDAPMessage * res; /* Pointer returned from ldap_search */
456
LDAPMessage * ldent; /* Current item in LDAP that we're processing.
458
int close_brace; /* Put a closing } after we're through with
460
int processed; /* We set this flag if this base item has been
461
processed. After this base item is processed,
462
we can start processing the children */
463
struct ldap_config_stack *children;
464
struct ldap_config_stack *next;
472
server_hibernate = 3,
474
} control_object_state_t;
477
OMAPI_OBJECT_PREAMBLE;
478
control_object_state_t state;
479
} dhcp_control_object_t;
484
#define FTS_EXPIRED 3
485
#define FTS_RELEASED 4
486
#define FTS_ABANDONED 5
489
typedef u_int8_t binding_state_t;
491
/* FTS_LAST is the highest value that is valid for a lease binding state. */
492
#define FTS_LAST FTS_BACKUP
494
/* A dhcp lease declaration structure. */
496
OMAPI_OBJECT_PREAMBLE;
498
struct lease *n_uid, *n_hw;
500
struct iaddr ip_addr;
501
TIME starts, ends, sort_time;
502
char *client_hostname;
503
struct binding_scope *scope;
504
struct host_decl *host;
505
struct subnet *subnet;
507
struct class *billing_class;
508
struct option_chain_head *agent_options;
510
struct executable_statement *on_expiry;
511
struct executable_statement *on_commit;
512
struct executable_statement *on_release;
515
unsigned short uid_len;
516
unsigned short uid_max;
517
unsigned char uid_buf [7];
518
struct hardware hardware_addr;
521
# define STATIC_LEASE 1
522
# define BOOTP_LEASE 2
523
# define RESERVED_LEASE 4
524
# define MS_NULL_TERMINATION 8
525
# define ON_UPDATE_QUEUE 16
526
# define ON_ACK_QUEUE 32
527
# define ON_QUEUE (ON_UPDATE_QUEUE | ON_ACK_QUEUE)
528
# define UNICAST_BROADCAST_HACK 64
529
# define ON_DEFERRED_QUEUE 128
531
/* Persistent flags are to be preserved on a given lease structure. */
532
# define PERSISTENT_FLAGS (ON_ACK_QUEUE | ON_UPDATE_QUEUE)
533
/* Ephemeral flags are to be preserved on a given lease (copied etc). */
534
# define EPHEMERAL_FLAGS (MS_NULL_TERMINATION | \
535
UNICAST_BROADCAST_HACK | \
540
* The lease's binding state is its current state. The next binding
541
* state is the next state this lease will move into by expiration,
542
* or timers in general. The desired binding state is used on lease
543
* updates; the caller is attempting to move the lease to the desired
544
* binding state (and this may either succeed or fail, so the binding
545
* state must be preserved).
547
* The 'rewind' binding state is used in failover processing. It
548
* is used for an optimization when out of communications; it allows
549
* the server to "rewind" a lease to the previous state acknowledged
550
* by the peer, and progress forward from that point.
552
binding_state_t binding_state;
553
binding_state_t next_binding_state;
554
binding_state_t desired_binding_state;
555
binding_state_t rewind_binding_state;
557
struct lease_state *state;
560
* 'tsfp' is more of an 'effective' tsfp. It may be calculated from
561
* stos+mclt for example if it's an expired lease and the server is
562
* in partner-down state. 'atsfp' is zeroed whenever a lease is
563
* updated - and only set when the peer acknowledges it. This
564
* ensures every state change is transmitted.
566
TIME tstp; /* Time sent to partner. */
567
TIME tsfp; /* Time sent from partner. */
568
TIME atsfp; /* Actual time sent from partner. */
569
TIME cltt; /* Client last transaction time. */
570
u_int32_t last_xid; /* XID we sent in this lease's BNDUPD */
571
struct lease *next_pending;
574
* A pointer to the state of the ddns update for this lease.
575
* It should be set while the update is in progress and cleared
576
* when the update finishes. It can be used to cancel the
577
* update if we want to do a different update.
579
struct dhcp_ddns_cb *ddns_cb;
583
struct lease_state *next;
585
struct interface_info *ip;
587
struct packet *packet; /* The incoming packet. */
591
struct option_state *options;
592
struct data_string parameter_request_list;
593
int max_message_size;
594
unsigned char expiry[4], renewal[4], rebind[4];
595
struct data_string filename, server_name;
596
int got_requested_address;
597
int got_server_identifier;
598
struct shared_network *shared_network; /* Shared network of interface
599
on which request arrived. */
603
u_int16_t bootp_flags;
604
struct in_addr ciaddr;
605
struct in_addr siaddr;
606
struct in_addr giaddr;
614
#define SHARED_NET_DECL 2
615
#define SUBNET_DECL 3
620
/* Possible modes in which discover_interfaces can run. */
622
#define DISCOVER_RUNNING 0
623
#define DISCOVER_SERVER 1
624
#define DISCOVER_UNCONFIGURED 2
625
#define DISCOVER_RELAY 3
626
#define DISCOVER_REQUESTED 4
628
/* DDNS_UPDATE_STYLE enumerations. */
629
#define DDNS_UPDATE_STYLE_NONE 0
630
#define DDNS_UPDATE_STYLE_AD_HOC 1
631
#define DDNS_UPDATE_STYLE_INTERIM 2
633
/* Server option names. */
635
#define SV_DEFAULT_LEASE_TIME 1
636
#define SV_MAX_LEASE_TIME 2
637
#define SV_MIN_LEASE_TIME 3
638
#define SV_BOOTP_LEASE_CUTOFF 4
639
#define SV_BOOTP_LEASE_LENGTH 5
640
#define SV_BOOT_UNKNOWN_CLIENTS 6
641
#define SV_DYNAMIC_BOOTP 7
642
#define SV_ALLOW_BOOTP 8
643
#define SV_ALLOW_BOOTING 9
644
#define SV_ONE_LEASE_PER_CLIENT 10
645
#define SV_GET_LEASE_HOSTNAMES 11
646
#define SV_USE_HOST_DECL_NAMES 12
647
#define SV_USE_LEASE_ADDR_FOR_DEFAULT_ROUTE 13
648
#define SV_MIN_SECS 14
649
#define SV_FILENAME 15
650
#define SV_SERVER_NAME 16
651
#define SV_NEXT_SERVER 17
652
#define SV_AUTHORITATIVE 18
653
#define SV_VENDOR_OPTION_SPACE 19
654
#define SV_ALWAYS_REPLY_RFC1048 20
655
#define SV_SITE_OPTION_SPACE 21
656
#define SV_ALWAYS_BROADCAST 22
657
#define SV_DDNS_DOMAIN_NAME 23
658
#define SV_DDNS_HOST_NAME 24
659
#define SV_DDNS_REV_DOMAIN_NAME 25
660
#define SV_LEASE_FILE_NAME 26
661
#define SV_PID_FILE_NAME 27
662
#define SV_DUPLICATES 28
663
#define SV_DECLINES 29
664
#define SV_DDNS_UPDATES 30
665
#define SV_OMAPI_PORT 31
666
#define SV_LOCAL_PORT 32
667
#define SV_LIMITED_BROADCAST_ADDRESS 33
668
#define SV_REMOTE_PORT 34
669
#define SV_LOCAL_ADDRESS 35
670
#define SV_OMAPI_KEY 36
671
#define SV_STASH_AGENT_OPTIONS 37
672
#define SV_DDNS_TTL 38
673
#define SV_DDNS_UPDATE_STYLE 39
674
#define SV_CLIENT_UPDATES 40
675
#define SV_UPDATE_OPTIMIZATION 41
676
#define SV_PING_CHECKS 42
677
#define SV_UPDATE_STATIC_LEASES 43
678
#define SV_LOG_FACILITY 44
679
#define SV_DO_FORWARD_UPDATES 45
680
#define SV_PING_TIMEOUT 46
681
#define SV_RESERVE_INFINITE 47
682
#define SV_DDNS_CONFLICT_DETECT 48
683
#define SV_LEASEQUERY 49
684
#define SV_ADAPTIVE_LEASE_TIME_THRESHOLD 50
685
#define SV_DO_REVERSE_UPDATES 51
686
#define SV_FQDN_REPLY 52
687
#define SV_PREFER_LIFETIME 53
688
#define SV_DHCPV6_LEASE_FILE_NAME 54
689
#define SV_DHCPV6_PID_FILE_NAME 55
690
#define SV_LIMIT_ADDRS_PER_IA 56
691
#define SV_LIMIT_PREFS_PER_IA 57
692
#define SV_DELAYED_ACK 58
693
#define SV_MAX_ACK_DELAY 59
694
#if defined(LDAP_CONFIGURATION)
695
# define SV_LDAP_SERVER 60
696
# define SV_LDAP_PORT 61
697
# define SV_LDAP_USERNAME 62
698
# define SV_LDAP_PASSWORD 63
699
# define SV_LDAP_BASE_DN 64
700
# define SV_LDAP_METHOD 65
701
# define SV_LDAP_DEBUG_FILE 66
702
# define SV_LDAP_DHCP_SERVER_CN 67
703
# define SV_LDAP_REFERRALS 68
704
#if defined (LDAP_USE_SSL)
705
# define SV_LDAP_SSL 69
706
# define SV_LDAP_TLS_REQCERT 70
707
# define SV_LDAP_TLS_CA_FILE 71
708
# define SV_LDAP_TLS_CA_DIR 72
709
# define SV_LDAP_TLS_CERT 73
710
# define SV_LDAP_TLS_KEY 74
711
# define SV_LDAP_TLS_CRLCHECK 75
712
# define SV_LDAP_TLS_CIPHERS 76
713
# define SV_LDAP_TLS_RANDFILE 77
717
#if !defined (DEFAULT_PING_TIMEOUT)
718
# define DEFAULT_PING_TIMEOUT 1
721
#if !defined (DEFAULT_DELAYED_ACK)
722
# define DEFAULT_DELAYED_ACK 28 /* default SO_SNDBUF size / 576 bytes */
725
#if !defined (DEFAULT_ACK_DELAY_SECS)
726
# define DEFAULT_ACK_DELAY_SECS 0
729
#if !defined (DEFAULT_ACK_DELAY_USECS)
730
# define DEFAULT_ACK_DELAY_USECS 250000 /* 1/4 of a second */
733
#if !defined (DEFAULT_MIN_ACK_DELAY_USECS)
734
# define DEFAULT_MIN_ACK_DELAY_USECS 10000 /* 1/100 second */
737
#if defined(LDAP_CONFIGURATION)
738
# define SV_LDAP_SERVER 60
739
# define SV_LDAP_PORT 61
740
# define SV_LDAP_USERNAME 62
741
# define SV_LDAP_PASSWORD 63
742
# define SV_LDAP_BASE_DN 64
743
# define SV_LDAP_METHOD 65
744
# define SV_LDAP_DEBUG_FILE 66
745
# define SV_LDAP_DHCP_SERVER_CN 67
746
# define SV_LDAP_REFERRALS 68
747
#if defined (LDAP_USE_SSL)
748
# define SV_LDAP_SSL 69
749
# define SV_LDAP_TLS_REQCERT 70
750
# define SV_LDAP_TLS_CA_FILE 71
751
# define SV_LDAP_TLS_CA_DIR 72
752
# define SV_LDAP_TLS_CERT 73
753
# define SV_LDAP_TLS_KEY 74
754
# define SV_LDAP_TLS_CRLCHECK 75
755
# define SV_LDAP_TLS_CIPHERS 76
756
# define SV_LDAP_TLS_RANDFILE 77
760
#if !defined (DEFAULT_DEFAULT_LEASE_TIME)
761
# define DEFAULT_DEFAULT_LEASE_TIME 43200
764
#if !defined (DEFAULT_MIN_LEASE_TIME)
765
# define DEFAULT_MIN_LEASE_TIME 300
768
#if !defined (DEFAULT_MAX_LEASE_TIME)
769
# define DEFAULT_MAX_LEASE_TIME 86400
772
#if !defined (DEFAULT_DDNS_TTL)
773
# define DEFAULT_DDNS_TTL 3600
775
#if !defined (MAX_DEFAULT_DDNS_TTL)
776
# define MAX_DEFAULT_DDNS_TTL 3600
779
#if !defined (MIN_LEASE_WRITE)
780
# define MIN_LEASE_WRITE 15
783
/* Client option names */
786
#define CL_SELECT_INTERVAL 2
787
#define CL_REBOOT_TIMEOUT 3
788
#define CL_RETRY_INTERVAL 4
789
#define CL_BACKOFF_CUTOFF 5
790
#define CL_INITIAL_INTERVAL 6
791
#define CL_BOOTP_POLICY 7
792
#define CL_SCRIPT_NAME 8
793
#define CL_REQUESTED_OPTIONS 9
794
#define CL_REQUESTED_LEASE_TIME 10
795
#define CL_SEND_OPTIONS 11
797
#define CL_REJECT_LIST 13
799
#ifndef CL_DEFAULT_TIMEOUT
800
# define CL_DEFAULT_TIMEOUT 60
803
#ifndef CL_DEFAULT_SELECT_INTERVAL
804
# define CL_DEFAULT_SELECT_INTERVAL 0
807
#ifndef CL_DEFAULT_REBOOT_TIMEOUT
808
# define CL_DEFAULT_REBOOT_TIMEOUT 10
811
#ifndef CL_DEFAULT_RETRY_INTERVAL
812
# define CL_DEFAULT_RETRY_INTERVAL 300
815
#ifndef CL_DEFAULT_BACKOFF_CUTOFF
816
# define CL_DEFAULT_BACKOFF_CUTOFF 120
819
#ifndef CL_DEFAULT_INITIAL_INTERVAL
820
# define CL_DEFAULT_INITIAL_INTERVAL 10
823
#ifndef CL_DEFAULT_BOOTP_POLICY
824
# define CL_DEFAULT_BOOTP_POLICY P_ACCEPT
827
#ifndef CL_DEFAULT_REQUESTED_OPTIONS
828
# define CL_DEFAULT_REQUESTED_OPTIONS \
830
DHO_BROADCAST_ADDRESS, \
834
DHO_DOMAIN_NAME_SERVERS, \
838
struct group_object {
839
OMAPI_OBJECT_PREAMBLE;
841
struct group_object *n_dynamic;
845
#define GROUP_OBJECT_DELETED 1
846
#define GROUP_OBJECT_DYNAMIC 2
847
#define GROUP_OBJECT_STATIC 4
850
/* Group of declarations that share common parameters. */
855
struct group_object *object;
856
struct subnet *subnet;
857
struct shared_network *shared_network;
859
struct executable_statement *statements;
862
/* A dhcp host declaration structure. */
864
OMAPI_OBJECT_PREAMBLE;
865
struct host_decl *n_ipaddr;
866
struct host_decl *n_dynamic;
868
struct hardware interface;
869
struct data_string client_identifier;
870
struct option *host_id_option;
871
struct data_string host_id;
872
/* XXXSK: fixed_addr should be an array of iaddr values,
873
not an option_cache, but it's referenced in a lot of
874
places, so we'll leave it for now. */
875
struct option_cache *fixed_addr;
876
struct iaddrcidrnetlist *fixed_prefix;
878
struct group_object *named_group;
879
struct data_string auth_key_id;
881
#define HOST_DECL_DELETED 1
882
#define HOST_DECL_DYNAMIC 2
883
#define HOST_DECL_STATIC 4
889
permit_unknown_clients,
890
permit_known_clients,
891
permit_authenticated_clients,
892
permit_unauthenticated_clients,
894
permit_dynamic_bootp_clients,
899
TIME after; /* date after which this clause applies */
903
OMAPI_OBJECT_PREAMBLE;
906
struct shared_network *shared_network;
907
struct permit *permit_list;
908
struct permit *prohibit_list;
909
struct lease *active;
910
struct lease *expired;
912
struct lease *backup;
913
struct lease *abandoned;
914
struct lease *reserved;
915
TIME next_event_time;
920
TIME valid_from; /* deny pool use before this date */
921
TIME valid_until; /* deny pool use after this date */
923
#if defined (FAILOVER_PROTOCOL)
924
dhcp_failover_state_t *failover_peer;
928
struct shared_network {
929
OMAPI_OBJECT_PREAMBLE;
930
struct shared_network *next;
933
#define SHARED_IMPLICIT 1 /* This network was synthesized. */
936
struct subnet *subnets;
937
struct interface_info *interface;
939
struct ipv6_pool **ipv6_pools; /* NULL-terminated array */
940
int last_ipv6_pool; /* offset of last IPv6 pool
941
used to issue a lease */
943
#if defined (FAILOVER_PROTOCOL)
944
dhcp_failover_state_t *failover_peer;
949
OMAPI_OBJECT_PREAMBLE;
950
struct subnet *next_subnet;
951
struct subnet *next_sibling;
952
struct shared_network *shared_network;
953
struct interface_info *interface;
954
struct iaddr interface_address;
956
struct iaddr netmask;
957
int prefix_len; /* XXX: currently for IPv6 only */
962
struct collection *next;
965
struct class *classes;
968
/* Used as an argument to parse_clasS_decl() */
969
#define CLASS_TYPE_VENDOR 0
970
#define CLASS_TYPE_USER 1
971
#define CLASS_TYPE_CLASS 2
972
#define CLASS_TYPE_SUBCLASS 3
974
/* XXX classes must be reference-counted. */
976
OMAPI_OBJECT_PREAMBLE;
977
struct class *nic; /* Next in collection. */
978
struct class *superclass; /* Set for spawned classes only. */
979
char *name; /* Not set for spawned classes. */
981
/* A class may be configured to permit a limited number of leases. */
984
struct lease **billed_leases;
986
/* If nonzero, class has not been saved since it was last
990
/* Hash table containing subclasses. */
992
struct data_string hash_string;
994
/* Expression used to match class. */
995
struct expression *expr;
997
/* Expression used to compute subclass identifiers for spawning
998
and to do subclass matching. */
999
struct expression *submatch;
1002
struct group *group;
1004
/* Statements to execute if class matches. */
1005
struct executable_statement *statements;
1007
#define CLASS_DECL_DELETED 1
1008
#define CLASS_DECL_DYNAMIC 2
1009
#define CLASS_DECL_STATIC 4
1010
#define CLASS_DECL_SUBCLASS 8
1015
/* DHCP client lease structure... */
1016
struct client_lease {
1017
struct client_lease *next; /* Next lease in list. */
1018
TIME expiry, renewal, rebind; /* Lease timeouts. */
1019
struct iaddr address; /* Address being leased. */
1020
char *server_name; /* Name of boot server. */
1021
char *filename; /* Name of file we're supposed to boot. */
1022
struct string_list *medium; /* Network medium. */
1023
struct auth_key *key; /* Key used in basic DHCP authentication. */
1025
unsigned int is_static : 1; /* If set, lease is from config file. */
1026
unsigned int is_bootp: 1; /* If set, lease was acquired with BOOTP. */
1028
struct option_state *options; /* Options supplied with lease. */
1031
/* DHCPv6 lease structures */
1033
struct dhc6_addr *next;
1034
struct iaddr address;
1037
/* Address state flags. */
1038
#define DHC6_ADDR_DEPREFFED 0x01
1039
#define DHC6_ADDR_EXPIRED 0x02
1043
u_int32_t preferred_life;
1046
struct option_state *options;
1050
struct dhc6_ia *next;
1051
unsigned char iaid[4];
1057
struct dhc6_addr *addrs;
1059
struct option_state *options;
1063
struct dhc6_lease *next;
1064
struct data_string server_id;
1066
isc_boolean_t released;
1070
unsigned char dhcpv6_transaction_id[3];
1071
struct dhc6_ia *bindings;
1073
struct option_state *options;
1076
/* Possible states in which the client can be. */
1088
/* Authentication and BOOTP policy possibilities (not all values work
1090
enum policy { P_IGNORE, P_ACCEPT, P_PREFER, P_REQUIRE, P_DONT };
1092
/* Configuration information from the config file... */
1093
struct client_config {
1095
* When a message has been received, run these statements
1098
struct group *on_receipt;
1101
* When a message is sent, run these statements.
1103
struct group *on_transmission;
1105
struct option **required_options; /* Options that MUST be present. */
1106
struct option **requested_options; /* Options to request (ORO/PRL). */
1108
TIME timeout; /* Start to panic if we don't get a
1109
lease in this time period when
1111
TIME initial_delay; /* Set initial delay before first
1113
TIME initial_interval; /* All exponential backoff intervals
1115
TIME retry_interval; /* If the protocol failed to produce
1116
an address before the timeout,
1117
try the protocol again after this
1119
TIME select_interval; /* Wait this many seconds from the
1120
first DHCPDISCOVER before
1121
picking an offered lease. */
1122
TIME reboot_timeout; /* When in INIT-REBOOT, wait this
1123
long before giving up and going
1125
TIME backoff_cutoff; /* When doing exponential backoff,
1126
never back off to an interval
1127
longer than this amount. */
1128
u_int32_t requested_lease; /* Requested lease time, if user
1129
doesn't configure one. */
1130
struct string_list *media; /* Possible network media values. */
1131
char *script_name; /* Name of config script. */
1132
char *vendor_space_name; /* Name of config script. */
1133
enum policy bootp_policy;
1134
/* Ignore, accept or prefer BOOTP
1136
enum policy auth_policy;
1137
/* Require authentication, prefer
1138
authentication, or don't try to
1140
struct string_list *medium; /* Current network medium. */
1142
struct iaddrmatchlist *reject_list; /* Servers to reject. */
1144
int omapi_port; /* port on which to accept OMAPI
1145
connections, or -1 for no
1147
int do_forward_update; /* If nonzero, and if we have the
1148
information we need, update the
1149
A record for the address we get. */
1152
/* Per-interface state used in the dhcp client... */
1153
/* XXX: consider union {}'ing this for v4/v6. */
1154
struct client_state {
1155
struct client_state *next;
1156
struct interface_info *interface;
1159
/* Common values. */
1160
struct client_config *config; /* Client configuration. */
1161
struct string_list *env; /* Client script environment. */
1162
int envc; /* Number of entries in environment. */
1163
struct option_state *sent_options; /* Options we sent. */
1164
enum dhcp_state state; /* Current state for this interface. */
1165
TIME last_write; /* Last time this state was written. */
1167
/* DHCPv4 values. */
1168
struct client_lease *active; /* Currently active lease. */
1169
struct client_lease *new; /* New lease. */
1170
struct client_lease *offered_leases; /* Leases offered to us. */
1171
struct client_lease *leases; /* Leases we currently hold. */
1172
struct client_lease *alias; /* Alias lease. */
1174
struct iaddr destination; /* Where to send packet. */
1175
u_int32_t xid; /* Transaction ID. */
1176
u_int16_t secs; /* secs value from DHCPDISCOVER. */
1177
TIME first_sending; /* When was first copy sent? */
1178
TIME interval; /* What's the current resend interval? */
1179
struct string_list *medium; /* Last media type tried. */
1180
struct dhcp_packet packet; /* Outgoing DHCP packet. */
1181
unsigned packet_length; /* Actual length of generated packet. */
1183
struct iaddr requested_address; /* Address we would like to get. */
1185
/* DHCPv6 values. */
1186
unsigned char dhcpv6_transaction_id[3];
1187
u_int8_t refresh_type;
1189
struct dhc6_lease *active_lease;
1190
struct dhc6_lease *old_lease;
1191
struct dhc6_lease *advertised_leases;
1192
struct dhc6_lease *selected_lease;
1193
struct dhc6_lease *held_leases;
1195
struct timeval start_time;
1199
/* See RFC3315 section 14. */
1200
TIME RT; /* In hundredths of seconds. */
1201
TIME IRT; /* In hundredths of seconds. */
1202
TIME MRC; /* Count. */
1203
TIME MRT; /* In hundredths of seconds. */
1204
TIME MRD; /* In seconds, relative. */
1205
TIME next_MRD; /* In seconds, absolute. */
1207
/* Rather than a state, we use a function that shifts around
1208
* depending what stage of life the v6 state machine is in.
1209
* This is where incoming packets are dispatched to (sometimes
1212
void (*v6_handler)(struct packet *, struct client_state *);
1215
* A pointer to the state of the ddns update for this lease.
1216
* It should be set while the update is in progress and cleared
1217
* when the update finishes. It can be used to cancel the
1218
* update if we want to do a different update.
1220
struct dhcp_ddns_cb *ddns_cb;
1223
struct envadd_state {
1224
struct client_state *client;
1228
struct dns_update_state {
1229
struct client_state *client;
1230
struct iaddr address;
1231
int dns_update_timeout;
1234
/* Information about each network interface. */
1236
struct interface_info {
1237
OMAPI_OBJECT_PREAMBLE;
1238
struct interface_info *next; /* Next interface in list... */
1239
struct shared_network *shared_network;
1240
/* Networks connected to this interface. */
1241
struct hardware hw_address; /* Its physical address. */
1242
struct in_addr *addresses; /* Addresses associated with this
1245
int address_count; /* Number of addresses stored. */
1246
int address_max; /* Size of addresses buffer. */
1247
struct in6_addr *v6addresses; /* IPv6 addresses associated with
1249
int v6address_count; /* Number of IPv6 addresses associated
1250
with this interface. */
1251
int v6address_max; /* Maximum number of IPv6 addresses
1252
we can store in current buffer. */
1254
u_int8_t *circuit_id; /* Circuit ID associated with this
1256
unsigned circuit_id_len; /* Length of Circuit ID, if there
1258
u_int8_t *remote_id; /* Remote ID associated with this
1259
interface (if any). */
1260
unsigned remote_id_len; /* Length of Remote ID. */
1262
char name [IFNAMSIZ]; /* Its name... */
1263
int index; /* Its if_nametoindex(). */
1264
int rfdesc; /* Its read file descriptor. */
1265
int wfdesc; /* Its write file descriptor, if
1267
unsigned char *rbuf; /* Read buffer, if required. */
1268
unsigned int rbuf_max; /* Size of read buffer. */
1269
size_t rbuf_offset; /* Current offset into buffer. */
1270
size_t rbuf_len; /* Length of data in buffer. */
1272
struct ifreq *ifp; /* Pointer to ifreq struct. */
1273
int configured; /* If set to 1, interface has at least
1274
* one valid IP address.
1276
u_int32_t flags; /* Control flags... */
1277
#define INTERFACE_REQUESTED 1
1278
#define INTERFACE_AUTOMATIC 2
1279
#define INTERFACE_RUNNING 4
1280
#define INTERFACE_DOWNSTREAM 8
1281
#define INTERFACE_UPSTREAM 16
1282
#define INTERFACE_STREAMS (INTERFACE_DOWNSTREAM | INTERFACE_UPSTREAM)
1284
/* Only used by DHCP client code. */
1285
struct client_state *client;
1286
# if defined(USE_DLPI_SEND) || defined(USE_DLPI_RECEIVE) || \
1287
defined(USE_DLPI_HWADDR)
1288
int dlpi_sap_length;
1289
struct hardware dlpi_broadcast_addr;
1290
# endif /* DLPI_SEND || DLPI_RECEIVE */
1291
struct hardware anycast_mac_addr;
1294
struct hardware_link {
1295
struct hardware_link *next;
1296
char name [IFNAMSIZ];
1297
struct hardware address;
1301
struct leasequeue *prev;
1302
struct leasequeue *next;
1303
struct lease *lease;
1306
typedef void (*tvref_t)(void *, void *, const char *, int);
1307
typedef void (*tvunref_t)(void *, const char *, int);
1309
struct timeout *next;
1310
struct timeval when;
1311
void (*func) (void *);
1315
isc_timer_t *isc_timeout;
1319
struct eventqueue *next;
1320
void (*handler)(void *);
1324
struct protocol *next;
1326
void (*handler) (struct protocol *);
1330
struct dns_query; /* forward */
1333
struct dns_wakeup *next; /* Next wakeup in chain. */
1334
void (*func) (struct dns_query *);
1337
struct dns_question {
1338
u_int16_t type; /* Type of query. */
1339
u_int16_t class; /* Class of query. */
1340
unsigned char data [1]; /* Query data. */
1344
u_int16_t type; /* Type of answer. */
1345
u_int16_t class; /* Class of answer. */
1346
int count; /* Number of answers. */
1347
unsigned char *answers[1]; /* Pointers to answers. */
1351
struct dns_query *next; /* Next query in hash bucket. */
1352
u_int32_t hash; /* Hash bucket index. */
1353
TIME expiry; /* Query expiry time (zero if not yet
1355
u_int16_t id; /* Query ID (also hash table index) */
1356
caddr_t waiters; /* Pointer to list of things waiting
1359
struct dns_question *question; /* Question, internal format. */
1360
struct dns_answer *answer; /* Answer, internal format. */
1362
unsigned char *query; /* Query formatted for DNS server. */
1363
unsigned len; /* Length of entire query. */
1364
int sent; /* The query has been sent. */
1365
struct dns_wakeup *wakeups; /* Wakeups to call if this query is
1367
struct name_server *next_server; /* Next server to try. */
1368
int backoff; /* Current backoff, in seconds. */
1375
struct option_cache *primary;
1376
struct option_cache *secondary;
1377
struct auth_key *key;
1381
OMAPI_OBJECT_PREAMBLE;
1383
void (*icmp_handler) (struct iaddr, u_int8_t *, int);
1388
/* Bitmask of dhcp option codes. */
1389
typedef unsigned char option_mask [16];
1391
/* DHCP Option mask manipulation macros... */
1392
#define OPTION_ZERO(mask) (memset (mask, 0, 16))
1393
#define OPTION_SET(mask, bit) (mask [bit >> 8] |= (1 << (bit & 7)))
1394
#define OPTION_CLR(mask, bit) (mask [bit >> 8] &= ~(1 << (bit & 7)))
1395
#define OPTION_ISSET(mask, bit) (mask [bit >> 8] & (1 << (bit & 7)))
1396
#define OPTION_ISCLR(mask, bit) (!OPTION_ISSET (mask, bit))
1398
/* An option occupies its length plus two header bytes (code and
1399
length) for every 255 bytes that must be stored. */
1400
#define OPTION_SPACE(x) ((x) + 2 * ((x) / 255 + 1))
1402
/* Default path to dhcpd config file. */
1404
#undef _PATH_DHCPD_CONF
1405
#define _PATH_DHCPD_CONF "dhcpd.conf"
1406
#undef _PATH_DHCPD_DB
1407
#define _PATH_DHCPD_DB "dhcpd.leases"
1408
#undef _PATH_DHCPD6_DB
1409
#define _PATH_DHCPD6_DB "dhcpd6.leases"
1410
#undef _PATH_DHCPD_PID
1411
#define _PATH_DHCPD_PID "dhcpd.pid"
1412
#undef _PATH_DHCPD6_PID
1413
#define _PATH_DHCPD6_PID "dhcpd6.pid"
1416
#ifndef _PATH_DHCPD_CONF
1417
#define _PATH_DHCPD_CONF "/etc/dhcpd.conf"
1420
#ifndef _PATH_DHCPD_DB
1421
#define _PATH_DHCPD_DB LOCALSTATEDIR"/db/dhcpd.leases"
1424
#ifndef _PATH_DHCPD6_DB
1425
#define _PATH_DHCPD6_DB LOCALSTATEDIR"/db/dhcpd6.leases"
1428
#ifndef _PATH_DHCPD_PID
1429
#define _PATH_DHCPD_PID LOCALSTATEDIR"/run/dhcpd.pid"
1432
#ifndef _PATH_DHCPD6_PID
1433
#define _PATH_DHCPD6_PID LOCALSTATEDIR"/run/dhcpd6.pid"
1438
#ifndef _PATH_DHCLIENT_CONF
1439
#define _PATH_DHCLIENT_CONF "/etc/dhclient.conf"
1442
#ifndef _PATH_DHCLIENT_SCRIPT
1443
#define _PATH_DHCLIENT_SCRIPT "/sbin/dhclient-script"
1446
#ifndef _PATH_DHCLIENT_PID
1447
#define _PATH_DHCLIENT_PID LOCALSTATEDIR"/run/dhclient.pid"
1450
#ifndef _PATH_DHCLIENT6_PID
1451
#define _PATH_DHCLIENT6_PID LOCALSTATEDIR"/run/dhclient6.pid"
1454
#ifndef _PATH_DHCLIENT_DB
1455
#define _PATH_DHCLIENT_DB LOCALSTATEDIR"/db/dhclient.leases"
1458
#ifndef _PATH_DHCLIENT6_DB
1459
#define _PATH_DHCLIENT6_DB LOCALSTATEDIR"/db/dhclient6.leases"
1462
#ifndef _PATH_RESOLV_CONF
1463
#define _PATH_RESOLV_CONF "/etc/resolv.conf"
1466
#ifndef _PATH_DHCRELAY_PID
1467
#define _PATH_DHCRELAY_PID LOCALSTATEDIR"/run/dhcrelay.pid"
1470
#ifndef _PATH_DHCRELAY6_PID
1471
#define _PATH_DHCRELAY6_PID LOCALSTATEDIR"/run/dhcrelay6.pid"
1474
#ifndef DHCPD_LOG_FACILITY
1475
#define DHCPD_LOG_FACILITY LOG_DAEMON
1478
#define MAX_TIME 0x7fffffff
1481
/* these are referenced */
1482
typedef struct hash_table ia_hash_t;
1483
typedef struct hash_table iasubopt_hash_t;
1485
/* IAADDR/IAPREFIX lease */
1488
int refcnt; /* reference count */
1489
struct in6_addr addr; /* IPv6 address/prefix */
1490
u_int8_t plen; /* iaprefix prefix length */
1491
binding_state_t state; /* state */
1492
struct binding_scope *scope; /* "set var = value;" */
1493
time_t hard_lifetime_end_time; /* time address expires */
1494
time_t soft_lifetime_end_time; /* time ephemeral expires */
1495
u_int32_t prefer; /* cached preferred lifetime */
1496
u_int32_t valid; /* cached valid lifetime */
1497
struct ia_xx *ia; /* IA for this lease */
1498
struct ipv6_pool *ipv6_pool; /* pool for this lease */
1500
* For now, just pick an arbitrary time to keep old hard leases
1501
* around (value in seconds).
1503
#define EXPIRED_IPV6_CLEANUP_TIME (60*60)
1505
int heap_index; /* index into heap, or -1
1506
(internal use only) */
1509
* A pointer to the state of the ddns update for this lease.
1510
* It should be set while the update is in progress and cleared
1511
* when the update finishes. It can be used to cancel the
1512
* update if we want to do a different update.
1514
struct dhcp_ddns_cb *ddns_cb;
1519
int refcnt; /* reference count */
1520
struct data_string iaid_duid; /* from the client */
1521
u_int16_t ia_type; /* IA_XX */
1522
int num_iasubopt; /* number of IAADDR/PREFIX */
1523
int max_iasubopt; /* space available for IAADDR/PREFIX */
1524
time_t cltt; /* client last transaction time */
1525
struct iasubopt **iasubopt; /* pointers to the IAADDR/IAPREFIXs */
1528
extern ia_hash_t *ia_na_active;
1529
extern ia_hash_t *ia_ta_active;
1530
extern ia_hash_t *ia_pd_active;
1533
int refcnt; /* reference count */
1534
u_int16_t pool_type; /* IA_xx */
1535
struct in6_addr start_addr; /* first IPv6 address */
1536
int bits; /* number of bits, CIDR style */
1537
int units; /* allocation unit in bits */
1538
iasubopt_hash_t *leases; /* non-free leases */
1539
int num_active; /* count of active leases */
1540
isc_heap_t *active_timeouts; /* timeouts for active leases */
1541
int num_inactive; /* count of inactive leases */
1542
isc_heap_t *inactive_timeouts; /* timeouts for expired or
1544
struct shared_network *shared_network; /* shared_network for
1546
struct subnet *subnet; /* subnet for this pool */
1549
/* Flags and state for dhcp_ddns_cb_t */
1550
#define DDNS_UPDATE_ADDR 0x01
1551
#define DDNS_UPDATE_PTR 0x02
1552
#define DDNS_INCLUDE_RRSET 0x04
1553
#define DDNS_CONFLICT_OVERRIDE 0x08
1554
#define DDNS_CLIENT_DID_UPDATE 0x10
1555
#define DDNS_EXECUTE_NEXT 0x20
1556
#define DDNS_ABORT 0x40
1559
* The following two groups are separate and we could reuse
1560
* values but not reusing them may be useful in the future.
1562
#define DDNS_STATE_CLEANUP 0 // The previous step failed, cleanup
1564
#define DDNS_STATE_ADD_FW_NXDOMAIN 1
1565
#define DDNS_STATE_ADD_FW_YXDHCID 2
1566
#define DDNS_STATE_ADD_PTR 3
1568
#define DDNS_STATE_REM_FW_YXDHCID 17
1569
#define DDNS_STATE_REM_FW_NXRR 18
1570
#define DDNS_STATE_REM_PTR 19
1573
* Flags for the dns print function
1575
#define DDNS_PRINT_INBOUND 1
1576
#define DDNS_PRINT_OUTBOUND 0
1578
struct dhcp_ddns_cb;
1580
typedef void (*ddns_action_t)(struct dhcp_ddns_cb *ddns_cb,
1581
isc_result_t result);
1583
typedef struct dhcp_ddns_cb {
1584
struct data_string fwd_name;
1585
struct data_string rev_name;
1586
struct data_string dhcid;
1587
struct iaddr address;
1592
unsigned char zone_name[DHCP_MAXDNS_WIRE];
1593
isc_sockaddrlist_t zone_server_list;
1594
isc_sockaddr_t zone_addrs[DHCP_MAXNS];
1595
int zone_addr_count;
1596
struct dns_zone *zone;
1601
ddns_action_t cur_func;
1603
struct dhcp_ddns_cb * next_op;
1605
/* Lease or client state that triggered the ddns operation */
1607
struct binding_scope **scope;
1613
extern struct ipv6_pool **pools;
1614
extern int num_pools;
1616
/* External definitions... */
1618
HASH_FUNCTIONS_DECL (group, const char *, struct group_object, group_hash_t)
1619
HASH_FUNCTIONS_DECL (universe, const char *, struct universe, universe_hash_t)
1620
HASH_FUNCTIONS_DECL (option_name, const char *, struct option,
1622
HASH_FUNCTIONS_DECL (option_code, const unsigned *, struct option,
1624
HASH_FUNCTIONS_DECL (dns_zone, const char *, struct dns_zone, dns_zone_hash_t)
1625
HASH_FUNCTIONS_DECL(lease_ip, const unsigned char *, struct lease,
1627
HASH_FUNCTIONS_DECL(lease_id, const unsigned char *, struct lease,
1629
HASH_FUNCTIONS_DECL (host, const unsigned char *, struct host_decl, host_hash_t)
1630
HASH_FUNCTIONS_DECL (class, const char *, struct class, class_hash_t)
1634
extern struct option *vendor_cfg_option;
1635
int parse_options (struct packet *);
1636
int parse_option_buffer (struct option_state *, const unsigned char *,
1637
unsigned, struct universe *);
1638
struct universe *find_option_universe (struct option *, const char *);
1639
int parse_encapsulated_suboptions (struct option_state *, struct option *,
1640
const unsigned char *, unsigned,
1641
struct universe *, const char *);
1642
int cons_options (struct packet *, struct dhcp_packet *, struct lease *,
1643
struct client_state *,
1644
int, struct option_state *, struct option_state *,
1645
struct binding_scope **,
1646
int, int, int, struct data_string *, const char *);
1647
int fqdn_universe_decode (struct option_state *,
1648
const unsigned char *, unsigned, struct universe *);
1649
struct option_cache *
1650
lookup_fqdn6_option(struct universe *universe, struct option_state *options,
1653
save_fqdn6_option(struct universe *universe, struct option_state *options,
1654
struct option_cache *oc, isc_boolean_t appendp);
1656
delete_fqdn6_option(struct universe *universe, struct option_state *options,
1659
fqdn6_option_space_foreach(struct packet *packet, struct lease *lease,
1660
struct client_state *client_state,
1661
struct option_state *in_options,
1662
struct option_state *cfg_options,
1663
struct binding_scope **scope,
1664
struct universe *u, void *stuff,
1665
void (*func)(struct option_cache *,
1668
struct client_state *,
1669
struct option_state *,
1670
struct option_state *,
1671
struct binding_scope **,
1672
struct universe *, void *));
1674
fqdn6_option_space_encapsulate(struct data_string *result,
1675
struct packet *packet, struct lease *lease,
1676
struct client_state *client_state,
1677
struct option_state *in_options,
1678
struct option_state *cfg_options,
1679
struct binding_scope **scope,
1680
struct universe *universe);
1682
fqdn6_universe_decode(struct option_state *options,
1683
const unsigned char *buffer, unsigned length,
1684
struct universe *u);
1685
int append_option(struct data_string *dst, struct universe *universe,
1686
struct option *option, struct data_string *src);
1688
store_options(int *ocount,
1689
unsigned char *buffer, unsigned buflen, unsigned index,
1690
struct packet *packet, struct lease *lease,
1691
struct client_state *client_state,
1692
struct option_state *in_options,
1693
struct option_state *cfg_options,
1694
struct binding_scope **scope,
1695
unsigned *priority_list, int priority_len,
1696
unsigned first_cutoff, int second_cutoff, int terminate,
1697
const char *vuname);
1698
int store_options6(char *, int, struct option_state *, struct packet *,
1699
const int *, struct data_string *);
1700
int format_has_text(const char *);
1701
int format_min_length(const char *, struct option_cache *);
1702
const char *pretty_print_option (struct option *, const unsigned char *,
1703
unsigned, int, int);
1704
int pretty_escape(char **, char *, const unsigned char **,
1705
const unsigned char *);
1706
int get_option (struct data_string *, struct universe *,
1707
struct packet *, struct lease *, struct client_state *,
1708
struct option_state *, struct option_state *,
1709
struct option_state *, struct binding_scope **, unsigned,
1711
void set_option (struct universe *, struct option_state *,
1712
struct option_cache *, enum statement_op);
1713
struct option_cache *lookup_option (struct universe *,
1714
struct option_state *, unsigned);
1715
struct option_cache *lookup_hashed_option (struct universe *,
1716
struct option_state *,
1718
struct option_cache *next_hashed_option(struct universe *,
1719
struct option_state *,
1720
struct option_cache *);
1721
int save_option_buffer (struct universe *, struct option_state *,
1722
struct buffer *, unsigned char *, unsigned,
1724
int append_option_buffer(struct universe *, struct option_state *,
1725
struct buffer *, unsigned char *, unsigned,
1727
void build_server_oro(struct data_string *, struct option_state *,
1729
void save_option(struct universe *, struct option_state *,
1730
struct option_cache *);
1731
void also_save_option(struct universe *, struct option_state *,
1732
struct option_cache *);
1733
void save_hashed_option(struct universe *, struct option_state *,
1734
struct option_cache *, isc_boolean_t appendp);
1735
void delete_option (struct universe *, struct option_state *, int);
1736
void delete_hashed_option (struct universe *,
1737
struct option_state *, int);
1738
int option_cache_dereference (struct option_cache **,
1740
int hashed_option_state_dereference (struct universe *,
1741
struct option_state *,
1743
int store_option (struct data_string *,
1744
struct universe *, struct packet *, struct lease *,
1745
struct client_state *,
1746
struct option_state *, struct option_state *,
1747
struct binding_scope **, struct option_cache *);
1748
int option_space_encapsulate (struct data_string *,
1749
struct packet *, struct lease *,
1750
struct client_state *,
1751
struct option_state *,
1752
struct option_state *,
1753
struct binding_scope **,
1754
struct data_string *);
1755
int hashed_option_space_encapsulate (struct data_string *,
1756
struct packet *, struct lease *,
1757
struct client_state *,
1758
struct option_state *,
1759
struct option_state *,
1760
struct binding_scope **,
1762
int nwip_option_space_encapsulate (struct data_string *,
1763
struct packet *, struct lease *,
1764
struct client_state *,
1765
struct option_state *,
1766
struct option_state *,
1767
struct binding_scope **,
1769
int fqdn_option_space_encapsulate (struct data_string *,
1770
struct packet *, struct lease *,
1771
struct client_state *,
1772
struct option_state *,
1773
struct option_state *,
1774
struct binding_scope **,
1776
void suboption_foreach (struct packet *, struct lease *, struct client_state *,
1777
struct option_state *, struct option_state *,
1778
struct binding_scope **, struct universe *, void *,
1779
void (*) (struct option_cache *, struct packet *,
1780
struct lease *, struct client_state *,
1781
struct option_state *, struct option_state *,
1782
struct binding_scope **,
1783
struct universe *, void *),
1784
struct option_cache *, const char *);
1785
void option_space_foreach (struct packet *, struct lease *,
1786
struct client_state *,
1787
struct option_state *,
1788
struct option_state *,
1789
struct binding_scope **,
1790
struct universe *, void *,
1791
void (*) (struct option_cache *,
1793
struct lease *, struct client_state *,
1794
struct option_state *,
1795
struct option_state *,
1796
struct binding_scope **,
1797
struct universe *, void *));
1798
void hashed_option_space_foreach (struct packet *, struct lease *,
1799
struct client_state *,
1800
struct option_state *,
1801
struct option_state *,
1802
struct binding_scope **,
1803
struct universe *, void *,
1804
void (*) (struct option_cache *,
1807
struct client_state *,
1808
struct option_state *,
1809
struct option_state *,
1810
struct binding_scope **,
1811
struct universe *, void *));
1812
int linked_option_get (struct data_string *, struct universe *,
1813
struct packet *, struct lease *,
1814
struct client_state *,
1815
struct option_state *, struct option_state *,
1816
struct option_state *, struct binding_scope **,
1818
int linked_option_state_dereference (struct universe *,
1819
struct option_state *,
1821
void save_linked_option(struct universe *, struct option_state *,
1822
struct option_cache *, isc_boolean_t appendp);
1823
void linked_option_space_foreach (struct packet *, struct lease *,
1824
struct client_state *,
1825
struct option_state *,
1826
struct option_state *,
1827
struct binding_scope **,
1828
struct universe *, void *,
1829
void (*) (struct option_cache *,
1832
struct client_state *,
1833
struct option_state *,
1834
struct option_state *,
1835
struct binding_scope **,
1836
struct universe *, void *));
1837
int linked_option_space_encapsulate (struct data_string *, struct packet *,
1838
struct lease *, struct client_state *,
1839
struct option_state *,
1840
struct option_state *,
1841
struct binding_scope **,
1843
void delete_linked_option (struct universe *, struct option_state *, int);
1844
struct option_cache *lookup_linked_option (struct universe *,
1845
struct option_state *, unsigned);
1846
void do_packet (struct interface_info *,
1847
struct dhcp_packet *, unsigned,
1848
unsigned int, struct iaddr, struct hardware *);
1849
void do_packet6(struct interface_info *, const char *,
1850
int, int, const struct iaddr *, isc_boolean_t);
1851
int packet6_len_okay(const char *, int);
1853
int add_option(struct option_state *options,
1854
unsigned int option_num,
1856
unsigned int data_len);
1859
extern struct timeval cur_tv;
1860
#define cur_time cur_tv.tv_sec
1862
extern int ddns_update_style;
1864
extern const char *path_dhcpd_conf;
1865
extern const char *path_dhcpd_db;
1866
extern const char *path_dhcpd_pid;
1868
extern int dhcp_max_agent_option_packet_length;
1869
extern struct eventqueue *rw_queue_empty;
1871
int main(int, char **);
1872
void postconf_initialization(int);
1873
void postdb_startup(void);
1874
void cleanup (void);
1875
void lease_pinged (struct iaddr, u_int8_t *, int);
1876
void lease_ping_timeout (void *);
1877
int dhcpd_interface_setup_hook (struct interface_info *ip, struct iaddr *ia);
1878
extern enum dhcp_shutdown_state shutdown_state;
1879
isc_result_t dhcp_io_shutdown (omapi_object_t *, void *);
1880
isc_result_t dhcp_set_control_state (control_object_state_t oldstate,
1881
control_object_state_t newstate);
1882
#if defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
1883
void relinquish_ackqueue(void);
1887
isc_result_t new_parse (struct parse **, int,
1888
char *, unsigned, const char *, int);
1889
isc_result_t end_parse (struct parse **);
1890
isc_result_t save_parse_state(struct parse *cfile);
1891
isc_result_t restore_parse_state(struct parse *cfile);
1892
enum dhcp_token next_token (const char **, unsigned *, struct parse *);
1893
enum dhcp_token peek_token (const char **, unsigned *, struct parse *);
1894
enum dhcp_token next_raw_token(const char **rval, unsigned *rlen,
1895
struct parse *cfile);
1896
enum dhcp_token peek_raw_token(const char **rval, unsigned *rlen,
1897
struct parse *cfile);
1900
void parse_trace_setup (void);
1901
isc_result_t readconf (void);
1902
isc_result_t read_conf_file (const char *, struct group *, int, int);
1903
#if defined (TRACING)
1904
void trace_conf_input (trace_type_t *, unsigned, char *);
1905
void trace_conf_stop (trace_type_t *ttype);
1907
isc_result_t conf_file_subparse (struct parse *, struct group *, int);
1908
isc_result_t lease_file_subparse (struct parse *);
1909
int parse_statement (struct parse *, struct group *, int,
1910
struct host_decl *, int);
1911
#if defined (FAILOVER_PROTOCOL)
1912
void parse_failover_peer (struct parse *, struct group *, int);
1913
void parse_failover_state_declaration (struct parse *,
1914
dhcp_failover_state_t *);
1915
void parse_failover_state (struct parse *,
1916
enum failover_state *, TIME *);
1918
int permit_list_match (struct permit *, struct permit *);
1919
void parse_pool_statement (struct parse *, struct group *, int);
1920
int parse_lbrace (struct parse *);
1921
void parse_host_declaration (struct parse *, struct group *);
1922
int parse_class_declaration (struct class **, struct parse *,
1923
struct group *, int);
1924
void parse_shared_net_declaration (struct parse *, struct group *);
1925
void parse_subnet_declaration (struct parse *,
1926
struct shared_network *);
1927
void parse_subnet6_declaration (struct parse *,
1928
struct shared_network *);
1929
void parse_group_declaration (struct parse *, struct group *);
1930
int parse_fixed_addr_param (struct option_cache **,
1931
struct parse *, enum dhcp_token);
1932
int parse_lease_declaration (struct lease **, struct parse *);
1933
int parse_ip6_addr(struct parse *, struct iaddr *);
1934
int parse_ip6_addr_expr(struct expression **, struct parse *);
1935
int parse_ip6_prefix(struct parse *, struct iaddr *, u_int8_t *);
1936
void parse_address_range (struct parse *, struct group *, int,
1937
struct pool *, struct lease **);
1938
void parse_address_range6(struct parse *cfile, struct group *group);
1939
void parse_prefix6(struct parse *cfile, struct group *group);
1940
void parse_fixed_prefix6(struct parse *cfile, struct host_decl *host_decl);
1941
void parse_ia_na_declaration(struct parse *);
1942
void parse_ia_ta_declaration(struct parse *);
1943
void parse_ia_pd_declaration(struct parse *);
1944
void parse_server_duid(struct parse *cfile);
1945
void parse_server_duid_conf(struct parse *cfile);
1948
int ddns_updates(struct packet *, struct lease *, struct lease *,
1949
struct iasubopt *, struct iasubopt *, struct option_state *);
1950
int ddns_removals(struct lease *, struct iasubopt *, struct dhcp_ddns_cb *);
1951
#if defined (TRACING)
1952
void trace_ddns_init(void);
1956
void add_enumeration (struct enumeration *);
1957
struct enumeration *find_enumeration (const char *, int);
1958
struct enumeration_value *find_enumeration_value (const char *, int,
1961
void skip_to_semi (struct parse *);
1962
void skip_to_rbrace (struct parse *, int);
1963
int parse_semi (struct parse *);
1964
int parse_string (struct parse *, char **, unsigned *);
1965
char *parse_host_name (struct parse *);
1966
int parse_ip_addr_or_hostname (struct expression **,
1967
struct parse *, int);
1968
void parse_hardware_param (struct parse *, struct hardware *);
1969
void parse_lease_time (struct parse *, TIME *);
1970
unsigned char *parse_numeric_aggregate (struct parse *,
1971
unsigned char *, unsigned *,
1972
int, int, unsigned);
1973
void convert_num (struct parse *, unsigned char *, const char *,
1975
TIME parse_date (struct parse *);
1976
TIME parse_date_core(struct parse *);
1977
isc_result_t parse_option_name (struct parse *, int, int *,
1979
void parse_option_space_decl (struct parse *);
1980
int parse_option_code_definition (struct parse *, struct option *);
1981
int parse_base64 (struct data_string *, struct parse *);
1982
int parse_cshl (struct data_string *, struct parse *);
1983
int parse_executable_statement (struct executable_statement **,
1984
struct parse *, int *,
1985
enum expression_context);
1986
int parse_executable_statements (struct executable_statement **,
1987
struct parse *, int *,
1988
enum expression_context);
1989
int parse_zone (struct dns_zone *, struct parse *);
1990
int parse_key (struct parse *);
1991
int parse_on_statement (struct executable_statement **,
1992
struct parse *, int *);
1993
int parse_switch_statement (struct executable_statement **,
1994
struct parse *, int *);
1995
int parse_case_statement (struct executable_statement **,
1996
struct parse *, int *,
1997
enum expression_context);
1998
int parse_if_statement (struct executable_statement **,
1999
struct parse *, int *);
2000
int parse_boolean_expression (struct expression **,
2001
struct parse *, int *);
2002
int parse_boolean (struct parse *);
2003
int parse_data_expression (struct expression **,
2004
struct parse *, int *);
2005
int parse_numeric_expression (struct expression **,
2006
struct parse *, int *);
2007
int parse_dns_expression (struct expression **, struct parse *, int *);
2008
int parse_non_binary (struct expression **, struct parse *, int *,
2009
enum expression_context);
2010
int parse_expression (struct expression **, struct parse *, int *,
2011
enum expression_context,
2012
struct expression **, enum expr_op);
2013
int parse_option_data(struct expression **expr, struct parse *cfile,
2014
int lookups, struct option *option);
2015
int parse_option_statement (struct executable_statement **,
2016
struct parse *, int,
2017
struct option *, enum statement_op);
2018
int parse_option_token (struct expression **, struct parse *,
2019
const char **, struct expression *, int, int);
2020
int parse_allow_deny (struct option_cache **, struct parse *, int);
2021
int parse_auth_key (struct data_string *, struct parse *);
2022
int parse_warn (struct parse *, const char *, ...)
2023
__attribute__((__format__(__printf__,2,3)));
2024
struct expression *parse_domain_list(struct parse *cfile, int);
2028
#if defined (NSUPDATE)
2029
extern struct __res_state resolver_state;
2030
extern int resolver_inited;
2033
extern struct binding_scope *global_scope;
2034
pair cons (caddr_t, pair);
2035
int make_const_option_cache (struct option_cache **, struct buffer **,
2036
u_int8_t *, unsigned, struct option *,
2038
int make_host_lookup (struct expression **, const char *);
2039
int enter_dns_host (struct dns_host_entry **, const char *);
2040
int make_const_data (struct expression **,
2041
const unsigned char *, unsigned, int, int,
2043
int make_const_int (struct expression **, unsigned long);
2044
int make_concat (struct expression **,
2045
struct expression *, struct expression *);
2046
int make_encapsulation (struct expression **, struct data_string *);
2047
int make_substring (struct expression **, struct expression *,
2048
struct expression *, struct expression *);
2049
int make_limit (struct expression **, struct expression *, int);
2050
int make_let (struct executable_statement **, const char *);
2051
int option_cache (struct option_cache **, struct data_string *,
2052
struct expression *, struct option *,
2054
int evaluate_expression (struct binding_value **, struct packet *,
2055
struct lease *, struct client_state *,
2056
struct option_state *, struct option_state *,
2057
struct binding_scope **, struct expression *,
2059
int binding_value_dereference (struct binding_value **, const char *, int);
2060
#if defined (NSUPDATE_OLD)
2061
int evaluate_dns_expression (ns_updrec **, struct packet *,
2063
struct client_state *,
2064
struct option_state *,
2065
struct option_state *,
2066
struct binding_scope **,
2067
struct expression *);
2069
int evaluate_boolean_expression (int *,
2070
struct packet *, struct lease *,
2071
struct client_state *,
2072
struct option_state *,
2073
struct option_state *,
2074
struct binding_scope **,
2075
struct expression *);
2076
int evaluate_data_expression (struct data_string *,
2077
struct packet *, struct lease *,
2078
struct client_state *,
2079
struct option_state *,
2080
struct option_state *,
2081
struct binding_scope **,
2082
struct expression *, const char *, int);
2083
int evaluate_numeric_expression (unsigned long *, struct packet *,
2084
struct lease *, struct client_state *,
2085
struct option_state *, struct option_state *,
2086
struct binding_scope **,
2087
struct expression *);
2088
int evaluate_option_cache (struct data_string *,
2089
struct packet *, struct lease *,
2090
struct client_state *,
2091
struct option_state *, struct option_state *,
2092
struct binding_scope **,
2093
struct option_cache *,
2095
int evaluate_boolean_option_cache (int *,
2096
struct packet *, struct lease *,
2097
struct client_state *,
2098
struct option_state *,
2099
struct option_state *,
2100
struct binding_scope **,
2101
struct option_cache *,
2103
int evaluate_boolean_expression_result (int *,
2104
struct packet *, struct lease *,
2105
struct client_state *,
2106
struct option_state *,
2107
struct option_state *,
2108
struct binding_scope **,
2109
struct expression *);
2110
void expression_dereference (struct expression **, const char *, int);
2111
int is_dns_expression (struct expression *);
2112
int is_boolean_expression (struct expression *);
2113
int is_data_expression (struct expression *);
2114
int is_numeric_expression (struct expression *);
2115
int is_compound_expression (struct expression *);
2116
int op_precedence (enum expr_op, enum expr_op);
2117
enum expression_context expression_context (struct expression *);
2118
enum expression_context op_context (enum expr_op);
2119
int write_expression (FILE *, struct expression *, int, int, int);
2120
struct binding *find_binding (struct binding_scope *, const char *);
2121
int free_bindings (struct binding_scope *, const char *, int);
2122
int binding_scope_dereference (struct binding_scope **,
2124
int fundef_dereference (struct fundef **, const char *, int);
2125
int data_subexpression_length (int *, struct expression *);
2126
int expr_valid_for_context (struct expression *, enum expression_context);
2127
struct binding *create_binding (struct binding_scope **, const char *);
2128
int bind_ds_value (struct binding_scope **,
2129
const char *, struct data_string *);
2130
int find_bound_string (struct data_string *,
2131
struct binding_scope *, const char *);
2132
int unset (struct binding_scope *, const char *);
2133
int data_string_sprintfa(struct data_string *ds, const char *fmt, ...);
2136
extern int outstanding_pings;
2137
extern int max_outstanding_acks;
2138
extern int max_ack_delay_secs;
2139
extern int max_ack_delay_usecs;
2141
void dhcp (struct packet *);
2142
void dhcpdiscover (struct packet *, int);
2143
void dhcprequest (struct packet *, int, struct lease *);
2144
void dhcprelease (struct packet *, int);
2145
void dhcpdecline (struct packet *, int);
2146
void dhcpinform (struct packet *, int);
2147
void nak_lease (struct packet *, struct iaddr *cip);
2148
void ack_lease (struct packet *, struct lease *,
2149
unsigned int, TIME, char *, int, struct host_decl *);
2150
void delayed_ack_enqueue(struct lease *);
2151
void commit_leases_readerdry(void *);
2152
void flush_ackqueue(void *);
2153
void dhcp_reply (struct lease *);
2154
int find_lease (struct lease **, struct packet *,
2155
struct shared_network *, int *, int *, struct lease *,
2157
int mockup_lease (struct lease **, struct packet *,
2158
struct shared_network *,
2159
struct host_decl *);
2160
void static_lease_dereference (struct lease *, const char *, int);
2162
int allocate_lease (struct lease **, struct packet *,
2163
struct pool *, int *);
2164
int permitted (struct packet *, struct permit *);
2165
int locate_network (struct packet *);
2166
int parse_agent_information_option (struct packet *, int, u_int8_t *);
2167
unsigned cons_agent_information_options (struct option_state *,
2168
struct dhcp_packet *,
2169
unsigned, unsigned);
2170
void get_server_source_address(struct in_addr *from,
2171
struct option_state *options,
2172
struct packet *packet);
2174
/* dhcpleasequery.c */
2175
void dhcpleasequery (struct packet *, int);
2176
void dhcpv6_leasequery (struct data_string *, struct packet *);
2179
isc_boolean_t server_duid_isset(void);
2180
void copy_server_duid(struct data_string *ds, const char *file, int line);
2181
void set_server_duid(struct data_string *new_duid);
2182
isc_result_t set_server_duid_from_option(void);
2183
void set_server_duid_type(int type);
2184
isc_result_t generate_new_server_duid(void);
2185
isc_result_t get_client_id(struct packet *, struct data_string *);
2186
void dhcpv6(struct packet *);
2189
void bootp (struct packet *);
2192
extern int (*group_write_hook) (struct group_object *);
2193
extern struct group *root_group;
2194
extern group_hash_t *group_name_hash;
2195
isc_result_t delete_group (struct group_object *, int);
2196
isc_result_t supersede_group (struct group_object *, int);
2197
int clone_group (struct group **, struct group *, const char *, int);
2198
int write_group (struct group_object *);
2201
void relinquish_lease_hunks (void);
2202
struct lease *new_leases (unsigned, const char *, int);
2203
#if defined (DEBUG_MEMORY_LEAKAGE) || \
2204
defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
2205
void relinquish_free_lease_states (void);
2207
OMAPI_OBJECT_ALLOC_DECL (lease, struct lease, dhcp_type_lease)
2208
OMAPI_OBJECT_ALLOC_DECL (class, struct class, dhcp_type_class)
2209
OMAPI_OBJECT_ALLOC_DECL (subclass, struct class, dhcp_type_subclass)
2210
OMAPI_OBJECT_ALLOC_DECL (pool, struct pool, dhcp_type_pool)
2211
OMAPI_OBJECT_ALLOC_DECL (host, struct host_decl, dhcp_type_host)
2214
OMAPI_OBJECT_ALLOC_DECL (subnet, struct subnet, dhcp_type_subnet)
2215
OMAPI_OBJECT_ALLOC_DECL (shared_network, struct shared_network,
2216
dhcp_type_shared_network)
2217
OMAPI_OBJECT_ALLOC_DECL (group_object, struct group_object, dhcp_type_group)
2218
OMAPI_OBJECT_ALLOC_DECL (dhcp_control,
2219
dhcp_control_object_t, dhcp_type_control)
2221
#if defined (DEBUG_MEMORY_LEAKAGE) || \
2222
defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
2223
void relinquish_free_pairs (void);
2224
void relinquish_free_expressions (void);
2225
void relinquish_free_binding_values (void);
2226
void relinquish_free_option_caches (void);
2227
void relinquish_free_packets (void);
2230
int option_chain_head_allocate (struct option_chain_head **,
2232
int option_chain_head_reference (struct option_chain_head **,
2233
struct option_chain_head *,
2235
int option_chain_head_dereference (struct option_chain_head **,
2237
int group_allocate (struct group **, const char *, int);
2238
int group_reference (struct group **, struct group *, const char *, int);
2239
int group_dereference (struct group **, const char *, int);
2240
struct dhcp_packet *new_dhcp_packet (const char *, int);
2241
struct protocol *new_protocol (const char *, int);
2242
struct lease_state *new_lease_state (const char *, int);
2243
struct domain_search_list *new_domain_search_list (const char *, int);
2244
struct name_server *new_name_server (const char *, int);
2245
void free_name_server (struct name_server *, const char *, int);
2246
struct option *new_option (const char *, const char *, int);
2247
int option_reference(struct option **dest, struct option *src,
2248
const char * file, int line);
2249
int option_dereference(struct option **dest, const char *file, int line);
2250
struct universe *new_universe (const char *, int);
2251
void free_universe (struct universe *, const char *, int);
2252
void free_domain_search_list (struct domain_search_list *,
2254
void free_lease_state (struct lease_state *, const char *, int);
2255
void free_protocol (struct protocol *, const char *, int);
2256
void free_dhcp_packet (struct dhcp_packet *, const char *, int);
2257
struct client_lease *new_client_lease (const char *, int);
2258
void free_client_lease (struct client_lease *, const char *, int);
2259
struct permit *new_permit (const char *, int);
2260
void free_permit (struct permit *, const char *, int);
2261
pair new_pair (const char *, int);
2262
void free_pair (pair, const char *, int);
2263
int expression_allocate (struct expression **, const char *, int);
2264
int expression_reference (struct expression **,
2265
struct expression *, const char *, int);
2266
void free_expression (struct expression *, const char *, int);
2267
int binding_value_allocate (struct binding_value **,
2269
int binding_value_reference (struct binding_value **,
2270
struct binding_value *,
2272
void free_binding_value (struct binding_value *, const char *, int);
2273
int fundef_allocate (struct fundef **, const char *, int);
2274
int fundef_reference (struct fundef **,
2275
struct fundef *, const char *, int);
2276
int option_cache_allocate (struct option_cache **, const char *, int);
2277
int option_cache_reference (struct option_cache **,
2278
struct option_cache *, const char *, int);
2279
int buffer_allocate (struct buffer **, unsigned, const char *, int);
2280
int buffer_reference (struct buffer **, struct buffer *,
2282
int buffer_dereference (struct buffer **, const char *, int);
2283
int dns_host_entry_allocate (struct dns_host_entry **,
2284
const char *, const char *, int);
2285
int dns_host_entry_reference (struct dns_host_entry **,
2286
struct dns_host_entry *,
2288
int dns_host_entry_dereference (struct dns_host_entry **,
2290
int option_state_allocate (struct option_state **, const char *, int);
2291
int option_state_reference (struct option_state **,
2292
struct option_state *, const char *, int);
2293
int option_state_dereference (struct option_state **,
2295
void data_string_copy(struct data_string *, const struct data_string *,
2297
void data_string_forget (struct data_string *, const char *, int);
2298
void data_string_truncate (struct data_string *, int);
2299
int executable_statement_allocate (struct executable_statement **,
2301
int executable_statement_reference (struct executable_statement **,
2302
struct executable_statement *,
2304
int packet_allocate (struct packet **, const char *, int);
2305
int packet_reference (struct packet **,
2306
struct packet *, const char *, int);
2307
int packet_dereference (struct packet **, const char *, int);
2308
int binding_scope_allocate (struct binding_scope **,
2310
int binding_scope_reference (struct binding_scope **,
2311
struct binding_scope *,
2313
int dns_zone_allocate (struct dns_zone **, const char *, int);
2314
int dns_zone_reference (struct dns_zone **,
2315
struct dns_zone *, const char *, int);
2318
#define DEFAULT_TIME_FORMAT 0
2319
#define LOCAL_TIME_FORMAT 1
2320
extern int db_time_format;
2321
char *quotify_string (const char *, const char *, int);
2322
char *quotify_buf (const unsigned char *, unsigned, const char *, int);
2323
char *print_base64 (const unsigned char *, unsigned, const char *, int);
2324
char *print_hw_addr (const int, const int, const unsigned char *);
2325
void print_lease (struct lease *);
2326
void dump_raw (const unsigned char *, unsigned);
2327
void dump_packet_option (struct option_cache *, struct packet *,
2328
struct lease *, struct client_state *,
2329
struct option_state *, struct option_state *,
2330
struct binding_scope **, struct universe *, void *);
2331
void dump_packet (struct packet *);
2332
void hash_dump (struct hash_table *);
2333
char *print_hex (unsigned, const u_int8_t *, unsigned, unsigned);
2334
void print_hex_only (unsigned, const u_int8_t *, unsigned, char *);
2335
void print_hex_or_string (unsigned, const u_int8_t *, unsigned, char *);
2336
#define print_hex_1(len, data, limit) print_hex(len, data, limit, 0)
2337
#define print_hex_2(len, data, limit) print_hex(len, data, limit, 1)
2338
#define print_hex_3(len, data, limit) print_hex(len, data, limit, 2)
2339
char *print_dotted_quads (unsigned, const u_int8_t *);
2340
char *print_dec_1 (unsigned long);
2341
char *print_dec_2 (unsigned long);
2342
void print_expression (const char *, struct expression *);
2343
int token_print_indent_concat (FILE *, int, int,
2344
const char *, const char *, ...);
2345
int token_indent_data_string (FILE *, int, int, const char *, const char *,
2346
struct data_string *);
2347
int token_print_indent (FILE *, int, int,
2348
const char *, const char *, const char *);
2349
void indent_spaces (FILE *, int);
2350
#if defined (NSUPDATE)
2351
void print_dns_status (int, struct dhcp_ddns_cb *, isc_result_t);
2353
const char *print_time(TIME);
2355
void get_hw_addr(const char *name, struct hardware *hw);
2358
#if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_RECEIVE) \
2359
|| defined (USE_SOCKET_FALLBACK)
2360
int if_register_socket(struct interface_info *, int, int *);
2363
#if defined (USE_SOCKET_FALLBACK) && !defined (USE_SOCKET_SEND)
2364
void if_reinitialize_fallback (struct interface_info *);
2365
void if_register_fallback (struct interface_info *);
2366
ssize_t send_fallback (struct interface_info *,
2367
struct packet *, struct dhcp_packet *, size_t,
2369
struct sockaddr_in *, struct hardware *);
2370
ssize_t send_fallback6(struct interface_info *, struct packet *,
2371
struct dhcp_packet *, size_t, struct in6_addr,
2372
struct sockaddr_in6 *, struct hardware *);
2375
#ifdef USE_SOCKET_SEND
2376
void if_reinitialize_send (struct interface_info *);
2377
void if_register_send (struct interface_info *);
2378
void if_deregister_send (struct interface_info *);
2379
ssize_t send_packet (struct interface_info *,
2380
struct packet *, struct dhcp_packet *, size_t,
2382
struct sockaddr_in *, struct hardware *);
2384
ssize_t send_packet6(struct interface_info *, const unsigned char *, size_t,
2385
struct sockaddr_in6 *);
2386
#ifdef USE_SOCKET_RECEIVE
2387
void if_reinitialize_receive (struct interface_info *);
2388
void if_register_receive (struct interface_info *);
2389
void if_deregister_receive (struct interface_info *);
2390
ssize_t receive_packet (struct interface_info *,
2391
unsigned char *, size_t,
2392
struct sockaddr_in *, struct hardware *);
2395
#if defined (USE_SOCKET_FALLBACK)
2396
isc_result_t fallback_discard (omapi_object_t *);
2399
#if defined (USE_SOCKET_SEND)
2400
int can_unicast_without_arp (struct interface_info *);
2401
int can_receive_unicast_unconfigured (struct interface_info *);
2402
int supports_multiple_interfaces (struct interface_info *);
2403
void maybe_setup_fallback (void);
2406
void if_register6(struct interface_info *info, int do_multicast);
2407
ssize_t receive_packet6(struct interface_info *interface,
2408
unsigned char *buf, size_t len,
2409
struct sockaddr_in6 *from, struct in6_addr *to_addr,
2410
unsigned int *if_index);
2411
void if_deregister6(struct interface_info *info);
2415
#if defined (USE_BPF_SEND) || defined (USE_BPF_RECEIVE)
2416
int if_register_bpf (struct interface_info *);
2419
void if_reinitialize_send (struct interface_info *);
2420
void if_register_send (struct interface_info *);
2421
void if_deregister_send (struct interface_info *);
2422
ssize_t send_packet (struct interface_info *,
2423
struct packet *, struct dhcp_packet *, size_t,
2425
struct sockaddr_in *, struct hardware *);
2427
#ifdef USE_BPF_RECEIVE
2428
void if_reinitialize_receive (struct interface_info *);
2429
void if_register_receive (struct interface_info *);
2430
void if_deregister_receive (struct interface_info *);
2431
ssize_t receive_packet (struct interface_info *,
2432
unsigned char *, size_t,
2433
struct sockaddr_in *, struct hardware *);
2435
#if defined (USE_BPF_SEND)
2436
int can_unicast_without_arp (struct interface_info *);
2437
int can_receive_unicast_unconfigured (struct interface_info *);
2438
int supports_multiple_interfaces (struct interface_info *);
2439
void maybe_setup_fallback (void);
2443
#if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE)
2444
int if_register_lpf (struct interface_info *);
2447
void if_reinitialize_send (struct interface_info *);
2448
void if_register_send (struct interface_info *);
2449
void if_deregister_send (struct interface_info *);
2450
ssize_t send_packet (struct interface_info *,
2451
struct packet *, struct dhcp_packet *, size_t,
2453
struct sockaddr_in *, struct hardware *);
2455
#ifdef USE_LPF_RECEIVE
2456
void if_reinitialize_receive (struct interface_info *);
2457
void if_register_receive (struct interface_info *);
2458
void if_deregister_receive (struct interface_info *);
2459
ssize_t receive_packet (struct interface_info *,
2460
unsigned char *, size_t,
2461
struct sockaddr_in *, struct hardware *);
2463
#if defined (USE_LPF_SEND)
2464
int can_unicast_without_arp (struct interface_info *);
2465
int can_receive_unicast_unconfigured (struct interface_info *);
2466
int supports_multiple_interfaces (struct interface_info *);
2467
void maybe_setup_fallback (void);
2471
#if defined (USE_NIT_SEND) || defined (USE_NIT_RECEIVE)
2472
int if_register_nit (struct interface_info *);
2476
void if_reinitialize_send (struct interface_info *);
2477
void if_register_send (struct interface_info *);
2478
void if_deregister_send (struct interface_info *);
2479
ssize_t send_packet (struct interface_info *,
2480
struct packet *, struct dhcp_packet *, size_t,
2482
struct sockaddr_in *, struct hardware *);
2484
#ifdef USE_NIT_RECEIVE
2485
void if_reinitialize_receive (struct interface_info *);
2486
void if_register_receive (struct interface_info *);
2487
void if_deregister_receive (struct interface_info *);
2488
ssize_t receive_packet (struct interface_info *,
2489
unsigned char *, size_t,
2490
struct sockaddr_in *, struct hardware *);
2492
#if defined (USE_NIT_SEND)
2493
int can_unicast_without_arp (struct interface_info *);
2494
int can_receive_unicast_unconfigured (struct interface_info *);
2495
int supports_multiple_interfaces (struct interface_info *);
2496
void maybe_setup_fallback (void);
2500
#if defined (USE_DLPI_SEND) || defined (USE_DLPI_RECEIVE)
2501
int if_register_dlpi (struct interface_info *);
2504
#ifdef USE_DLPI_SEND
2505
int can_unicast_without_arp (struct interface_info *);
2506
int can_receive_unicast_unconfigured (struct interface_info *);
2507
void if_reinitialize_send (struct interface_info *);
2508
void if_register_send (struct interface_info *);
2509
void if_deregister_send (struct interface_info *);
2510
ssize_t send_packet (struct interface_info *,
2511
struct packet *, struct dhcp_packet *, size_t,
2513
struct sockaddr_in *, struct hardware *);
2514
int supports_multiple_interfaces (struct interface_info *);
2515
void maybe_setup_fallback (void);
2517
#ifdef USE_DLPI_RECEIVE
2518
void if_reinitialize_receive (struct interface_info *);
2519
void if_register_receive (struct interface_info *);
2520
void if_deregister_receive (struct interface_info *);
2521
ssize_t receive_packet (struct interface_info *,
2522
unsigned char *, size_t,
2523
struct sockaddr_in *, struct hardware *);
2529
void if_reinitialize_send (struct interface_info *);
2530
void if_register_send (struct interface_info *);
2531
void if_deregister_send (struct interface_info *);
2532
ssize_t send_packet (struct interface_info *, struct packet *,
2533
struct dhcp_packet *, size_t, struct in_addr,
2534
struct sockaddr_in *, struct hardware *);
2535
int can_unicast_without_arp (struct interface_info *);
2536
int can_receive_unicast_unconfigured (struct interface_info *);
2537
int supports_multiple_interfaces (struct interface_info *);
2538
void maybe_setup_fallback (void);
2542
extern struct interface_info *interfaces,
2543
*dummy_interfaces, *fallback_interface;
2544
extern struct protocol *protocols;
2545
extern int quiet_interface_discovery;
2546
isc_result_t interface_setup (void);
2547
void interface_trace_setup (void);
2549
extern struct in_addr limited_broadcast;
2550
extern int local_family;
2551
extern struct in_addr local_address;
2552
extern struct in6_addr local_address6;
2554
extern u_int16_t local_port;
2555
extern u_int16_t remote_port;
2556
extern int (*dhcp_interface_setup_hook) (struct interface_info *,
2558
extern int (*dhcp_interface_discovery_hook) (struct interface_info *);
2559
extern isc_result_t (*dhcp_interface_startup_hook) (struct interface_info *);
2561
extern void (*bootp_packet_handler) (struct interface_info *,
2562
struct dhcp_packet *, unsigned,
2564
struct iaddr, struct hardware *);
2565
extern void (*dhcpv6_packet_handler)(struct interface_info *,
2567
int, const struct iaddr *, isc_boolean_t);
2568
extern struct timeout *timeouts;
2569
extern omapi_object_type_t *dhcp_type_interface;
2570
#if defined (TRACING)
2571
extern trace_type_t *interface_trace;
2572
extern trace_type_t *inpacket_trace;
2573
extern trace_type_t *outpacket_trace;
2575
extern struct interface_info **interface_vector;
2576
extern int interface_count;
2577
extern int interface_max;
2578
isc_result_t interface_initialize(omapi_object_t *, const char *, int);
2579
void discover_interfaces(int);
2580
int setup_fallback (struct interface_info **, const char *, int);
2581
int if_readsocket (omapi_object_t *);
2582
void reinitialize_interfaces (void);
2585
void set_time(TIME);
2586
struct timeval *process_outstanding_timeouts (struct timeval *);
2587
void dispatch (void);
2588
isc_result_t got_one(omapi_object_t *);
2589
isc_result_t got_one_v6(omapi_object_t *);
2590
isc_result_t interface_set_value (omapi_object_t *, omapi_object_t *,
2591
omapi_data_string_t *, omapi_typed_data_t *);
2592
isc_result_t interface_get_value (omapi_object_t *, omapi_object_t *,
2593
omapi_data_string_t *, omapi_value_t **);
2594
isc_result_t interface_destroy (omapi_object_t *, const char *, int);
2595
isc_result_t interface_signal_handler (omapi_object_t *,
2596
const char *, va_list);
2597
isc_result_t interface_stuff_values (omapi_object_t *,
2601
void add_timeout (struct timeval *, void (*) (void *), void *,
2602
tvref_t, tvunref_t);
2603
void cancel_timeout (void (*) (void *), void *);
2604
void cancel_all_timeouts (void);
2605
void relinquish_timeouts (void);
2607
OMAPI_OBJECT_ALLOC_DECL (interface,
2608
struct interface_info, dhcp_type_interface)
2611
extern char *default_option_format;
2612
extern struct universe dhcp_universe;
2613
extern struct universe dhcpv6_universe;
2614
extern struct universe nwip_universe;
2615
extern struct universe fqdn_universe;
2616
extern struct universe vsio_universe;
2617
extern int dhcp_option_default_priority_list [];
2618
extern int dhcp_option_default_priority_list_count;
2619
extern const char *hardware_types [256];
2620
extern int universe_count, universe_max;
2621
extern struct universe **universes;
2622
extern universe_hash_t *universe_hash;
2623
void initialize_common_option_spaces (void);
2624
extern struct universe *config_universe;
2627
#if defined (FAILOVER_PROTOCOL)
2628
extern failover_option_t null_failover_option;
2629
extern failover_option_t skip_failover_option;
2630
extern struct failover_option_info ft_options [];
2631
extern u_int32_t fto_allowed [];
2632
extern int ft_sizes [];
2633
extern const char *dhcp_flink_state_names [];
2635
extern const char *binding_state_names [];
2637
extern struct universe agent_universe;
2638
extern struct universe server_universe;
2640
extern struct enumeration ddns_styles;
2641
extern struct enumeration syslog_enum;
2642
void initialize_server_option_spaces (void);
2645
struct iaddr subnet_number (struct iaddr, struct iaddr);
2646
struct iaddr ip_addr (struct iaddr, struct iaddr, u_int32_t);
2647
struct iaddr broadcast_addr (struct iaddr, struct iaddr);
2648
u_int32_t host_addr (struct iaddr, struct iaddr);
2649
int addr_eq (struct iaddr, struct iaddr);
2650
int addr_match(struct iaddr *, struct iaddrmatch *);
2651
int addr_cmp(const struct iaddr *a1, const struct iaddr *a2);
2652
int addr_or(struct iaddr *result,
2653
const struct iaddr *a1, const struct iaddr *a2);
2654
int addr_and(struct iaddr *result,
2655
const struct iaddr *a1, const struct iaddr *a2);
2656
isc_boolean_t is_cidr_mask_valid(const struct iaddr *addr, int bits);
2657
isc_result_t range2cidr(struct iaddrcidrnetlist **result,
2658
const struct iaddr *lo, const struct iaddr *hi);
2659
isc_result_t free_iaddrcidrnetlist(struct iaddrcidrnetlist **result);
2660
const char *piaddr (struct iaddr);
2661
char *piaddrmask(struct iaddr *, struct iaddr *);
2662
char *piaddrcidr(const struct iaddr *, unsigned int);
2663
u_int16_t validate_port(char *);
2668
extern int wanted_ia_na;
2669
extern int wanted_ia_ta;
2670
extern int wanted_ia_pd;
2672
extern const char *path_dhclient_conf;
2673
extern const char *path_dhclient_db;
2674
extern const char *path_dhclient_pid;
2675
extern char *path_dhclient_script;
2676
extern int interfaces_requested;
2677
extern struct data_string default_duid;
2678
extern int duid_type;
2680
extern struct client_config top_level_config;
2682
void dhcpoffer (struct packet *);
2683
void dhcpack (struct packet *);
2684
void dhcpnak (struct packet *);
2686
void send_discover (void *);
2687
void send_request (void *);
2688
void send_release (void *);
2689
void send_decline (void *);
2691
void state_reboot (void *);
2692
void state_init (void *);
2693
void state_selecting (void *);
2694
void state_requesting (void *);
2695
void state_bound (void *);
2696
void state_stop (void *);
2697
void state_panic (void *);
2699
void bind_lease (struct client_state *);
2701
void make_client_options (struct client_state *,
2702
struct client_lease *, u_int8_t *,
2703
struct option_cache *, struct iaddr *,
2704
struct option **, struct option_state **);
2705
void make_discover (struct client_state *, struct client_lease *);
2706
void make_request (struct client_state *, struct client_lease *);
2707
void make_decline (struct client_state *, struct client_lease *);
2708
void make_release (struct client_state *, struct client_lease *);
2710
void destroy_client_lease (struct client_lease *);
2711
void rewrite_client_leases (void);
2712
void write_lease_option (struct option_cache *, struct packet *,
2713
struct lease *, struct client_state *,
2714
struct option_state *, struct option_state *,
2715
struct binding_scope **, struct universe *, void *);
2716
int write_client_lease (struct client_state *, struct client_lease *, int, int);
2717
isc_result_t write_client6_lease(struct client_state *client,
2718
struct dhc6_lease *lease,
2719
int rewrite, int sync);
2720
int dhcp_option_ev_name (char *, size_t, struct option *);
2722
void script_init (struct client_state *, const char *,
2723
struct string_list *);
2724
void client_option_envadd (struct option_cache *, struct packet *,
2725
struct lease *, struct client_state *,
2726
struct option_state *, struct option_state *,
2727
struct binding_scope **, struct universe *, void *);
2728
void script_write_params (struct client_state *, const char *,
2729
struct client_lease *);
2730
int script_go (struct client_state *);
2731
void client_envadd (struct client_state *,
2732
const char *, const char *, const char *, ...)
2733
__attribute__((__format__(__printf__,4,5)));
2735
struct client_lease *packet_to_lease (struct packet *, struct client_state *);
2736
void go_daemon (void);
2737
void write_client_pid_file (void);
2738
void client_location_changed (void);
2739
void do_release (struct client_state *);
2740
int dhclient_interface_shutdown_hook (struct interface_info *);
2741
int dhclient_interface_discovery_hook (struct interface_info *);
2742
isc_result_t dhclient_interface_startup_hook (struct interface_info *);
2743
void dhclient_schedule_updates(struct client_state *client,
2744
struct iaddr *addr, int offset);
2745
void client_dns_update_timeout (void *cp);
2746
isc_result_t client_dns_update(struct client_state *client,
2747
dhcp_ddns_cb_t *ddns_cb);
2748
void client_dns_remove(struct client_state *client, struct iaddr *addr);
2750
void dhcpv4_client_assignments(void);
2751
void dhcpv6_client_assignments(void);
2754
void form_duid(struct data_string *duid, const char *file, int line);
2755
void dhc6_lease_destroy(struct dhc6_lease **src, const char *file, int line);
2756
void start_init6(struct client_state *client);
2757
void start_info_request6(struct client_state *client);
2758
void start_confirm6(struct client_state *client);
2759
void start_release6(struct client_state *client);
2760
void start_selecting6(struct client_state *client);
2761
void unconfigure6(struct client_state *client, const char *reason);
2764
int write_lease (struct lease *);
2765
int write_host (struct host_decl *);
2766
int write_server_duid(void);
2767
#if defined (FAILOVER_PROTOCOL)
2768
int write_failover_state (dhcp_failover_state_t *);
2770
int db_printable (const unsigned char *);
2771
int db_printable_len (const unsigned char *, unsigned);
2772
isc_result_t write_named_billing_class(const void *, unsigned, void *);
2773
void write_billing_classes (void);
2774
int write_billing_class (struct class *);
2775
void commit_leases_timeout (void *);
2776
void commit_leases_readerdry(void *);
2777
int commit_leases (void);
2778
void db_startup (int);
2779
int new_lease_file (void);
2780
int group_writer (struct group_object *);
2781
int write_ia(const struct ia_xx *);
2784
u_int32_t checksum (unsigned char *, unsigned, u_int32_t);
2785
u_int32_t wrapsum (u_int32_t);
2786
void assemble_hw_header (struct interface_info *, unsigned char *,
2787
unsigned *, struct hardware *);
2788
void assemble_udp_ip_header (struct interface_info *, unsigned char *,
2789
unsigned *, u_int32_t, u_int32_t,
2790
u_int32_t, unsigned char *, unsigned);
2791
ssize_t decode_hw_header (struct interface_info *, unsigned char *,
2792
unsigned, struct hardware *);
2793
ssize_t decode_udp_ip_header (struct interface_info *, unsigned char *,
2794
unsigned, struct sockaddr_in *,
2795
unsigned, unsigned *);
2798
void assemble_ethernet_header (struct interface_info *, unsigned char *,
2799
unsigned *, struct hardware *);
2800
ssize_t decode_ethernet_header (struct interface_info *,
2802
unsigned, struct hardware *);
2805
void assemble_tr_header (struct interface_info *, unsigned char *,
2806
unsigned *, struct hardware *);
2807
ssize_t decode_tr_header (struct interface_info *,
2809
unsigned, struct hardware *);
2812
void convert_statement (struct parse *);
2813
void convert_host_statement (struct parse *, jrefproto);
2814
void convert_host_name (struct parse *, jrefproto);
2815
void convert_class_statement (struct parse *, jrefproto, int);
2816
void convert_class_decl (struct parse *, jrefproto);
2817
void convert_lease_time (struct parse *, jrefproto, char *);
2818
void convert_shared_net_statement (struct parse *, jrefproto);
2819
void convert_subnet_statement (struct parse *, jrefproto);
2820
void convert_subnet_decl (struct parse *, jrefproto);
2821
void convert_host_decl (struct parse *, jrefproto);
2822
void convert_hardware_decl (struct parse *, jrefproto);
2823
void convert_hardware_addr (struct parse *, jrefproto);
2824
void convert_filename_decl (struct parse *, jrefproto);
2825
void convert_servername_decl (struct parse *, jrefproto);
2826
void convert_ip_addr_or_hostname (struct parse *, jrefproto, int);
2827
void convert_fixed_addr_decl (struct parse *, jrefproto);
2828
void convert_option_decl (struct parse *, jrefproto);
2829
void convert_lease_statement (struct parse *, jrefproto);
2830
void convert_address_range (struct parse *, jrefproto);
2831
void convert_date (struct parse *, jrefproto, char *);
2832
void convert_numeric_aggregate (struct parse *, jrefproto, int, int, int, int);
2836
void add_route_direct (struct interface_info *, struct in_addr);
2837
void add_route_net (struct interface_info *, struct in_addr, struct in_addr);
2838
void add_route_default_gateway (struct interface_info *, struct in_addr);
2839
void remove_routes (struct in_addr);
2840
void remove_if_route (struct interface_info *, struct in_addr);
2841
void remove_all_if_routes (struct interface_info *);
2842
void set_netmask (struct interface_info *, struct in_addr);
2843
void set_broadcast_addr (struct interface_info *, struct in_addr);
2844
void set_ip_address (struct interface_info *, struct in_addr);
2847
isc_result_t read_client_conf (void);
2848
int read_client_conf_file (const char *,
2849
struct interface_info *, struct client_config *);
2850
void read_client_leases (void);
2851
void parse_client_statement (struct parse *, struct interface_info *,
2852
struct client_config *);
2853
int parse_X (struct parse *, u_int8_t *, unsigned);
2854
int parse_option_list (struct parse *, struct option ***);
2855
void parse_interface_declaration (struct parse *,
2856
struct client_config *, char *);
2857
int interface_or_dummy (struct interface_info **, const char *);
2858
void make_client_state (struct client_state **);
2859
void make_client_config (struct client_state *, struct client_config *);
2860
void parse_client_lease_statement (struct parse *, int);
2861
void parse_client_lease_declaration (struct parse *,
2862
struct client_lease *,
2863
struct interface_info **,
2864
struct client_state **);
2865
int parse_option_decl (struct option_cache **, struct parse *);
2866
void parse_string_list (struct parse *, struct string_list **, int);
2867
int parse_ip_addr (struct parse *, struct iaddr *);
2868
int parse_ip_addr_with_subnet(struct parse *, struct iaddrmatch *);
2869
void parse_reject_statement (struct parse *, struct client_config *);
2872
OMAPI_OBJECT_ALLOC_DECL (icmp_state, struct icmp_state, dhcp_type_icmp)
2873
extern struct icmp_state *icmp_state;
2874
void icmp_startup (int, void (*) (struct iaddr, u_int8_t *, int));
2875
int icmp_readsocket (omapi_object_t *);
2876
int icmp_echorequest (struct iaddr *);
2877
isc_result_t icmp_echoreply (omapi_object_t *);
2880
#if defined (NSUPDATE)
2881
isc_result_t find_tsig_key (ns_tsig_key **, const char *, struct dns_zone *);
2882
void tkey_free (ns_tsig_key **);
2884
isc_result_t enter_dns_zone (struct dns_zone *);
2885
isc_result_t dns_zone_lookup (struct dns_zone **, const char *);
2886
int dns_zone_dereference (struct dns_zone **, const char *, int);
2887
#if defined (NSUPDATE)
2888
#define FIND_FORWARD 0
2889
#define FIND_REVERSE 1
2890
isc_result_t find_cached_zone (dhcp_ddns_cb_t *, int);
2891
void forget_zone (struct dns_zone **);
2892
void repudiate_zone (struct dns_zone **);
2893
//void cache_found_zone (ns_class, char *, struct in_addr *, int);
2894
int get_dhcid (struct data_string *, int, const u_int8_t *, unsigned);
2895
void dhcid_tolease (struct data_string *, struct data_string *);
2896
isc_result_t dhcid_fromlease (struct data_string *, struct data_string *);
2897
isc_result_t ddns_update_fwd(struct data_string *, struct iaddr,
2898
struct data_string *, unsigned long, unsigned,
2900
isc_result_t ddns_remove_fwd(struct data_string *,
2901
struct iaddr, struct data_string *);
2902
#endif /* NSUPDATE */
2905
extern char path_resolv_conf [];
2906
extern struct name_server *name_servers;
2907
extern struct domain_search_list *domains;
2909
void read_resolv_conf (TIME);
2910
struct name_server *first_name_server (void);
2913
#ifdef NEED_INET_ATON
2914
int inet_aton (const char *, struct in_addr *);
2918
extern int have_billing_classes;
2919
struct class unknown_class;
2920
struct class known_class;
2921
struct collection default_collection;
2922
struct collection *collections;
2923
extern struct executable_statement *default_classification_rules;
2925
void classification_setup (void);
2926
void classify_client (struct packet *);
2927
int check_collection (struct packet *, struct lease *, struct collection *);
2928
void classify (struct packet *, struct class *);
2929
isc_result_t unlink_class (struct class **class);
2930
isc_result_t find_class (struct class **, const char *,
2932
int unbill_class (struct lease *, struct class *);
2933
int bill_class (struct lease *, struct class *);
2936
int execute_statements (struct binding_value **result,
2937
struct packet *, struct lease *,
2938
struct client_state *,
2939
struct option_state *, struct option_state *,
2940
struct binding_scope **,
2941
struct executable_statement *);
2942
void execute_statements_in_scope (struct binding_value **result,
2943
struct packet *, struct lease *,
2944
struct client_state *,
2945
struct option_state *,
2946
struct option_state *,
2947
struct binding_scope **,
2948
struct group *, struct group *);
2949
int executable_statement_dereference (struct executable_statement **,
2951
void write_statements (FILE *, struct executable_statement *, int);
2952
int find_matching_case (struct executable_statement **,
2953
struct packet *, struct lease *, struct client_state *,
2954
struct option_state *, struct option_state *,
2955
struct binding_scope **,
2956
struct expression *, struct executable_statement *);
2957
int executable_statement_foreach (struct executable_statement *,
2958
int (*) (struct executable_statement *,
2959
void *, int), void *, int);
2962
extern omapi_object_type_t *dhcp_type_group;
2963
extern omapi_object_type_t *dhcp_type_shared_network;
2964
extern omapi_object_type_t *dhcp_type_subnet;
2965
extern omapi_object_type_t *dhcp_type_control;
2966
extern dhcp_control_object_t *dhcp_control_object;
2968
void dhcp_common_objects_setup (void);
2970
isc_result_t dhcp_group_set_value (omapi_object_t *, omapi_object_t *,
2971
omapi_data_string_t *,
2972
omapi_typed_data_t *);
2973
isc_result_t dhcp_group_get_value (omapi_object_t *, omapi_object_t *,
2974
omapi_data_string_t *,
2976
isc_result_t dhcp_group_destroy (omapi_object_t *, const char *, int);
2977
isc_result_t dhcp_group_signal_handler (omapi_object_t *,
2978
const char *, va_list);
2979
isc_result_t dhcp_group_stuff_values (omapi_object_t *,
2982
isc_result_t dhcp_group_lookup (omapi_object_t **,
2983
omapi_object_t *, omapi_object_t *);
2984
isc_result_t dhcp_group_create (omapi_object_t **,
2986
isc_result_t dhcp_group_remove (omapi_object_t *,
2989
isc_result_t dhcp_control_set_value (omapi_object_t *, omapi_object_t *,
2990
omapi_data_string_t *,
2991
omapi_typed_data_t *);
2992
isc_result_t dhcp_control_get_value (omapi_object_t *, omapi_object_t *,
2993
omapi_data_string_t *,
2995
isc_result_t dhcp_control_destroy (omapi_object_t *, const char *, int);
2996
isc_result_t dhcp_control_signal_handler (omapi_object_t *,
2997
const char *, va_list);
2998
isc_result_t dhcp_control_stuff_values (omapi_object_t *,
3001
isc_result_t dhcp_control_lookup (omapi_object_t **,
3002
omapi_object_t *, omapi_object_t *);
3003
isc_result_t dhcp_control_create (omapi_object_t **,
3005
isc_result_t dhcp_control_remove (omapi_object_t *,
3008
isc_result_t dhcp_subnet_set_value (omapi_object_t *, omapi_object_t *,
3009
omapi_data_string_t *,
3010
omapi_typed_data_t *);
3011
isc_result_t dhcp_subnet_get_value (omapi_object_t *, omapi_object_t *,
3012
omapi_data_string_t *,
3014
isc_result_t dhcp_subnet_destroy (omapi_object_t *, const char *, int);
3015
isc_result_t dhcp_subnet_signal_handler (omapi_object_t *,
3016
const char *, va_list);
3017
isc_result_t dhcp_subnet_stuff_values (omapi_object_t *,
3020
isc_result_t dhcp_subnet_lookup (omapi_object_t **,
3021
omapi_object_t *, omapi_object_t *);
3022
isc_result_t dhcp_subnet_create (omapi_object_t **,
3024
isc_result_t dhcp_subnet_remove (omapi_object_t *,
3027
isc_result_t dhcp_shared_network_set_value (omapi_object_t *,
3029
omapi_data_string_t *,
3030
omapi_typed_data_t *);
3031
isc_result_t dhcp_shared_network_get_value (omapi_object_t *,
3033
omapi_data_string_t *,
3035
isc_result_t dhcp_shared_network_destroy (omapi_object_t *, const char *, int);
3036
isc_result_t dhcp_shared_network_signal_handler (omapi_object_t *,
3037
const char *, va_list);
3038
isc_result_t dhcp_shared_network_stuff_values (omapi_object_t *,
3041
isc_result_t dhcp_shared_network_lookup (omapi_object_t **,
3042
omapi_object_t *, omapi_object_t *);
3043
isc_result_t dhcp_shared_network_create (omapi_object_t **,
3045
isc_result_t dhcp_shared_network_remove (omapi_object_t *,
3049
extern int (*dhcp_interface_shutdown_hook) (struct interface_info *);
3051
extern omapi_object_type_t *dhcp_type_lease;
3052
extern omapi_object_type_t *dhcp_type_pool;
3053
extern omapi_object_type_t *dhcp_type_class;
3054
extern omapi_object_type_t *dhcp_type_subclass;
3056
#if defined (FAILOVER_PROTOCOL)
3057
extern omapi_object_type_t *dhcp_type_failover_state;
3058
extern omapi_object_type_t *dhcp_type_failover_link;
3059
extern omapi_object_type_t *dhcp_type_failover_listener;
3062
void dhcp_db_objects_setup (void);
3064
isc_result_t dhcp_lease_set_value (omapi_object_t *, omapi_object_t *,
3065
omapi_data_string_t *,
3066
omapi_typed_data_t *);
3067
isc_result_t dhcp_lease_get_value (omapi_object_t *, omapi_object_t *,
3068
omapi_data_string_t *,
3070
isc_result_t dhcp_lease_destroy (omapi_object_t *, const char *, int);
3071
isc_result_t dhcp_lease_signal_handler (omapi_object_t *,
3072
const char *, va_list);
3073
isc_result_t dhcp_lease_stuff_values (omapi_object_t *,
3076
isc_result_t dhcp_lease_lookup (omapi_object_t **,
3077
omapi_object_t *, omapi_object_t *);
3078
isc_result_t dhcp_lease_create (omapi_object_t **,
3080
isc_result_t dhcp_lease_remove (omapi_object_t *,
3082
isc_result_t dhcp_host_set_value (omapi_object_t *, omapi_object_t *,
3083
omapi_data_string_t *,
3084
omapi_typed_data_t *);
3085
isc_result_t dhcp_host_get_value (omapi_object_t *, omapi_object_t *,
3086
omapi_data_string_t *,
3088
isc_result_t dhcp_host_destroy (omapi_object_t *, const char *, int);
3089
isc_result_t dhcp_host_signal_handler (omapi_object_t *,
3090
const char *, va_list);
3091
isc_result_t dhcp_host_stuff_values (omapi_object_t *,
3094
isc_result_t dhcp_host_lookup (omapi_object_t **,
3095
omapi_object_t *, omapi_object_t *);
3096
isc_result_t dhcp_host_create (omapi_object_t **,
3098
isc_result_t dhcp_host_remove (omapi_object_t *,
3100
isc_result_t dhcp_pool_set_value (omapi_object_t *, omapi_object_t *,
3101
omapi_data_string_t *,
3102
omapi_typed_data_t *);
3103
isc_result_t dhcp_pool_get_value (omapi_object_t *, omapi_object_t *,
3104
omapi_data_string_t *,
3106
isc_result_t dhcp_pool_destroy (omapi_object_t *, const char *, int);
3107
isc_result_t dhcp_pool_signal_handler (omapi_object_t *,
3108
const char *, va_list);
3109
isc_result_t dhcp_pool_stuff_values (omapi_object_t *,
3112
isc_result_t dhcp_pool_lookup (omapi_object_t **,
3113
omapi_object_t *, omapi_object_t *);
3114
isc_result_t dhcp_pool_create (omapi_object_t **,
3116
isc_result_t dhcp_pool_remove (omapi_object_t *,
3118
isc_result_t dhcp_class_set_value (omapi_object_t *, omapi_object_t *,
3119
omapi_data_string_t *,
3120
omapi_typed_data_t *);
3121
isc_result_t dhcp_class_get_value (omapi_object_t *, omapi_object_t *,
3122
omapi_data_string_t *,
3124
isc_result_t dhcp_class_destroy (omapi_object_t *, const char *, int);
3125
isc_result_t dhcp_class_signal_handler (omapi_object_t *,
3126
const char *, va_list);
3127
isc_result_t dhcp_class_stuff_values (omapi_object_t *,
3130
isc_result_t dhcp_class_lookup (omapi_object_t **,
3131
omapi_object_t *, omapi_object_t *);
3132
isc_result_t dhcp_class_create (omapi_object_t **,
3134
isc_result_t dhcp_class_remove (omapi_object_t *,
3136
isc_result_t dhcp_subclass_set_value (omapi_object_t *, omapi_object_t *,
3137
omapi_data_string_t *,
3138
omapi_typed_data_t *);
3139
isc_result_t dhcp_subclass_get_value (omapi_object_t *, omapi_object_t *,
3140
omapi_data_string_t *,
3142
isc_result_t dhcp_subclass_destroy (omapi_object_t *, const char *, int);
3143
isc_result_t dhcp_subclass_signal_handler (omapi_object_t *,
3144
const char *, va_list);
3145
isc_result_t dhcp_subclass_stuff_values (omapi_object_t *,
3148
isc_result_t dhcp_subclass_lookup (omapi_object_t **,
3149
omapi_object_t *, omapi_object_t *);
3150
isc_result_t dhcp_subclass_create (omapi_object_t **,
3152
isc_result_t dhcp_subclass_remove (omapi_object_t *,
3154
isc_result_t dhcp_interface_set_value (omapi_object_t *,
3156
omapi_data_string_t *,
3157
omapi_typed_data_t *);
3158
isc_result_t dhcp_interface_get_value (omapi_object_t *,
3160
omapi_data_string_t *,
3162
isc_result_t dhcp_interface_destroy (omapi_object_t *,
3164
isc_result_t dhcp_interface_signal_handler (omapi_object_t *,
3167
isc_result_t dhcp_interface_stuff_values (omapi_object_t *,
3170
isc_result_t dhcp_interface_lookup (omapi_object_t **,
3173
isc_result_t dhcp_interface_create (omapi_object_t **,
3175
isc_result_t dhcp_interface_remove (omapi_object_t *,
3177
void interface_stash (struct interface_info *);
3178
void interface_snorf (struct interface_info *, int);
3180
isc_result_t binding_scope_set_value (struct binding_scope *, int,
3181
omapi_data_string_t *,
3182
omapi_typed_data_t *);
3183
isc_result_t binding_scope_get_value (omapi_value_t **,
3184
struct binding_scope *,
3185
omapi_data_string_t *);
3186
isc_result_t binding_scope_stuff_values (omapi_object_t *,
3187
struct binding_scope *);
3189
void register_eventhandler(struct eventqueue **, void (*handler)(void *));
3190
void unregister_eventhandler(struct eventqueue **, void (*handler)(void *));
3191
void trigger_event(struct eventqueue **);
3195
extern struct subnet *subnets;
3196
extern struct shared_network *shared_networks;
3197
extern host_hash_t *host_hw_addr_hash;
3198
extern host_hash_t *host_uid_hash;
3199
extern host_hash_t *host_name_hash;
3200
extern lease_id_hash_t *lease_uid_hash;
3201
extern lease_ip_hash_t *lease_ip_addr_hash;
3202
extern lease_id_hash_t *lease_hw_addr_hash;
3204
extern omapi_object_type_t *dhcp_type_host;
3206
extern int numclasseswritten;
3209
isc_result_t enter_class (struct class *, int, int);
3210
isc_result_t delete_class (struct class *, int);
3211
isc_result_t enter_host (struct host_decl *, int, int);
3212
isc_result_t delete_host (struct host_decl *, int);
3213
void change_host_uid(struct host_decl *host, const char *data, int len);
3214
int find_hosts_by_haddr (struct host_decl **, int,
3215
const unsigned char *, unsigned,
3217
int find_hosts_by_uid (struct host_decl **, const unsigned char *,
3218
unsigned, const char *, int);
3219
int find_hosts_by_option(struct host_decl **, struct packet *,
3220
struct option_state *, const char *, int);
3221
int find_host_for_network (struct subnet **, struct host_decl **,
3222
struct iaddr *, struct shared_network *);
3223
void new_address_range (struct parse *, struct iaddr, struct iaddr,
3224
struct subnet *, struct pool *,
3226
isc_result_t dhcp_lease_free (omapi_object_t *, const char *, int);
3227
isc_result_t dhcp_lease_get (omapi_object_t **, const char *, int);
3228
int find_grouped_subnet (struct subnet **, struct shared_network *,
3229
struct iaddr, const char *, int);
3230
int find_subnet(struct subnet **, struct iaddr, const char *, int);
3231
void enter_shared_network (struct shared_network *);
3232
void new_shared_network_interface (struct parse *,
3233
struct shared_network *,
3235
int subnet_inner_than(const struct subnet *, const struct subnet *, int);
3236
void enter_subnet (struct subnet *);
3237
void enter_lease (struct lease *);
3238
int supersede_lease (struct lease *, struct lease *, int, int, int);
3239
void make_binding_state_transition (struct lease *);
3240
int lease_copy (struct lease **, struct lease *, const char *, int);
3241
void release_lease (struct lease *, struct packet *);
3242
void abandon_lease (struct lease *, const char *);
3243
void dissociate_lease (struct lease *);
3244
void pool_timer (void *);
3245
int find_lease_by_uid (struct lease **, const unsigned char *,
3246
unsigned, const char *, int);
3247
int find_lease_by_hw_addr (struct lease **, const unsigned char *,
3248
unsigned, const char *, int);
3249
int find_lease_by_ip_addr (struct lease **, struct iaddr,
3251
void uid_hash_add (struct lease *);
3252
void uid_hash_delete (struct lease *);
3253
void hw_hash_add (struct lease *);
3254
void hw_hash_delete (struct lease *);
3255
int write_leases (void);
3256
int write_leases6(void);
3257
int lease_enqueue (struct lease *);
3258
isc_result_t lease_instantiate(const void *, unsigned, void *);
3259
void expire_all_pools (void);
3260
void dump_subnets (void);
3261
#if defined (DEBUG_MEMORY_LEAKAGE) || \
3262
defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
3263
void free_everything (void);
3267
char *ddns_rev_name (struct lease *, struct lease_state *, struct packet *);
3268
char *ddns_fwd_name (struct lease *, struct lease_state *, struct packet *);
3269
int nsupdateA (const char *, const unsigned char *, u_int32_t, int);
3270
int nsupdatePTR (const char *, const unsigned char *, u_int32_t, int);
3271
void nsupdate (struct lease *, struct lease_state *, struct packet *, int);
3272
int updateA (const struct data_string *, const struct data_string *,
3273
unsigned int, struct lease *);
3274
int updatePTR (const struct data_string *, const struct data_string *,
3275
unsigned int, struct lease *);
3276
int deleteA (const struct data_string *, const struct data_string *,
3278
int deletePTR (const struct data_string *, const struct data_string *,
3282
#if defined (FAILOVER_PROTOCOL)
3283
extern dhcp_failover_state_t *failover_states;
3284
void dhcp_failover_startup (void);
3285
int dhcp_failover_write_all_states (void);
3286
isc_result_t enter_failover_peer (dhcp_failover_state_t *);
3287
isc_result_t find_failover_peer (dhcp_failover_state_t **,
3288
const char *, const char *, int);
3289
isc_result_t dhcp_failover_link_initiate (omapi_object_t *);
3290
isc_result_t dhcp_failover_link_signal (omapi_object_t *,
3291
const char *, va_list);
3292
isc_result_t dhcp_failover_link_set_value (omapi_object_t *,
3294
omapi_data_string_t *,
3295
omapi_typed_data_t *);
3296
isc_result_t dhcp_failover_link_get_value (omapi_object_t *,
3298
omapi_data_string_t *,
3300
isc_result_t dhcp_failover_link_destroy (omapi_object_t *,
3302
isc_result_t dhcp_failover_link_stuff_values (omapi_object_t *,
3305
isc_result_t dhcp_failover_listen (omapi_object_t *);
3307
isc_result_t dhcp_failover_listener_signal (omapi_object_t *,
3310
isc_result_t dhcp_failover_listener_set_value (omapi_object_t *,
3312
omapi_data_string_t *,
3313
omapi_typed_data_t *);
3314
isc_result_t dhcp_failover_listener_get_value (omapi_object_t *,
3316
omapi_data_string_t *,
3318
isc_result_t dhcp_failover_listener_destroy (omapi_object_t *,
3320
isc_result_t dhcp_failover_listener_stuff (omapi_object_t *,
3323
isc_result_t dhcp_failover_register (omapi_object_t *);
3324
isc_result_t dhcp_failover_state_signal (omapi_object_t *,
3325
const char *, va_list);
3326
isc_result_t dhcp_failover_state_transition (dhcp_failover_state_t *,
3328
isc_result_t dhcp_failover_set_service_state (dhcp_failover_state_t *state);
3329
isc_result_t dhcp_failover_set_state (dhcp_failover_state_t *,
3330
enum failover_state);
3331
isc_result_t dhcp_failover_peer_state_changed (dhcp_failover_state_t *,
3332
failover_message_t *);
3333
void dhcp_failover_pool_rebalance (void *);
3334
void dhcp_failover_pool_check (struct pool *);
3335
int dhcp_failover_state_pool_check (dhcp_failover_state_t *);
3336
void dhcp_failover_timeout (void *);
3337
void dhcp_failover_send_contact (void *);
3338
isc_result_t dhcp_failover_send_state (dhcp_failover_state_t *);
3339
isc_result_t dhcp_failover_send_updates (dhcp_failover_state_t *);
3340
int dhcp_failover_queue_update (struct lease *, int);
3341
int dhcp_failover_send_acks (dhcp_failover_state_t *);
3342
void dhcp_failover_toack_queue_timeout (void *);
3343
int dhcp_failover_queue_ack (dhcp_failover_state_t *, failover_message_t *msg);
3344
void dhcp_failover_ack_queue_remove (dhcp_failover_state_t *, struct lease *);
3345
isc_result_t dhcp_failover_state_set_value (omapi_object_t *,
3347
omapi_data_string_t *,
3348
omapi_typed_data_t *);
3349
void dhcp_failover_keepalive (void *);
3350
void dhcp_failover_reconnect (void *);
3351
void dhcp_failover_startup_timeout (void *);
3352
void dhcp_failover_link_startup_timeout (void *);
3353
void dhcp_failover_listener_restart (void *);
3354
void dhcp_failover_auto_partner_down(void *vs);
3355
isc_result_t dhcp_failover_state_get_value (omapi_object_t *,
3357
omapi_data_string_t *,
3359
isc_result_t dhcp_failover_state_destroy (omapi_object_t *,
3361
isc_result_t dhcp_failover_state_stuff (omapi_object_t *,
3364
isc_result_t dhcp_failover_state_lookup (omapi_object_t **,
3367
isc_result_t dhcp_failover_state_create (omapi_object_t **,
3369
isc_result_t dhcp_failover_state_remove (omapi_object_t *,
3371
int dhcp_failover_state_match (dhcp_failover_state_t *, u_int8_t *, unsigned);
3372
int dhcp_failover_state_match_by_name(dhcp_failover_state_t *,
3373
failover_option_t *);
3374
const char *dhcp_failover_reject_reason_print (int);
3375
const char *dhcp_failover_state_name_print (enum failover_state);
3376
const char *dhcp_failover_message_name (unsigned);
3377
const char *dhcp_failover_option_name (unsigned);
3378
failover_option_t *dhcp_failover_option_printf (unsigned, char *,
3382
__attribute__((__format__(__printf__,5,6)));
3383
failover_option_t *dhcp_failover_make_option (unsigned, char *,
3384
unsigned *, unsigned, ...);
3385
isc_result_t dhcp_failover_put_message (dhcp_failover_link_t *,
3386
omapi_object_t *, int, u_int32_t, ...);
3387
isc_result_t dhcp_failover_send_connect (omapi_object_t *);
3388
isc_result_t dhcp_failover_send_connectack (omapi_object_t *,
3389
dhcp_failover_state_t *,
3391
isc_result_t dhcp_failover_send_disconnect (omapi_object_t *,
3393
isc_result_t dhcp_failover_send_bind_update (dhcp_failover_state_t *,
3395
isc_result_t dhcp_failover_send_bind_ack (dhcp_failover_state_t *,
3396
failover_message_t *,
3398
isc_result_t dhcp_failover_send_poolreq (dhcp_failover_state_t *);
3399
isc_result_t dhcp_failover_send_poolresp (dhcp_failover_state_t *, int);
3400
isc_result_t dhcp_failover_send_update_request (dhcp_failover_state_t *);
3401
isc_result_t dhcp_failover_send_update_request_all (dhcp_failover_state_t *);
3402
isc_result_t dhcp_failover_send_update_done (dhcp_failover_state_t *);
3403
isc_result_t dhcp_failover_process_bind_update (dhcp_failover_state_t *,
3404
failover_message_t *);
3405
isc_result_t dhcp_failover_process_bind_ack (dhcp_failover_state_t *,
3406
failover_message_t *);
3407
isc_result_t dhcp_failover_generate_update_queue (dhcp_failover_state_t *,
3409
isc_result_t dhcp_failover_process_update_request (dhcp_failover_state_t *,
3410
failover_message_t *);
3411
isc_result_t dhcp_failover_process_update_request_all (dhcp_failover_state_t *,
3412
failover_message_t *);
3413
isc_result_t dhcp_failover_process_update_done (dhcp_failover_state_t *,
3414
failover_message_t *);
3415
void ia_remove_all_lease(struct ia_xx *ia, const char *file, int line);
3416
void dhcp_failover_recover_done (void *);
3417
void failover_print (char *, unsigned *, unsigned, const char *);
3418
void update_partner (struct lease *);
3419
int load_balance_mine (struct packet *, dhcp_failover_state_t *);
3420
int peer_wants_lease (struct lease *);
3421
binding_state_t normal_binding_state_transition_check (struct lease *,
3422
dhcp_failover_state_t *,
3426
conflict_binding_state_transition_check (struct lease *,
3427
dhcp_failover_state_t *,
3428
binding_state_t, u_int32_t);
3429
int lease_mine_to_reallocate (struct lease *);
3431
OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_state, dhcp_failover_state_t,
3432
dhcp_type_failover_state)
3433
OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_listener, dhcp_failover_listener_t,
3434
dhcp_type_failover_listener)
3435
OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_link, dhcp_failover_link_t,
3436
dhcp_type_failover_link)
3437
#endif /* FAILOVER_PROTOCOL */
3439
const char *binding_state_print (enum failover_state);
3442
#if defined(LDAP_CONFIGURATION)
3443
extern struct enumeration ldap_methods;
3444
#if defined (LDAP_USE_SSL)
3445
extern struct enumeration ldap_ssl_usage_enum;
3446
extern struct enumeration ldap_tls_reqcert_enum;
3447
extern struct enumeration ldap_tls_crlcheck_enum;
3449
isc_result_t ldap_read_config (void);
3450
int find_haddr_in_ldap (struct host_decl **, int, unsigned,
3451
const unsigned char *, const char *, int);
3452
int find_subclass_in_ldap (struct class *, struct class **,
3453
struct data_string *);
3457
HASH_FUNCTIONS_DECL(ia, unsigned char *, struct ia_xx, ia_hash_t)
3458
HASH_FUNCTIONS_DECL(iasubopt, struct in6_addr *, struct iasubopt,
3461
isc_result_t iasubopt_allocate(struct iasubopt **iasubopt,
3462
const char *file, int line);
3463
isc_result_t iasubopt_reference(struct iasubopt **iasubopt,
3464
struct iasubopt *src,
3465
const char *file, int line);
3466
isc_result_t iasubopt_dereference(struct iasubopt **iasubopt,
3467
const char *file, int line);
3469
isc_result_t ia_make_key(struct data_string *key, u_int32_t iaid,
3470
const char *duid, unsigned int duid_len,
3471
const char *file, int line);
3472
isc_result_t ia_allocate(struct ia_xx **ia, u_int32_t iaid,
3473
const char *duid, unsigned int duid_len,
3474
const char *file, int line);
3475
isc_result_t ia_reference(struct ia_xx **ia, struct ia_xx *src,
3476
const char *file, int line);
3477
isc_result_t ia_dereference(struct ia_xx **ia,
3478
const char *file, int line);
3479
isc_result_t ia_add_iasubopt(struct ia_xx *ia, struct iasubopt *iasubopt,
3480
const char *file, int line);
3481
void ia_remove_iasubopt(struct ia_xx *ia, struct iasubopt *iasubopt,
3482
const char *file, int line);
3483
isc_boolean_t ia_equal(const struct ia_xx *a, const struct ia_xx *b);
3485
isc_result_t ipv6_pool_allocate(struct ipv6_pool **pool, u_int16_t type,
3486
const struct in6_addr *start_addr,
3487
int bits, int units,
3488
const char *file, int line);
3489
isc_result_t ipv6_pool_reference(struct ipv6_pool **pool,
3490
struct ipv6_pool *src,
3491
const char *file, int line);
3492
isc_result_t ipv6_pool_dereference(struct ipv6_pool **pool,
3493
const char *file, int line);
3494
isc_result_t create_lease6(struct ipv6_pool *pool,
3495
struct iasubopt **addr,
3496
unsigned int *attempts,
3497
const struct data_string *uid,
3498
time_t soft_lifetime_end_time);
3499
isc_result_t add_lease6(struct ipv6_pool *pool,
3500
struct iasubopt *lease,
3501
time_t valid_lifetime_end_time);
3502
isc_result_t renew_lease6(struct ipv6_pool *pool, struct iasubopt *lease);
3503
isc_result_t expire_lease6(struct iasubopt **leasep,
3504
struct ipv6_pool *pool, time_t now);
3505
isc_result_t release_lease6(struct ipv6_pool *pool, struct iasubopt *lease);
3506
isc_result_t decline_lease6(struct ipv6_pool *pool, struct iasubopt *lease);
3507
isc_boolean_t lease6_exists(const struct ipv6_pool *pool,
3508
const struct in6_addr *addr);
3509
isc_result_t mark_lease_unavailble(struct ipv6_pool *pool,
3510
const struct in6_addr *addr);
3512
isc_result_t create_prefix6(struct ipv6_pool *pool,
3513
struct iasubopt **pref,
3514
unsigned int *attempts,
3515
const struct data_string *uid,
3516
time_t soft_lifetime_end_time);
3517
isc_boolean_t prefix6_exists(const struct ipv6_pool *pool,
3518
const struct in6_addr *pref, u_int8_t plen);
3520
isc_result_t add_ipv6_pool(struct ipv6_pool *pool);
3521
isc_result_t find_ipv6_pool(struct ipv6_pool **pool, u_int16_t type,
3522
const struct in6_addr *addr);
3523
isc_boolean_t ipv6_in_pool(const struct in6_addr *addr,
3524
const struct ipv6_pool *pool);
3526
isc_result_t renew_leases(struct ia_xx *ia);
3527
isc_result_t release_leases(struct ia_xx *ia);
3528
isc_result_t decline_leases(struct ia_xx *ia);
3529
void schedule_lease_timeout(struct ipv6_pool *pool);
3530
void schedule_all_ipv6_lease_timeouts();
3532
void mark_hosts_unavailable(void);
3533
void mark_phosts_unavailable(void);
3534
void mark_interfaces_unavailable(void);
3536
dhcp_ddns_cb_t *ddns_cb_alloc(const char *file, int line);
3537
void ddns_cb_free (dhcp_ddns_cb_t *ddns_cb, const char *file, int line);
3538
void ddns_cb_forget_zone (dhcp_ddns_cb_t *ddns_cb);
3540
//void *key_from_zone(struct dns_zone *zone);
3543
ddns_modify_fwd(dhcp_ddns_cb_t *ddns_cb);
3546
ddns_modify_ptr(dhcp_ddns_cb_t *ddns_cb);
3549
ddns_cancel(dhcp_ddns_cb_t *ddns_cb);
3551
#define MAX_ADDRESS_STRING_LEN \
3552
(sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"))