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
716 #define SV_CACHE_THRESHOLD 78
718 #if !defined (DEFAULT_PING_TIMEOUT)
719 # define DEFAULT_PING_TIMEOUT 1
722 #if !defined (DEFAULT_DELAYED_ACK)
723 # define DEFAULT_DELAYED_ACK 28 /* default SO_SNDBUF size / 576 bytes */
726 #if !defined (DEFAULT_ACK_DELAY_SECS)
727 # define DEFAULT_ACK_DELAY_SECS 0
730 #if !defined (DEFAULT_ACK_DELAY_USECS)
731 # define DEFAULT_ACK_DELAY_USECS 250000 /* 1/4 of a second */
734 #if !defined (DEFAULT_MIN_ACK_DELAY_USECS)
735 # define DEFAULT_MIN_ACK_DELAY_USECS 10000 /* 1/100 second */
738 #if !defined (DEFAULT_CACHE_THRESHOLD)
739 # define DEFAULT_CACHE_THRESHOLD 25
742 #if !defined (DEFAULT_DEFAULT_LEASE_TIME)
743 # define DEFAULT_DEFAULT_LEASE_TIME 43200
746 #if !defined (DEFAULT_MIN_LEASE_TIME)
747 # define DEFAULT_MIN_LEASE_TIME 300
750 #if !defined (DEFAULT_MAX_LEASE_TIME)
751 # define DEFAULT_MAX_LEASE_TIME 86400
754 #if !defined (DEFAULT_DDNS_TTL)
755 # define DEFAULT_DDNS_TTL 3600
757 #if !defined (MAX_DEFAULT_DDNS_TTL)
758 # define MAX_DEFAULT_DDNS_TTL 3600
761 #if !defined (MIN_LEASE_WRITE)
762 # define MIN_LEASE_WRITE 15
765 /* Client option names */
768 #define CL_SELECT_INTERVAL 2
769 #define CL_REBOOT_TIMEOUT 3
770 #define CL_RETRY_INTERVAL 4
771 #define CL_BACKOFF_CUTOFF 5
772 #define CL_INITIAL_INTERVAL 6
773 #define CL_BOOTP_POLICY 7
774 #define CL_SCRIPT_NAME 8
775 #define CL_REQUESTED_OPTIONS 9
776 #define CL_REQUESTED_LEASE_TIME 10
777 #define CL_SEND_OPTIONS 11
779 #define CL_REJECT_LIST 13
781 #ifndef CL_DEFAULT_TIMEOUT
782 # define CL_DEFAULT_TIMEOUT 60
785 #ifndef CL_DEFAULT_SELECT_INTERVAL
786 # define CL_DEFAULT_SELECT_INTERVAL 0
789 #ifndef CL_DEFAULT_REBOOT_TIMEOUT
790 # define CL_DEFAULT_REBOOT_TIMEOUT 10
793 #ifndef CL_DEFAULT_RETRY_INTERVAL
794 # define CL_DEFAULT_RETRY_INTERVAL 300
797 #ifndef CL_DEFAULT_BACKOFF_CUTOFF
798 # define CL_DEFAULT_BACKOFF_CUTOFF 120
801 #ifndef CL_DEFAULT_INITIAL_INTERVAL
802 # define CL_DEFAULT_INITIAL_INTERVAL 10
805 #ifndef CL_DEFAULT_BOOTP_POLICY
806 # define CL_DEFAULT_BOOTP_POLICY P_ACCEPT
809 #ifndef CL_DEFAULT_REQUESTED_OPTIONS
810 # define CL_DEFAULT_REQUESTED_OPTIONS \
812 DHO_BROADCAST_ADDRESS, \
816 DHO_DOMAIN_NAME_SERVERS, \
820 struct group_object
{
821 OMAPI_OBJECT_PREAMBLE
;
823 struct group_object
*n_dynamic
;
827 #define GROUP_OBJECT_DELETED 1
828 #define GROUP_OBJECT_DYNAMIC 2
829 #define GROUP_OBJECT_STATIC 4
832 /* Group of declarations that share common parameters. */
837 struct group_object
*object
;
838 struct subnet
*subnet
;
839 struct shared_network
*shared_network
;
841 struct executable_statement
*statements
;
844 /* A dhcp host declaration structure. */
846 OMAPI_OBJECT_PREAMBLE
;
847 struct host_decl
*n_ipaddr
;
848 struct host_decl
*n_dynamic
;
850 struct hardware interface
;
851 struct data_string client_identifier
;
852 struct option
*host_id_option
;
853 struct data_string host_id
;
854 /* XXXSK: fixed_addr should be an array of iaddr values,
855 not an option_cache, but it's referenced in a lot of
856 places, so we'll leave it for now. */
857 struct option_cache
*fixed_addr
;
858 struct iaddrcidrnetlist
*fixed_prefix
;
860 struct group_object
*named_group
;
861 struct data_string auth_key_id
;
863 #define HOST_DECL_DELETED 1
864 #define HOST_DECL_DYNAMIC 2
865 #define HOST_DECL_STATIC 4
871 permit_unknown_clients
,
872 permit_known_clients
,
873 permit_authenticated_clients
,
874 permit_unauthenticated_clients
,
876 permit_dynamic_bootp_clients
,
881 TIME after
; /* date after which this clause applies */
885 OMAPI_OBJECT_PREAMBLE
;
888 struct shared_network
*shared_network
;
889 struct permit
*permit_list
;
890 struct permit
*prohibit_list
;
891 struct lease
*active
;
892 struct lease
*expired
;
894 struct lease
*backup
;
895 struct lease
*abandoned
;
896 struct lease
*reserved
;
897 TIME next_event_time
;
902 TIME valid_from
; /* deny pool use before this date */
903 TIME valid_until
; /* deny pool use after this date */
905 #if defined (FAILOVER_PROTOCOL)
906 dhcp_failover_state_t
*failover_peer
;
910 struct shared_network
{
911 OMAPI_OBJECT_PREAMBLE
;
912 struct shared_network
*next
;
915 #define SHARED_IMPLICIT 1 /* This network was synthesized. */
918 struct subnet
*subnets
;
919 struct interface_info
*interface
;
921 struct ipv6_pool
**ipv6_pools
; /* NULL-terminated array */
922 int last_ipv6_pool
; /* offset of last IPv6 pool
923 used to issue a lease */
925 #if defined (FAILOVER_PROTOCOL)
926 dhcp_failover_state_t
*failover_peer
;
931 OMAPI_OBJECT_PREAMBLE
;
932 struct subnet
*next_subnet
;
933 struct subnet
*next_sibling
;
934 struct shared_network
*shared_network
;
935 struct interface_info
*interface
;
936 struct iaddr interface_address
;
938 struct iaddr netmask
;
939 int prefix_len
; /* XXX: currently for IPv6 only */
944 struct collection
*next
;
947 struct class *classes
;
950 /* Used as an argument to parse_clasS_decl() */
951 #define CLASS_TYPE_VENDOR 0
952 #define CLASS_TYPE_USER 1
953 #define CLASS_TYPE_CLASS 2
954 #define CLASS_TYPE_SUBCLASS 3
956 /* XXX classes must be reference-counted. */
958 OMAPI_OBJECT_PREAMBLE
;
959 struct class *nic
; /* Next in collection. */
960 struct class *superclass
; /* Set for spawned classes only. */
961 char *name
; /* Not set for spawned classes. */
963 /* A class may be configured to permit a limited number of leases. */
966 struct lease
**billed_leases
;
968 /* If nonzero, class has not been saved since it was last
972 /* Hash table containing subclasses. */
974 struct data_string hash_string
;
976 /* Expression used to match class. */
977 struct expression
*expr
;
979 /* Expression used to compute subclass identifiers for spawning
980 and to do subclass matching. */
981 struct expression
*submatch
;
986 /* Statements to execute if class matches. */
987 struct executable_statement
*statements
;
989 #define CLASS_DECL_DELETED 1
990 #define CLASS_DECL_DYNAMIC 2
991 #define CLASS_DECL_STATIC 4
992 #define CLASS_DECL_SUBCLASS 8
997 /* DHCP client lease structure... */
998 struct client_lease
{
999 struct client_lease
*next
; /* Next lease in list. */
1000 TIME expiry
, renewal
, rebind
; /* Lease timeouts. */
1001 struct iaddr address
; /* Address being leased. */
1002 char *server_name
; /* Name of boot server. */
1003 char *filename
; /* Name of file we're supposed to boot. */
1004 struct string_list
*medium
; /* Network medium. */
1005 struct auth_key
*key
; /* Key used in basic DHCP authentication. */
1007 unsigned int is_static
: 1; /* If set, lease is from config file. */
1008 unsigned int is_bootp
: 1; /* If set, lease was acquired with BOOTP. */
1010 struct option_state
*options
; /* Options supplied with lease. */
1013 /* DHCPv6 lease structures */
1015 struct dhc6_addr
*next
;
1016 struct iaddr address
;
1019 /* Address state flags. */
1020 #define DHC6_ADDR_DEPREFFED 0x01
1021 #define DHC6_ADDR_EXPIRED 0x02
1025 u_int32_t preferred_life
;
1028 struct option_state
*options
;
1032 struct dhc6_ia
*next
;
1033 unsigned char iaid
[4];
1039 struct dhc6_addr
*addrs
;
1041 struct option_state
*options
;
1045 struct dhc6_lease
*next
;
1046 struct data_string server_id
;
1048 isc_boolean_t released
;
1052 unsigned char dhcpv6_transaction_id
[3];
1053 struct dhc6_ia
*bindings
;
1055 struct option_state
*options
;
1058 /* Possible states in which the client can be. */
1070 /* Authentication and BOOTP policy possibilities (not all values work
1072 enum policy
{ P_IGNORE
, P_ACCEPT
, P_PREFER
, P_REQUIRE
, P_DONT
};
1074 /* Configuration information from the config file... */
1075 struct client_config
{
1077 * When a message has been received, run these statements
1080 struct group
*on_receipt
;
1083 * When a message is sent, run these statements.
1085 struct group
*on_transmission
;
1087 struct option
**required_options
; /* Options that MUST be present. */
1088 struct option
**requested_options
; /* Options to request (ORO/PRL). */
1090 TIME timeout
; /* Start to panic if we don't get a
1091 lease in this time period when
1093 TIME initial_delay
; /* Set initial delay before first
1095 TIME initial_interval
; /* All exponential backoff intervals
1097 TIME retry_interval
; /* If the protocol failed to produce
1098 an address before the timeout,
1099 try the protocol again after this
1101 TIME select_interval
; /* Wait this many seconds from the
1102 first DHCPDISCOVER before
1103 picking an offered lease. */
1104 TIME reboot_timeout
; /* When in INIT-REBOOT, wait this
1105 long before giving up and going
1107 TIME backoff_cutoff
; /* When doing exponential backoff,
1108 never back off to an interval
1109 longer than this amount. */
1110 u_int32_t requested_lease
; /* Requested lease time, if user
1111 doesn't configure one. */
1112 struct string_list
*media
; /* Possible network media values. */
1113 char *script_name
; /* Name of config script. */
1114 char *vendor_space_name
; /* Name of config script. */
1115 enum policy bootp_policy
;
1116 /* Ignore, accept or prefer BOOTP
1118 enum policy auth_policy
;
1119 /* Require authentication, prefer
1120 authentication, or don't try to
1122 struct string_list
*medium
; /* Current network medium. */
1124 struct iaddrmatchlist
*reject_list
; /* Servers to reject. */
1126 int omapi_port
; /* port on which to accept OMAPI
1127 connections, or -1 for no
1129 int do_forward_update
; /* If nonzero, and if we have the
1130 information we need, update the
1131 A record for the address we get. */
1134 /* Per-interface state used in the dhcp client... */
1135 /* XXX: consider union {}'ing this for v4/v6. */
1136 struct client_state
{
1137 struct client_state
*next
;
1138 struct interface_info
*interface
;
1141 /* Common values. */
1142 struct client_config
*config
; /* Client configuration. */
1143 struct string_list
*env
; /* Client script environment. */
1144 int envc
; /* Number of entries in environment. */
1145 struct option_state
*sent_options
; /* Options we sent. */
1146 enum dhcp_state state
; /* Current state for this interface. */
1147 TIME last_write
; /* Last time this state was written. */
1149 /* DHCPv4 values. */
1150 struct client_lease
*active
; /* Currently active lease. */
1151 struct client_lease
*new; /* New lease. */
1152 struct client_lease
*offered_leases
; /* Leases offered to us. */
1153 struct client_lease
*leases
; /* Leases we currently hold. */
1154 struct client_lease
*alias
; /* Alias lease. */
1156 struct iaddr destination
; /* Where to send packet. */
1157 u_int32_t xid
; /* Transaction ID. */
1158 u_int16_t secs
; /* secs value from DHCPDISCOVER. */
1159 TIME first_sending
; /* When was first copy sent? */
1160 TIME interval
; /* What's the current resend interval? */
1161 struct string_list
*medium
; /* Last media type tried. */
1162 struct dhcp_packet packet
; /* Outgoing DHCP packet. */
1163 unsigned packet_length
; /* Actual length of generated packet. */
1165 struct iaddr requested_address
; /* Address we would like to get. */
1167 /* DHCPv6 values. */
1168 unsigned char dhcpv6_transaction_id
[3];
1169 u_int8_t refresh_type
;
1171 struct dhc6_lease
*active_lease
;
1172 struct dhc6_lease
*old_lease
;
1173 struct dhc6_lease
*advertised_leases
;
1174 struct dhc6_lease
*selected_lease
;
1175 struct dhc6_lease
*held_leases
;
1177 struct timeval start_time
;
1181 /* See RFC3315 section 14. */
1182 TIME RT
; /* In hundredths of seconds. */
1183 TIME IRT
; /* In hundredths of seconds. */
1184 TIME MRC
; /* Count. */
1185 TIME MRT
; /* In hundredths of seconds. */
1186 TIME MRD
; /* In seconds, relative. */
1187 TIME next_MRD
; /* In seconds, absolute. */
1189 /* Rather than a state, we use a function that shifts around
1190 * depending what stage of life the v6 state machine is in.
1191 * This is where incoming packets are dispatched to (sometimes
1194 void (*v6_handler
)(struct packet
*, struct client_state
*);
1197 * A pointer to the state of the ddns update for this lease.
1198 * It should be set while the update is in progress and cleared
1199 * when the update finishes. It can be used to cancel the
1200 * update if we want to do a different update.
1202 struct dhcp_ddns_cb
*ddns_cb
;
1205 struct envadd_state
{
1206 struct client_state
*client
;
1210 struct dns_update_state
{
1211 struct client_state
*client
;
1212 struct iaddr address
;
1213 int dns_update_timeout
;
1216 /* Information about each network interface. */
1218 struct interface_info
{
1219 OMAPI_OBJECT_PREAMBLE
;
1220 struct interface_info
*next
; /* Next interface in list... */
1221 struct shared_network
*shared_network
;
1222 /* Networks connected to this interface. */
1223 struct hardware hw_address
; /* Its physical address. */
1224 struct in_addr
*addresses
; /* Addresses associated with this
1227 int address_count
; /* Number of addresses stored. */
1228 int address_max
; /* Size of addresses buffer. */
1229 struct in6_addr
*v6addresses
; /* IPv6 addresses associated with
1231 int v6address_count
; /* Number of IPv6 addresses associated
1232 with this interface. */
1233 int v6address_max
; /* Maximum number of IPv6 addresses
1234 we can store in current buffer. */
1236 u_int8_t
*circuit_id
; /* Circuit ID associated with this
1238 unsigned circuit_id_len
; /* Length of Circuit ID, if there
1240 u_int8_t
*remote_id
; /* Remote ID associated with this
1241 interface (if any). */
1242 unsigned remote_id_len
; /* Length of Remote ID. */
1244 char name
[IFNAMSIZ
]; /* Its name... */
1245 int index
; /* Its if_nametoindex(). */
1246 int rfdesc
; /* Its read file descriptor. */
1247 int wfdesc
; /* Its write file descriptor, if
1249 unsigned char *rbuf
; /* Read buffer, if required. */
1250 unsigned int rbuf_max
; /* Size of read buffer. */
1251 size_t rbuf_offset
; /* Current offset into buffer. */
1252 size_t rbuf_len
; /* Length of data in buffer. */
1254 struct ifreq
*ifp
; /* Pointer to ifreq struct. */
1255 int configured
; /* If set to 1, interface has at least
1256 * one valid IP address.
1258 u_int32_t flags
; /* Control flags... */
1259 #define INTERFACE_REQUESTED 1
1260 #define INTERFACE_AUTOMATIC 2
1261 #define INTERFACE_RUNNING 4
1262 #define INTERFACE_DOWNSTREAM 8
1263 #define INTERFACE_UPSTREAM 16
1264 #define INTERFACE_STREAMS (INTERFACE_DOWNSTREAM | INTERFACE_UPSTREAM)
1266 /* Only used by DHCP client code. */
1267 struct client_state
*client
;
1268 # if defined(USE_DLPI_SEND) || defined(USE_DLPI_RECEIVE) || \
1269 defined(USE_DLPI_HWADDR)
1270 int dlpi_sap_length
;
1271 struct hardware dlpi_broadcast_addr
;
1272 # endif /* DLPI_SEND || DLPI_RECEIVE */
1273 struct hardware anycast_mac_addr
;
1276 struct hardware_link
{
1277 struct hardware_link
*next
;
1278 char name
[IFNAMSIZ
];
1279 struct hardware address
;
1283 struct leasequeue
*prev
;
1284 struct leasequeue
*next
;
1285 struct lease
*lease
;
1288 typedef void (*tvref_t
)(void *, void *, const char *, int);
1289 typedef void (*tvunref_t
)(void *, const char *, int);
1291 struct timeout
*next
;
1292 struct timeval when
;
1293 void (*func
) (void *);
1297 isc_timer_t
*isc_timeout
;
1301 struct eventqueue
*next
;
1302 void (*handler
)(void *);
1306 struct protocol
*next
;
1308 void (*handler
) (struct protocol
*);
1312 struct dns_query
; /* forward */
1315 struct dns_wakeup
*next
; /* Next wakeup in chain. */
1316 void (*func
) (struct dns_query
*);
1319 struct dns_question
{
1320 u_int16_t type
; /* Type of query. */
1321 u_int16_t
class; /* Class of query. */
1322 unsigned char data
[1]; /* Query data. */
1326 u_int16_t type
; /* Type of answer. */
1327 u_int16_t
class; /* Class of answer. */
1328 int count
; /* Number of answers. */
1329 unsigned char *answers
[1]; /* Pointers to answers. */
1333 struct dns_query
*next
; /* Next query in hash bucket. */
1334 u_int32_t hash
; /* Hash bucket index. */
1335 TIME expiry
; /* Query expiry time (zero if not yet
1337 u_int16_t id
; /* Query ID (also hash table index) */
1338 caddr_t waiters
; /* Pointer to list of things waiting
1341 struct dns_question
*question
; /* Question, internal format. */
1342 struct dns_answer
*answer
; /* Answer, internal format. */
1344 unsigned char *query
; /* Query formatted for DNS server. */
1345 unsigned len
; /* Length of entire query. */
1346 int sent
; /* The query has been sent. */
1347 struct dns_wakeup
*wakeups
; /* Wakeups to call if this query is
1349 struct name_server
*next_server
; /* Next server to try. */
1350 int backoff
; /* Current backoff, in seconds. */
1357 struct option_cache
*primary
;
1358 struct option_cache
*secondary
;
1359 struct option_cache
*primary6
;
1360 struct option_cache
*secondary6
;
1361 struct auth_key
*key
;
1365 OMAPI_OBJECT_PREAMBLE
;
1367 void (*icmp_handler
) (struct iaddr
, u_int8_t
*, int);
1372 /* Bitmask of dhcp option codes. */
1373 typedef unsigned char option_mask
[16];
1375 /* DHCP Option mask manipulation macros... */
1376 #define OPTION_ZERO(mask) (memset (mask, 0, 16))
1377 #define OPTION_SET(mask, bit) (mask [bit >> 8] |= (1 << (bit & 7)))
1378 #define OPTION_CLR(mask, bit) (mask [bit >> 8] &= ~(1 << (bit & 7)))
1379 #define OPTION_ISSET(mask, bit) (mask [bit >> 8] & (1 << (bit & 7)))
1380 #define OPTION_ISCLR(mask, bit) (!OPTION_ISSET (mask, bit))
1382 /* An option occupies its length plus two header bytes (code and
1383 length) for every 255 bytes that must be stored. */
1384 #define OPTION_SPACE(x) ((x) + 2 * ((x) / 255 + 1))
1386 /* Default path to dhcpd config file. */
1388 #undef _PATH_DHCPD_CONF
1389 #define _PATH_DHCPD_CONF "dhcpd.conf"
1390 #undef _PATH_DHCPD_DB
1391 #define _PATH_DHCPD_DB "dhcpd.leases"
1392 #undef _PATH_DHCPD6_DB
1393 #define _PATH_DHCPD6_DB "dhcpd6.leases"
1394 #undef _PATH_DHCPD_PID
1395 #define _PATH_DHCPD_PID "dhcpd.pid"
1396 #undef _PATH_DHCPD6_PID
1397 #define _PATH_DHCPD6_PID "dhcpd6.pid"
1400 #ifndef _PATH_DHCPD_CONF
1401 #define _PATH_DHCPD_CONF "/etc/dhcpd.conf"
1404 #ifndef _PATH_DHCPD_DB
1405 #define _PATH_DHCPD_DB LOCALSTATEDIR"/db/dhcpd.leases"
1408 #ifndef _PATH_DHCPD6_DB
1409 #define _PATH_DHCPD6_DB LOCALSTATEDIR"/db/dhcpd6.leases"
1412 #ifndef _PATH_DHCPD_PID
1413 #define _PATH_DHCPD_PID LOCALSTATEDIR"/run/dhcpd.pid"
1416 #ifndef _PATH_DHCPD6_PID
1417 #define _PATH_DHCPD6_PID LOCALSTATEDIR"/run/dhcpd6.pid"
1422 #ifndef _PATH_DHCLIENT_CONF
1423 #define _PATH_DHCLIENT_CONF "/etc/dhclient.conf"
1426 #ifndef _PATH_DHCLIENT_SCRIPT
1427 #define _PATH_DHCLIENT_SCRIPT "/sbin/dhclient-script"
1430 #ifndef _PATH_DHCLIENT_PID
1431 #define _PATH_DHCLIENT_PID LOCALSTATEDIR"/run/dhclient.pid"
1434 #ifndef _PATH_DHCLIENT6_PID
1435 #define _PATH_DHCLIENT6_PID LOCALSTATEDIR"/run/dhclient6.pid"
1438 #ifndef _PATH_DHCLIENT_DB
1439 #define _PATH_DHCLIENT_DB LOCALSTATEDIR"/db/dhclient.leases"
1442 #ifndef _PATH_DHCLIENT6_DB
1443 #define _PATH_DHCLIENT6_DB LOCALSTATEDIR"/db/dhclient6.leases"
1446 #ifndef _PATH_RESOLV_CONF
1447 #define _PATH_RESOLV_CONF "/etc/resolv.conf"
1450 #ifndef _PATH_DHCRELAY_PID
1451 #define _PATH_DHCRELAY_PID LOCALSTATEDIR"/run/dhcrelay.pid"
1454 #ifndef _PATH_DHCRELAY6_PID
1455 #define _PATH_DHCRELAY6_PID LOCALSTATEDIR"/run/dhcrelay6.pid"
1458 #ifndef DHCPD_LOG_FACILITY
1459 #define DHCPD_LOG_FACILITY LOG_DAEMON
1462 #define MAX_TIME 0x7fffffff
1465 /* these are referenced */
1466 typedef struct hash_table ia_hash_t
;
1467 typedef struct hash_table iasubopt_hash_t
;
1469 /* IAADDR/IAPREFIX lease */
1472 int refcnt
; /* reference count */
1473 struct in6_addr addr
; /* IPv6 address/prefix */
1474 u_int8_t plen
; /* iaprefix prefix length */
1475 binding_state_t state
; /* state */
1476 struct binding_scope
*scope
; /* "set var = value;" */
1477 time_t hard_lifetime_end_time
; /* time address expires */
1478 time_t soft_lifetime_end_time
; /* time ephemeral expires */
1479 u_int32_t prefer
; /* cached preferred lifetime */
1480 u_int32_t valid
; /* cached valid lifetime */
1481 struct ia_xx
*ia
; /* IA for this lease */
1482 struct ipv6_pool
*ipv6_pool
; /* pool for this lease */
1484 * For now, just pick an arbitrary time to keep old hard leases
1485 * around (value in seconds).
1487 #define EXPIRED_IPV6_CLEANUP_TIME (60*60)
1489 int heap_index
; /* index into heap, or -1
1490 (internal use only) */
1493 * A pointer to the state of the ddns update for this lease.
1494 * It should be set while the update is in progress and cleared
1495 * when the update finishes. It can be used to cancel the
1496 * update if we want to do a different update.
1498 struct dhcp_ddns_cb
*ddns_cb
;
1503 int refcnt
; /* reference count */
1504 struct data_string iaid_duid
; /* from the client */
1505 u_int16_t ia_type
; /* IA_XX */
1506 int num_iasubopt
; /* number of IAADDR/PREFIX */
1507 int max_iasubopt
; /* space available for IAADDR/PREFIX */
1508 time_t cltt
; /* client last transaction time */
1509 struct iasubopt
**iasubopt
; /* pointers to the IAADDR/IAPREFIXs */
1512 extern ia_hash_t
*ia_na_active
;
1513 extern ia_hash_t
*ia_ta_active
;
1514 extern ia_hash_t
*ia_pd_active
;
1517 int refcnt
; /* reference count */
1518 u_int16_t pool_type
; /* IA_xx */
1519 struct in6_addr start_addr
; /* first IPv6 address */
1520 int bits
; /* number of bits, CIDR style */
1521 int units
; /* allocation unit in bits */
1522 iasubopt_hash_t
*leases
; /* non-free leases */
1523 int num_active
; /* count of active leases */
1524 isc_heap_t
*active_timeouts
; /* timeouts for active leases */
1525 int num_inactive
; /* count of inactive leases */
1526 isc_heap_t
*inactive_timeouts
; /* timeouts for expired or
1528 struct shared_network
*shared_network
; /* shared_network for
1530 struct subnet
*subnet
; /* subnet for this pool */
1533 /* Flags and state for dhcp_ddns_cb_t */
1534 #define DDNS_UPDATE_ADDR 0x01
1535 #define DDNS_UPDATE_PTR 0x02
1536 #define DDNS_INCLUDE_RRSET 0x04
1537 #define DDNS_CONFLICT_OVERRIDE 0x08
1538 #define DDNS_CLIENT_DID_UPDATE 0x10
1539 #define DDNS_EXECUTE_NEXT 0x20
1540 #define DDNS_ABORT 0x40
1541 #define DDNS_STATIC_LEASE 0x80
1542 #define DDNS_ACTIVE_LEASE 0x100
1544 * The following two groups are separate and we could reuse
1545 * values but not reusing them may be useful in the future.
1547 #define DDNS_STATE_CLEANUP 0 // The previous step failed, cleanup
1549 #define DDNS_STATE_ADD_FW_NXDOMAIN 1
1550 #define DDNS_STATE_ADD_FW_YXDHCID 2
1551 #define DDNS_STATE_ADD_PTR 3
1553 #define DDNS_STATE_REM_FW_YXDHCID 17
1554 #define DDNS_STATE_REM_FW_NXRR 18
1555 #define DDNS_STATE_REM_PTR 19
1558 * Flags for the dns print function
1560 #define DDNS_PRINT_INBOUND 1
1561 #define DDNS_PRINT_OUTBOUND 0
1563 struct dhcp_ddns_cb
;
1565 typedef void (*ddns_action_t
)(struct dhcp_ddns_cb
*ddns_cb
,
1566 isc_result_t result
);
1568 typedef struct dhcp_ddns_cb
{
1569 struct data_string fwd_name
;
1570 struct data_string rev_name
;
1571 struct data_string dhcid
;
1572 struct iaddr address
;
1577 unsigned char zone_name
[DHCP_MAXDNS_WIRE
];
1578 isc_sockaddrlist_t zone_server_list
;
1579 isc_sockaddr_t zone_addrs
[DHCP_MAXNS
];
1580 int zone_addr_count
;
1581 struct dns_zone
*zone
;
1586 ddns_action_t cur_func
;
1588 struct dhcp_ddns_cb
* next_op
;
1590 /* Lease or client state that triggered the ddns operation */
1592 struct binding_scope
**scope
;
1598 extern struct ipv6_pool
**pools
;
1599 extern int num_pools
;
1601 /* External definitions... */
1603 HASH_FUNCTIONS_DECL (group
, const char *, struct group_object
, group_hash_t
)
1604 HASH_FUNCTIONS_DECL (universe
, const char *, struct universe
, universe_hash_t
)
1605 HASH_FUNCTIONS_DECL (option_name
, const char *, struct option
,
1607 HASH_FUNCTIONS_DECL (option_code
, const unsigned *, struct option
,
1609 HASH_FUNCTIONS_DECL (dns_zone
, const char *, struct dns_zone
, dns_zone_hash_t
)
1610 HASH_FUNCTIONS_DECL(lease_ip
, const unsigned char *, struct lease
,
1612 HASH_FUNCTIONS_DECL(lease_id
, const unsigned char *, struct lease
,
1614 HASH_FUNCTIONS_DECL (host
, const unsigned char *, struct host_decl
, host_hash_t
)
1615 HASH_FUNCTIONS_DECL (class, const char *, struct class, class_hash_t
)
1619 extern struct option
*vendor_cfg_option
;
1620 int parse_options (struct packet
*);
1621 int parse_option_buffer (struct option_state
*, const unsigned char *,
1622 unsigned, struct universe
*);
1623 struct universe
*find_option_universe (struct option
*, const char *);
1624 int parse_encapsulated_suboptions (struct option_state
*, struct option
*,
1625 const unsigned char *, unsigned,
1626 struct universe
*, const char *);
1627 int cons_options (struct packet
*, struct dhcp_packet
*, struct lease
*,
1628 struct client_state
*,
1629 int, struct option_state
*, struct option_state
*,
1630 struct binding_scope
**,
1631 int, int, int, struct data_string
*, const char *);
1632 int fqdn_universe_decode (struct option_state
*,
1633 const unsigned char *, unsigned, struct universe
*);
1634 struct option_cache
*
1635 lookup_fqdn6_option(struct universe
*universe
, struct option_state
*options
,
1638 save_fqdn6_option(struct universe
*universe
, struct option_state
*options
,
1639 struct option_cache
*oc
, isc_boolean_t appendp
);
1641 delete_fqdn6_option(struct universe
*universe
, struct option_state
*options
,
1644 fqdn6_option_space_foreach(struct packet
*packet
, struct lease
*lease
,
1645 struct client_state
*client_state
,
1646 struct option_state
*in_options
,
1647 struct option_state
*cfg_options
,
1648 struct binding_scope
**scope
,
1649 struct universe
*u
, void *stuff
,
1650 void (*func
)(struct option_cache
*,
1653 struct client_state
*,
1654 struct option_state
*,
1655 struct option_state
*,
1656 struct binding_scope
**,
1657 struct universe
*, void *));
1659 fqdn6_option_space_encapsulate(struct data_string
*result
,
1660 struct packet
*packet
, struct lease
*lease
,
1661 struct client_state
*client_state
,
1662 struct option_state
*in_options
,
1663 struct option_state
*cfg_options
,
1664 struct binding_scope
**scope
,
1665 struct universe
*universe
);
1667 fqdn6_universe_decode(struct option_state
*options
,
1668 const unsigned char *buffer
, unsigned length
,
1669 struct universe
*u
);
1670 int append_option(struct data_string
*dst
, struct universe
*universe
,
1671 struct option
*option
, struct data_string
*src
);
1673 store_options(int *ocount
,
1674 unsigned char *buffer
, unsigned buflen
, unsigned index
,
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 unsigned *priority_list
, int priority_len
,
1681 unsigned first_cutoff
, int second_cutoff
, int terminate
,
1682 const char *vuname
);
1683 int store_options6(char *, int, struct option_state
*, struct packet
*,
1684 const int *, struct data_string
*);
1685 int format_has_text(const char *);
1686 int format_min_length(const char *, struct option_cache
*);
1687 const char *pretty_print_option (struct option
*, const unsigned char *,
1688 unsigned, int, int);
1689 int pretty_escape(char **, char *, const unsigned char **,
1690 const unsigned char *);
1691 int get_option (struct data_string
*, struct universe
*,
1692 struct packet
*, struct lease
*, struct client_state
*,
1693 struct option_state
*, struct option_state
*,
1694 struct option_state
*, struct binding_scope
**, unsigned,
1696 void set_option (struct universe
*, struct option_state
*,
1697 struct option_cache
*, enum statement_op
);
1698 struct option_cache
*lookup_option (struct universe
*,
1699 struct option_state
*, unsigned);
1700 struct option_cache
*lookup_hashed_option (struct universe
*,
1701 struct option_state
*,
1703 struct option_cache
*next_hashed_option(struct universe
*,
1704 struct option_state
*,
1705 struct option_cache
*);
1706 int save_option_buffer (struct universe
*, struct option_state
*,
1707 struct buffer
*, unsigned char *, unsigned,
1709 int append_option_buffer(struct universe
*, struct option_state
*,
1710 struct buffer
*, unsigned char *, unsigned,
1712 void build_server_oro(struct data_string
*, struct option_state
*,
1714 void save_option(struct universe
*, struct option_state
*,
1715 struct option_cache
*);
1716 void also_save_option(struct universe
*, struct option_state
*,
1717 struct option_cache
*);
1718 void save_hashed_option(struct universe
*, struct option_state
*,
1719 struct option_cache
*, isc_boolean_t appendp
);
1720 void delete_option (struct universe
*, struct option_state
*, int);
1721 void delete_hashed_option (struct universe
*,
1722 struct option_state
*, int);
1723 int option_cache_dereference (struct option_cache
**,
1725 int hashed_option_state_dereference (struct universe
*,
1726 struct option_state
*,
1728 int store_option (struct data_string
*,
1729 struct universe
*, struct packet
*, struct lease
*,
1730 struct client_state
*,
1731 struct option_state
*, struct option_state
*,
1732 struct binding_scope
**, struct option_cache
*);
1733 int option_space_encapsulate (struct data_string
*,
1734 struct packet
*, struct lease
*,
1735 struct client_state
*,
1736 struct option_state
*,
1737 struct option_state
*,
1738 struct binding_scope
**,
1739 struct data_string
*);
1740 int hashed_option_space_encapsulate (struct data_string
*,
1741 struct packet
*, struct lease
*,
1742 struct client_state
*,
1743 struct option_state
*,
1744 struct option_state
*,
1745 struct binding_scope
**,
1747 int nwip_option_space_encapsulate (struct data_string
*,
1748 struct packet
*, struct lease
*,
1749 struct client_state
*,
1750 struct option_state
*,
1751 struct option_state
*,
1752 struct binding_scope
**,
1754 int fqdn_option_space_encapsulate (struct data_string
*,
1755 struct packet
*, struct lease
*,
1756 struct client_state
*,
1757 struct option_state
*,
1758 struct option_state
*,
1759 struct binding_scope
**,
1761 void suboption_foreach (struct packet
*, struct lease
*, struct client_state
*,
1762 struct option_state
*, struct option_state
*,
1763 struct binding_scope
**, struct universe
*, void *,
1764 void (*) (struct option_cache
*, struct packet
*,
1765 struct lease
*, struct client_state
*,
1766 struct option_state
*, struct option_state
*,
1767 struct binding_scope
**,
1768 struct universe
*, void *),
1769 struct option_cache
*, const char *);
1770 void option_space_foreach (struct packet
*, struct lease
*,
1771 struct client_state
*,
1772 struct option_state
*,
1773 struct option_state
*,
1774 struct binding_scope
**,
1775 struct universe
*, void *,
1776 void (*) (struct option_cache
*,
1778 struct lease
*, struct client_state
*,
1779 struct option_state
*,
1780 struct option_state
*,
1781 struct binding_scope
**,
1782 struct universe
*, void *));
1783 void hashed_option_space_foreach (struct packet
*, struct lease
*,
1784 struct client_state
*,
1785 struct option_state
*,
1786 struct option_state
*,
1787 struct binding_scope
**,
1788 struct universe
*, void *,
1789 void (*) (struct option_cache
*,
1792 struct client_state
*,
1793 struct option_state
*,
1794 struct option_state
*,
1795 struct binding_scope
**,
1796 struct universe
*, void *));
1797 int linked_option_get (struct data_string
*, struct universe
*,
1798 struct packet
*, struct lease
*,
1799 struct client_state
*,
1800 struct option_state
*, struct option_state
*,
1801 struct option_state
*, struct binding_scope
**,
1803 int linked_option_state_dereference (struct universe
*,
1804 struct option_state
*,
1806 void save_linked_option(struct universe
*, struct option_state
*,
1807 struct option_cache
*, isc_boolean_t appendp
);
1808 void linked_option_space_foreach (struct packet
*, struct lease
*,
1809 struct client_state
*,
1810 struct option_state
*,
1811 struct option_state
*,
1812 struct binding_scope
**,
1813 struct universe
*, void *,
1814 void (*) (struct option_cache
*,
1817 struct client_state
*,
1818 struct option_state
*,
1819 struct option_state
*,
1820 struct binding_scope
**,
1821 struct universe
*, void *));
1822 int linked_option_space_encapsulate (struct data_string
*, struct packet
*,
1823 struct lease
*, struct client_state
*,
1824 struct option_state
*,
1825 struct option_state
*,
1826 struct binding_scope
**,
1828 void delete_linked_option (struct universe
*, struct option_state
*, int);
1829 struct option_cache
*lookup_linked_option (struct universe
*,
1830 struct option_state
*, unsigned);
1831 void do_packet (struct interface_info
*,
1832 struct dhcp_packet
*, unsigned,
1833 unsigned int, struct iaddr
, struct hardware
*);
1834 void do_packet6(struct interface_info
*, const char *,
1835 int, int, const struct iaddr
*, isc_boolean_t
);
1836 int packet6_len_okay(const char *, int);
1838 int add_option(struct option_state
*options
,
1839 unsigned int option_num
,
1841 unsigned int data_len
);
1844 extern struct timeval cur_tv
;
1845 #define cur_time cur_tv.tv_sec
1847 extern int ddns_update_style
;
1849 extern const char *path_dhcpd_conf
;
1850 extern const char *path_dhcpd_db
;
1851 extern const char *path_dhcpd_pid
;
1853 extern int dhcp_max_agent_option_packet_length
;
1854 extern struct eventqueue
*rw_queue_empty
;
1856 int main(int, char **);
1857 void postconf_initialization(int);
1858 void postdb_startup(void);
1859 void cleanup (void);
1860 void lease_pinged (struct iaddr
, u_int8_t
*, int);
1861 void lease_ping_timeout (void *);
1862 int dhcpd_interface_setup_hook (struct interface_info
*ip
, struct iaddr
*ia
);
1863 extern enum dhcp_shutdown_state shutdown_state
;
1864 isc_result_t
dhcp_io_shutdown (omapi_object_t
*, void *);
1865 isc_result_t
dhcp_set_control_state (control_object_state_t oldstate
,
1866 control_object_state_t newstate
);
1867 #if defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
1868 void relinquish_ackqueue(void);
1872 isc_result_t
new_parse (struct parse
**, int,
1873 char *, unsigned, const char *, int);
1874 isc_result_t
end_parse (struct parse
**);
1875 isc_result_t
save_parse_state(struct parse
*cfile
);
1876 isc_result_t
restore_parse_state(struct parse
*cfile
);
1877 enum dhcp_token
next_token (const char **, unsigned *, struct parse
*);
1878 enum dhcp_token
peek_token (const char **, unsigned *, struct parse
*);
1879 enum dhcp_token
next_raw_token(const char **rval
, unsigned *rlen
,
1880 struct parse
*cfile
);
1881 enum dhcp_token
peek_raw_token(const char **rval
, unsigned *rlen
,
1882 struct parse
*cfile
);
1885 void parse_trace_setup (void);
1886 isc_result_t
readconf (void);
1887 isc_result_t
read_conf_file (const char *, struct group
*, int, int);
1888 #if defined (TRACING)
1889 void trace_conf_input (trace_type_t
*, unsigned, char *);
1890 void trace_conf_stop (trace_type_t
*ttype
);
1892 isc_result_t
conf_file_subparse (struct parse
*, struct group
*, int);
1893 isc_result_t
lease_file_subparse (struct parse
*);
1894 int parse_statement (struct parse
*, struct group
*, int,
1895 struct host_decl
*, int);
1896 #if defined (FAILOVER_PROTOCOL)
1897 void parse_failover_peer (struct parse
*, struct group
*, int);
1898 void parse_failover_state_declaration (struct parse
*,
1899 dhcp_failover_state_t
*);
1900 void parse_failover_state (struct parse
*,
1901 enum failover_state
*, TIME
*);
1903 int permit_list_match (struct permit
*, struct permit
*);
1904 void parse_pool_statement (struct parse
*, struct group
*, int);
1905 int parse_lbrace (struct parse
*);
1906 void parse_host_declaration (struct parse
*, struct group
*);
1907 int parse_class_declaration (struct class **, struct parse
*,
1908 struct group
*, int);
1909 void parse_shared_net_declaration (struct parse
*, struct group
*);
1910 void parse_subnet_declaration (struct parse
*,
1911 struct shared_network
*);
1912 void parse_subnet6_declaration (struct parse
*,
1913 struct shared_network
*);
1914 void parse_group_declaration (struct parse
*, struct group
*);
1915 int parse_fixed_addr_param (struct option_cache
**,
1916 struct parse
*, enum dhcp_token
);
1917 int parse_lease_declaration (struct lease
**, struct parse
*);
1918 int parse_ip6_addr(struct parse
*, struct iaddr
*);
1919 int parse_ip6_addr_expr(struct expression
**, struct parse
*);
1920 int parse_ip6_prefix(struct parse
*, struct iaddr
*, u_int8_t
*);
1921 void parse_address_range (struct parse
*, struct group
*, int,
1922 struct pool
*, struct lease
**);
1923 void parse_address_range6(struct parse
*cfile
, struct group
*group
);
1924 void parse_prefix6(struct parse
*cfile
, struct group
*group
);
1925 void parse_fixed_prefix6(struct parse
*cfile
, struct host_decl
*host_decl
);
1926 void parse_ia_na_declaration(struct parse
*);
1927 void parse_ia_ta_declaration(struct parse
*);
1928 void parse_ia_pd_declaration(struct parse
*);
1929 void parse_server_duid(struct parse
*cfile
);
1930 void parse_server_duid_conf(struct parse
*cfile
);
1933 int ddns_updates(struct packet
*, struct lease
*, struct lease
*,
1934 struct iasubopt
*, struct iasubopt
*, struct option_state
*);
1935 int ddns_removals(struct lease
*, struct iasubopt
*, struct dhcp_ddns_cb
*, isc_boolean_t
);
1936 #if defined (TRACING)
1937 void trace_ddns_init(void);
1941 void add_enumeration (struct enumeration
*);
1942 struct enumeration
*find_enumeration (const char *, int);
1943 struct enumeration_value
*find_enumeration_value (const char *, int,
1946 void skip_to_semi (struct parse
*);
1947 void skip_to_rbrace (struct parse
*, int);
1948 int parse_semi (struct parse
*);
1949 int parse_string (struct parse
*, char **, unsigned *);
1950 char *parse_host_name (struct parse
*);
1951 int parse_ip_addr_or_hostname (struct expression
**,
1952 struct parse
*, int);
1953 void parse_hardware_param (struct parse
*, struct hardware
*);
1954 void parse_lease_time (struct parse
*, TIME
*);
1955 unsigned char *parse_numeric_aggregate (struct parse
*,
1956 unsigned char *, unsigned *,
1957 int, int, unsigned);
1958 void convert_num (struct parse
*, unsigned char *, const char *,
1960 TIME
parse_date (struct parse
*);
1961 TIME
parse_date_core(struct parse
*);
1962 isc_result_t
parse_option_name (struct parse
*, int, int *,
1964 void parse_option_space_decl (struct parse
*);
1965 int parse_option_code_definition (struct parse
*, struct option
*);
1966 int parse_base64 (struct data_string
*, struct parse
*);
1967 int parse_cshl (struct data_string
*, struct parse
*);
1968 int parse_executable_statement (struct executable_statement
**,
1969 struct parse
*, int *,
1970 enum expression_context
);
1971 int parse_executable_statements (struct executable_statement
**,
1972 struct parse
*, int *,
1973 enum expression_context
);
1974 int parse_zone (struct dns_zone
*, struct parse
*);
1975 int parse_key (struct parse
*);
1976 int parse_on_statement (struct executable_statement
**,
1977 struct parse
*, int *);
1978 int parse_switch_statement (struct executable_statement
**,
1979 struct parse
*, int *);
1980 int parse_case_statement (struct executable_statement
**,
1981 struct parse
*, int *,
1982 enum expression_context
);
1983 int parse_if_statement (struct executable_statement
**,
1984 struct parse
*, int *);
1985 int parse_boolean_expression (struct expression
**,
1986 struct parse
*, int *);
1987 int parse_boolean (struct parse
*);
1988 int parse_data_expression (struct expression
**,
1989 struct parse
*, int *);
1990 int parse_numeric_expression (struct expression
**,
1991 struct parse
*, int *);
1992 int parse_dns_expression (struct expression
**, struct parse
*, int *);
1993 int parse_non_binary (struct expression
**, struct parse
*, int *,
1994 enum expression_context
);
1995 int parse_expression (struct expression
**, struct parse
*, int *,
1996 enum expression_context
,
1997 struct expression
**, enum expr_op
);
1998 int parse_option_data(struct expression
**expr
, struct parse
*cfile
,
1999 int lookups
, struct option
*option
);
2000 int parse_option_statement (struct executable_statement
**,
2001 struct parse
*, int,
2002 struct option
*, enum statement_op
);
2003 int parse_option_token (struct expression
**, struct parse
*,
2004 const char **, struct expression
*, int, int);
2005 int parse_allow_deny (struct option_cache
**, struct parse
*, int);
2006 int parse_auth_key (struct data_string
*, struct parse
*);
2007 int parse_warn (struct parse
*, const char *, ...)
2008 __attribute__((__format__(__printf__
,2,3)));
2009 struct expression
*parse_domain_list(struct parse
*cfile
, int);
2013 #if defined (NSUPDATE)
2014 extern struct __res_state resolver_state
;
2015 extern int resolver_inited
;
2018 extern struct binding_scope
*global_scope
;
2019 pair
cons (caddr_t
, pair
);
2020 int make_const_option_cache (struct option_cache
**, struct buffer
**,
2021 u_int8_t
*, unsigned, struct option
*,
2023 int make_host_lookup (struct expression
**, const char *);
2024 int enter_dns_host (struct dns_host_entry
**, const char *);
2025 int make_const_data (struct expression
**,
2026 const unsigned char *, unsigned, int, int,
2028 int make_const_int (struct expression
**, unsigned long);
2029 int make_concat (struct expression
**,
2030 struct expression
*, struct expression
*);
2031 int make_encapsulation (struct expression
**, struct data_string
*);
2032 int make_substring (struct expression
**, struct expression
*,
2033 struct expression
*, struct expression
*);
2034 int make_limit (struct expression
**, struct expression
*, int);
2035 int make_let (struct executable_statement
**, const char *);
2036 int option_cache (struct option_cache
**, struct data_string
*,
2037 struct expression
*, struct option
*,
2039 int evaluate_expression (struct binding_value
**, struct packet
*,
2040 struct lease
*, struct client_state
*,
2041 struct option_state
*, struct option_state
*,
2042 struct binding_scope
**, struct expression
*,
2044 int binding_value_dereference (struct binding_value
**, const char *, int);
2045 #if defined (NSUPDATE_OLD)
2046 int evaluate_dns_expression (ns_updrec
**, struct packet
*,
2048 struct client_state
*,
2049 struct option_state
*,
2050 struct option_state
*,
2051 struct binding_scope
**,
2052 struct expression
*);
2054 int evaluate_boolean_expression (int *,
2055 struct packet
*, struct lease
*,
2056 struct client_state
*,
2057 struct option_state
*,
2058 struct option_state
*,
2059 struct binding_scope
**,
2060 struct expression
*);
2061 int evaluate_data_expression (struct data_string
*,
2062 struct packet
*, struct lease
*,
2063 struct client_state
*,
2064 struct option_state
*,
2065 struct option_state
*,
2066 struct binding_scope
**,
2067 struct expression
*, const char *, int);
2068 int evaluate_numeric_expression (unsigned long *, struct packet
*,
2069 struct lease
*, struct client_state
*,
2070 struct option_state
*, struct option_state
*,
2071 struct binding_scope
**,
2072 struct expression
*);
2073 int evaluate_option_cache (struct data_string
*,
2074 struct packet
*, struct lease
*,
2075 struct client_state
*,
2076 struct option_state
*, struct option_state
*,
2077 struct binding_scope
**,
2078 struct option_cache
*,
2080 int evaluate_boolean_option_cache (int *,
2081 struct packet
*, struct lease
*,
2082 struct client_state
*,
2083 struct option_state
*,
2084 struct option_state
*,
2085 struct binding_scope
**,
2086 struct option_cache
*,
2088 int evaluate_boolean_expression_result (int *,
2089 struct packet
*, struct lease
*,
2090 struct client_state
*,
2091 struct option_state
*,
2092 struct option_state
*,
2093 struct binding_scope
**,
2094 struct expression
*);
2095 void expression_dereference (struct expression
**, const char *, int);
2096 int is_dns_expression (struct expression
*);
2097 int is_boolean_expression (struct expression
*);
2098 int is_data_expression (struct expression
*);
2099 int is_numeric_expression (struct expression
*);
2100 int is_compound_expression (struct expression
*);
2101 int op_precedence (enum expr_op
, enum expr_op
);
2102 enum expression_context
expression_context (struct expression
*);
2103 enum expression_context
op_context (enum expr_op
);
2104 int write_expression (FILE *, struct expression
*, int, int, int);
2105 struct binding
*find_binding (struct binding_scope
*, const char *);
2106 int free_bindings (struct binding_scope
*, const char *, int);
2107 int binding_scope_dereference (struct binding_scope
**,
2109 int fundef_dereference (struct fundef
**, const char *, int);
2110 int data_subexpression_length (int *, struct expression
*);
2111 int expr_valid_for_context (struct expression
*, enum expression_context
);
2112 struct binding
*create_binding (struct binding_scope
**, const char *);
2113 int bind_ds_value (struct binding_scope
**,
2114 const char *, struct data_string
*);
2115 int find_bound_string (struct data_string
*,
2116 struct binding_scope
*, const char *);
2117 int unset (struct binding_scope
*, const char *);
2118 int data_string_sprintfa(struct data_string
*ds
, const char *fmt
, ...);
2121 extern int outstanding_pings
;
2122 extern int max_outstanding_acks
;
2123 extern int max_ack_delay_secs
;
2124 extern int max_ack_delay_usecs
;
2126 void dhcp (struct packet
*);
2127 void dhcpdiscover (struct packet
*, int);
2128 void dhcprequest (struct packet
*, int, struct lease
*);
2129 void dhcprelease (struct packet
*, int);
2130 void dhcpdecline (struct packet
*, int);
2131 void dhcpinform (struct packet
*, int);
2132 void nak_lease (struct packet
*, struct iaddr
*cip
);
2133 void ack_lease (struct packet
*, struct lease
*,
2134 unsigned int, TIME
, char *, int, struct host_decl
*);
2135 void delayed_ack_enqueue(struct lease
*);
2136 void commit_leases_readerdry(void *);
2137 void flush_ackqueue(void *);
2138 void dhcp_reply (struct lease
*);
2139 int find_lease (struct lease
**, struct packet
*,
2140 struct shared_network
*, int *, int *, struct lease
*,
2142 int mockup_lease (struct lease
**, struct packet
*,
2143 struct shared_network
*,
2144 struct host_decl
*);
2145 void static_lease_dereference (struct lease
*, const char *, int);
2147 int allocate_lease (struct lease
**, struct packet
*,
2148 struct pool
*, int *);
2149 int permitted (struct packet
*, struct permit
*);
2150 int locate_network (struct packet
*);
2151 int parse_agent_information_option (struct packet
*, int, u_int8_t
*);
2152 unsigned cons_agent_information_options (struct option_state
*,
2153 struct dhcp_packet
*,
2154 unsigned, unsigned);
2155 void get_server_source_address(struct in_addr
*from
,
2156 struct option_state
*options
,
2157 struct packet
*packet
);
2159 /* dhcpleasequery.c */
2160 void dhcpleasequery (struct packet
*, int);
2161 void dhcpv6_leasequery (struct data_string
*, struct packet
*);
2164 isc_boolean_t
server_duid_isset(void);
2165 void copy_server_duid(struct data_string
*ds
, const char *file
, int line
);
2166 void set_server_duid(struct data_string
*new_duid
);
2167 isc_result_t
set_server_duid_from_option(void);
2168 void set_server_duid_type(int type
);
2169 isc_result_t
generate_new_server_duid(void);
2170 isc_result_t
get_client_id(struct packet
*, struct data_string
*);
2171 void dhcpv6(struct packet
*);
2174 void bootp (struct packet
*);
2177 extern int (*group_write_hook
) (struct group_object
*);
2178 extern struct group
*root_group
;
2179 extern group_hash_t
*group_name_hash
;
2180 isc_result_t
delete_group (struct group_object
*, int);
2181 isc_result_t
supersede_group (struct group_object
*, int);
2182 int clone_group (struct group
**, struct group
*, const char *, int);
2183 int write_group (struct group_object
*);
2186 void relinquish_lease_hunks (void);
2187 struct lease
*new_leases (unsigned, const char *, int);
2188 #if defined (DEBUG_MEMORY_LEAKAGE) || \
2189 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
2190 void relinquish_free_lease_states (void);
2192 OMAPI_OBJECT_ALLOC_DECL (lease
, struct lease
, dhcp_type_lease
)
2193 OMAPI_OBJECT_ALLOC_DECL (class, struct class, dhcp_type_class
)
2194 OMAPI_OBJECT_ALLOC_DECL (subclass
, struct class, dhcp_type_subclass
)
2195 OMAPI_OBJECT_ALLOC_DECL (pool
, struct pool
, dhcp_type_pool
)
2196 OMAPI_OBJECT_ALLOC_DECL (host
, struct host_decl
, dhcp_type_host
)
2199 OMAPI_OBJECT_ALLOC_DECL (subnet
, struct subnet
, dhcp_type_subnet
)
2200 OMAPI_OBJECT_ALLOC_DECL (shared_network
, struct shared_network
,
2201 dhcp_type_shared_network
)
2202 OMAPI_OBJECT_ALLOC_DECL (group_object
, struct group_object
, dhcp_type_group
)
2203 OMAPI_OBJECT_ALLOC_DECL (dhcp_control
,
2204 dhcp_control_object_t
, dhcp_type_control
)
2206 #if defined (DEBUG_MEMORY_LEAKAGE) || \
2207 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
2208 void relinquish_free_pairs (void);
2209 void relinquish_free_expressions (void);
2210 void relinquish_free_binding_values (void);
2211 void relinquish_free_option_caches (void);
2212 void relinquish_free_packets (void);
2215 int option_chain_head_allocate (struct option_chain_head
**,
2217 int option_chain_head_reference (struct option_chain_head
**,
2218 struct option_chain_head
*,
2220 int option_chain_head_dereference (struct option_chain_head
**,
2222 int group_allocate (struct group
**, const char *, int);
2223 int group_reference (struct group
**, struct group
*, const char *, int);
2224 int group_dereference (struct group
**, const char *, int);
2225 struct dhcp_packet
*new_dhcp_packet (const char *, int);
2226 struct protocol
*new_protocol (const char *, int);
2227 struct lease_state
*new_lease_state (const char *, int);
2228 struct domain_search_list
*new_domain_search_list (const char *, int);
2229 struct name_server
*new_name_server (const char *, int);
2230 void free_name_server (struct name_server
*, const char *, int);
2231 struct option
*new_option (const char *, const char *, int);
2232 int option_reference(struct option
**dest
, struct option
*src
,
2233 const char * file
, int line
);
2234 int option_dereference(struct option
**dest
, const char *file
, int line
);
2235 struct universe
*new_universe (const char *, int);
2236 void free_universe (struct universe
*, const char *, int);
2237 void free_domain_search_list (struct domain_search_list
*,
2239 void free_lease_state (struct lease_state
*, const char *, int);
2240 void free_protocol (struct protocol
*, const char *, int);
2241 void free_dhcp_packet (struct dhcp_packet
*, const char *, int);
2242 struct client_lease
*new_client_lease (const char *, int);
2243 void free_client_lease (struct client_lease
*, const char *, int);
2244 struct permit
*new_permit (const char *, int);
2245 void free_permit (struct permit
*, const char *, int);
2246 pair
new_pair (const char *, int);
2247 void free_pair (pair
, const char *, int);
2248 int expression_allocate (struct expression
**, const char *, int);
2249 int expression_reference (struct expression
**,
2250 struct expression
*, const char *, int);
2251 void free_expression (struct expression
*, const char *, int);
2252 int binding_value_allocate (struct binding_value
**,
2254 int binding_value_reference (struct binding_value
**,
2255 struct binding_value
*,
2257 void free_binding_value (struct binding_value
*, const char *, int);
2258 int fundef_allocate (struct fundef
**, const char *, int);
2259 int fundef_reference (struct fundef
**,
2260 struct fundef
*, const char *, int);
2261 int option_cache_allocate (struct option_cache
**, const char *, int);
2262 int option_cache_reference (struct option_cache
**,
2263 struct option_cache
*, const char *, int);
2264 int buffer_allocate (struct buffer
**, unsigned, const char *, int);
2265 int buffer_reference (struct buffer
**, struct buffer
*,
2267 int buffer_dereference (struct buffer
**, const char *, int);
2268 int dns_host_entry_allocate (struct dns_host_entry
**,
2269 const char *, const char *, int);
2270 int dns_host_entry_reference (struct dns_host_entry
**,
2271 struct dns_host_entry
*,
2273 int dns_host_entry_dereference (struct dns_host_entry
**,
2275 int option_state_allocate (struct option_state
**, const char *, int);
2276 int option_state_reference (struct option_state
**,
2277 struct option_state
*, const char *, int);
2278 int option_state_dereference (struct option_state
**,
2280 void data_string_copy(struct data_string
*, const struct data_string
*,
2282 void data_string_forget (struct data_string
*, const char *, int);
2283 void data_string_truncate (struct data_string
*, int);
2284 int executable_statement_allocate (struct executable_statement
**,
2286 int executable_statement_reference (struct executable_statement
**,
2287 struct executable_statement
*,
2289 int packet_allocate (struct packet
**, const char *, int);
2290 int packet_reference (struct packet
**,
2291 struct packet
*, const char *, int);
2292 int packet_dereference (struct packet
**, const char *, int);
2293 int binding_scope_allocate (struct binding_scope
**,
2295 int binding_scope_reference (struct binding_scope
**,
2296 struct binding_scope
*,
2298 int dns_zone_allocate (struct dns_zone
**, const char *, int);
2299 int dns_zone_reference (struct dns_zone
**,
2300 struct dns_zone
*, const char *, int);
2303 #define DEFAULT_TIME_FORMAT 0
2304 #define LOCAL_TIME_FORMAT 1
2305 extern int db_time_format
;
2306 char *quotify_string (const char *, const char *, int);
2307 char *quotify_buf (const unsigned char *, unsigned, const char *, int);
2308 char *print_base64 (const unsigned char *, unsigned, const char *, int);
2309 char *print_hw_addr (const int, const int, const unsigned char *);
2310 void print_lease (struct lease
*);
2311 void dump_raw (const unsigned char *, unsigned);
2312 void dump_packet_option (struct option_cache
*, struct packet
*,
2313 struct lease
*, struct client_state
*,
2314 struct option_state
*, struct option_state
*,
2315 struct binding_scope
**, struct universe
*, void *);
2316 void dump_packet (struct packet
*);
2317 void hash_dump (struct hash_table
*);
2318 char *print_hex (unsigned, const u_int8_t
*, unsigned, unsigned);
2319 void print_hex_only (unsigned, const u_int8_t
*, unsigned, char *);
2320 void print_hex_or_string (unsigned, const u_int8_t
*, unsigned, char *);
2321 #define print_hex_1(len, data, limit) print_hex(len, data, limit, 0)
2322 #define print_hex_2(len, data, limit) print_hex(len, data, limit, 1)
2323 #define print_hex_3(len, data, limit) print_hex(len, data, limit, 2)
2324 char *print_dotted_quads (unsigned, const u_int8_t
*);
2325 char *print_dec_1 (unsigned long);
2326 char *print_dec_2 (unsigned long);
2327 void print_expression (const char *, struct expression
*);
2328 int token_print_indent_concat (FILE *, int, int,
2329 const char *, const char *, ...);
2330 int token_indent_data_string (FILE *, int, int, const char *, const char *,
2331 struct data_string
*);
2332 int token_print_indent (FILE *, int, int,
2333 const char *, const char *, const char *);
2334 void indent_spaces (FILE *, int);
2335 #if defined (NSUPDATE)
2336 void print_dns_status (int, struct dhcp_ddns_cb
*, isc_result_t
);
2338 const char *print_time(TIME
);
2340 void get_hw_addr(const char *name
, struct hardware
*hw
);
2343 #if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_RECEIVE) \
2344 || defined (USE_SOCKET_FALLBACK)
2345 int if_register_socket(struct interface_info
*, int, int *);
2348 #if defined (USE_SOCKET_FALLBACK) && !defined (USE_SOCKET_SEND)
2349 void if_reinitialize_fallback (struct interface_info
*);
2350 void if_register_fallback (struct interface_info
*);
2351 ssize_t
send_fallback (struct interface_info
*,
2352 struct packet
*, struct dhcp_packet
*, size_t,
2354 struct sockaddr_in
*, struct hardware
*);
2355 ssize_t
send_fallback6(struct interface_info
*, struct packet
*,
2356 struct dhcp_packet
*, size_t, struct in6_addr
,
2357 struct sockaddr_in6
*, struct hardware
*);
2360 #ifdef USE_SOCKET_SEND
2361 void if_reinitialize_send (struct interface_info
*);
2362 void if_register_send (struct interface_info
*);
2363 void if_deregister_send (struct interface_info
*);
2364 ssize_t
send_packet (struct interface_info
*,
2365 struct packet
*, struct dhcp_packet
*, size_t,
2367 struct sockaddr_in
*, struct hardware
*);
2369 ssize_t
send_packet6(struct interface_info
*, const unsigned char *, size_t,
2370 struct sockaddr_in6
*);
2371 #ifdef USE_SOCKET_RECEIVE
2372 void if_reinitialize_receive (struct interface_info
*);
2373 void if_register_receive (struct interface_info
*);
2374 void if_deregister_receive (struct interface_info
*);
2375 ssize_t
receive_packet (struct interface_info
*,
2376 unsigned char *, size_t,
2377 struct sockaddr_in
*, struct hardware
*);
2380 #if defined (USE_SOCKET_FALLBACK)
2381 isc_result_t
fallback_discard (omapi_object_t
*);
2384 #if defined (USE_SOCKET_SEND)
2385 int can_unicast_without_arp (struct interface_info
*);
2386 int can_receive_unicast_unconfigured (struct interface_info
*);
2387 int supports_multiple_interfaces (struct interface_info
*);
2388 void maybe_setup_fallback (void);
2391 void if_register6(struct interface_info
*info
, int do_multicast
);
2392 ssize_t
receive_packet6(struct interface_info
*interface
,
2393 unsigned char *buf
, size_t len
,
2394 struct sockaddr_in6
*from
, struct in6_addr
*to_addr
,
2395 unsigned int *if_index
);
2396 void if_deregister6(struct interface_info
*info
);
2400 #if defined (USE_BPF_SEND) || defined (USE_BPF_RECEIVE)
2401 int if_register_bpf (struct interface_info
*);
2404 void if_reinitialize_send (struct interface_info
*);
2405 void if_register_send (struct interface_info
*);
2406 void if_deregister_send (struct interface_info
*);
2407 ssize_t
send_packet (struct interface_info
*,
2408 struct packet
*, struct dhcp_packet
*, size_t,
2410 struct sockaddr_in
*, struct hardware
*);
2412 #ifdef USE_BPF_RECEIVE
2413 void if_reinitialize_receive (struct interface_info
*);
2414 void if_register_receive (struct interface_info
*);
2415 void if_deregister_receive (struct interface_info
*);
2416 ssize_t
receive_packet (struct interface_info
*,
2417 unsigned char *, size_t,
2418 struct sockaddr_in
*, struct hardware
*);
2420 #if defined (USE_BPF_SEND)
2421 int can_unicast_without_arp (struct interface_info
*);
2422 int can_receive_unicast_unconfigured (struct interface_info
*);
2423 int supports_multiple_interfaces (struct interface_info
*);
2424 void maybe_setup_fallback (void);
2428 #if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE)
2429 int if_register_lpf (struct interface_info
*);
2432 void if_reinitialize_send (struct interface_info
*);
2433 void if_register_send (struct interface_info
*);
2434 void if_deregister_send (struct interface_info
*);
2435 ssize_t
send_packet (struct interface_info
*,
2436 struct packet
*, struct dhcp_packet
*, size_t,
2438 struct sockaddr_in
*, struct hardware
*);
2440 #ifdef USE_LPF_RECEIVE
2441 void if_reinitialize_receive (struct interface_info
*);
2442 void if_register_receive (struct interface_info
*);
2443 void if_deregister_receive (struct interface_info
*);
2444 ssize_t
receive_packet (struct interface_info
*,
2445 unsigned char *, size_t,
2446 struct sockaddr_in
*, struct hardware
*);
2448 #if defined (USE_LPF_SEND)
2449 int can_unicast_without_arp (struct interface_info
*);
2450 int can_receive_unicast_unconfigured (struct interface_info
*);
2451 int supports_multiple_interfaces (struct interface_info
*);
2452 void maybe_setup_fallback (void);
2456 #if defined (USE_NIT_SEND) || defined (USE_NIT_RECEIVE)
2457 int if_register_nit (struct interface_info
*);
2461 void if_reinitialize_send (struct interface_info
*);
2462 void if_register_send (struct interface_info
*);
2463 void if_deregister_send (struct interface_info
*);
2464 ssize_t
send_packet (struct interface_info
*,
2465 struct packet
*, struct dhcp_packet
*, size_t,
2467 struct sockaddr_in
*, struct hardware
*);
2469 #ifdef USE_NIT_RECEIVE
2470 void if_reinitialize_receive (struct interface_info
*);
2471 void if_register_receive (struct interface_info
*);
2472 void if_deregister_receive (struct interface_info
*);
2473 ssize_t
receive_packet (struct interface_info
*,
2474 unsigned char *, size_t,
2475 struct sockaddr_in
*, struct hardware
*);
2477 #if defined (USE_NIT_SEND)
2478 int can_unicast_without_arp (struct interface_info
*);
2479 int can_receive_unicast_unconfigured (struct interface_info
*);
2480 int supports_multiple_interfaces (struct interface_info
*);
2481 void maybe_setup_fallback (void);
2485 #if defined (USE_DLPI_SEND) || defined (USE_DLPI_RECEIVE)
2486 int if_register_dlpi (struct interface_info
*);
2489 #ifdef USE_DLPI_SEND
2490 int can_unicast_without_arp (struct interface_info
*);
2491 int can_receive_unicast_unconfigured (struct interface_info
*);
2492 void if_reinitialize_send (struct interface_info
*);
2493 void if_register_send (struct interface_info
*);
2494 void if_deregister_send (struct interface_info
*);
2495 ssize_t
send_packet (struct interface_info
*,
2496 struct packet
*, struct dhcp_packet
*, size_t,
2498 struct sockaddr_in
*, struct hardware
*);
2499 int supports_multiple_interfaces (struct interface_info
*);
2500 void maybe_setup_fallback (void);
2502 #ifdef USE_DLPI_RECEIVE
2503 void if_reinitialize_receive (struct interface_info
*);
2504 void if_register_receive (struct interface_info
*);
2505 void if_deregister_receive (struct interface_info
*);
2506 ssize_t
receive_packet (struct interface_info
*,
2507 unsigned char *, size_t,
2508 struct sockaddr_in
*, struct hardware
*);
2514 void if_reinitialize_send (struct interface_info
*);
2515 void if_register_send (struct interface_info
*);
2516 void if_deregister_send (struct interface_info
*);
2517 ssize_t
send_packet (struct interface_info
*, struct packet
*,
2518 struct dhcp_packet
*, size_t, struct in_addr
,
2519 struct sockaddr_in
*, struct hardware
*);
2520 int can_unicast_without_arp (struct interface_info
*);
2521 int can_receive_unicast_unconfigured (struct interface_info
*);
2522 int supports_multiple_interfaces (struct interface_info
*);
2523 void maybe_setup_fallback (void);
2527 extern struct interface_info
*interfaces
,
2528 *dummy_interfaces
, *fallback_interface
;
2529 extern struct protocol
*protocols
;
2530 extern int quiet_interface_discovery
;
2531 isc_result_t
interface_setup (void);
2532 void interface_trace_setup (void);
2534 extern struct in_addr limited_broadcast
;
2535 extern int local_family
;
2536 extern struct in_addr local_address
;
2537 extern struct in6_addr local_address6
;
2539 extern u_int16_t local_port
;
2540 extern u_int16_t remote_port
;
2541 extern int (*dhcp_interface_setup_hook
) (struct interface_info
*,
2543 extern int (*dhcp_interface_discovery_hook
) (struct interface_info
*);
2544 extern isc_result_t (*dhcp_interface_startup_hook
) (struct interface_info
*);
2546 extern void (*bootp_packet_handler
) (struct interface_info
*,
2547 struct dhcp_packet
*, unsigned,
2549 struct iaddr
, struct hardware
*);
2550 extern void (*dhcpv6_packet_handler
)(struct interface_info
*,
2552 int, const struct iaddr
*, isc_boolean_t
);
2553 extern struct timeout
*timeouts
;
2554 extern omapi_object_type_t
*dhcp_type_interface
;
2555 #if defined (TRACING)
2556 extern trace_type_t
*interface_trace
;
2557 extern trace_type_t
*inpacket_trace
;
2558 extern trace_type_t
*outpacket_trace
;
2560 extern struct interface_info
**interface_vector
;
2561 extern int interface_count
;
2562 extern int interface_max
;
2563 isc_result_t
interface_initialize(omapi_object_t
*, const char *, int);
2564 void discover_interfaces(int);
2565 int setup_fallback (struct interface_info
**, const char *, int);
2566 int if_readsocket (omapi_object_t
*);
2567 void reinitialize_interfaces (void);
2570 void set_time(TIME
);
2571 struct timeval
*process_outstanding_timeouts (struct timeval
*);
2572 void dispatch (void);
2573 isc_result_t
got_one(omapi_object_t
*);
2574 isc_result_t
got_one_v6(omapi_object_t
*);
2575 isc_result_t
interface_set_value (omapi_object_t
*, omapi_object_t
*,
2576 omapi_data_string_t
*, omapi_typed_data_t
*);
2577 isc_result_t
interface_get_value (omapi_object_t
*, omapi_object_t
*,
2578 omapi_data_string_t
*, omapi_value_t
**);
2579 isc_result_t
interface_destroy (omapi_object_t
*, const char *, int);
2580 isc_result_t
interface_signal_handler (omapi_object_t
*,
2581 const char *, va_list);
2582 isc_result_t
interface_stuff_values (omapi_object_t
*,
2586 void add_timeout (struct timeval
*, void (*) (void *), void *,
2587 tvref_t
, tvunref_t
);
2588 void cancel_timeout (void (*) (void *), void *);
2589 void cancel_all_timeouts (void);
2590 void relinquish_timeouts (void);
2592 OMAPI_OBJECT_ALLOC_DECL (interface
,
2593 struct interface_info
, dhcp_type_interface
)
2596 extern char *default_option_format
;
2597 extern struct universe dhcp_universe
;
2598 extern struct universe dhcpv6_universe
;
2599 extern struct universe nwip_universe
;
2600 extern struct universe fqdn_universe
;
2601 extern struct universe vsio_universe
;
2602 extern int dhcp_option_default_priority_list
[];
2603 extern int dhcp_option_default_priority_list_count
;
2604 extern const char *hardware_types
[256];
2605 extern int universe_count
, universe_max
;
2606 extern struct universe
**universes
;
2607 extern universe_hash_t
*universe_hash
;
2608 void initialize_common_option_spaces (void);
2609 extern struct universe
*config_universe
;
2612 #if defined (FAILOVER_PROTOCOL)
2613 extern failover_option_t null_failover_option
;
2614 extern failover_option_t skip_failover_option
;
2615 extern struct failover_option_info ft_options
[];
2616 extern u_int32_t fto_allowed
[];
2617 extern int ft_sizes
[];
2618 extern const char *dhcp_flink_state_names
[];
2620 extern const char *binding_state_names
[];
2622 extern struct universe agent_universe
;
2623 extern struct universe server_universe
;
2625 extern struct enumeration ddns_styles
;
2626 extern struct enumeration syslog_enum
;
2627 void initialize_server_option_spaces (void);
2630 struct iaddr
subnet_number (struct iaddr
, struct iaddr
);
2631 struct iaddr
ip_addr (struct iaddr
, struct iaddr
, u_int32_t
);
2632 struct iaddr
broadcast_addr (struct iaddr
, struct iaddr
);
2633 u_int32_t
host_addr (struct iaddr
, struct iaddr
);
2634 int addr_eq (struct iaddr
, struct iaddr
);
2635 int addr_match(struct iaddr
*, struct iaddrmatch
*);
2636 int addr_cmp(const struct iaddr
*a1
, const struct iaddr
*a2
);
2637 int addr_or(struct iaddr
*result
,
2638 const struct iaddr
*a1
, const struct iaddr
*a2
);
2639 int addr_and(struct iaddr
*result
,
2640 const struct iaddr
*a1
, const struct iaddr
*a2
);
2641 isc_boolean_t
is_cidr_mask_valid(const struct iaddr
*addr
, int bits
);
2642 isc_result_t
range2cidr(struct iaddrcidrnetlist
**result
,
2643 const struct iaddr
*lo
, const struct iaddr
*hi
);
2644 isc_result_t
free_iaddrcidrnetlist(struct iaddrcidrnetlist
**result
);
2645 const char *piaddr (struct iaddr
);
2646 char *piaddrmask(struct iaddr
*, struct iaddr
*);
2647 char *piaddrcidr(const struct iaddr
*, unsigned int);
2648 u_int16_t
validate_port(char *);
2653 extern int wanted_ia_na
;
2654 extern int wanted_ia_ta
;
2655 extern int wanted_ia_pd
;
2657 extern const char *path_dhclient_conf
;
2658 extern const char *path_dhclient_db
;
2659 extern const char *path_dhclient_pid
;
2660 extern char *path_dhclient_script
;
2661 extern int interfaces_requested
;
2662 extern struct data_string default_duid
;
2663 extern int duid_type
;
2665 extern struct client_config top_level_config
;
2667 void dhcpoffer (struct packet
*);
2668 void dhcpack (struct packet
*);
2669 void dhcpnak (struct packet
*);
2671 void send_discover (void *);
2672 void send_request (void *);
2673 void send_release (void *);
2674 void send_decline (void *);
2676 void state_reboot (void *);
2677 void state_init (void *);
2678 void state_selecting (void *);
2679 void state_requesting (void *);
2680 void state_bound (void *);
2681 void state_stop (void *);
2682 void state_panic (void *);
2684 void bind_lease (struct client_state
*);
2686 void make_client_options (struct client_state
*,
2687 struct client_lease
*, u_int8_t
*,
2688 struct option_cache
*, struct iaddr
*,
2689 struct option
**, struct option_state
**);
2690 void make_discover (struct client_state
*, struct client_lease
*);
2691 void make_request (struct client_state
*, struct client_lease
*);
2692 void make_decline (struct client_state
*, struct client_lease
*);
2693 void make_release (struct client_state
*, struct client_lease
*);
2695 void destroy_client_lease (struct client_lease
*);
2696 void rewrite_client_leases (void);
2697 void write_lease_option (struct option_cache
*, struct packet
*,
2698 struct lease
*, struct client_state
*,
2699 struct option_state
*, struct option_state
*,
2700 struct binding_scope
**, struct universe
*, void *);
2701 int write_client_lease (struct client_state
*, struct client_lease
*, int, int);
2702 isc_result_t
write_client6_lease(struct client_state
*client
,
2703 struct dhc6_lease
*lease
,
2704 int rewrite
, int sync
);
2705 int dhcp_option_ev_name (char *, size_t, struct option
*);
2707 void script_init (struct client_state
*, const char *,
2708 struct string_list
*);
2709 void client_option_envadd (struct option_cache
*, struct packet
*,
2710 struct lease
*, struct client_state
*,
2711 struct option_state
*, struct option_state
*,
2712 struct binding_scope
**, struct universe
*, void *);
2713 void script_write_params (struct client_state
*, const char *,
2714 struct client_lease
*);
2715 int script_go (struct client_state
*);
2716 void client_envadd (struct client_state
*,
2717 const char *, const char *, const char *, ...)
2718 __attribute__((__format__(__printf__
,4,5)));
2720 struct client_lease
*packet_to_lease (struct packet
*, struct client_state
*);
2721 void go_daemon (void);
2722 void write_client_pid_file (void);
2723 void client_location_changed (void);
2724 void do_release (struct client_state
*);
2725 int dhclient_interface_shutdown_hook (struct interface_info
*);
2726 int dhclient_interface_discovery_hook (struct interface_info
*);
2727 isc_result_t
dhclient_interface_startup_hook (struct interface_info
*);
2728 void dhclient_schedule_updates(struct client_state
*client
,
2729 struct iaddr
*addr
, int offset
);
2730 void client_dns_update_timeout (void *cp
);
2731 isc_result_t
client_dns_update(struct client_state
*client
,
2732 dhcp_ddns_cb_t
*ddns_cb
);
2733 void client_dns_remove(struct client_state
*client
, struct iaddr
*addr
);
2735 void dhcpv4_client_assignments(void);
2736 void dhcpv6_client_assignments(void);
2739 void form_duid(struct data_string
*duid
, const char *file
, int line
);
2740 void dhc6_lease_destroy(struct dhc6_lease
**src
, const char *file
, int line
);
2741 void start_init6(struct client_state
*client
);
2742 void start_info_request6(struct client_state
*client
);
2743 void start_confirm6(struct client_state
*client
);
2744 void start_release6(struct client_state
*client
);
2745 void start_selecting6(struct client_state
*client
);
2746 void unconfigure6(struct client_state
*client
, const char *reason
);
2749 int write_lease (struct lease
*);
2750 int write_host (struct host_decl
*);
2751 int write_server_duid(void);
2752 #if defined (FAILOVER_PROTOCOL)
2753 int write_failover_state (dhcp_failover_state_t
*);
2755 int db_printable (const unsigned char *);
2756 int db_printable_len (const unsigned char *, unsigned);
2757 isc_result_t
write_named_billing_class(const void *, unsigned, void *);
2758 void write_billing_classes (void);
2759 int write_billing_class (struct class *);
2760 void commit_leases_timeout (void *);
2761 void commit_leases_readerdry(void *);
2762 int commit_leases (void);
2763 void db_startup (int);
2764 int new_lease_file (void);
2765 int group_writer (struct group_object
*);
2766 int write_ia(const struct ia_xx
*);
2769 u_int32_t
checksum (unsigned char *, unsigned, u_int32_t
);
2770 u_int32_t
wrapsum (u_int32_t
);
2771 void assemble_hw_header (struct interface_info
*, unsigned char *,
2772 unsigned *, struct hardware
*);
2773 void assemble_udp_ip_header (struct interface_info
*, unsigned char *,
2774 unsigned *, u_int32_t
, u_int32_t
,
2775 u_int32_t
, unsigned char *, unsigned);
2776 ssize_t
decode_hw_header (struct interface_info
*, unsigned char *,
2777 unsigned, struct hardware
*);
2778 ssize_t
decode_udp_ip_header (struct interface_info
*, unsigned char *,
2779 unsigned, struct sockaddr_in
*,
2780 unsigned, unsigned *);
2783 void assemble_ethernet_header (struct interface_info
*, unsigned char *,
2784 unsigned *, struct hardware
*);
2785 ssize_t
decode_ethernet_header (struct interface_info
*,
2787 unsigned, struct hardware
*);
2790 void assemble_tr_header (struct interface_info
*, unsigned char *,
2791 unsigned *, struct hardware
*);
2792 ssize_t
decode_tr_header (struct interface_info
*,
2794 unsigned, struct hardware
*);
2797 void convert_statement (struct parse
*);
2798 void convert_host_statement (struct parse
*, jrefproto
);
2799 void convert_host_name (struct parse
*, jrefproto
);
2800 void convert_class_statement (struct parse
*, jrefproto
, int);
2801 void convert_class_decl (struct parse
*, jrefproto
);
2802 void convert_lease_time (struct parse
*, jrefproto
, char *);
2803 void convert_shared_net_statement (struct parse
*, jrefproto
);
2804 void convert_subnet_statement (struct parse
*, jrefproto
);
2805 void convert_subnet_decl (struct parse
*, jrefproto
);
2806 void convert_host_decl (struct parse
*, jrefproto
);
2807 void convert_hardware_decl (struct parse
*, jrefproto
);
2808 void convert_hardware_addr (struct parse
*, jrefproto
);
2809 void convert_filename_decl (struct parse
*, jrefproto
);
2810 void convert_servername_decl (struct parse
*, jrefproto
);
2811 void convert_ip_addr_or_hostname (struct parse
*, jrefproto
, int);
2812 void convert_fixed_addr_decl (struct parse
*, jrefproto
);
2813 void convert_option_decl (struct parse
*, jrefproto
);
2814 void convert_lease_statement (struct parse
*, jrefproto
);
2815 void convert_address_range (struct parse
*, jrefproto
);
2816 void convert_date (struct parse
*, jrefproto
, char *);
2817 void convert_numeric_aggregate (struct parse
*, jrefproto
, int, int, int, int);
2821 void add_route_direct (struct interface_info
*, struct in_addr
);
2822 void add_route_net (struct interface_info
*, struct in_addr
, struct in_addr
);
2823 void add_route_default_gateway (struct interface_info
*, struct in_addr
);
2824 void remove_routes (struct in_addr
);
2825 void remove_if_route (struct interface_info
*, struct in_addr
);
2826 void remove_all_if_routes (struct interface_info
*);
2827 void set_netmask (struct interface_info
*, struct in_addr
);
2828 void set_broadcast_addr (struct interface_info
*, struct in_addr
);
2829 void set_ip_address (struct interface_info
*, struct in_addr
);
2832 isc_result_t
read_client_conf (void);
2833 int read_client_conf_file (const char *,
2834 struct interface_info
*, struct client_config
*);
2835 void read_client_leases (void);
2836 void parse_client_statement (struct parse
*, struct interface_info
*,
2837 struct client_config
*);
2838 int parse_X (struct parse
*, u_int8_t
*, unsigned);
2839 int parse_option_list (struct parse
*, struct option
***);
2840 void parse_interface_declaration (struct parse
*,
2841 struct client_config
*, char *);
2842 int interface_or_dummy (struct interface_info
**, const char *);
2843 void make_client_state (struct client_state
**);
2844 void make_client_config (struct client_state
*, struct client_config
*);
2845 void parse_client_lease_statement (struct parse
*, int);
2846 void parse_client_lease_declaration (struct parse
*,
2847 struct client_lease
*,
2848 struct interface_info
**,
2849 struct client_state
**);
2850 int parse_option_decl (struct option_cache
**, struct parse
*);
2851 void parse_string_list (struct parse
*, struct string_list
**, int);
2852 int parse_ip_addr (struct parse
*, struct iaddr
*);
2853 int parse_ip_addr_with_subnet(struct parse
*, struct iaddrmatch
*);
2854 void parse_reject_statement (struct parse
*, struct client_config
*);
2857 OMAPI_OBJECT_ALLOC_DECL (icmp_state
, struct icmp_state
, dhcp_type_icmp
)
2858 extern struct icmp_state
*icmp_state
;
2859 void icmp_startup (int, void (*) (struct iaddr
, u_int8_t
*, int));
2860 int icmp_readsocket (omapi_object_t
*);
2861 int icmp_echorequest (struct iaddr
*);
2862 isc_result_t
icmp_echoreply (omapi_object_t
*);
2865 #if defined (NSUPDATE)
2866 isc_result_t
find_tsig_key (ns_tsig_key
**, const char *, struct dns_zone
*);
2867 void tkey_free (ns_tsig_key
**);
2869 isc_result_t
enter_dns_zone (struct dns_zone
*);
2870 isc_result_t
dns_zone_lookup (struct dns_zone
**, const char *);
2871 int dns_zone_dereference (struct dns_zone
**, const char *, int);
2872 #if defined (NSUPDATE)
2873 #define FIND_FORWARD 0
2874 #define FIND_REVERSE 1
2875 isc_result_t
find_cached_zone (dhcp_ddns_cb_t
*, int);
2876 void forget_zone (struct dns_zone
**);
2877 void repudiate_zone (struct dns_zone
**);
2878 //void cache_found_zone (ns_class, char *, struct in_addr *, int);
2879 int get_dhcid (struct data_string
*, int, const u_int8_t
*, unsigned);
2880 void dhcid_tolease (struct data_string
*, struct data_string
*);
2881 isc_result_t
dhcid_fromlease (struct data_string
*, struct data_string
*);
2882 isc_result_t
ddns_update_fwd(struct data_string
*, struct iaddr
,
2883 struct data_string
*, unsigned long, unsigned,
2885 isc_result_t
ddns_remove_fwd(struct data_string
*,
2886 struct iaddr
, struct data_string
*);
2887 #endif /* NSUPDATE */
2890 extern char path_resolv_conf
[];
2891 extern struct name_server
*name_servers
;
2892 extern struct domain_search_list
*domains
;
2894 void read_resolv_conf (TIME
);
2895 struct name_server
*first_name_server (void);
2898 #ifdef NEED_INET_ATON
2899 int inet_aton (const char *, struct in_addr
*);
2903 extern int have_billing_classes
;
2904 struct class unknown_class
;
2905 struct class known_class
;
2906 struct collection default_collection
;
2907 struct collection
*collections
;
2908 extern struct executable_statement
*default_classification_rules
;
2910 void classification_setup (void);
2911 void classify_client (struct packet
*);
2912 int check_collection (struct packet
*, struct lease
*, struct collection
*);
2913 void classify (struct packet
*, struct class *);
2914 isc_result_t
unlink_class (struct class **class);
2915 isc_result_t
find_class (struct class **, const char *,
2917 int unbill_class (struct lease
*, struct class *);
2918 int bill_class (struct lease
*, struct class *);
2921 int execute_statements (struct binding_value
**result
,
2922 struct packet
*, struct lease
*,
2923 struct client_state
*,
2924 struct option_state
*, struct option_state
*,
2925 struct binding_scope
**,
2926 struct executable_statement
*);
2927 void execute_statements_in_scope (struct binding_value
**result
,
2928 struct packet
*, struct lease
*,
2929 struct client_state
*,
2930 struct option_state
*,
2931 struct option_state
*,
2932 struct binding_scope
**,
2933 struct group
*, struct group
*);
2934 int executable_statement_dereference (struct executable_statement
**,
2936 void write_statements (FILE *, struct executable_statement
*, int);
2937 int find_matching_case (struct executable_statement
**,
2938 struct packet
*, struct lease
*, struct client_state
*,
2939 struct option_state
*, struct option_state
*,
2940 struct binding_scope
**,
2941 struct expression
*, struct executable_statement
*);
2942 int executable_statement_foreach (struct executable_statement
*,
2943 int (*) (struct executable_statement
*,
2944 void *, int), void *, int);
2947 extern omapi_object_type_t
*dhcp_type_group
;
2948 extern omapi_object_type_t
*dhcp_type_shared_network
;
2949 extern omapi_object_type_t
*dhcp_type_subnet
;
2950 extern omapi_object_type_t
*dhcp_type_control
;
2951 extern dhcp_control_object_t
*dhcp_control_object
;
2953 void dhcp_common_objects_setup (void);
2955 isc_result_t
dhcp_group_set_value (omapi_object_t
*, omapi_object_t
*,
2956 omapi_data_string_t
*,
2957 omapi_typed_data_t
*);
2958 isc_result_t
dhcp_group_get_value (omapi_object_t
*, omapi_object_t
*,
2959 omapi_data_string_t
*,
2961 isc_result_t
dhcp_group_destroy (omapi_object_t
*, const char *, int);
2962 isc_result_t
dhcp_group_signal_handler (omapi_object_t
*,
2963 const char *, va_list);
2964 isc_result_t
dhcp_group_stuff_values (omapi_object_t
*,
2967 isc_result_t
dhcp_group_lookup (omapi_object_t
**,
2968 omapi_object_t
*, omapi_object_t
*);
2969 isc_result_t
dhcp_group_create (omapi_object_t
**,
2971 isc_result_t
dhcp_group_remove (omapi_object_t
*,
2974 isc_result_t
dhcp_control_set_value (omapi_object_t
*, omapi_object_t
*,
2975 omapi_data_string_t
*,
2976 omapi_typed_data_t
*);
2977 isc_result_t
dhcp_control_get_value (omapi_object_t
*, omapi_object_t
*,
2978 omapi_data_string_t
*,
2980 isc_result_t
dhcp_control_destroy (omapi_object_t
*, const char *, int);
2981 isc_result_t
dhcp_control_signal_handler (omapi_object_t
*,
2982 const char *, va_list);
2983 isc_result_t
dhcp_control_stuff_values (omapi_object_t
*,
2986 isc_result_t
dhcp_control_lookup (omapi_object_t
**,
2987 omapi_object_t
*, omapi_object_t
*);
2988 isc_result_t
dhcp_control_create (omapi_object_t
**,
2990 isc_result_t
dhcp_control_remove (omapi_object_t
*,
2993 isc_result_t
dhcp_subnet_set_value (omapi_object_t
*, omapi_object_t
*,
2994 omapi_data_string_t
*,
2995 omapi_typed_data_t
*);
2996 isc_result_t
dhcp_subnet_get_value (omapi_object_t
*, omapi_object_t
*,
2997 omapi_data_string_t
*,
2999 isc_result_t
dhcp_subnet_destroy (omapi_object_t
*, const char *, int);
3000 isc_result_t
dhcp_subnet_signal_handler (omapi_object_t
*,
3001 const char *, va_list);
3002 isc_result_t
dhcp_subnet_stuff_values (omapi_object_t
*,
3005 isc_result_t
dhcp_subnet_lookup (omapi_object_t
**,
3006 omapi_object_t
*, omapi_object_t
*);
3007 isc_result_t
dhcp_subnet_create (omapi_object_t
**,
3009 isc_result_t
dhcp_subnet_remove (omapi_object_t
*,
3012 isc_result_t
dhcp_shared_network_set_value (omapi_object_t
*,
3014 omapi_data_string_t
*,
3015 omapi_typed_data_t
*);
3016 isc_result_t
dhcp_shared_network_get_value (omapi_object_t
*,
3018 omapi_data_string_t
*,
3020 isc_result_t
dhcp_shared_network_destroy (omapi_object_t
*, const char *, int);
3021 isc_result_t
dhcp_shared_network_signal_handler (omapi_object_t
*,
3022 const char *, va_list);
3023 isc_result_t
dhcp_shared_network_stuff_values (omapi_object_t
*,
3026 isc_result_t
dhcp_shared_network_lookup (omapi_object_t
**,
3027 omapi_object_t
*, omapi_object_t
*);
3028 isc_result_t
dhcp_shared_network_create (omapi_object_t
**,
3030 isc_result_t
dhcp_shared_network_remove (omapi_object_t
*,
3034 extern int (*dhcp_interface_shutdown_hook
) (struct interface_info
*);
3036 extern omapi_object_type_t
*dhcp_type_lease
;
3037 extern omapi_object_type_t
*dhcp_type_pool
;
3038 extern omapi_object_type_t
*dhcp_type_class
;
3039 extern omapi_object_type_t
*dhcp_type_subclass
;
3041 #if defined (FAILOVER_PROTOCOL)
3042 extern omapi_object_type_t
*dhcp_type_failover_state
;
3043 extern omapi_object_type_t
*dhcp_type_failover_link
;
3044 extern omapi_object_type_t
*dhcp_type_failover_listener
;
3047 void dhcp_db_objects_setup (void);
3049 isc_result_t
dhcp_lease_set_value (omapi_object_t
*, omapi_object_t
*,
3050 omapi_data_string_t
*,
3051 omapi_typed_data_t
*);
3052 isc_result_t
dhcp_lease_get_value (omapi_object_t
*, omapi_object_t
*,
3053 omapi_data_string_t
*,
3055 isc_result_t
dhcp_lease_destroy (omapi_object_t
*, const char *, int);
3056 isc_result_t
dhcp_lease_signal_handler (omapi_object_t
*,
3057 const char *, va_list);
3058 isc_result_t
dhcp_lease_stuff_values (omapi_object_t
*,
3061 isc_result_t
dhcp_lease_lookup (omapi_object_t
**,
3062 omapi_object_t
*, omapi_object_t
*);
3063 isc_result_t
dhcp_lease_create (omapi_object_t
**,
3065 isc_result_t
dhcp_lease_remove (omapi_object_t
*,
3067 isc_result_t
dhcp_host_set_value (omapi_object_t
*, omapi_object_t
*,
3068 omapi_data_string_t
*,
3069 omapi_typed_data_t
*);
3070 isc_result_t
dhcp_host_get_value (omapi_object_t
*, omapi_object_t
*,
3071 omapi_data_string_t
*,
3073 isc_result_t
dhcp_host_destroy (omapi_object_t
*, const char *, int);
3074 isc_result_t
dhcp_host_signal_handler (omapi_object_t
*,
3075 const char *, va_list);
3076 isc_result_t
dhcp_host_stuff_values (omapi_object_t
*,
3079 isc_result_t
dhcp_host_lookup (omapi_object_t
**,
3080 omapi_object_t
*, omapi_object_t
*);
3081 isc_result_t
dhcp_host_create (omapi_object_t
**,
3083 isc_result_t
dhcp_host_remove (omapi_object_t
*,
3085 isc_result_t
dhcp_pool_set_value (omapi_object_t
*, omapi_object_t
*,
3086 omapi_data_string_t
*,
3087 omapi_typed_data_t
*);
3088 isc_result_t
dhcp_pool_get_value (omapi_object_t
*, omapi_object_t
*,
3089 omapi_data_string_t
*,
3091 isc_result_t
dhcp_pool_destroy (omapi_object_t
*, const char *, int);
3092 isc_result_t
dhcp_pool_signal_handler (omapi_object_t
*,
3093 const char *, va_list);
3094 isc_result_t
dhcp_pool_stuff_values (omapi_object_t
*,
3097 isc_result_t
dhcp_pool_lookup (omapi_object_t
**,
3098 omapi_object_t
*, omapi_object_t
*);
3099 isc_result_t
dhcp_pool_create (omapi_object_t
**,
3101 isc_result_t
dhcp_pool_remove (omapi_object_t
*,
3103 isc_result_t
dhcp_class_set_value (omapi_object_t
*, omapi_object_t
*,
3104 omapi_data_string_t
*,
3105 omapi_typed_data_t
*);
3106 isc_result_t
dhcp_class_get_value (omapi_object_t
*, omapi_object_t
*,
3107 omapi_data_string_t
*,
3109 isc_result_t
dhcp_class_destroy (omapi_object_t
*, const char *, int);
3110 isc_result_t
dhcp_class_signal_handler (omapi_object_t
*,
3111 const char *, va_list);
3112 isc_result_t
dhcp_class_stuff_values (omapi_object_t
*,
3115 isc_result_t
dhcp_class_lookup (omapi_object_t
**,
3116 omapi_object_t
*, omapi_object_t
*);
3117 isc_result_t
dhcp_class_create (omapi_object_t
**,
3119 isc_result_t
dhcp_class_remove (omapi_object_t
*,
3121 isc_result_t
dhcp_subclass_set_value (omapi_object_t
*, omapi_object_t
*,
3122 omapi_data_string_t
*,
3123 omapi_typed_data_t
*);
3124 isc_result_t
dhcp_subclass_get_value (omapi_object_t
*, omapi_object_t
*,
3125 omapi_data_string_t
*,
3127 isc_result_t
dhcp_subclass_destroy (omapi_object_t
*, const char *, int);
3128 isc_result_t
dhcp_subclass_signal_handler (omapi_object_t
*,
3129 const char *, va_list);
3130 isc_result_t
dhcp_subclass_stuff_values (omapi_object_t
*,
3133 isc_result_t
dhcp_subclass_lookup (omapi_object_t
**,
3134 omapi_object_t
*, omapi_object_t
*);
3135 isc_result_t
dhcp_subclass_create (omapi_object_t
**,
3137 isc_result_t
dhcp_subclass_remove (omapi_object_t
*,
3139 isc_result_t
dhcp_interface_set_value (omapi_object_t
*,
3141 omapi_data_string_t
*,
3142 omapi_typed_data_t
*);
3143 isc_result_t
dhcp_interface_get_value (omapi_object_t
*,
3145 omapi_data_string_t
*,
3147 isc_result_t
dhcp_interface_destroy (omapi_object_t
*,
3149 isc_result_t
dhcp_interface_signal_handler (omapi_object_t
*,
3152 isc_result_t
dhcp_interface_stuff_values (omapi_object_t
*,
3155 isc_result_t
dhcp_interface_lookup (omapi_object_t
**,
3158 isc_result_t
dhcp_interface_create (omapi_object_t
**,
3160 isc_result_t
dhcp_interface_remove (omapi_object_t
*,
3162 void interface_stash (struct interface_info
*);
3163 void interface_snorf (struct interface_info
*, int);
3165 isc_result_t
binding_scope_set_value (struct binding_scope
*, int,
3166 omapi_data_string_t
*,
3167 omapi_typed_data_t
*);
3168 isc_result_t
binding_scope_get_value (omapi_value_t
**,
3169 struct binding_scope
*,
3170 omapi_data_string_t
*);
3171 isc_result_t
binding_scope_stuff_values (omapi_object_t
*,
3172 struct binding_scope
*);
3174 void register_eventhandler(struct eventqueue
**, void (*handler
)(void *));
3175 void unregister_eventhandler(struct eventqueue
**, void (*handler
)(void *));
3176 void trigger_event(struct eventqueue
**);
3180 extern struct subnet
*subnets
;
3181 extern struct shared_network
*shared_networks
;
3182 extern host_hash_t
*host_hw_addr_hash
;
3183 extern host_hash_t
*host_uid_hash
;
3184 extern host_hash_t
*host_name_hash
;
3185 extern lease_id_hash_t
*lease_uid_hash
;
3186 extern lease_ip_hash_t
*lease_ip_addr_hash
;
3187 extern lease_id_hash_t
*lease_hw_addr_hash
;
3189 extern omapi_object_type_t
*dhcp_type_host
;
3191 extern int numclasseswritten
;
3194 isc_result_t
enter_class (struct class *, int, int);
3195 isc_result_t
delete_class (struct class *, int);
3196 isc_result_t
enter_host (struct host_decl
*, int, int);
3197 isc_result_t
delete_host (struct host_decl
*, int);
3198 void change_host_uid(struct host_decl
*host
, const char *data
, int len
);
3199 int find_hosts_by_haddr (struct host_decl
**, int,
3200 const unsigned char *, unsigned,
3202 int find_hosts_by_uid (struct host_decl
**, const unsigned char *,
3203 unsigned, const char *, int);
3204 int find_hosts_by_option(struct host_decl
**, struct packet
*,
3205 struct option_state
*, const char *, int);
3206 int find_host_for_network (struct subnet
**, struct host_decl
**,
3207 struct iaddr
*, struct shared_network
*);
3208 void new_address_range (struct parse
*, struct iaddr
, struct iaddr
,
3209 struct subnet
*, struct pool
*,
3211 isc_result_t
dhcp_lease_free (omapi_object_t
*, const char *, int);
3212 isc_result_t
dhcp_lease_get (omapi_object_t
**, const char *, int);
3213 int find_grouped_subnet (struct subnet
**, struct shared_network
*,
3214 struct iaddr
, const char *, int);
3215 int find_subnet(struct subnet
**, struct iaddr
, const char *, int);
3216 void enter_shared_network (struct shared_network
*);
3217 void new_shared_network_interface (struct parse
*,
3218 struct shared_network
*,
3220 int subnet_inner_than(const struct subnet
*, const struct subnet
*, int);
3221 void enter_subnet (struct subnet
*);
3222 void enter_lease (struct lease
*);
3223 int supersede_lease (struct lease
*, struct lease
*, int, int, int);
3224 void make_binding_state_transition (struct lease
*);
3225 int lease_copy (struct lease
**, struct lease
*, const char *, int);
3226 void release_lease (struct lease
*, struct packet
*);
3227 void abandon_lease (struct lease
*, const char *);
3228 void dissociate_lease (struct lease
*);
3229 void pool_timer (void *);
3230 int find_lease_by_uid (struct lease
**, const unsigned char *,
3231 unsigned, const char *, int);
3232 int find_lease_by_hw_addr (struct lease
**, const unsigned char *,
3233 unsigned, const char *, int);
3234 int find_lease_by_ip_addr (struct lease
**, struct iaddr
,
3236 void uid_hash_add (struct lease
*);
3237 void uid_hash_delete (struct lease
*);
3238 void hw_hash_add (struct lease
*);
3239 void hw_hash_delete (struct lease
*);
3240 int write_leases (void);
3241 int write_leases6(void);
3242 int lease_enqueue (struct lease
*);
3243 isc_result_t
lease_instantiate(const void *, unsigned, void *);
3244 void expire_all_pools (void);
3245 void dump_subnets (void);
3246 #if defined (DEBUG_MEMORY_LEAKAGE) || \
3247 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
3248 void free_everything (void);
3252 char *ddns_rev_name (struct lease
*, struct lease_state
*, struct packet
*);
3253 char *ddns_fwd_name (struct lease
*, struct lease_state
*, struct packet
*);
3254 int nsupdateA (const char *, const unsigned char *, u_int32_t
, int);
3255 int nsupdatePTR (const char *, const unsigned char *, u_int32_t
, int);
3256 void nsupdate (struct lease
*, struct lease_state
*, struct packet
*, int);
3257 int updateA (const struct data_string
*, const struct data_string
*,
3258 unsigned int, struct lease
*);
3259 int updatePTR (const struct data_string
*, const struct data_string
*,
3260 unsigned int, struct lease
*);
3261 int deleteA (const struct data_string
*, const struct data_string
*,
3263 int deletePTR (const struct data_string
*, const struct data_string
*,
3267 #if defined (FAILOVER_PROTOCOL)
3268 extern dhcp_failover_state_t
*failover_states
;
3269 void dhcp_failover_startup (void);
3270 int dhcp_failover_write_all_states (void);
3271 isc_result_t
enter_failover_peer (dhcp_failover_state_t
*);
3272 isc_result_t
find_failover_peer (dhcp_failover_state_t
**,
3273 const char *, const char *, int);
3274 isc_result_t
dhcp_failover_link_initiate (omapi_object_t
*);
3275 isc_result_t
dhcp_failover_link_signal (omapi_object_t
*,
3276 const char *, va_list);
3277 isc_result_t
dhcp_failover_link_set_value (omapi_object_t
*,
3279 omapi_data_string_t
*,
3280 omapi_typed_data_t
*);
3281 isc_result_t
dhcp_failover_link_get_value (omapi_object_t
*,
3283 omapi_data_string_t
*,
3285 isc_result_t
dhcp_failover_link_destroy (omapi_object_t
*,
3287 isc_result_t
dhcp_failover_link_stuff_values (omapi_object_t
*,
3290 isc_result_t
dhcp_failover_listen (omapi_object_t
*);
3292 isc_result_t
dhcp_failover_listener_signal (omapi_object_t
*,
3295 isc_result_t
dhcp_failover_listener_set_value (omapi_object_t
*,
3297 omapi_data_string_t
*,
3298 omapi_typed_data_t
*);
3299 isc_result_t
dhcp_failover_listener_get_value (omapi_object_t
*,
3301 omapi_data_string_t
*,
3303 isc_result_t
dhcp_failover_listener_destroy (omapi_object_t
*,
3305 isc_result_t
dhcp_failover_listener_stuff (omapi_object_t
*,
3308 isc_result_t
dhcp_failover_register (omapi_object_t
*);
3309 isc_result_t
dhcp_failover_state_signal (omapi_object_t
*,
3310 const char *, va_list);
3311 isc_result_t
dhcp_failover_state_transition (dhcp_failover_state_t
*,
3313 isc_result_t
dhcp_failover_set_service_state (dhcp_failover_state_t
*state
);
3314 isc_result_t
dhcp_failover_set_state (dhcp_failover_state_t
*,
3315 enum failover_state
);
3316 isc_result_t
dhcp_failover_peer_state_changed (dhcp_failover_state_t
*,
3317 failover_message_t
*);
3318 void dhcp_failover_pool_rebalance (void *);
3319 void dhcp_failover_pool_check (struct pool
*);
3320 int dhcp_failover_state_pool_check (dhcp_failover_state_t
*);
3321 void dhcp_failover_timeout (void *);
3322 void dhcp_failover_send_contact (void *);
3323 isc_result_t
dhcp_failover_send_state (dhcp_failover_state_t
*);
3324 isc_result_t
dhcp_failover_send_updates (dhcp_failover_state_t
*);
3325 int dhcp_failover_queue_update (struct lease
*, int);
3326 int dhcp_failover_send_acks (dhcp_failover_state_t
*);
3327 void dhcp_failover_toack_queue_timeout (void *);
3328 int dhcp_failover_queue_ack (dhcp_failover_state_t
*, failover_message_t
*msg
);
3329 void dhcp_failover_ack_queue_remove (dhcp_failover_state_t
*, struct lease
*);
3330 isc_result_t
dhcp_failover_state_set_value (omapi_object_t
*,
3332 omapi_data_string_t
*,
3333 omapi_typed_data_t
*);
3334 void dhcp_failover_keepalive (void *);
3335 void dhcp_failover_reconnect (void *);
3336 void dhcp_failover_startup_timeout (void *);
3337 void dhcp_failover_link_startup_timeout (void *);
3338 void dhcp_failover_listener_restart (void *);
3339 void dhcp_failover_auto_partner_down(void *vs
);
3340 isc_result_t
dhcp_failover_state_get_value (omapi_object_t
*,
3342 omapi_data_string_t
*,
3344 isc_result_t
dhcp_failover_state_destroy (omapi_object_t
*,
3346 isc_result_t
dhcp_failover_state_stuff (omapi_object_t
*,
3349 isc_result_t
dhcp_failover_state_lookup (omapi_object_t
**,
3352 isc_result_t
dhcp_failover_state_create (omapi_object_t
**,
3354 isc_result_t
dhcp_failover_state_remove (omapi_object_t
*,
3356 int dhcp_failover_state_match (dhcp_failover_state_t
*, u_int8_t
*, unsigned);
3357 int dhcp_failover_state_match_by_name(dhcp_failover_state_t
*,
3358 failover_option_t
*);
3359 const char *dhcp_failover_reject_reason_print (int);
3360 const char *dhcp_failover_state_name_print (enum failover_state
);
3361 const char *dhcp_failover_message_name (unsigned);
3362 const char *dhcp_failover_option_name (unsigned);
3363 failover_option_t
*dhcp_failover_option_printf (unsigned, char *,
3367 __attribute__((__format__(__printf__
,5,6)));
3368 failover_option_t
*dhcp_failover_make_option (unsigned, char *,
3369 unsigned *, unsigned, ...);
3370 isc_result_t
dhcp_failover_put_message (dhcp_failover_link_t
*,
3371 omapi_object_t
*, int, u_int32_t
, ...);
3372 isc_result_t
dhcp_failover_send_connect (omapi_object_t
*);
3373 isc_result_t
dhcp_failover_send_connectack (omapi_object_t
*,
3374 dhcp_failover_state_t
*,
3376 isc_result_t
dhcp_failover_send_disconnect (omapi_object_t
*,
3378 isc_result_t
dhcp_failover_send_bind_update (dhcp_failover_state_t
*,
3380 isc_result_t
dhcp_failover_send_bind_ack (dhcp_failover_state_t
*,
3381 failover_message_t
*,
3383 isc_result_t
dhcp_failover_send_poolreq (dhcp_failover_state_t
*);
3384 isc_result_t
dhcp_failover_send_poolresp (dhcp_failover_state_t
*, int);
3385 isc_result_t
dhcp_failover_send_update_request (dhcp_failover_state_t
*);
3386 isc_result_t
dhcp_failover_send_update_request_all (dhcp_failover_state_t
*);
3387 isc_result_t
dhcp_failover_send_update_done (dhcp_failover_state_t
*);
3388 isc_result_t
dhcp_failover_process_bind_update (dhcp_failover_state_t
*,
3389 failover_message_t
*);
3390 isc_result_t
dhcp_failover_process_bind_ack (dhcp_failover_state_t
*,
3391 failover_message_t
*);
3392 isc_result_t
dhcp_failover_generate_update_queue (dhcp_failover_state_t
*,
3394 isc_result_t
dhcp_failover_process_update_request (dhcp_failover_state_t
*,
3395 failover_message_t
*);
3396 isc_result_t
dhcp_failover_process_update_request_all (dhcp_failover_state_t
*,
3397 failover_message_t
*);
3398 isc_result_t
dhcp_failover_process_update_done (dhcp_failover_state_t
*,
3399 failover_message_t
*);
3400 void ia_remove_all_lease(struct ia_xx
*ia
, const char *file
, int line
);
3401 void dhcp_failover_recover_done (void *);
3402 void failover_print (char *, unsigned *, unsigned, const char *);
3403 void update_partner (struct lease
*);
3404 int load_balance_mine (struct packet
*, dhcp_failover_state_t
*);
3405 int peer_wants_lease (struct lease
*);
3406 binding_state_t
normal_binding_state_transition_check (struct lease
*,
3407 dhcp_failover_state_t
*,
3411 conflict_binding_state_transition_check (struct lease
*,
3412 dhcp_failover_state_t
*,
3413 binding_state_t
, u_int32_t
);
3414 int lease_mine_to_reallocate (struct lease
*);
3416 OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_state
, dhcp_failover_state_t
,
3417 dhcp_type_failover_state
)
3418 OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_listener
, dhcp_failover_listener_t
,
3419 dhcp_type_failover_listener
)
3420 OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_link
, dhcp_failover_link_t
,
3421 dhcp_type_failover_link
)
3422 #endif /* FAILOVER_PROTOCOL */
3424 const char *binding_state_print (enum failover_state
);
3427 #if defined(LDAP_CONFIGURATION)
3428 extern struct enumeration ldap_methods
;
3429 #if defined (LDAP_USE_SSL)
3430 extern struct enumeration ldap_ssl_usage_enum
;
3431 extern struct enumeration ldap_tls_reqcert_enum
;
3432 extern struct enumeration ldap_tls_crlcheck_enum
;
3434 isc_result_t
ldap_read_config (void);
3435 int find_haddr_in_ldap (struct host_decl
**, int, unsigned,
3436 const unsigned char *, const char *, int);
3437 int find_subclass_in_ldap (struct class *, struct class **,
3438 struct data_string
*);
3442 HASH_FUNCTIONS_DECL(ia
, unsigned char *, struct ia_xx
, ia_hash_t
)
3443 HASH_FUNCTIONS_DECL(iasubopt
, struct in6_addr
*, struct iasubopt
,
3446 isc_result_t
iasubopt_allocate(struct iasubopt
**iasubopt
,
3447 const char *file
, int line
);
3448 isc_result_t
iasubopt_reference(struct iasubopt
**iasubopt
,
3449 struct iasubopt
*src
,
3450 const char *file
, int line
);
3451 isc_result_t
iasubopt_dereference(struct iasubopt
**iasubopt
,
3452 const char *file
, int line
);
3454 isc_result_t
ia_make_key(struct data_string
*key
, u_int32_t iaid
,
3455 const char *duid
, unsigned int duid_len
,
3456 const char *file
, int line
);
3457 isc_result_t
ia_allocate(struct ia_xx
**ia
, u_int32_t iaid
,
3458 const char *duid
, unsigned int duid_len
,
3459 const char *file
, int line
);
3460 isc_result_t
ia_reference(struct ia_xx
**ia
, struct ia_xx
*src
,
3461 const char *file
, int line
);
3462 isc_result_t
ia_dereference(struct ia_xx
**ia
,
3463 const char *file
, int line
);
3464 isc_result_t
ia_add_iasubopt(struct ia_xx
*ia
, struct iasubopt
*iasubopt
,
3465 const char *file
, int line
);
3466 void ia_remove_iasubopt(struct ia_xx
*ia
, struct iasubopt
*iasubopt
,
3467 const char *file
, int line
);
3468 isc_boolean_t
ia_equal(const struct ia_xx
*a
, const struct ia_xx
*b
);
3470 isc_result_t
ipv6_pool_allocate(struct ipv6_pool
**pool
, u_int16_t type
,
3471 const struct in6_addr
*start_addr
,
3472 int bits
, int units
,
3473 const char *file
, int line
);
3474 isc_result_t
ipv6_pool_reference(struct ipv6_pool
**pool
,
3475 struct ipv6_pool
*src
,
3476 const char *file
, int line
);
3477 isc_result_t
ipv6_pool_dereference(struct ipv6_pool
**pool
,
3478 const char *file
, int line
);
3479 isc_result_t
create_lease6(struct ipv6_pool
*pool
,
3480 struct iasubopt
**addr
,
3481 unsigned int *attempts
,
3482 const struct data_string
*uid
,
3483 time_t soft_lifetime_end_time
);
3484 isc_result_t
add_lease6(struct ipv6_pool
*pool
,
3485 struct iasubopt
*lease
,
3486 time_t valid_lifetime_end_time
);
3487 isc_result_t
renew_lease6(struct ipv6_pool
*pool
, struct iasubopt
*lease
);
3488 isc_result_t
expire_lease6(struct iasubopt
**leasep
,
3489 struct ipv6_pool
*pool
, time_t now
);
3490 isc_result_t
release_lease6(struct ipv6_pool
*pool
, struct iasubopt
*lease
);
3491 isc_result_t
decline_lease6(struct ipv6_pool
*pool
, struct iasubopt
*lease
);
3492 isc_boolean_t
lease6_exists(const struct ipv6_pool
*pool
,
3493 const struct in6_addr
*addr
);
3494 isc_result_t
mark_lease_unavailble(struct ipv6_pool
*pool
,
3495 const struct in6_addr
*addr
);
3497 isc_result_t
create_prefix6(struct ipv6_pool
*pool
,
3498 struct iasubopt
**pref
,
3499 unsigned int *attempts
,
3500 const struct data_string
*uid
,
3501 time_t soft_lifetime_end_time
);
3502 isc_boolean_t
prefix6_exists(const struct ipv6_pool
*pool
,
3503 const struct in6_addr
*pref
, u_int8_t plen
);
3505 isc_result_t
add_ipv6_pool(struct ipv6_pool
*pool
);
3506 isc_result_t
find_ipv6_pool(struct ipv6_pool
**pool
, u_int16_t type
,
3507 const struct in6_addr
*addr
);
3508 isc_boolean_t
ipv6_in_pool(const struct in6_addr
*addr
,
3509 const struct ipv6_pool
*pool
);
3511 isc_result_t
renew_leases(struct ia_xx
*ia
);
3512 isc_result_t
release_leases(struct ia_xx
*ia
);
3513 isc_result_t
decline_leases(struct ia_xx
*ia
);
3514 void schedule_lease_timeout(struct ipv6_pool
*pool
);
3515 void schedule_all_ipv6_lease_timeouts();
3517 void mark_hosts_unavailable(void);
3518 void mark_phosts_unavailable(void);
3519 void mark_interfaces_unavailable(void);
3521 dhcp_ddns_cb_t
*ddns_cb_alloc(const char *file
, int line
);
3522 void ddns_cb_free (dhcp_ddns_cb_t
*ddns_cb
, const char *file
, int line
);
3523 void ddns_cb_forget_zone (dhcp_ddns_cb_t
*ddns_cb
);
3525 //void *key_from_zone(struct dns_zone *zone);
3528 ddns_modify_fwd(dhcp_ddns_cb_t
*ddns_cb
);
3531 ddns_modify_ptr(dhcp_ddns_cb_t
*ddns_cb
);
3534 ddns_cancel(dhcp_ddns_cb_t
*ddns_cb
);
3536 #define MAX_ADDRESS_STRING_LEN \
3537 (sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"))