3 Definitions for dhcpd... */
6 * Copyright (c) 2004-2007 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
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 * ``http://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>
46 #define fd_set cygwin_fd_set
47 #include <sys/types.h>
60 #include <net/route.h>
61 #include <net/if_arp.h>
63 # include <net/if_dl.h>
71 #include "arpa/nameser.h"
72 #if defined (NSUPDATE)
73 # include "minires/minires.h"
77 typedef struct hash_table group_hash_t
;
78 typedef struct hash_table universe_hash_t
;
79 typedef struct hash_table option_name_hash_t
;
80 typedef struct hash_table option_code_hash_t
;
81 typedef struct hash_table dns_zone_hash_t
;
82 typedef struct hash_table lease_ip_hash_t
;
83 typedef struct hash_table lease_id_hash_t
;
84 typedef struct hash_table host_hash_t
;
85 typedef struct hash_table class_hash_t
;
95 #include "statement.h"
101 #include <isc-dhcp/result.h>
102 #include <omapip/omapip_p.h>
104 #if !defined (BYTE_NAME_HASH_SIZE)
105 # define BYTE_NAME_HASH_SIZE 401 /* Default would be rediculous. */
107 #if !defined (BYTE_CODE_HASH_SIZE)
108 # define BYTE_CODE_HASH_SIZE 254 /* Default would be rediculous. */
111 /* Although it is highly improbable that a 16-bit option space might
112 * actually use 2^16 actual defined options, it is the worst case
113 * scenario we must prepare for. Having 4 options per bucket in this
114 * case is pretty reasonable.
116 #if !defined (WORD_NAME_HASH_SIZE)
117 # define WORD_NAME_HASH_SIZE 20479
119 #if !defined (WORD_CODE_HASH_SIZE)
120 # define WORD_CODE_HASH_SIZE 16384
123 /* Not only is it improbable that the 32-bit spaces might actually use 2^32
124 * defined options, it is infeasable. It would be best for this kind of
125 * space to be dynamically sized. Instead we size it at the word hash's
128 #if !defined (QUAD_NAME_HASH_SIZE)
129 # define QUAD_NAME_HASH_SIZE WORD_NAME_HASH_SIZE
131 #if !defined (QUAD_CODE_HASH_SIZE)
132 # define QUAD_CODE_HASH_SIZE WORD_CODE_HASH_SIZE
135 #if !defined (DNS_HASH_SIZE)
136 # define DNS_HASH_SIZE 0 /* Default. */
139 /* Default size to use for name/code hashes on user-defined option spaces. */
140 #if !defined (DEFAULT_SPACE_HASH_SIZE)
141 # define DEFAULT_SPACE_HASH_SIZE 11
144 #if !defined (NWIP_HASH_SIZE)
145 # define NWIP_HASH_SIZE 17 /* A really small table. */
148 #if !defined (FQDN_HASH_SIZE)
149 # define FQDN_HASH_SIZE 13 /* A rediculously small table. */
152 /* I really doubt a given installation is going to have more than a few
153 * hundred vendors involved.
155 #if !defined (VIVCO_HASH_SIZE)
156 # define VIVCO_HASH_SIZE 127
159 #if !defined (VIVSO_HASH_SIZE)
160 # define VIVSO_HASH_SIZE VIVCO_HASH_SIZE
163 #if !defined (VSIO_HASH_SIZE)
164 # define VSIO_HASH_SIZE VIVCO_HASH_SIZE
167 #if !defined (VIV_ISC_HASH_SIZE)
168 # define VIV_ISC_HASH_SIZE 3 /* An incredulously small table. */
171 #if !defined (UNIVERSE_HASH_SIZE)
172 # define UNIVERSE_HASH_SIZE 13 /* A really small table. */
175 #if !defined (GROUP_HASH_SIZE)
176 # define GROUP_HASH_SIZE 0 /* Default. */
179 /* At least one person has indicated they use ~20k host records.
181 #if !defined (HOST_HASH_SIZE)
182 # define HOST_HASH_SIZE 22501
185 /* We have user reports of use of ISC DHCP numbering leases in the 200k's.
187 * We also have reports of folks using 10.0/8 as a dynamic range. The
188 * following is something of a compromise between the two. At the ~2-3
189 * hundred thousand leases, there's ~2-3 leases to search in each bucket.
191 #if !defined (LEASE_HASH_SIZE)
192 # define LEASE_HASH_SIZE 100003
195 /* It is not known what the worst case subclass hash size is. We estimate
198 #if !defined (SCLASS_HASH_SIZE)
199 # define SCLASS_HASH_SIZE 12007
202 #if !defined (AGENT_HASH_SIZE)
203 # define AGENT_HASH_SIZE 11 /* A really small table. */
206 /* The server hash size is used for both names and codes. There aren't
207 * many (roughly 50 at the moment), so we use a smaller table. If we
208 * use a 1:1 table size, then we get name collisions due to poor name
209 * hashing. So we use double the space we need, which drastically
210 * reduces collisions.
212 #if !defined (SERVER_HASH_SIZE)
213 # define SERVER_HASH_SIZE (2*(sizeof(server_options) / sizeof(struct option)))
217 /* How many options are likely to appear in a single packet? */
218 #if !defined (OPTION_HASH_SIZE)
219 # define OPTION_HASH_SIZE 17
220 # define OPTION_HASH_PTWO 32 /* Next power of two above option hash. */
221 # define OPTION_HASH_EXP 5 /* The exponent for that power of two. */
224 #define compute_option_hash(x) \
225 (((x) & (OPTION_HASH_PTWO - 1)) + \
226 (((x) >> OPTION_HASH_EXP) & \
227 (OPTION_HASH_PTWO - 1))) % OPTION_HASH_SIZE;
229 enum dhcp_shutdown_state
{
231 shutdown_omapi_connections
,
232 shutdown_drop_omapi_connections
,
237 /* Client FQDN option, failover FQDN option, etc. */
244 #include "failover.h"
246 /* A parsing context. */
263 enum dhcp_token token
;
269 int warnings_occurred
;
272 size_t bufix
, buflen
;
275 struct parse
*saved_state
;
278 /* Variable-length array of data. */
281 struct string_list
*next
;
285 /* A name server, from /etc/resolv.conf. */
287 struct name_server
*next
;
288 struct sockaddr_in addr
;
292 /* A domain search list element. */
293 struct domain_search_list
{
294 struct domain_search_list
*next
;
299 /* Option tag structures are used to build chains of option tags, for
300 when we're sure we're not going to have enough of them to justify
301 maintaining an array. */
304 struct option_tag
*next
;
308 /* An agent option structure. We need a special structure for the
309 Relay Agent Information option because if more than one appears in
310 a message, we have to keep them separate. */
312 struct agent_options
{
313 struct agent_options
*next
;
315 struct option_tag
*first
;
318 struct option_cache
{
320 struct option_cache
*next
;
321 struct expression
*expression
;
322 struct option
*option
;
323 struct data_string data
;
325 #define OPTION_HAD_NULLS 0x00000001
329 struct option_state
{
337 /* A dhcp packet and the pointers to its option values. */
339 struct dhcp_packet
*raw
;
341 unsigned packet_length
;
344 unsigned char dhcpv6_msg_type
; /* DHCPv6 message type */
346 /* DHCPv6 transaction ID */
347 unsigned char dhcpv6_transaction_id
[3];
349 /* DHCPv6 relay information */
350 unsigned char dhcpv6_hop_count
;
351 struct in6_addr dhcpv6_link_address
;
352 struct in6_addr dhcpv6_peer_address
;
354 /* DHCPv6 packet containing this one, or NULL if none */
355 struct packet
*dhcpv6_container_packet
;
359 struct iaddr client_addr
;
360 struct interface_info
*interface
; /* Interface on which packet
362 struct hardware
*haddr
; /* Physical link address
363 of local sender (maybe gateway). */
365 /* Information for relay agent options (see
366 draft-ietf-dhc-agent-options-xx.txt). */
367 u_int8_t
*circuit_id
; /* Circuit ID of client connection. */
369 u_int8_t
*remote_id
; /* Remote ID of client. */
372 int got_requested_address
; /* True if client sent the
373 dhcp-requested-address option. */
375 struct shared_network
*shared_network
;
376 struct option_state
*options
;
378 #if !defined (PACKET_MAX_CLASSES)
379 # define PACKET_MAX_CLASSES 5
382 struct class *classes
[PACKET_MAX_CLASSES
];
387 /* If we stash agent options onto the packet option state, to pretend
388 * options we got in a previous exchange were still there, we need
389 * to signal this in a reliable way.
391 isc_boolean_t agent_options_stashed
;
394 * ISC_TRUE if packet received unicast (as opposed to multicast).
395 * Only used in DHCPv6.
397 isc_boolean_t unicast
;
400 /* A network interface's MAC address. */
411 server_hibernate
= 3,
413 } control_object_state_t
;
416 OMAPI_OBJECT_PREAMBLE
;
417 control_object_state_t state
;
418 } dhcp_control_object_t
;
423 #define FTS_EXPIRED 3
424 #define FTS_RELEASED 4
425 #define FTS_ABANDONED 5
428 typedef u_int8_t binding_state_t
;
430 /* FTS_LAST is the highest value that is valid for a lease binding state. */
431 #define FTS_LAST FTS_BACKUP
433 /* A dhcp lease declaration structure. */
435 OMAPI_OBJECT_PREAMBLE
;
437 struct lease
*n_uid
, *n_hw
;
439 struct iaddr ip_addr
;
440 TIME starts
, ends
, sort_time
;
441 char *client_hostname
;
442 struct binding_scope
*scope
;
443 struct host_decl
*host
;
444 struct subnet
*subnet
;
446 struct class *billing_class
;
447 struct option_chain_head
*agent_options
;
449 struct executable_statement
*on_expiry
;
450 struct executable_statement
*on_commit
;
451 struct executable_statement
*on_release
;
454 unsigned short uid_len
;
455 unsigned short uid_max
;
456 unsigned char uid_buf
[7];
457 struct hardware hardware_addr
;
460 # define STATIC_LEASE 1
461 # define BOOTP_LEASE 2
462 # define RESERVED_LEASE 4
463 # define MS_NULL_TERMINATION 8
464 # define ON_UPDATE_QUEUE 16
465 # define ON_ACK_QUEUE 32
466 # define ON_QUEUE (ON_UPDATE_QUEUE | ON_ACK_QUEUE)
467 # define UNICAST_BROADCAST_HACK 64
468 # define ON_DEFERRED_QUEUE 128
470 /* Persistent flags are to be preserved on a given lease structure. */
471 # define PERSISTENT_FLAGS (ON_ACK_QUEUE | ON_UPDATE_QUEUE)
472 /* Ephemeral flags are to be preserved on a given lease (copied etc). */
473 # define EPHEMERAL_FLAGS (MS_NULL_TERMINATION | \
474 UNICAST_BROADCAST_HACK | \
478 binding_state_t binding_state
;
479 binding_state_t next_binding_state
;
480 binding_state_t desired_binding_state
;
482 struct lease_state
*state
;
484 /* 'tsfp' is more of an 'effective' tsfp. It may be calculated from
485 * stos+mclt for example if it's an expired lease and the server is
486 * in partner-down state. 'atsfp' is zeroed whenever a lease is
487 * updated - and only set when the peer acknowledges it. This
488 * ensures every state change is transmitted.
490 TIME tstp
; /* Time sent to partner. */
491 TIME tsfp
; /* Time sent from partner. */
492 TIME atsfp
; /* Actual time sent from partner. */
493 TIME cltt
; /* Client last transaction time. */
494 u_int32_t last_xid
; /* XID we sent in this lease's BNDUPD */
495 struct lease
*next_pending
;
499 struct lease_state
*next
;
501 struct interface_info
*ip
;
503 struct packet
*packet
; /* The incoming packet. */
507 struct option_state
*options
;
508 struct data_string parameter_request_list
;
509 int max_message_size
;
510 unsigned char expiry
[4], renewal
[4], rebind
[4];
511 struct data_string filename
, server_name
;
512 int got_requested_address
;
513 int got_server_identifier
;
514 struct shared_network
*shared_network
; /* Shared network of interface
515 on which request arrived. */
519 u_int16_t bootp_flags
;
520 struct in_addr ciaddr
;
521 struct in_addr siaddr
;
522 struct in_addr giaddr
;
530 #define SHARED_NET_DECL 2
531 #define SUBNET_DECL 3
536 /* Possible modes in which discover_interfaces can run. */
538 #define DISCOVER_RUNNING 0
539 #define DISCOVER_SERVER 1
540 #define DISCOVER_UNCONFIGURED 2
541 #define DISCOVER_RELAY 3
542 #define DISCOVER_REQUESTED 4
544 /* DDNS_UPDATE_STYLE enumerations. */
545 #define DDNS_UPDATE_STYLE_NONE 0
546 #define DDNS_UPDATE_STYLE_AD_HOC 1
547 #define DDNS_UPDATE_STYLE_INTERIM 2
549 /* Server option names. */
551 #define SV_DEFAULT_LEASE_TIME 1
552 #define SV_MAX_LEASE_TIME 2
553 #define SV_MIN_LEASE_TIME 3
554 #define SV_BOOTP_LEASE_CUTOFF 4
555 #define SV_BOOTP_LEASE_LENGTH 5
556 #define SV_BOOT_UNKNOWN_CLIENTS 6
557 #define SV_DYNAMIC_BOOTP 7
558 #define SV_ALLOW_BOOTP 8
559 #define SV_ALLOW_BOOTING 9
560 #define SV_ONE_LEASE_PER_CLIENT 10
561 #define SV_GET_LEASE_HOSTNAMES 11
562 #define SV_USE_HOST_DECL_NAMES 12
563 #define SV_USE_LEASE_ADDR_FOR_DEFAULT_ROUTE 13
564 #define SV_MIN_SECS 14
565 #define SV_FILENAME 15
566 #define SV_SERVER_NAME 16
567 #define SV_NEXT_SERVER 17
568 #define SV_AUTHORITATIVE 18
569 #define SV_VENDOR_OPTION_SPACE 19
570 #define SV_ALWAYS_REPLY_RFC1048 20
571 #define SV_SITE_OPTION_SPACE 21
572 #define SV_ALWAYS_BROADCAST 22
573 #define SV_DDNS_DOMAIN_NAME 23
574 #define SV_DDNS_HOST_NAME 24
575 #define SV_DDNS_REV_DOMAIN_NAME 25
576 #define SV_LEASE_FILE_NAME 26
577 #define SV_PID_FILE_NAME 27
578 #define SV_DUPLICATES 28
579 #define SV_DECLINES 29
580 #define SV_DDNS_UPDATES 30
581 #define SV_OMAPI_PORT 31
582 #define SV_LOCAL_PORT 32
583 #define SV_LIMITED_BROADCAST_ADDRESS 33
584 #define SV_REMOTE_PORT 34
585 #define SV_LOCAL_ADDRESS 35
586 #define SV_OMAPI_KEY 36
587 #define SV_STASH_AGENT_OPTIONS 37
588 #define SV_DDNS_TTL 38
589 #define SV_DDNS_UPDATE_STYLE 39
590 #define SV_CLIENT_UPDATES 40
591 #define SV_UPDATE_OPTIMIZATION 41
592 #define SV_PING_CHECKS 42
593 #define SV_UPDATE_STATIC_LEASES 43
594 #define SV_LOG_FACILITY 44
595 #define SV_DO_FORWARD_UPDATES 45
596 #define SV_PING_TIMEOUT 46
597 #define SV_RESERVE_INFINITE 47
598 #define SV_DDNS_CONFLICT_DETECT 48
599 #define SV_LEASEQUERY 49
600 #define SV_ADAPTIVE_LEASE_TIME_THRESHOLD 50
601 #define SV_DO_REVERSE_UPDATES 51
602 #define SV_FQDN_REPLY 52
603 #define SV_PREFER_LIFETIME 53
605 #if !defined (DEFAULT_PING_TIMEOUT)
606 # define DEFAULT_PING_TIMEOUT 1
609 #if !defined (DEFAULT_DEFAULT_LEASE_TIME)
610 # define DEFAULT_DEFAULT_LEASE_TIME 43200
613 #if !defined (DEFAULT_MIN_LEASE_TIME)
614 # define DEFAULT_MIN_LEASE_TIME 300
617 #if !defined (DEFAULT_MAX_LEASE_TIME)
618 # define DEFAULT_MAX_LEASE_TIME 86400
621 #if !defined (DEFAULT_DDNS_TTL)
622 # define DEFAULT_DDNS_TTL 3600
625 /* Client option names */
628 #define CL_SELECT_INTERVAL 2
629 #define CL_REBOOT_TIMEOUT 3
630 #define CL_RETRY_INTERVAL 4
631 #define CL_BACKOFF_CUTOFF 5
632 #define CL_INITIAL_INTERVAL 6
633 #define CL_BOOTP_POLICY 7
634 #define CL_SCRIPT_NAME 8
635 #define CL_REQUESTED_OPTIONS 9
636 #define CL_REQUESTED_LEASE_TIME 10
637 #define CL_SEND_OPTIONS 11
639 #define CL_REJECT_LIST 13
641 #ifndef CL_DEFAULT_TIMEOUT
642 # define CL_DEFAULT_TIMEOUT 60
645 #ifndef CL_DEFAULT_SELECT_INTERVAL
646 # define CL_DEFAULT_SELECT_INTERVAL 0
649 #ifndef CL_DEFAULT_REBOOT_TIMEOUT
650 # define CL_DEFAULT_REBOOT_TIMEOUT 10
653 #ifndef CL_DEFAULT_RETRY_INTERVAL
654 # define CL_DEFAULT_RETRY_INTERVAL 300
657 #ifndef CL_DEFAULT_BACKOFF_CUTOFF
658 # define CL_DEFAULT_BACKOFF_CUTOFF 120
661 #ifndef CL_DEFAULT_INITIAL_INTERVAL
662 # define CL_DEFAULT_INITIAL_INTERVAL 10
665 #ifndef CL_DEFAULT_BOOTP_POLICY
666 # define CL_DEFAULT_BOOTP_POLICY P_ACCEPT
669 #ifndef CL_DEFAULT_REQUESTED_OPTIONS
670 # define CL_DEFAULT_REQUESTED_OPTIONS \
672 DHO_BROADCAST_ADDRESS, \
676 DHO_DOMAIN_NAME_SERVERS, \
680 struct group_object
{
681 OMAPI_OBJECT_PREAMBLE
;
683 struct group_object
*n_dynamic
;
687 #define GROUP_OBJECT_DELETED 1
688 #define GROUP_OBJECT_DYNAMIC 2
689 #define GROUP_OBJECT_STATIC 4
692 /* Group of declarations that share common parameters. */
697 struct group_object
*object
;
698 struct subnet
*subnet
;
699 struct shared_network
*shared_network
;
701 struct executable_statement
*statements
;
704 /* A dhcp host declaration structure. */
706 OMAPI_OBJECT_PREAMBLE
;
707 struct host_decl
*n_ipaddr
;
708 struct host_decl
*n_dynamic
;
710 struct hardware interface
;
711 struct data_string client_identifier
;
712 struct option
*host_id_option
;
713 struct data_string host_id
;
714 /* XXXSK: fixed_addr should be an array of iaddr values,
715 not an option_cache, but it's referenced in a lot of
716 places, so we'll leave it for now. */
717 struct option_cache
*fixed_addr
;
719 struct group_object
*named_group
;
720 struct data_string auth_key_id
;
722 #define HOST_DECL_DELETED 1
723 #define HOST_DECL_DYNAMIC 2
724 #define HOST_DECL_STATIC 4
730 permit_unknown_clients
,
731 permit_known_clients
,
732 permit_authenticated_clients
,
733 permit_unauthenticated_clients
,
735 permit_dynamic_bootp_clients
,
742 OMAPI_OBJECT_PREAMBLE
;
745 struct shared_network
*shared_network
;
746 struct permit
*permit_list
;
747 struct permit
*prohibit_list
;
748 struct lease
*active
;
749 struct lease
*expired
;
751 struct lease
*backup
;
752 struct lease
*abandoned
;
753 struct lease
*reserved
;
754 TIME next_event_time
;
759 #if defined (FAILOVER_PROTOCOL)
760 dhcp_failover_state_t
*failover_peer
;
764 struct shared_network
{
765 OMAPI_OBJECT_PREAMBLE
;
766 struct shared_network
*next
;
768 struct subnet
*subnets
;
769 struct interface_info
*interface
;
771 struct ipv6_pool
**ipv6_pools
; /* NULL-terminated array */
772 int last_ipv6_pool
; /* offset of last IPv6 pool
773 used to issue a lease */
775 #if defined (FAILOVER_PROTOCOL)
776 dhcp_failover_state_t
*failover_peer
;
781 OMAPI_OBJECT_PREAMBLE
;
782 struct subnet
*next_subnet
;
783 struct subnet
*next_sibling
;
784 struct shared_network
*shared_network
;
785 struct interface_info
*interface
;
786 struct iaddr interface_address
;
788 struct iaddr netmask
;
789 int prefix_len
; /* XXX: currently for IPv6 only */
794 struct collection
*next
;
797 struct class *classes
;
800 /* Used as an argument to parse_clasS_decl() */
801 #define CLASS_TYPE_VENDOR 0
802 #define CLASS_TYPE_USER 1
803 #define CLASS_TYPE_CLASS 2
804 #define CLASS_TYPE_SUBCLASS 3
806 /* XXX classes must be reference-counted. */
808 OMAPI_OBJECT_PREAMBLE
;
809 struct class *nic
; /* Next in collection. */
810 struct class *superclass
; /* Set for spawned classes only. */
811 char *name
; /* Not set for spawned classes. */
813 /* A class may be configured to permit a limited number of leases. */
816 struct lease
**billed_leases
;
818 /* If nonzero, class has not been saved since it was last
822 /* Hash table containing subclasses. */
824 struct data_string hash_string
;
826 /* Expression used to match class. */
827 struct expression
*expr
;
829 /* Expression used to compute subclass identifiers for spawning
830 and to do subclass matching. */
831 struct expression
*submatch
;
836 /* Statements to execute if class matches. */
837 struct executable_statement
*statements
;
839 #define CLASS_DECL_DELETED 1
840 #define CLASS_DECL_DYNAMIC 2
841 #define CLASS_DECL_STATIC 4
842 #define CLASS_DECL_SUBCLASS 8
847 /* DHCP client lease structure... */
848 struct client_lease
{
849 struct client_lease
*next
; /* Next lease in list. */
850 TIME expiry
, renewal
, rebind
; /* Lease timeouts. */
851 struct iaddr address
; /* Address being leased. */
852 char *server_name
; /* Name of boot server. */
853 char *filename
; /* Name of file we're supposed to boot. */
854 struct string_list
*medium
; /* Network medium. */
855 struct auth_key
*key
; /* Key used in basic DHCP authentication. */
857 unsigned int is_static
: 1; /* If set, lease is from config file. */
858 unsigned int is_bootp
: 1; /* If set, lease was acquired with BOOTP. */
860 struct option_state
*options
; /* Options supplied with lease. */
863 /* DHCPv6 lease structures */
865 struct dhc6_addr
*next
;
866 struct iaddr address
;
868 /* Address state flags. */
869 #define DHC6_ADDR_DEPREFFED 0x01
870 #define DHC6_ADDR_EXPIRED 0x02
874 u_int32_t preferred_life
;
877 struct option_state
*options
;
881 struct dhc6_ia
*next
;
882 unsigned char iaid
[4];
887 struct dhc6_addr
*addrs
;
889 struct option_state
*options
;
893 struct dhc6_lease
*next
;
894 struct data_string server_id
;
899 unsigned char dhcpv6_transaction_id
[3];
900 struct dhc6_ia
*bindings
;
902 struct option_state
*options
;
905 /* Possible states in which the client can be. */
917 /* Authentication and BOOTP policy possibilities (not all values work
919 enum policy
{ P_IGNORE
, P_ACCEPT
, P_PREFER
, P_REQUIRE
, P_DONT
};
921 /* Configuration information from the config file... */
922 struct client_config
{
924 * When a message has been received, run these statements
927 struct group
*on_receipt
;
930 * When a message is sent, run these statements.
932 struct group
*on_transmission
;
934 u_int32_t
*required_options
; /* Options server must supply. */
935 u_int32_t
*requested_options
; /* Options to request from server. */
937 TIME timeout
; /* Start to panic if we don't get a
938 lease in this time period when
940 TIME initial_interval
; /* All exponential backoff intervals
942 TIME retry_interval
; /* If the protocol failed to produce
943 an address before the timeout,
944 try the protocol again after this
946 TIME select_interval
; /* Wait this many seconds from the
947 first DHCPDISCOVER before
948 picking an offered lease. */
949 TIME reboot_timeout
; /* When in INIT-REBOOT, wait this
950 long before giving up and going
952 TIME backoff_cutoff
; /* When doing exponential backoff,
953 never back off to an interval
954 longer than this amount. */
955 u_int32_t requested_lease
; /* Requested lease time, if user
956 doesn't configure one. */
957 struct string_list
*media
; /* Possible network media values. */
958 char *script_name
; /* Name of config script. */
959 char *vendor_space_name
; /* Name of config script. */
960 enum policy bootp_policy
;
961 /* Ignore, accept or prefer BOOTP
963 enum policy auth_policy
;
964 /* Require authentication, prefer
965 authentication, or don't try to
967 struct string_list
*medium
; /* Current network medium. */
969 struct iaddrmatchlist
*reject_list
; /* Servers to reject. */
971 int omapi_port
; /* port on which to accept OMAPI
972 connections, or -1 for no
974 int do_forward_update
; /* If nonzero, and if we have the
975 information we need, update the
976 A record for the address we get. */
979 /* Per-interface state used in the dhcp client... */
980 /* XXX: consider union {}'ing this for v4/v6. */
981 struct client_state
{
982 struct client_state
*next
;
983 struct interface_info
*interface
;
987 struct client_config
*config
; /* Client configuration. */
988 struct string_list
*env
; /* Client script environment. */
989 int envc
; /* Number of entries in environment. */
990 struct option_state
*sent_options
; /* Options we sent. */
991 enum dhcp_state state
; /* Current state for this interface. */
995 struct client_lease
*active
; /* Currently active lease. */
996 struct client_lease
*new; /* New lease. */
997 struct client_lease
*offered_leases
; /* Leases offered to us. */
998 struct client_lease
*leases
; /* Leases we currently hold. */
999 struct client_lease
*alias
; /* Alias lease. */
1001 struct iaddr destination
; /* Where to send packet. */
1002 u_int32_t xid
; /* Transaction ID. */
1003 u_int16_t secs
; /* secs value from DHCPDISCOVER. */
1004 TIME first_sending
; /* When was first copy sent? */
1005 TIME interval
; /* What's the current resend interval? */
1006 struct string_list
*medium
; /* Last media type tried. */
1007 struct dhcp_packet packet
; /* Outgoing DHCP packet. */
1008 unsigned packet_length
; /* Actual length of generated packet. */
1010 struct iaddr requested_address
; /* Address we would like to get. */
1012 /* DHCPv6 values. */
1013 unsigned char dhcpv6_transaction_id
[3];
1014 u_int8_t refresh_type
;
1016 struct dhc6_lease
*active_lease
;
1017 struct dhc6_lease
*old_lease
;
1018 struct dhc6_lease
*advertised_leases
;
1019 struct dhc6_lease
*selected_lease
;
1020 struct dhc6_lease
*held_leases
;
1026 /* See RFC3315 section 14. */
1034 /* Rather than a state, we use a function that shifts around
1035 * depending what stage of life the v6 state machine is in.
1036 * This is where incoming packets are dispatched to (sometimes
1039 void (*v6_handler
)(struct packet
*, struct client_state
*);
1042 struct envadd_state
{
1043 struct client_state
*client
;
1047 struct dns_update_state
{
1048 struct client_state
*client
;
1049 struct iaddr address
;
1050 int dns_update_timeout
;
1053 /* Information about each network interface. */
1055 struct interface_info
{
1056 OMAPI_OBJECT_PREAMBLE
;
1057 struct interface_info
*next
; /* Next interface in list... */
1058 struct shared_network
*shared_network
;
1059 /* Networks connected to this interface. */
1060 struct hardware hw_address
; /* Its physical address. */
1061 struct in_addr
*addresses
; /* Addresses associated with this
1064 int address_count
; /* Number of addresses stored. */
1065 int address_max
; /* Size of addresses buffer. */
1066 struct in6_addr
*v6addresses
; /* IPv6 addresses associated with
1068 int v6address_count
; /* Number of IPv6 addresses associated
1069 with this interface. */
1070 int v6address_max
; /* Maximum number of IPv6 addresses
1071 we can store in current buffer. */
1073 u_int8_t
*circuit_id
; /* Circuit ID associated with this
1075 unsigned circuit_id_len
; /* Length of Circuit ID, if there
1077 u_int8_t
*remote_id
; /* Remote ID associated with this
1078 interface (if any). */
1079 unsigned remote_id_len
; /* Length of Remote ID. */
1081 char name
[IFNAMSIZ
]; /* Its name... */
1082 int index
; /* Its index. */
1083 int rfdesc
; /* Its read file descriptor. */
1084 int wfdesc
; /* Its write file descriptor, if
1086 unsigned char *rbuf
; /* Read buffer, if required. */
1087 unsigned int rbuf_max
; /* Size of read buffer. */
1088 size_t rbuf_offset
; /* Current offset into buffer. */
1089 size_t rbuf_len
; /* Length of data in buffer. */
1091 struct ifreq
*ifp
; /* Pointer to ifreq struct. */
1092 int configured
; /* If set to 1, interface has at least
1093 * one valid IP address.
1095 u_int32_t flags
; /* Control flags... */
1096 #define INTERFACE_REQUESTED 1
1097 #define INTERFACE_AUTOMATIC 2
1098 #define INTERFACE_RUNNING 4
1100 /* Only used by DHCP client code. */
1101 struct client_state
*client
;
1102 # if defined (USE_DLPI_SEND) || defined (USE_DLPI_RECEIVE)
1103 int dlpi_sap_length
;
1104 struct hardware dlpi_broadcast_addr
;
1105 # endif /* DLPI_SEND || DLPI_RECEIVE */
1108 struct hardware_link
{
1109 struct hardware_link
*next
;
1110 char name
[IFNAMSIZ
];
1111 struct hardware address
;
1114 typedef void (*tvref_t
)(void *, void *, const char *, int);
1115 typedef void (*tvunref_t
)(void *, const char *, int);
1117 struct timeout
*next
;
1119 void (*func
) PROTO ((void *));
1126 struct protocol
*next
;
1128 void (*handler
) PROTO ((struct protocol
*));
1132 struct dns_query
; /* forward */
1135 struct dns_wakeup
*next
; /* Next wakeup in chain. */
1136 void (*func
) PROTO ((struct dns_query
*));
1139 struct dns_question
{
1140 u_int16_t type
; /* Type of query. */
1141 u_int16_t
class; /* Class of query. */
1142 unsigned char data
[1]; /* Query data. */
1146 u_int16_t type
; /* Type of answer. */
1147 u_int16_t
class; /* Class of answer. */
1148 int count
; /* Number of answers. */
1149 unsigned char *answers
[1]; /* Pointers to answers. */
1153 struct dns_query
*next
; /* Next query in hash bucket. */
1154 u_int32_t hash
; /* Hash bucket index. */
1155 TIME expiry
; /* Query expiry time (zero if not yet
1157 u_int16_t id
; /* Query ID (also hash table index) */
1158 caddr_t waiters
; /* Pointer to list of things waiting
1161 struct dns_question
*question
; /* Question, internal format. */
1162 struct dns_answer
*answer
; /* Answer, internal format. */
1164 unsigned char *query
; /* Query formatted for DNS server. */
1165 unsigned len
; /* Length of entire query. */
1166 int sent
; /* The query has been sent. */
1167 struct dns_wakeup
*wakeups
; /* Wakeups to call if this query is
1169 struct name_server
*next_server
; /* Next server to try. */
1170 int backoff
; /* Current backoff, in seconds. */
1177 struct option_cache
*primary
;
1178 struct option_cache
*secondary
;
1179 struct auth_key
*key
;
1183 OMAPI_OBJECT_PREAMBLE
;
1185 void (*icmp_handler
) PROTO ((struct iaddr
, u_int8_t
*, int));
1190 /* Bitmask of dhcp option codes. */
1191 typedef unsigned char option_mask
[16];
1193 /* DHCP Option mask manipulation macros... */
1194 #define OPTION_ZERO(mask) (memset (mask, 0, 16))
1195 #define OPTION_SET(mask, bit) (mask [bit >> 8] |= (1 << (bit & 7)))
1196 #define OPTION_CLR(mask, bit) (mask [bit >> 8] &= ~(1 << (bit & 7)))
1197 #define OPTION_ISSET(mask, bit) (mask [bit >> 8] & (1 << (bit & 7)))
1198 #define OPTION_ISCLR(mask, bit) (!OPTION_ISSET (mask, bit))
1200 /* An option occupies its length plus two header bytes (code and
1201 length) for every 255 bytes that must be stored. */
1202 #define OPTION_SPACE(x) ((x) + 2 * ((x) / 255 + 1))
1204 /* Default path to dhcpd config file. */
1206 #undef _PATH_DHCPD_CONF
1207 #define _PATH_DHCPD_CONF "dhcpd.conf"
1208 #undef _PATH_DHCPD_DB
1209 #define _PATH_DHCPD_DB "dhcpd.leases"
1210 #undef _PATH_DHCPD_PID
1211 #define _PATH_DHCPD_PID "dhcpd.pid"
1213 #ifndef _PATH_DHCPD_CONF
1214 #define _PATH_DHCPD_CONF "/etc/dhcpd.conf"
1217 #ifndef _PATH_DHCPD_DB
1218 #define _PATH_DHCPD_DB LOCALSTATEDIR"/db/dhcpd.leases"
1221 #ifndef _PATH_DHCPD_PID
1222 #define _PATH_DHCPD_PID LOCALSTATEDIR"/run/dhcpd.pid"
1226 #ifndef _PATH_DHCLIENT_CONF
1227 #define _PATH_DHCLIENT_CONF "/etc/dhclient.conf"
1230 #ifndef _PATH_DHCLIENT_SCRIPT
1231 #define _PATH_DHCLIENT_SCRIPT "/sbin/dhclient-script"
1234 #ifndef _PATH_DHCLIENT_PID
1235 #define _PATH_DHCLIENT_PID LOCALSTATEDIR"/run/dhclient.pid"
1238 #ifndef _PATH_DHCLIENT6_PID
1239 #define _PATH_DHCLIENT6_PID LOCALSTATEDIR"/run/dhclient6.pid"
1242 #ifndef _PATH_DHCLIENT_DB
1243 #define _PATH_DHCLIENT_DB LOCALSTATEDIR"/db/dhclient.leases"
1246 #ifndef _PATH_DHCLIENT6_DB
1247 #define _PATH_DHCLIENT6_DB LOCALSTATEDIR"/db/dhclient6.leases"
1250 #ifndef _PATH_RESOLV_CONF
1251 #define _PATH_RESOLV_CONF "/etc/resolv.conf"
1254 #ifndef _PATH_DHCRELAY_PID
1255 #define _PATH_DHCRELAY_PID LOCALSTATEDIR"/run/dhcrelay.pid"
1258 #ifndef DHCPD_LOG_FACILITY
1259 #define DHCPD_LOG_FACILITY LOG_DAEMON
1262 #define MAX_TIME 0x7fffffff
1265 /* these are referenced */
1266 typedef struct hash_table ia_na_hash_t
;
1267 typedef struct hash_table iaaddr_hash_t
;
1270 int refcnt
; /* reference count */
1271 struct in6_addr addr
; /* IPv6 address */
1272 binding_state_t state
; /* state */
1273 struct binding_scope
*scope
; /* "set var = value;" */
1274 time_t valid_lifetime_end_time
; /* time address expires */
1275 struct ia_na
*ia_na
; /* IA for this address */
1276 struct ipv6_pool
*ipv6_pool
; /* pool for this address */
1278 * For now, just pick an arbitrary time to keep old leases
1279 * around (value in seconds).
1281 #define EXPIRED_IPV6_CLEANUP_TIME (60*60)
1283 int heap_index
; /* index into heap, or -1
1284 (internal use only) */
1288 int refcnt
; /* reference count */
1289 struct data_string iaid_duid
; /* from the client */
1290 int num_iaaddr
; /* number of IAADDR for this IA_NA */
1291 int max_iaaddr
; /* space available for IAADDR */
1292 struct iaaddr
**iaaddr
; /* pointers to the various IAADDRs */
1295 extern ia_na_hash_t
*ia_active
;
1298 int refcnt
; /* reference count */
1299 struct in6_addr start_addr
; /* first IPv6 address */
1300 int bits
; /* number of bits, CIDR style */
1301 iaaddr_hash_t
*addrs
; /* non-free IAADDR */
1302 int num_active
; /* count of active IAADDR */
1303 isc_heap_t
*active_timeouts
; /* timeouts for active leases */
1304 int num_inactive
; /* count of inactive IAADDR */
1305 isc_heap_t
*inactive_timeouts
; /* timeouts for expired or
1307 struct shared_network
*shared_network
; /* shared_network for
1311 extern struct ipv6_pool
**pools
;
1312 extern int num_pools
;
1314 /* External definitions... */
1316 HASH_FUNCTIONS_DECL (group
, const char *, struct group_object
, group_hash_t
)
1317 HASH_FUNCTIONS_DECL (universe
, const char *, struct universe
, universe_hash_t
)
1318 HASH_FUNCTIONS_DECL (option_name
, const char *, struct option
,
1320 HASH_FUNCTIONS_DECL (option_code
, const unsigned *, struct option
,
1322 HASH_FUNCTIONS_DECL (dns_zone
, const char *, struct dns_zone
, dns_zone_hash_t
)
1323 HASH_FUNCTIONS_DECL(lease_ip
, const unsigned char *, struct lease
,
1325 HASH_FUNCTIONS_DECL(lease_id
, const unsigned char *, struct lease
,
1327 HASH_FUNCTIONS_DECL (host
, const unsigned char *, struct host_decl
, host_hash_t
)
1328 HASH_FUNCTIONS_DECL (class, const char *, struct class, class_hash_t
)
1332 extern struct option
*vendor_cfg_option
;
1333 int parse_options
PROTO ((struct packet
*));
1334 int parse_option_buffer
PROTO ((struct option_state
*, const unsigned char *,
1335 unsigned, struct universe
*));
1336 struct universe
*find_option_universe (struct option
*, const char *);
1337 int parse_encapsulated_suboptions (struct option_state
*, struct option
*,
1338 const unsigned char *, unsigned,
1339 struct universe
*, const char *);
1340 int cons_options
PROTO ((struct packet
*, struct dhcp_packet
*, struct lease
*,
1341 struct client_state
*,
1342 int, struct option_state
*, struct option_state
*,
1343 struct binding_scope
**,
1344 int, int, int, struct data_string
*, const char *));
1345 int fqdn_universe_decode (struct option_state
*,
1346 const unsigned char *, unsigned, struct universe
*);
1347 struct option_cache
*
1348 lookup_fqdn6_option(struct universe
*universe
, struct option_state
*options
,
1351 save_fqdn6_option(struct universe
*universe
, struct option_state
*options
,
1352 struct option_cache
*oc
);
1354 delete_fqdn6_option(struct universe
*universe
, struct option_state
*options
,
1357 fqdn6_option_space_foreach(struct packet
*packet
, struct lease
*lease
,
1358 struct client_state
*client_state
,
1359 struct option_state
*in_options
,
1360 struct option_state
*cfg_options
,
1361 struct binding_scope
**scope
,
1362 struct universe
*u
, void *stuff
,
1363 void (*func
)(struct option_cache
*,
1366 struct client_state
*,
1367 struct option_state
*,
1368 struct option_state
*,
1369 struct binding_scope
**,
1370 struct universe
*, void *));
1372 fqdn6_option_space_encapsulate(struct data_string
*result
,
1373 struct packet
*packet
, struct lease
*lease
,
1374 struct client_state
*client_state
,
1375 struct option_state
*in_options
,
1376 struct option_state
*cfg_options
,
1377 struct binding_scope
**scope
,
1378 struct universe
*universe
);
1380 fqdn6_universe_decode(struct option_state
*options
,
1381 const unsigned char *buffer
, unsigned length
,
1382 struct universe
*u
);
1383 int append_option(struct data_string
*dst
, struct universe
*universe
,
1384 struct option
*option
, struct data_string
*src
);
1385 int store_options
PROTO ((int *, unsigned char *, unsigned, struct packet
*,
1386 struct lease
*, struct client_state
*,
1387 struct option_state
*,
1388 struct option_state
*, struct binding_scope
**,
1389 unsigned *, int, unsigned, unsigned,
1390 int, const char *));
1391 int store_options6(char *, int, struct option_state
*, struct packet
*,
1392 const int *, struct data_string
*);
1393 int format_has_text(const char *);
1394 int format_min_length(const char *, struct option_cache
*);
1395 const char *pretty_print_option
PROTO ((struct option
*, const unsigned char *,
1396 unsigned, int, int));
1397 int pretty_escape(char **, char *, const unsigned char **,
1398 const unsigned char *);
1399 int get_option (struct data_string
*, struct universe
*,
1400 struct packet
*, struct lease
*, struct client_state
*,
1401 struct option_state
*, struct option_state
*,
1402 struct option_state
*, struct binding_scope
**, unsigned,
1404 void set_option (struct universe
*, struct option_state
*,
1405 struct option_cache
*, enum statement_op
);
1406 struct option_cache
*lookup_option
PROTO ((struct universe
*,
1407 struct option_state
*, unsigned));
1408 struct option_cache
*lookup_hashed_option
PROTO ((struct universe
*,
1409 struct option_state
*,
1411 struct option_cache
*next_hashed_option(struct universe
*,
1412 struct option_state
*,
1413 struct option_cache
*);
1414 int save_option_buffer (struct universe
*, struct option_state
*,
1415 struct buffer
*, unsigned char *, unsigned,
1417 void build_server_oro(struct data_string
*, struct option_state
*,
1419 void save_option
PROTO ((struct universe
*,
1420 struct option_state
*, struct option_cache
*));
1421 void save_hashed_option
PROTO ((struct universe
*,
1422 struct option_state
*, struct option_cache
*));
1423 void delete_option
PROTO ((struct universe
*, struct option_state
*, int));
1424 void delete_hashed_option
PROTO ((struct universe
*,
1425 struct option_state
*, int));
1426 int option_cache_dereference
PROTO ((struct option_cache
**,
1427 const char *, int));
1428 int hashed_option_state_dereference
PROTO ((struct universe
*,
1429 struct option_state
*,
1430 const char *, int));
1431 int store_option
PROTO ((struct data_string
*,
1432 struct universe
*, struct packet
*, struct lease
*,
1433 struct client_state
*,
1434 struct option_state
*, struct option_state
*,
1435 struct binding_scope
**, struct option_cache
*));
1436 int option_space_encapsulate
PROTO ((struct data_string
*,
1437 struct packet
*, struct lease
*,
1438 struct client_state
*,
1439 struct option_state
*,
1440 struct option_state
*,
1441 struct binding_scope
**,
1442 struct data_string
*));
1443 int hashed_option_space_encapsulate
PROTO ((struct data_string
*,
1444 struct packet
*, struct lease
*,
1445 struct client_state
*,
1446 struct option_state
*,
1447 struct option_state
*,
1448 struct binding_scope
**,
1449 struct universe
*));
1450 int nwip_option_space_encapsulate
PROTO ((struct data_string
*,
1451 struct packet
*, struct lease
*,
1452 struct client_state
*,
1453 struct option_state
*,
1454 struct option_state
*,
1455 struct binding_scope
**,
1456 struct universe
*));
1457 int fqdn_option_space_encapsulate (struct data_string
*,
1458 struct packet
*, struct lease
*,
1459 struct client_state
*,
1460 struct option_state
*,
1461 struct option_state
*,
1462 struct binding_scope
**,
1464 void suboption_foreach (struct packet
*, struct lease
*, struct client_state
*,
1465 struct option_state
*, struct option_state
*,
1466 struct binding_scope
**, struct universe
*, void *,
1467 void (*) (struct option_cache
*, struct packet
*,
1468 struct lease
*, struct client_state
*,
1469 struct option_state
*, struct option_state
*,
1470 struct binding_scope
**,
1471 struct universe
*, void *),
1472 struct option_cache
*, const char *);
1473 void option_space_foreach (struct packet
*, struct lease
*,
1474 struct client_state
*,
1475 struct option_state
*,
1476 struct option_state
*,
1477 struct binding_scope
**,
1478 struct universe
*, void *,
1479 void (*) (struct option_cache
*,
1481 struct lease
*, struct client_state
*,
1482 struct option_state
*,
1483 struct option_state
*,
1484 struct binding_scope
**,
1485 struct universe
*, void *));
1486 void hashed_option_space_foreach (struct packet
*, struct lease
*,
1487 struct client_state
*,
1488 struct option_state
*,
1489 struct option_state
*,
1490 struct binding_scope
**,
1491 struct universe
*, void *,
1492 void (*) (struct option_cache
*,
1495 struct client_state
*,
1496 struct option_state
*,
1497 struct option_state
*,
1498 struct binding_scope
**,
1499 struct universe
*, void *));
1500 int linked_option_get
PROTO ((struct data_string
*, struct universe
*,
1501 struct packet
*, struct lease
*,
1502 struct client_state
*,
1503 struct option_state
*, struct option_state
*,
1504 struct option_state
*, struct binding_scope
**,
1506 int linked_option_state_dereference
PROTO ((struct universe
*,
1507 struct option_state
*,
1508 const char *, int));
1509 void save_linked_option (struct universe
*, struct option_state
*,
1510 struct option_cache
*);
1511 void linked_option_space_foreach (struct packet
*, struct lease
*,
1512 struct client_state
*,
1513 struct option_state
*,
1514 struct option_state
*,
1515 struct binding_scope
**,
1516 struct universe
*, void *,
1517 void (*) (struct option_cache
*,
1520 struct client_state
*,
1521 struct option_state
*,
1522 struct option_state
*,
1523 struct binding_scope
**,
1524 struct universe
*, void *));
1525 int linked_option_space_encapsulate (struct data_string
*, struct packet
*,
1526 struct lease
*, struct client_state
*,
1527 struct option_state
*,
1528 struct option_state
*,
1529 struct binding_scope
**,
1531 void delete_linked_option (struct universe
*, struct option_state
*, int);
1532 struct option_cache
*lookup_linked_option (struct universe
*,
1533 struct option_state
*, unsigned);
1534 void do_packet
PROTO ((struct interface_info
*,
1535 struct dhcp_packet
*, unsigned,
1536 unsigned int, struct iaddr
, struct hardware
*));
1537 void do_packet6(struct interface_info
*, const char *,
1538 int, int, const struct iaddr
*, isc_boolean_t
);
1539 int packet6_len_okay(const char *, int);
1541 int add_option(struct option_state
*options
,
1542 unsigned int option_num
,
1544 unsigned int data_len
);
1546 int add_option(struct option_state
*options
,
1547 unsigned int option_num
,
1549 unsigned int data_len
);
1552 extern TIME cur_time
;
1554 int ddns_update_style
;
1556 extern const char *path_dhcpd_conf
;
1557 extern const char *path_dhcpd_db
;
1558 extern const char *path_dhcpd_pid
;
1560 extern int dhcp_max_agent_option_packet_length
;
1562 int main(int, char **);
1563 void postconf_initialization(int);
1564 void postdb_startup(void);
1565 void cleanup
PROTO ((void));
1566 void lease_pinged
PROTO ((struct iaddr
, u_int8_t
*, int));
1567 void lease_ping_timeout
PROTO ((void *));
1568 int dhcpd_interface_setup_hook (struct interface_info
*ip
, struct iaddr
*ia
);
1569 enum dhcp_shutdown_state shutdown_state
;
1570 isc_result_t
dhcp_io_shutdown (omapi_object_t
*, void *);
1571 isc_result_t
dhcp_set_control_state (control_object_state_t oldstate
,
1572 control_object_state_t newstate
);
1575 isc_result_t new_parse
PROTO ((struct parse
**, int,
1576 char *, unsigned, const char *, int));
1577 isc_result_t end_parse
PROTO ((struct parse
**));
1578 isc_result_t
save_parse_state(struct parse
*cfile
);
1579 isc_result_t
restore_parse_state(struct parse
*cfile
);
1580 enum dhcp_token next_token
PROTO ((const char **, unsigned *, struct parse
*));
1581 enum dhcp_token peek_token
PROTO ((const char **, unsigned *, struct parse
*));
1582 enum dhcp_token
next_raw_token(const char **rval
, unsigned *rlen
,
1583 struct parse
*cfile
);
1584 enum dhcp_token
peek_raw_token(const char **rval
, unsigned *rlen
,
1585 struct parse
*cfile
);
1588 void parse_trace_setup (void);
1589 isc_result_t readconf
PROTO ((void));
1590 isc_result_t
read_conf_file (const char *, struct group
*, int, int);
1591 #if defined (TRACING)
1592 void trace_conf_input (trace_type_t
*, unsigned, char *);
1593 void trace_conf_stop (trace_type_t
*ttype
);
1595 isc_result_t
conf_file_subparse (struct parse
*, struct group
*, int);
1596 isc_result_t
lease_file_subparse (struct parse
*);
1597 int parse_statement
PROTO ((struct parse
*,
1598 struct group
*, int, struct host_decl
*, int));
1599 #if defined (FAILOVER_PROTOCOL)
1600 void parse_failover_peer
PROTO ((struct parse
*, struct group
*, int));
1601 void parse_failover_state_declaration (struct parse
*,
1602 dhcp_failover_state_t
*);
1603 void parse_failover_state
PROTO ((struct parse
*,
1604 enum failover_state
*, TIME
*));
1606 int permit_list_match (struct permit
*, struct permit
*);
1607 void parse_pool_statement
PROTO ((struct parse
*, struct group
*, int));
1608 int parse_boolean
PROTO ((struct parse
*));
1609 int parse_lbrace
PROTO ((struct parse
*));
1610 void parse_host_declaration
PROTO ((struct parse
*, struct group
*));
1611 int parse_class_declaration
PROTO ((struct class **, struct parse
*,
1612 struct group
*, int));
1613 void parse_shared_net_declaration
PROTO ((struct parse
*, struct group
*));
1614 void parse_subnet_declaration
PROTO ((struct parse
*,
1615 struct shared_network
*));
1616 void parse_subnet6_declaration
PROTO ((struct parse
*,
1617 struct shared_network
*));
1618 void parse_group_declaration
PROTO ((struct parse
*, struct group
*));
1619 int parse_fixed_addr_param
PROTO ((struct option_cache
**,
1620 struct parse
*, enum dhcp_token
));
1621 int parse_lease_declaration
PROTO ((struct lease
**, struct parse
*));
1622 int parse_ip6_addr(struct parse
*, struct iaddr
*);
1623 int parse_ip6_addr_expr(struct expression
**, struct parse
*);
1624 void parse_address_range
PROTO ((struct parse
*, struct group
*, int,
1625 struct pool
*, struct lease
**));
1626 void parse_address_range6(struct parse
*cfile
, struct group
*group
);
1627 void parse_ia_na_declaration(struct parse
*);
1628 void parse_server_duid(struct parse
*cfile
);
1629 void parse_server_duid_conf(struct parse
*cfile
);
1632 int ddns_updates(struct packet
*, struct lease
*, struct lease
*,
1633 struct iaaddr
*, struct iaaddr
*, struct option_state
*);
1634 int ddns_removals(struct lease
*, struct iaaddr
*);
1637 void add_enumeration (struct enumeration
*);
1638 struct enumeration
*find_enumeration (const char *, int);
1639 struct enumeration_value
*find_enumeration_value (const char *, int,
1641 void skip_to_semi
PROTO ((struct parse
*));
1642 void skip_to_rbrace
PROTO ((struct parse
*, int));
1643 int parse_semi
PROTO ((struct parse
*));
1644 int parse_string
PROTO ((struct parse
*, char **, unsigned *));
1645 char *parse_host_name
PROTO ((struct parse
*));
1646 int parse_ip_addr_or_hostname
PROTO ((struct expression
**,
1647 struct parse
*, int));
1648 void parse_hardware_param
PROTO ((struct parse
*, struct hardware
*));
1649 void parse_lease_time
PROTO ((struct parse
*, TIME
*));
1650 unsigned char *parse_numeric_aggregate
PROTO ((struct parse
*,
1651 unsigned char *, unsigned *,
1652 int, int, unsigned));
1653 void convert_num
PROTO ((struct parse
*, unsigned char *, const char *,
1655 TIME parse_date
PROTO ((struct parse
*));
1656 isc_result_t parse_option_name
PROTO ((struct parse
*, int, int *,
1658 void parse_option_space_decl
PROTO ((struct parse
*));
1659 int parse_option_code_definition
PROTO ((struct parse
*, struct option
*));
1660 int parse_base64 (struct data_string
*, struct parse
*);
1661 int parse_cshl
PROTO ((struct data_string
*, struct parse
*));
1662 int parse_executable_statement
PROTO ((struct executable_statement
**,
1663 struct parse
*, int *,
1664 enum expression_context
));
1665 int parse_executable_statements
PROTO ((struct executable_statement
**,
1666 struct parse
*, int *,
1667 enum expression_context
));
1668 int parse_zone (struct dns_zone
*, struct parse
*);
1669 int parse_key (struct parse
*);
1670 int parse_on_statement
PROTO ((struct executable_statement
**,
1671 struct parse
*, int *));
1672 int parse_switch_statement
PROTO ((struct executable_statement
**,
1673 struct parse
*, int *));
1674 int parse_case_statement
PROTO ((struct executable_statement
**,
1675 struct parse
*, int *,
1676 enum expression_context
));
1677 int parse_if_statement
PROTO ((struct executable_statement
**,
1678 struct parse
*, int *));
1679 int parse_boolean_expression
PROTO ((struct expression
**,
1680 struct parse
*, int *));
1681 int parse_data_expression
PROTO ((struct expression
**,
1682 struct parse
*, int *));
1683 int parse_numeric_expression
PROTO ((struct expression
**,
1684 struct parse
*, int *));
1685 int parse_dns_expression
PROTO ((struct expression
**, struct parse
*, int *));
1686 int parse_non_binary
PROTO ((struct expression
**, struct parse
*, int *,
1687 enum expression_context
));
1688 int parse_expression
PROTO ((struct expression
**, struct parse
*, int *,
1689 enum expression_context
,
1690 struct expression
**, enum expr_op
));
1691 int parse_option_statement
PROTO ((struct executable_statement
**,
1692 struct parse
*, int,
1693 struct option
*, enum statement_op
));
1694 int parse_option_token
PROTO ((struct expression
**, struct parse
*,
1695 const char **, struct expression
*, int, int));
1696 int parse_allow_deny
PROTO ((struct option_cache
**, struct parse
*, int));
1697 int parse_auth_key
PROTO ((struct data_string
*, struct parse
*));
1698 int parse_warn (struct parse
*, const char *, ...)
1699 __attribute__((__format__(__printf__
,2,3)));
1700 struct expression
*parse_domain_list(struct parse
*cfile
, int);
1704 #if defined (NSUPDATE)
1705 extern struct __res_state resolver_state
;
1706 extern int resolver_inited
;
1709 extern struct binding_scope
*global_scope
;
1710 pair cons
PROTO ((caddr_t
, pair
));
1711 int make_const_option_cache
PROTO ((struct option_cache
**, struct buffer
**,
1712 u_int8_t
*, unsigned, struct option
*,
1713 const char *, int));
1714 int make_host_lookup
PROTO ((struct expression
**, const char *));
1715 int enter_dns_host
PROTO ((struct dns_host_entry
**, const char *));
1716 int make_const_data (struct expression
**,
1717 const unsigned char *, unsigned, int, int,
1719 int make_const_int
PROTO ((struct expression
**, unsigned long));
1720 int make_concat
PROTO ((struct expression
**,
1721 struct expression
*, struct expression
*));
1722 int make_encapsulation
PROTO ((struct expression
**, struct data_string
*));
1723 int make_substring
PROTO ((struct expression
**, struct expression
*,
1724 struct expression
*, struct expression
*));
1725 int make_limit
PROTO ((struct expression
**, struct expression
*, int));
1726 int make_let
PROTO ((struct executable_statement
**, const char *));
1727 int option_cache
PROTO ((struct option_cache
**, struct data_string
*,
1728 struct expression
*, struct option
*,
1729 const char *, int));
1730 int evaluate_expression (struct binding_value
**, struct packet
*,
1731 struct lease
*, struct client_state
*,
1732 struct option_state
*, struct option_state
*,
1733 struct binding_scope
**, struct expression
*,
1735 int binding_value_dereference (struct binding_value
**, const char *, int);
1736 #if defined (NSUPDATE)
1737 int evaluate_dns_expression
PROTO ((ns_updrec
**, struct packet
*,
1739 struct client_state
*,
1740 struct option_state
*,
1741 struct option_state
*,
1742 struct binding_scope
**,
1743 struct expression
*));
1745 int evaluate_boolean_expression
PROTO ((int *,
1746 struct packet
*, struct lease
*,
1747 struct client_state
*,
1748 struct option_state
*,
1749 struct option_state
*,
1750 struct binding_scope
**,
1751 struct expression
*));
1752 int evaluate_data_expression
PROTO ((struct data_string
*,
1753 struct packet
*, struct lease
*,
1754 struct client_state
*,
1755 struct option_state
*,
1756 struct option_state
*,
1757 struct binding_scope
**,
1758 struct expression
*, const char *, int));
1759 int evaluate_numeric_expression (unsigned long *, struct packet
*,
1760 struct lease
*, struct client_state
*,
1761 struct option_state
*, struct option_state
*,
1762 struct binding_scope
**,
1763 struct expression
*);
1764 int evaluate_option_cache
PROTO ((struct data_string
*,
1765 struct packet
*, struct lease
*,
1766 struct client_state
*,
1767 struct option_state
*, struct option_state
*,
1768 struct binding_scope
**,
1769 struct option_cache
*,
1770 const char *, int));
1771 int evaluate_boolean_option_cache
PROTO ((int *,
1772 struct packet
*, struct lease
*,
1773 struct client_state
*,
1774 struct option_state
*,
1775 struct option_state
*,
1776 struct binding_scope
**,
1777 struct option_cache
*,
1778 const char *, int));
1779 int evaluate_boolean_expression_result
PROTO ((int *,
1780 struct packet
*, struct lease
*,
1781 struct client_state
*,
1782 struct option_state
*,
1783 struct option_state
*,
1784 struct binding_scope
**,
1785 struct expression
*));
1786 void expression_dereference
PROTO ((struct expression
**, const char *, int));
1787 int is_dns_expression
PROTO ((struct expression
*));
1788 int is_boolean_expression
PROTO ((struct expression
*));
1789 int is_data_expression
PROTO ((struct expression
*));
1790 int is_numeric_expression
PROTO ((struct expression
*));
1791 int is_compound_expression
PROTO ((struct expression
*));
1792 int op_precedence
PROTO ((enum expr_op
, enum expr_op
));
1793 enum expression_context
expression_context (struct expression
*);
1794 enum expression_context op_context
PROTO ((enum expr_op
));
1795 int write_expression
PROTO ((FILE *, struct expression
*, int, int, int));
1796 struct binding
*find_binding
PROTO ((struct binding_scope
*, const char *));
1797 int free_bindings
PROTO ((struct binding_scope
*, const char *, int));
1798 int binding_scope_dereference
PROTO ((struct binding_scope
**,
1799 const char *, int));
1800 int fundef_dereference (struct fundef
**, const char *, int);
1801 int data_subexpression_length (int *, struct expression
*);
1802 int expr_valid_for_context (struct expression
*, enum expression_context
);
1803 struct binding
*create_binding (struct binding_scope
**, const char *);
1804 int bind_ds_value (struct binding_scope
**,
1805 const char *, struct data_string
*);
1806 int find_bound_string (struct data_string
*,
1807 struct binding_scope
*, const char *);
1808 int unset (struct binding_scope
*, const char *);
1809 int data_string_sprintfa(struct data_string
*ds
, const char *fmt
, ...);
1812 extern int outstanding_pings
;
1814 void dhcp
PROTO ((struct packet
*));
1815 void dhcpdiscover
PROTO ((struct packet
*, int));
1816 void dhcprequest
PROTO ((struct packet
*, int, struct lease
*));
1817 void dhcprelease
PROTO ((struct packet
*, int));
1818 void dhcpdecline
PROTO ((struct packet
*, int));
1819 void dhcpinform
PROTO ((struct packet
*, int));
1820 void dhcpleasequery
PROTO ((struct packet
*, int));
1821 void nak_lease
PROTO ((struct packet
*, struct iaddr
*cip
));
1822 void ack_lease
PROTO ((struct packet
*, struct lease
*,
1823 unsigned int, TIME
, char *, int, struct host_decl
*));
1824 void dhcp_reply
PROTO ((struct lease
*));
1825 int find_lease
PROTO ((struct lease
**, struct packet
*,
1826 struct shared_network
*, int *, int *, struct lease
*,
1827 const char *, int));
1828 int mockup_lease
PROTO ((struct lease
**, struct packet
*,
1829 struct shared_network
*,
1830 struct host_decl
*));
1831 void static_lease_dereference
PROTO ((struct lease
*, const char *, int));
1833 int allocate_lease
PROTO ((struct lease
**, struct packet
*,
1834 struct pool
*, int *));
1835 int permitted
PROTO ((struct packet
*, struct permit
*));
1836 int locate_network
PROTO ((struct packet
*));
1837 int parse_agent_information_option
PROTO ((struct packet
*, int, u_int8_t
*));
1838 unsigned cons_agent_information_options
PROTO ((struct option_state
*,
1839 struct dhcp_packet
*,
1840 unsigned, unsigned));
1841 void get_server_source_address(struct in_addr
*from
,
1842 struct option_state
*options
,
1843 struct packet
*packet
);
1845 void get_server_source_address(struct in_addr
*from
,
1846 struct option_state
*options
,
1847 struct packet
*packet
);
1850 isc_boolean_t
server_duid_isset(void);
1851 void copy_server_duid(struct data_string
*ds
, const char *file
, int line
);
1852 void set_server_duid(struct data_string
*new_duid
);
1853 isc_result_t
set_server_duid_from_option(void);
1854 void set_server_duid_type(int type
);
1855 isc_result_t
generate_new_server_duid(void);
1856 void dhcpv6(struct packet
*);
1859 void bootp
PROTO ((struct packet
*));
1862 int (*group_write_hook
) (struct group_object
*);
1863 extern struct group
*root_group
;
1864 extern group_hash_t
*group_name_hash
;
1865 isc_result_t
delete_group (struct group_object
*, int);
1866 isc_result_t
supersede_group (struct group_object
*, int);
1867 int clone_group (struct group
**, struct group
*, const char *, int);
1868 int write_group
PROTO ((struct group_object
*));
1871 void relinquish_lease_hunks (void);
1872 struct lease
*new_leases
PROTO ((unsigned, const char *, int));
1873 #if defined (DEBUG_MEMORY_LEAKAGE) || \
1874 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
1875 void relinquish_free_lease_states (void);
1877 OMAPI_OBJECT_ALLOC_DECL (lease
, struct lease
, dhcp_type_lease
)
1878 OMAPI_OBJECT_ALLOC_DECL (class, struct class, dhcp_type_class
)
1879 OMAPI_OBJECT_ALLOC_DECL (subclass
, struct class, dhcp_type_subclass
)
1880 OMAPI_OBJECT_ALLOC_DECL (pool
, struct pool
, dhcp_type_pool
)
1881 OMAPI_OBJECT_ALLOC_DECL (host
, struct host_decl
, dhcp_type_host
)
1884 OMAPI_OBJECT_ALLOC_DECL (subnet
, struct subnet
, dhcp_type_subnet
)
1885 OMAPI_OBJECT_ALLOC_DECL (shared_network
, struct shared_network
,
1886 dhcp_type_shared_network
)
1887 OMAPI_OBJECT_ALLOC_DECL (group_object
, struct group_object
, dhcp_type_group
)
1888 OMAPI_OBJECT_ALLOC_DECL (dhcp_control
,
1889 dhcp_control_object_t
, dhcp_type_control
)
1891 #if defined (DEBUG_MEMORY_LEAKAGE) || \
1892 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
1893 void relinquish_free_pairs (void);
1894 void relinquish_free_expressions (void);
1895 void relinquish_free_binding_values (void);
1896 void relinquish_free_option_caches (void);
1897 void relinquish_free_packets (void);
1900 int option_chain_head_allocate (struct option_chain_head
**,
1902 int option_chain_head_reference (struct option_chain_head
**,
1903 struct option_chain_head
*,
1905 int option_chain_head_dereference (struct option_chain_head
**,
1907 int group_allocate (struct group
**, const char *, int);
1908 int group_reference (struct group
**, struct group
*, const char *, int);
1909 int group_dereference (struct group
**, const char *, int);
1910 struct dhcp_packet
*new_dhcp_packet
PROTO ((const char *, int));
1911 struct protocol
*new_protocol
PROTO ((const char *, int));
1912 struct lease_state
*new_lease_state
PROTO ((const char *, int));
1913 struct domain_search_list
*new_domain_search_list
PROTO ((const char *, int));
1914 struct name_server
*new_name_server
PROTO ((const char *, int));
1915 void free_name_server
PROTO ((struct name_server
*, const char *, int));
1916 struct option
*new_option
PROTO ((const char *, const char *, int));
1917 int option_reference(struct option
**dest
, struct option
*src
,
1918 const char * file
, int line
);
1919 int option_dereference(struct option
**dest
, const char *file
, int line
);
1920 int group_allocate (struct group
**, const char *, int);
1921 int group_reference (struct group
**, struct group
*, const char *, int);
1922 int group_dereference (struct group
**, const char *, int);
1923 struct universe
*new_universe
PROTO ((const char *, int));
1924 void free_universe
PROTO ((struct universe
*, const char *, int));
1925 void free_domain_search_list
PROTO ((struct domain_search_list
*,
1926 const char *, int));
1927 void free_lease_state
PROTO ((struct lease_state
*, const char *, int));
1928 void free_protocol
PROTO ((struct protocol
*, const char *, int));
1929 void free_dhcp_packet
PROTO ((struct dhcp_packet
*, const char *, int));
1930 struct client_lease
*new_client_lease
PROTO ((const char *, int));
1931 void free_client_lease
PROTO ((struct client_lease
*, const char *, int));
1932 struct permit
*new_permit
PROTO ((const char *, int));
1933 void free_permit
PROTO ((struct permit
*, const char *, int));
1934 pair new_pair
PROTO ((const char *, int));
1935 void free_pair
PROTO ((pair
, const char *, int));
1936 int expression_allocate
PROTO ((struct expression
**, const char *, int));
1937 int expression_reference
PROTO ((struct expression
**,
1938 struct expression
*, const char *, int));
1939 void free_expression
PROTO ((struct expression
*, const char *, int));
1940 int binding_value_allocate
PROTO ((struct binding_value
**,
1941 const char *, int));
1942 int binding_value_reference
PROTO ((struct binding_value
**,
1943 struct binding_value
*,
1944 const char *, int));
1945 void free_binding_value
PROTO ((struct binding_value
*, const char *, int));
1946 int fundef_allocate
PROTO ((struct fundef
**, const char *, int));
1947 int fundef_reference
PROTO ((struct fundef
**,
1948 struct fundef
*, const char *, int));
1949 int option_cache_allocate
PROTO ((struct option_cache
**, const char *, int));
1950 int option_cache_reference
PROTO ((struct option_cache
**,
1951 struct option_cache
*, const char *, int));
1952 int buffer_allocate
PROTO ((struct buffer
**, unsigned, const char *, int));
1953 int buffer_reference
PROTO ((struct buffer
**, struct buffer
*,
1954 const char *, int));
1955 int buffer_dereference
PROTO ((struct buffer
**, const char *, int));
1956 int dns_host_entry_allocate
PROTO ((struct dns_host_entry
**,
1957 const char *, const char *, int));
1958 int dns_host_entry_reference
PROTO ((struct dns_host_entry
**,
1959 struct dns_host_entry
*,
1960 const char *, int));
1961 int dns_host_entry_dereference
PROTO ((struct dns_host_entry
**,
1962 const char *, int));
1963 int option_state_allocate
PROTO ((struct option_state
**, const char *, int));
1964 int option_state_reference
PROTO ((struct option_state
**,
1965 struct option_state
*, const char *, int));
1966 int option_state_dereference
PROTO ((struct option_state
**,
1967 const char *, int));
1968 void data_string_copy
PROTO ((struct data_string
*,
1969 struct data_string
*, const char *, int));
1970 void data_string_forget
PROTO ((struct data_string
*, const char *, int));
1971 void data_string_truncate
PROTO ((struct data_string
*, int));
1972 int executable_statement_allocate
PROTO ((struct executable_statement
**,
1973 const char *, int));
1974 int executable_statement_reference
PROTO ((struct executable_statement
**,
1975 struct executable_statement
*,
1976 const char *, int));
1977 int packet_allocate
PROTO ((struct packet
**, const char *, int));
1978 int packet_reference
PROTO ((struct packet
**,
1979 struct packet
*, const char *, int));
1980 int packet_dereference
PROTO ((struct packet
**, const char *, int));
1981 int binding_scope_allocate
PROTO ((struct binding_scope
**,
1982 const char *, int));
1983 int binding_scope_reference
PROTO ((struct binding_scope
**,
1984 struct binding_scope
*,
1985 const char *, int));
1986 int dns_zone_allocate
PROTO ((struct dns_zone
**, const char *, int));
1987 int dns_zone_reference
PROTO ((struct dns_zone
**,
1988 struct dns_zone
*, const char *, int));
1991 #define DEFAULT_TIME_FORMAT 0
1992 #define LOCAL_TIME_FORMAT 1
1993 extern int db_time_format
;
1994 char *quotify_string (const char *, const char *, int);
1995 char *quotify_buf (const unsigned char *, unsigned, const char *, int);
1996 char *print_base64 (const unsigned char *, unsigned, const char *, int);
1997 char *print_hw_addr
PROTO ((int, int, unsigned char *));
1998 void print_lease
PROTO ((struct lease
*));
1999 void dump_raw
PROTO ((const unsigned char *, unsigned));
2000 void dump_packet_option (struct option_cache
*, struct packet
*,
2001 struct lease
*, struct client_state
*,
2002 struct option_state
*, struct option_state
*,
2003 struct binding_scope
**, struct universe
*, void *);
2004 void dump_packet
PROTO ((struct packet
*));
2005 void hash_dump
PROTO ((struct hash_table
*));
2006 char *print_hex_1
PROTO ((unsigned, const u_int8_t
*, unsigned));
2007 char *print_hex_2
PROTO ((unsigned, const u_int8_t
*, unsigned));
2008 char *print_hex_3
PROTO ((unsigned, const u_int8_t
*, unsigned));
2009 char *print_dotted_quads
PROTO ((unsigned, const u_int8_t
*));
2010 char *print_dec_1
PROTO ((unsigned long));
2011 char *print_dec_2
PROTO ((unsigned long));
2012 void print_expression
PROTO ((const char *, struct expression
*));
2013 int token_print_indent_concat (FILE *, int, int,
2014 const char *, const char *, ...);
2015 int token_indent_data_string (FILE *, int, int, const char *, const char *,
2016 struct data_string
*);
2017 int token_print_indent (FILE *, int, int,
2018 const char *, const char *, const char *);
2019 void indent_spaces (FILE *, int);
2020 #if defined (NSUPDATE)
2021 void print_dns_status (int, ns_updque
*);
2023 const char *print_time(TIME
);
2025 void get_hw_addr(const char *name
, struct hardware
*hw
);
2028 #if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_RECEIVE) \
2029 || defined (USE_SOCKET_FALLBACK)
2030 int if_register_socket(struct interface_info
*, int, int);
2033 #if defined (USE_SOCKET_FALLBACK) && !defined (USE_SOCKET_SEND)
2034 void if_reinitialize_fallback
PROTO ((struct interface_info
*));
2035 void if_register_fallback
PROTO ((struct interface_info
*));
2036 ssize_t send_fallback
PROTO ((struct interface_info
*,
2037 struct packet
*, struct dhcp_packet
*, size_t,
2039 struct sockaddr_in
*, struct hardware
*));
2040 ssize_t
send_fallback6(struct interface_info
*, struct packet
*,
2041 struct dhcp_packet
*, size_t, struct in6_addr
,
2042 struct sockaddr_in6
*, struct hardware
*);
2045 #ifdef USE_SOCKET_SEND
2046 void if_reinitialize_send
PROTO ((struct interface_info
*));
2047 void if_register_send
PROTO ((struct interface_info
*));
2048 void if_deregister_send
PROTO ((struct interface_info
*));
2049 ssize_t send_packet
PROTO ((struct interface_info
*,
2050 struct packet
*, struct dhcp_packet
*, size_t,
2052 struct sockaddr_in
*, struct hardware
*));
2054 ssize_t
send_packet6(struct interface_info
*, const unsigned char *, size_t,
2055 struct sockaddr_in6
*);
2056 #ifdef USE_SOCKET_RECEIVE
2057 void if_reinitialize_receive
PROTO ((struct interface_info
*));
2058 void if_register_receive
PROTO ((struct interface_info
*));
2059 void if_deregister_receive
PROTO ((struct interface_info
*));
2060 ssize_t receive_packet
PROTO ((struct interface_info
*,
2061 unsigned char *, size_t,
2062 struct sockaddr_in
*, struct hardware
*));
2065 #if defined (USE_SOCKET_FALLBACK)
2066 isc_result_t fallback_discard
PROTO ((omapi_object_t
*));
2069 #if defined (USE_SOCKET_SEND)
2070 int can_unicast_without_arp
PROTO ((struct interface_info
*));
2071 int can_receive_unicast_unconfigured
PROTO ((struct interface_info
*));
2072 int supports_multiple_interfaces (struct interface_info
*);
2073 void maybe_setup_fallback
PROTO ((void));
2076 void if_register6(struct interface_info
*info
, int do_multicast
);
2077 ssize_t
receive_packet6(struct interface_info
*interface
,
2078 unsigned char *buf
, size_t len
,
2079 struct sockaddr_in6
*from
, struct in6_addr
*to_addr
);
2080 void if_deregister6(struct interface_info
*info
);
2084 #if defined (USE_BPF_SEND) || defined (USE_BPF_RECEIVE)
2085 int if_register_bpf
PROTO ( (struct interface_info
*));
2088 void if_reinitialize_send
PROTO ((struct interface_info
*));
2089 void if_register_send
PROTO ((struct interface_info
*));
2090 void if_deregister_send
PROTO ((struct interface_info
*));
2091 ssize_t send_packet
PROTO ((struct interface_info
*,
2092 struct packet
*, struct dhcp_packet
*, size_t,
2094 struct sockaddr_in
*, struct hardware
*));
2096 #ifdef USE_BPF_RECEIVE
2097 void if_reinitialize_receive
PROTO ((struct interface_info
*));
2098 void if_register_receive
PROTO ((struct interface_info
*));
2099 void if_deregister_receive
PROTO ((struct interface_info
*));
2100 ssize_t receive_packet
PROTO ((struct interface_info
*,
2101 unsigned char *, size_t,
2102 struct sockaddr_in
*, struct hardware
*));
2104 #if defined (USE_BPF_SEND)
2105 int can_unicast_without_arp
PROTO ((struct interface_info
*));
2106 int can_receive_unicast_unconfigured
PROTO ((struct interface_info
*));
2107 int supports_multiple_interfaces (struct interface_info
*);
2108 void maybe_setup_fallback
PROTO ((void));
2112 #if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE)
2113 int if_register_lpf
PROTO ( (struct interface_info
*));
2116 void if_reinitialize_send
PROTO ((struct interface_info
*));
2117 void if_register_send
PROTO ((struct interface_info
*));
2118 void if_deregister_send
PROTO ((struct interface_info
*));
2119 ssize_t send_packet
PROTO ((struct interface_info
*,
2120 struct packet
*, struct dhcp_packet
*, size_t,
2122 struct sockaddr_in
*, struct hardware
*));
2124 #ifdef USE_LPF_RECEIVE
2125 void if_reinitialize_receive
PROTO ((struct interface_info
*));
2126 void if_register_receive
PROTO ((struct interface_info
*));
2127 void if_deregister_receive
PROTO ((struct interface_info
*));
2128 ssize_t receive_packet
PROTO ((struct interface_info
*,
2129 unsigned char *, size_t,
2130 struct sockaddr_in
*, struct hardware
*));
2132 #if defined (USE_LPF_SEND)
2133 int can_unicast_without_arp
PROTO ((struct interface_info
*));
2134 int can_receive_unicast_unconfigured
PROTO ((struct interface_info
*));
2135 int supports_multiple_interfaces (struct interface_info
*);
2136 void maybe_setup_fallback
PROTO ((void));
2140 #if defined (USE_NIT_SEND) || defined (USE_NIT_RECEIVE)
2141 int if_register_nit
PROTO ( (struct interface_info
*));
2145 void if_reinitialize_send
PROTO ((struct interface_info
*));
2146 void if_register_send
PROTO ((struct interface_info
*));
2147 void if_deregister_send
PROTO ((struct interface_info
*));
2148 ssize_t send_packet
PROTO ((struct interface_info
*,
2149 struct packet
*, struct dhcp_packet
*, size_t,
2151 struct sockaddr_in
*, struct hardware
*));
2153 #ifdef USE_NIT_RECEIVE
2154 void if_reinitialize_receive
PROTO ((struct interface_info
*));
2155 void if_register_receive
PROTO ((struct interface_info
*));
2156 void if_deregister_receive
PROTO ((struct interface_info
*));
2157 ssize_t receive_packet
PROTO ((struct interface_info
*,
2158 unsigned char *, size_t,
2159 struct sockaddr_in
*, struct hardware
*));
2161 #if defined (USE_NIT_SEND)
2162 int can_unicast_without_arp
PROTO ((struct interface_info
*));
2163 int can_receive_unicast_unconfigured
PROTO ((struct interface_info
*));
2164 int supports_multiple_interfaces (struct interface_info
*);
2165 void maybe_setup_fallback
PROTO ((void));
2169 #if defined (USE_DLPI_SEND) || defined (USE_DLPI_RECEIVE)
2170 int if_register_dlpi
PROTO ( (struct interface_info
*));
2173 #ifdef USE_DLPI_SEND
2174 void if_reinitialize_send
PROTO ((struct interface_info
*));
2175 void if_register_send
PROTO ((struct interface_info
*));
2176 void if_deregister_send
PROTO ((struct interface_info
*));
2177 ssize_t send_packet
PROTO ((struct interface_info
*,
2178 struct packet
*, struct dhcp_packet
*, size_t,
2180 struct sockaddr_in
*, struct hardware
*));
2182 #ifdef USE_DLPI_RECEIVE
2183 void if_reinitialize_receive
PROTO ((struct interface_info
*));
2184 void if_register_receive
PROTO ((struct interface_info
*));
2185 void if_deregister_receive
PROTO ((struct interface_info
*));
2186 ssize_t receive_packet
PROTO ((struct interface_info
*,
2187 unsigned char *, size_t,
2188 struct sockaddr_in
*, struct hardware
*));
2194 void if_reinitialize_send
PROTO ((struct interface_info
*));
2195 void if_register_send
PROTO ((struct interface_info
*));
2196 void if_deregister_send
PROTO ((struct interface_info
*));
2197 ssize_t send_packet
PROTO ((struct interface_info
*,
2198 struct packet
*, struct dhcp_packet
*, size_t,
2200 struct sockaddr_in
*, struct hardware
*));
2201 int can_unicast_without_arp
PROTO ((struct interface_info
*));
2202 int can_receive_unicast_unconfigured
PROTO ((struct interface_info
*));
2203 int supports_multiple_interfaces (struct interface_info
*);
2204 void maybe_setup_fallback
PROTO ((void));
2208 extern struct interface_info
*interfaces
,
2209 *dummy_interfaces
, *fallback_interface
;
2210 extern struct protocol
*protocols
;
2211 extern int quiet_interface_discovery
;
2212 isc_result_t
interface_setup (void);
2213 void interface_trace_setup (void);
2215 extern struct in_addr limited_broadcast
;
2216 extern int local_family
;
2217 extern struct in_addr local_address
;
2218 extern struct in6_addr local_address6
;
2220 extern u_int16_t local_port
;
2221 extern u_int16_t remote_port
;
2222 extern int (*dhcp_interface_setup_hook
) (struct interface_info
*,
2224 extern int (*dhcp_interface_discovery_hook
) (struct interface_info
*);
2225 isc_result_t (*dhcp_interface_startup_hook
) (struct interface_info
*);
2227 extern void (*bootp_packet_handler
) PROTO ((struct interface_info
*,
2228 struct dhcp_packet
*, unsigned,
2230 struct iaddr
, struct hardware
*));
2231 extern void (*dhcpv6_packet_handler
)(struct interface_info
*,
2233 int, const struct iaddr
*, isc_boolean_t
);
2234 extern struct timeout
*timeouts
;
2235 extern omapi_object_type_t
*dhcp_type_interface
;
2236 #if defined (TRACING)
2237 trace_type_t
*interface_trace
;
2238 trace_type_t
*inpacket_trace
;
2239 trace_type_t
*outpacket_trace
;
2241 extern struct interface_info
**interface_vector
;
2242 extern int interface_count
;
2243 extern int interface_max
;
2244 isc_result_t
interface_initialize(omapi_object_t
*, const char *, int);
2245 void discover_interfaces(int);
2246 int setup_fallback (struct interface_info
**, const char *, int);
2247 int if_readsocket
PROTO ((omapi_object_t
*));
2248 void reinitialize_interfaces
PROTO ((void));
2251 void set_time(TIME
);
2252 struct timeval
*process_outstanding_timeouts (struct timeval
*);
2253 void dispatch
PROTO ((void));
2254 isc_result_t
got_one(omapi_object_t
*);
2255 isc_result_t
got_one_v6(omapi_object_t
*);
2256 isc_result_t
interface_set_value (omapi_object_t
*, omapi_object_t
*,
2257 omapi_data_string_t
*, omapi_typed_data_t
*);
2258 isc_result_t
interface_get_value (omapi_object_t
*, omapi_object_t
*,
2259 omapi_data_string_t
*, omapi_value_t
**);
2260 isc_result_t
interface_destroy (omapi_object_t
*, const char *, int);
2261 isc_result_t
interface_signal_handler (omapi_object_t
*,
2262 const char *, va_list);
2263 isc_result_t
interface_stuff_values (omapi_object_t
*,
2267 void add_timeout
PROTO ((TIME
, void (*) PROTO ((void *)), void *,
2268 tvref_t
, tvunref_t
));
2269 void cancel_timeout
PROTO ((void (*) PROTO ((void *)), void *));
2270 void cancel_all_timeouts (void);
2271 void relinquish_timeouts (void);
2273 struct protocol
*add_protocol
PROTO ((const char *, int,
2274 void (*) PROTO ((struct protocol
*)),
2277 void remove_protocol
PROTO ((struct protocol
*));
2279 OMAPI_OBJECT_ALLOC_DECL (interface
,
2280 struct interface_info
, dhcp_type_interface
)
2283 extern char *default_option_format
;
2284 extern struct universe dhcp_universe
;
2285 extern struct universe dhcpv6_universe
;
2286 extern struct universe nwip_universe
;
2287 extern struct universe fqdn_universe
;
2288 extern struct universe vsio_universe
;
2289 extern int dhcp_option_default_priority_list
[];
2290 extern int dhcp_option_default_priority_list_count
;
2291 extern const char *hardware_types
[256];
2292 int universe_count
, universe_max
;
2293 struct universe
**universes
;
2294 extern universe_hash_t
*universe_hash
;
2295 void initialize_common_option_spaces
PROTO ((void));
2296 struct universe
*config_universe
;
2299 #if defined (FAILOVER_PROTOCOL)
2300 extern failover_option_t null_failover_option
;
2301 extern failover_option_t skip_failover_option
;
2302 extern struct failover_option_info ft_options
[];
2303 extern u_int32_t fto_allowed
[];
2304 extern int ft_sizes
[];
2305 extern const char *dhcp_flink_state_names
[];
2307 extern const char *binding_state_names
[];
2309 extern struct universe agent_universe
;
2310 extern struct universe server_universe
;
2312 extern struct enumeration ddns_styles
;
2313 extern struct enumeration syslog_enum
;
2314 void initialize_server_option_spaces
PROTO ((void));
2317 struct iaddr subnet_number
PROTO ((struct iaddr
, struct iaddr
));
2318 struct iaddr ip_addr
PROTO ((struct iaddr
, struct iaddr
, u_int32_t
));
2319 struct iaddr broadcast_addr
PROTO ((struct iaddr
, struct iaddr
));
2320 u_int32_t host_addr
PROTO ((struct iaddr
, struct iaddr
));
2321 int addr_eq
PROTO ((struct iaddr
, struct iaddr
));
2322 int addr_match(struct iaddr
*, struct iaddrmatch
*);
2323 int addr_cmp(const struct iaddr
*a1
, const struct iaddr
*a2
);
2324 int addr_or(struct iaddr
*result
,
2325 const struct iaddr
*a1
, const struct iaddr
*a2
);
2326 int addr_and(struct iaddr
*result
,
2327 const struct iaddr
*a1
, const struct iaddr
*a2
);
2328 isc_boolean_t
is_cidr_mask_valid(const struct iaddr
*addr
, int bits
);
2329 isc_result_t
range2cidr(struct iaddrcidrnetlist
**result
,
2330 const struct iaddr
*lo
, const struct iaddr
*hi
);
2331 isc_result_t
free_iaddrcidrnetlist(struct iaddrcidrnetlist
**result
);
2332 const char *piaddr
PROTO ((struct iaddr
));
2333 char *piaddrmask(struct iaddr
*, struct iaddr
*);
2334 char *piaddrcidr(const struct iaddr
*, unsigned int);
2339 extern const char *path_dhclient_conf
;
2340 extern const char *path_dhclient_db
;
2341 extern const char *path_dhclient_pid
;
2342 extern char *path_dhclient_script
;
2343 extern int interfaces_requested
;
2344 extern struct data_string default_duid
;
2346 extern struct client_config top_level_config
;
2348 void dhcpoffer
PROTO ((struct packet
*));
2349 void dhcpack
PROTO ((struct packet
*));
2350 void dhcpnak
PROTO ((struct packet
*));
2352 void send_discover
PROTO ((void *));
2353 void send_request
PROTO ((void *));
2354 void send_release
PROTO ((void *));
2355 void send_decline
PROTO ((void *));
2357 void state_reboot
PROTO ((void *));
2358 void state_init
PROTO ((void *));
2359 void state_selecting
PROTO ((void *));
2360 void state_requesting
PROTO ((void *));
2361 void state_bound
PROTO ((void *));
2362 void state_stop
PROTO ((void *));
2363 void state_panic
PROTO ((void *));
2365 void bind_lease
PROTO ((struct client_state
*));
2367 void make_client_options
PROTO ((struct client_state
*,
2368 struct client_lease
*, u_int8_t
*,
2369 struct option_cache
*, struct iaddr
*,
2370 u_int32_t
*, struct option_state
**));
2371 void make_discover
PROTO ((struct client_state
*, struct client_lease
*));
2372 void make_request
PROTO ((struct client_state
*, struct client_lease
*));
2373 void make_decline
PROTO ((struct client_state
*, struct client_lease
*));
2374 void make_release
PROTO ((struct client_state
*, struct client_lease
*));
2376 void destroy_client_lease
PROTO ((struct client_lease
*));
2377 void rewrite_client_leases
PROTO ((void));
2378 void write_lease_option (struct option_cache
*, struct packet
*,
2379 struct lease
*, struct client_state
*,
2380 struct option_state
*, struct option_state
*,
2381 struct binding_scope
**, struct universe
*, void *);
2382 int write_client_lease
PROTO ((struct client_state
*,
2383 struct client_lease
*, int, int));
2384 isc_result_t
write_client6_lease(struct client_state
*client
,
2385 struct dhc6_lease
*lease
,
2386 int rewrite
, int sync
);
2387 int dhcp_option_ev_name (char *, size_t, struct option
*);
2389 void script_init
PROTO ((struct client_state
*, const char *,
2390 struct string_list
*));
2391 void client_option_envadd (struct option_cache
*, struct packet
*,
2392 struct lease
*, struct client_state
*,
2393 struct option_state
*, struct option_state
*,
2394 struct binding_scope
**, struct universe
*, void *);
2395 void script_write_params
PROTO ((struct client_state
*,
2396 const char *, struct client_lease
*));
2397 int script_go
PROTO ((struct client_state
*));
2398 void client_envadd (struct client_state
*,
2399 const char *, const char *, const char *, ...)
2400 __attribute__((__format__(__printf__
,4,5)));
2402 struct client_lease
*packet_to_lease (struct packet
*, struct client_state
*);
2403 void go_daemon
PROTO ((void));
2404 void write_client_pid_file
PROTO ((void));
2405 void client_location_changed
PROTO ((void));
2406 void do_release
PROTO ((struct client_state
*));
2407 int dhclient_interface_shutdown_hook (struct interface_info
*);
2408 int dhclient_interface_discovery_hook (struct interface_info
*);
2409 isc_result_t
dhclient_interface_startup_hook (struct interface_info
*);
2410 void dhclient_schedule_updates(struct client_state
*client
,
2411 struct iaddr
*addr
, int offset
);
2412 void client_dns_update_timeout (void *cp
);
2413 isc_result_t
client_dns_update(struct client_state
*client
, int, int,
2416 void dhcpv4_client_assignments(void);
2417 void dhcpv6_client_assignments(void);
2420 void form_duid(struct data_string
*duid
, char *file
, int line
);
2421 void dhc6_lease_destroy(struct dhc6_lease
*lease
, char *file
, int line
);
2422 void start_init6(struct client_state
*client
);
2423 void start_confirm6(struct client_state
*client
);
2424 void start_release6(struct client_state
*client
);
2425 void start_selecting6(struct client_state
*client
);
2426 isc_result_t
write_client6_lease(struct client_state
*client
,
2427 struct dhc6_lease
*lease
,
2428 int rewrite
, int sync
);
2429 void unconfigure6(struct client_state
*client
, const char *reason
);
2432 int write_lease
PROTO ((struct lease
*));
2433 int write_host
PROTO ((struct host_decl
*));
2434 int write_server_duid(void);
2435 #if defined (FAILOVER_PROTOCOL)
2436 int write_failover_state (dhcp_failover_state_t
*);
2438 int db_printable
PROTO ((const unsigned char *));
2439 int db_printable_len
PROTO ((const unsigned char *, unsigned));
2440 isc_result_t
write_named_billing_class(const void *, unsigned, void *);
2441 void write_billing_classes (void);
2442 int write_billing_class
PROTO ((struct class *));
2443 void commit_leases_timeout
PROTO ((void *));
2444 int commit_leases
PROTO ((void));
2445 void db_startup
PROTO ((int));
2446 int new_lease_file
PROTO ((void));
2447 int group_writer (struct group_object
*);
2448 int write_ia_na(const struct ia_na
*);
2451 u_int32_t checksum
PROTO ((unsigned char *, unsigned, u_int32_t
));
2452 u_int32_t wrapsum
PROTO ((u_int32_t
));
2453 void assemble_hw_header
PROTO ((struct interface_info
*, unsigned char *,
2454 unsigned *, struct hardware
*));
2455 void assemble_udp_ip_header
PROTO ((struct interface_info
*, unsigned char *,
2456 unsigned *, u_int32_t
, u_int32_t
,
2457 u_int32_t
, unsigned char *, unsigned));
2458 ssize_t decode_hw_header
PROTO ((struct interface_info
*, unsigned char *,
2459 unsigned, struct hardware
*));
2460 ssize_t decode_udp_ip_header
PROTO ((struct interface_info
*, unsigned char *,
2461 unsigned, struct sockaddr_in
*,
2462 unsigned, unsigned *));
2465 void assemble_ethernet_header
PROTO ((struct interface_info
*, unsigned char *,
2466 unsigned *, struct hardware
*));
2467 ssize_t decode_ethernet_header
PROTO ((struct interface_info
*,
2469 unsigned, struct hardware
*));
2472 void assemble_tr_header
PROTO ((struct interface_info
*, unsigned char *,
2473 unsigned *, struct hardware
*));
2474 ssize_t decode_tr_header
PROTO ((struct interface_info
*,
2476 unsigned, struct hardware
*));
2479 void convert_statement
PROTO ((struct parse
*));
2480 void convert_host_statement
PROTO ((struct parse
*, jrefproto
));
2481 void convert_host_name
PROTO ((struct parse
*, jrefproto
));
2482 void convert_class_statement
PROTO ((struct parse
*, jrefproto
, int));
2483 void convert_class_decl
PROTO ((struct parse
*, jrefproto
));
2484 void convert_lease_time
PROTO ((struct parse
*, jrefproto
, char *));
2485 void convert_shared_net_statement
PROTO ((struct parse
*, jrefproto
));
2486 void convert_subnet_statement
PROTO ((struct parse
*, jrefproto
));
2487 void convert_subnet_decl
PROTO ((struct parse
*, jrefproto
));
2488 void convert_host_decl
PROTO ((struct parse
*, jrefproto
));
2489 void convert_hardware_decl
PROTO ((struct parse
*, jrefproto
));
2490 void convert_hardware_addr
PROTO ((struct parse
*, jrefproto
));
2491 void convert_filename_decl
PROTO ((struct parse
*, jrefproto
));
2492 void convert_servername_decl
PROTO ((struct parse
*, jrefproto
));
2493 void convert_ip_addr_or_hostname
PROTO ((struct parse
*, jrefproto
, int));
2494 void convert_fixed_addr_decl
PROTO ((struct parse
*, jrefproto
));
2495 void convert_option_decl
PROTO ((struct parse
*, jrefproto
));
2496 void convert_lease_statement
PROTO ((struct parse
*, jrefproto
));
2497 void convert_address_range
PROTO ((struct parse
*, jrefproto
));
2498 void convert_date
PROTO ((struct parse
*, jrefproto
, char *));
2499 void convert_numeric_aggregate
PROTO ((struct parse
*, jrefproto
, int, int, int, int));
2500 void indent
PROTO ((int));
2503 void add_route_direct
PROTO ((struct interface_info
*, struct in_addr
));
2504 void add_route_net
PROTO ((struct interface_info
*, struct in_addr
,
2506 void add_route_default_gateway
PROTO ((struct interface_info
*,
2508 void remove_routes
PROTO ((struct in_addr
));
2509 void remove_if_route
PROTO ((struct interface_info
*, struct in_addr
));
2510 void remove_all_if_routes
PROTO ((struct interface_info
*));
2511 void set_netmask
PROTO ((struct interface_info
*, struct in_addr
));
2512 void set_broadcast_addr
PROTO ((struct interface_info
*, struct in_addr
));
2513 void set_ip_address
PROTO ((struct interface_info
*, struct in_addr
));
2516 isc_result_t read_client_conf
PROTO ((void));
2517 int read_client_conf_file (const char *,
2518 struct interface_info
*, struct client_config
*);
2519 void read_client_leases
PROTO ((void));
2520 void parse_client_statement
PROTO ((struct parse
*, struct interface_info
*,
2521 struct client_config
*));
2522 int parse_X
PROTO ((struct parse
*, u_int8_t
*, unsigned));
2523 void parse_option_list
PROTO ((struct parse
*, u_int32_t
**));
2524 void parse_interface_declaration
PROTO ((struct parse
*,
2525 struct client_config
*, char *));
2526 int interface_or_dummy
PROTO ((struct interface_info
**, const char *));
2527 void make_client_state
PROTO ((struct client_state
**));
2528 void make_client_config
PROTO ((struct client_state
*,
2529 struct client_config
*));
2530 void parse_client_lease_statement
PROTO ((struct parse
*, int));
2531 void parse_client_lease_declaration
PROTO ((struct parse
*,
2532 struct client_lease
*,
2533 struct interface_info
**,
2534 struct client_state
**));
2535 int parse_option_decl
PROTO ((struct option_cache
**, struct parse
*));
2536 void parse_string_list
PROTO ((struct parse
*, struct string_list
**, int));
2537 int parse_ip_addr
PROTO ((struct parse
*, struct iaddr
*));
2538 int parse_ip_addr_with_subnet(struct parse
*, struct iaddrmatch
*);
2539 void parse_reject_statement
PROTO ((struct parse
*, struct client_config
*));
2542 void relay
PROTO ((struct interface_info
*, struct dhcp_packet
*, unsigned,
2543 unsigned int, struct iaddr
, struct hardware
*));
2544 int strip_relay_agent_options
PROTO ((struct interface_info
*,
2545 struct interface_info
**,
2546 struct dhcp_packet
*, unsigned));
2547 int find_interface_by_agent_option
PROTO ((struct dhcp_packet
*,
2548 struct interface_info
**,
2550 int add_relay_agent_options
PROTO ((struct interface_info
*,
2551 struct dhcp_packet
*,
2552 unsigned, struct in_addr
));
2555 OMAPI_OBJECT_ALLOC_DECL (icmp_state
, struct icmp_state
, dhcp_type_icmp
)
2556 extern struct icmp_state
*icmp_state
;
2557 void icmp_startup
PROTO ((int, void (*) PROTO ((struct iaddr
,
2558 u_int8_t
*, int))));
2559 int icmp_readsocket
PROTO ((omapi_object_t
*));
2560 int icmp_echorequest
PROTO ((struct iaddr
*));
2561 isc_result_t icmp_echoreply
PROTO ((omapi_object_t
*));
2564 #if defined (NSUPDATE)
2565 isc_result_t
find_tsig_key (ns_tsig_key
**, const char *, struct dns_zone
*);
2566 void tkey_free (ns_tsig_key
**);
2568 isc_result_t
enter_dns_zone (struct dns_zone
*);
2569 isc_result_t
dns_zone_lookup (struct dns_zone
**, const char *);
2570 int dns_zone_dereference
PROTO ((struct dns_zone
**, const char *, int));
2571 #if defined (NSUPDATE)
2572 isc_result_t
find_cached_zone (const char *, ns_class
, char *,
2573 size_t, struct in_addr
*, int, int *,
2574 struct dns_zone
**);
2575 void forget_zone (struct dns_zone
**);
2576 void repudiate_zone (struct dns_zone
**);
2577 void cache_found_zone (ns_class
, char *, struct in_addr
*, int);
2578 int get_dhcid (struct data_string
*, int, const u_int8_t
*, unsigned);
2579 isc_result_t
ddns_update_fwd(struct data_string
*, struct iaddr
,
2580 struct data_string
*, unsigned long, unsigned,
2582 isc_result_t
ddns_remove_fwd(struct data_string
*,
2583 struct iaddr
, struct data_string
*);
2584 #endif /* NSUPDATE */
2587 extern char path_resolv_conf
[];
2588 struct name_server
*name_servers
;
2589 struct domain_search_list
*domains
;
2591 void read_resolv_conf
PROTO ((TIME
));
2592 struct name_server
*first_name_server
PROTO ((void));
2595 #ifdef NEED_INET_ATON
2596 int inet_aton
PROTO ((const char *, struct in_addr
*));
2600 extern int have_billing_classes
;
2601 struct class unknown_class
;
2602 struct class known_class
;
2603 struct collection default_collection
;
2604 struct collection
*collections
;
2605 struct executable_statement
*default_classification_rules
;
2607 void classification_setup
PROTO ((void));
2608 void classify_client
PROTO ((struct packet
*));
2609 int check_collection
PROTO ((struct packet
*, struct lease
*,
2610 struct collection
*));
2611 void classify
PROTO ((struct packet
*, struct class *));
2612 isc_result_t unlink_class
PROTO((struct class **class));
2613 isc_result_t find_class
PROTO ((struct class **, const char *,
2614 const char *, int));
2615 int unbill_class
PROTO ((struct lease
*, struct class *));
2616 int bill_class
PROTO ((struct lease
*, struct class *));
2619 int execute_statements
PROTO ((struct binding_value
**result
,
2620 struct packet
*, struct lease
*,
2621 struct client_state
*,
2622 struct option_state
*, struct option_state
*,
2623 struct binding_scope
**,
2624 struct executable_statement
*));
2625 void execute_statements_in_scope
PROTO ((struct binding_value
**result
,
2626 struct packet
*, struct lease
*,
2627 struct client_state
*,
2628 struct option_state
*,
2629 struct option_state
*,
2630 struct binding_scope
**,
2631 struct group
*, struct group
*));
2632 int executable_statement_dereference
PROTO ((struct executable_statement
**,
2633 const char *, int));
2634 void write_statements (FILE *, struct executable_statement
*, int);
2635 int find_matching_case (struct executable_statement
**,
2636 struct packet
*, struct lease
*, struct client_state
*,
2637 struct option_state
*, struct option_state
*,
2638 struct binding_scope
**,
2639 struct expression
*, struct executable_statement
*);
2640 int executable_statement_foreach (struct executable_statement
*,
2641 int (*) (struct executable_statement
*,
2642 void *, int), void *, int);
2645 extern omapi_object_type_t
*dhcp_type_interface
;
2646 extern omapi_object_type_t
*dhcp_type_group
;
2647 extern omapi_object_type_t
*dhcp_type_shared_network
;
2648 extern omapi_object_type_t
*dhcp_type_subnet
;
2649 extern omapi_object_type_t
*dhcp_type_control
;
2650 extern dhcp_control_object_t
*dhcp_control_object
;
2652 void dhcp_common_objects_setup (void);
2654 isc_result_t
dhcp_group_set_value (omapi_object_t
*, omapi_object_t
*,
2655 omapi_data_string_t
*,
2656 omapi_typed_data_t
*);
2657 isc_result_t
dhcp_group_get_value (omapi_object_t
*, omapi_object_t
*,
2658 omapi_data_string_t
*,
2660 isc_result_t
dhcp_group_destroy (omapi_object_t
*, const char *, int);
2661 isc_result_t
dhcp_group_signal_handler (omapi_object_t
*,
2662 const char *, va_list);
2663 isc_result_t
dhcp_group_stuff_values (omapi_object_t
*,
2666 isc_result_t
dhcp_group_lookup (omapi_object_t
**,
2667 omapi_object_t
*, omapi_object_t
*);
2668 isc_result_t
dhcp_group_create (omapi_object_t
**,
2670 isc_result_t
dhcp_group_remove (omapi_object_t
*,
2673 isc_result_t
dhcp_control_set_value (omapi_object_t
*, omapi_object_t
*,
2674 omapi_data_string_t
*,
2675 omapi_typed_data_t
*);
2676 isc_result_t
dhcp_control_get_value (omapi_object_t
*, omapi_object_t
*,
2677 omapi_data_string_t
*,
2679 isc_result_t
dhcp_control_destroy (omapi_object_t
*, const char *, int);
2680 isc_result_t
dhcp_control_signal_handler (omapi_object_t
*,
2681 const char *, va_list);
2682 isc_result_t
dhcp_control_stuff_values (omapi_object_t
*,
2685 isc_result_t
dhcp_control_lookup (omapi_object_t
**,
2686 omapi_object_t
*, omapi_object_t
*);
2687 isc_result_t
dhcp_control_create (omapi_object_t
**,
2689 isc_result_t
dhcp_control_remove (omapi_object_t
*,
2692 isc_result_t
dhcp_subnet_set_value (omapi_object_t
*, omapi_object_t
*,
2693 omapi_data_string_t
*,
2694 omapi_typed_data_t
*);
2695 isc_result_t
dhcp_subnet_get_value (omapi_object_t
*, omapi_object_t
*,
2696 omapi_data_string_t
*,
2698 isc_result_t
dhcp_subnet_destroy (omapi_object_t
*, const char *, int);
2699 isc_result_t
dhcp_subnet_signal_handler (omapi_object_t
*,
2700 const char *, va_list);
2701 isc_result_t
dhcp_subnet_stuff_values (omapi_object_t
*,
2704 isc_result_t
dhcp_subnet_lookup (omapi_object_t
**,
2705 omapi_object_t
*, omapi_object_t
*);
2706 isc_result_t
dhcp_subnet_create (omapi_object_t
**,
2708 isc_result_t
dhcp_subnet_remove (omapi_object_t
*,
2711 isc_result_t
dhcp_shared_network_set_value (omapi_object_t
*,
2713 omapi_data_string_t
*,
2714 omapi_typed_data_t
*);
2715 isc_result_t
dhcp_shared_network_get_value (omapi_object_t
*,
2717 omapi_data_string_t
*,
2719 isc_result_t
dhcp_shared_network_destroy (omapi_object_t
*, const char *, int);
2720 isc_result_t
dhcp_shared_network_signal_handler (omapi_object_t
*,
2721 const char *, va_list);
2722 isc_result_t
dhcp_shared_network_stuff_values (omapi_object_t
*,
2725 isc_result_t
dhcp_shared_network_lookup (omapi_object_t
**,
2726 omapi_object_t
*, omapi_object_t
*);
2727 isc_result_t
dhcp_shared_network_create (omapi_object_t
**,
2729 isc_result_t
dhcp_shared_network_remove (omapi_object_t
*,
2733 extern int (*dhcp_interface_shutdown_hook
) (struct interface_info
*);
2735 extern omapi_object_type_t
*dhcp_type_lease
;
2736 extern omapi_object_type_t
*dhcp_type_pool
;
2737 extern omapi_object_type_t
*dhcp_type_class
;
2738 extern omapi_object_type_t
*dhcp_type_subclass
;
2740 #if defined (FAILOVER_PROTOCOL)
2741 extern omapi_object_type_t
*dhcp_type_failover_state
;
2742 extern omapi_object_type_t
*dhcp_type_failover_link
;
2743 extern omapi_object_type_t
*dhcp_type_failover_listener
;
2746 void dhcp_db_objects_setup (void);
2748 isc_result_t
dhcp_lease_set_value (omapi_object_t
*, omapi_object_t
*,
2749 omapi_data_string_t
*,
2750 omapi_typed_data_t
*);
2751 isc_result_t
dhcp_lease_get_value (omapi_object_t
*, omapi_object_t
*,
2752 omapi_data_string_t
*,
2754 isc_result_t
dhcp_lease_destroy (omapi_object_t
*, const char *, int);
2755 isc_result_t
dhcp_lease_signal_handler (omapi_object_t
*,
2756 const char *, va_list);
2757 isc_result_t
dhcp_lease_stuff_values (omapi_object_t
*,
2760 isc_result_t
dhcp_lease_lookup (omapi_object_t
**,
2761 omapi_object_t
*, omapi_object_t
*);
2762 isc_result_t
dhcp_lease_create (omapi_object_t
**,
2764 isc_result_t
dhcp_lease_remove (omapi_object_t
*,
2766 isc_result_t
dhcp_group_set_value (omapi_object_t
*, omapi_object_t
*,
2767 omapi_data_string_t
*,
2768 omapi_typed_data_t
*);
2769 isc_result_t
dhcp_group_get_value (omapi_object_t
*, omapi_object_t
*,
2770 omapi_data_string_t
*,
2772 isc_result_t
dhcp_group_destroy (omapi_object_t
*, const char *, int);
2773 isc_result_t
dhcp_group_signal_handler (omapi_object_t
*,
2774 const char *, va_list);
2775 isc_result_t
dhcp_group_stuff_values (omapi_object_t
*,
2778 isc_result_t
dhcp_group_lookup (omapi_object_t
**,
2779 omapi_object_t
*, omapi_object_t
*);
2780 isc_result_t
dhcp_group_create (omapi_object_t
**,
2782 isc_result_t
dhcp_group_remove (omapi_object_t
*,
2784 isc_result_t
dhcp_host_set_value (omapi_object_t
*, omapi_object_t
*,
2785 omapi_data_string_t
*,
2786 omapi_typed_data_t
*);
2787 isc_result_t
dhcp_host_get_value (omapi_object_t
*, omapi_object_t
*,
2788 omapi_data_string_t
*,
2790 isc_result_t
dhcp_host_destroy (omapi_object_t
*, const char *, int);
2791 isc_result_t
dhcp_host_signal_handler (omapi_object_t
*,
2792 const char *, va_list);
2793 isc_result_t
dhcp_host_stuff_values (omapi_object_t
*,
2796 isc_result_t
dhcp_host_lookup (omapi_object_t
**,
2797 omapi_object_t
*, omapi_object_t
*);
2798 isc_result_t
dhcp_host_create (omapi_object_t
**,
2800 isc_result_t
dhcp_host_remove (omapi_object_t
*,
2802 isc_result_t
dhcp_pool_set_value (omapi_object_t
*, omapi_object_t
*,
2803 omapi_data_string_t
*,
2804 omapi_typed_data_t
*);
2805 isc_result_t
dhcp_pool_get_value (omapi_object_t
*, omapi_object_t
*,
2806 omapi_data_string_t
*,
2808 isc_result_t
dhcp_pool_destroy (omapi_object_t
*, const char *, int);
2809 isc_result_t
dhcp_pool_signal_handler (omapi_object_t
*,
2810 const char *, va_list);
2811 isc_result_t
dhcp_pool_stuff_values (omapi_object_t
*,
2814 isc_result_t
dhcp_pool_lookup (omapi_object_t
**,
2815 omapi_object_t
*, omapi_object_t
*);
2816 isc_result_t
dhcp_pool_create (omapi_object_t
**,
2818 isc_result_t
dhcp_pool_remove (omapi_object_t
*,
2820 isc_result_t
dhcp_class_set_value (omapi_object_t
*, omapi_object_t
*,
2821 omapi_data_string_t
*,
2822 omapi_typed_data_t
*);
2823 isc_result_t
dhcp_class_get_value (omapi_object_t
*, omapi_object_t
*,
2824 omapi_data_string_t
*,
2826 isc_result_t
dhcp_class_destroy (omapi_object_t
*, const char *, int);
2827 isc_result_t
dhcp_class_signal_handler (omapi_object_t
*,
2828 const char *, va_list);
2829 isc_result_t
dhcp_class_stuff_values (omapi_object_t
*,
2832 isc_result_t
dhcp_class_lookup (omapi_object_t
**,
2833 omapi_object_t
*, omapi_object_t
*);
2834 isc_result_t
dhcp_class_create (omapi_object_t
**,
2836 isc_result_t
dhcp_class_remove (omapi_object_t
*,
2838 isc_result_t
dhcp_subclass_set_value (omapi_object_t
*, omapi_object_t
*,
2839 omapi_data_string_t
*,
2840 omapi_typed_data_t
*);
2841 isc_result_t
dhcp_subclass_get_value (omapi_object_t
*, omapi_object_t
*,
2842 omapi_data_string_t
*,
2844 isc_result_t
dhcp_subclass_destroy (omapi_object_t
*, const char *, int);
2845 isc_result_t
dhcp_subclass_signal_handler (omapi_object_t
*,
2846 const char *, va_list);
2847 isc_result_t
dhcp_subclass_stuff_values (omapi_object_t
*,
2850 isc_result_t
dhcp_subclass_lookup (omapi_object_t
**,
2851 omapi_object_t
*, omapi_object_t
*);
2852 isc_result_t
dhcp_subclass_create (omapi_object_t
**,
2854 isc_result_t
dhcp_subclass_remove (omapi_object_t
*,
2856 isc_result_t
dhcp_shared_network_set_value (omapi_object_t
*,
2858 omapi_data_string_t
*,
2859 omapi_typed_data_t
*);
2860 isc_result_t
dhcp_shared_network_get_value (omapi_object_t
*, omapi_object_t
*,
2861 omapi_data_string_t
*,
2863 isc_result_t
dhcp_shared_network_destroy (omapi_object_t
*, const char *, int);
2864 isc_result_t
dhcp_shared_network_signal_handler (omapi_object_t
*,
2865 const char *, va_list);
2866 isc_result_t
dhcp_shared_network_stuff_values (omapi_object_t
*,
2869 isc_result_t
dhcp_shared_network_lookup (omapi_object_t
**,
2870 omapi_object_t
*, omapi_object_t
*);
2871 isc_result_t
dhcp_shared_network_create (omapi_object_t
**,
2873 isc_result_t
dhcp_subnet_set_value (omapi_object_t
*, omapi_object_t
*,
2874 omapi_data_string_t
*,
2875 omapi_typed_data_t
*);
2876 isc_result_t
dhcp_subnet_get_value (omapi_object_t
*, omapi_object_t
*,
2877 omapi_data_string_t
*,
2879 isc_result_t
dhcp_subnet_destroy (omapi_object_t
*, const char *, int);
2880 isc_result_t
dhcp_subnet_signal_handler (omapi_object_t
*,
2881 const char *, va_list);
2882 isc_result_t
dhcp_subnet_stuff_values (omapi_object_t
*,
2885 isc_result_t
dhcp_subnet_lookup (omapi_object_t
**,
2886 omapi_object_t
*, omapi_object_t
*);
2887 isc_result_t
dhcp_subnet_create (omapi_object_t
**,
2889 isc_result_t
dhcp_interface_set_value (omapi_object_t
*,
2891 omapi_data_string_t
*,
2892 omapi_typed_data_t
*);
2893 isc_result_t
dhcp_interface_get_value (omapi_object_t
*,
2895 omapi_data_string_t
*,
2897 isc_result_t
dhcp_interface_destroy (omapi_object_t
*,
2899 isc_result_t
dhcp_interface_signal_handler (omapi_object_t
*,
2902 isc_result_t
dhcp_interface_stuff_values (omapi_object_t
*,
2905 isc_result_t
dhcp_interface_lookup (omapi_object_t
**,
2908 isc_result_t
dhcp_interface_create (omapi_object_t
**,
2910 isc_result_t
dhcp_interface_remove (omapi_object_t
*,
2912 void interface_stash (struct interface_info
*);
2913 void interface_snorf (struct interface_info
*, int);
2915 isc_result_t
binding_scope_set_value (struct binding_scope
*, int,
2916 omapi_data_string_t
*,
2917 omapi_typed_data_t
*);
2918 isc_result_t
binding_scope_get_value (omapi_value_t
**,
2919 struct binding_scope
*,
2920 omapi_data_string_t
*);
2921 isc_result_t
binding_scope_stuff_values (omapi_object_t
*,
2922 struct binding_scope
*);
2926 extern struct subnet
*subnets
;
2927 extern struct shared_network
*shared_networks
;
2928 extern host_hash_t
*host_hw_addr_hash
;
2929 extern host_hash_t
*host_uid_hash
;
2930 extern host_hash_t
*host_name_hash
;
2931 extern lease_id_hash_t
*lease_uid_hash
;
2932 extern lease_ip_hash_t
*lease_ip_addr_hash
;
2933 extern lease_id_hash_t
*lease_hw_addr_hash
;
2935 extern omapi_object_type_t
*dhcp_type_host
;
2937 extern int numclasseswritten
;
2940 isc_result_t enter_class
PROTO ((struct class *, int, int));
2941 isc_result_t delete_class
PROTO ((struct class *, int));
2942 isc_result_t enter_host
PROTO ((struct host_decl
*, int, int));
2943 isc_result_t delete_host
PROTO ((struct host_decl
*, int));
2944 void change_host_uid(struct host_decl
*host
, const char *data
, int len
);
2945 int find_hosts_by_haddr
PROTO ((struct host_decl
**, int,
2946 const unsigned char *, unsigned,
2947 const char *, int));
2948 int find_hosts_by_uid
PROTO ((struct host_decl
**, const unsigned char *,
2949 unsigned, const char *, int));
2950 int find_hosts_by_option(struct host_decl
**, struct packet
*,
2951 struct option_state
*, const char *, int);
2952 int find_host_for_network
PROTO ((struct subnet
**, struct host_decl
**,
2953 struct iaddr
*, struct shared_network
*));
2954 void new_address_range
PROTO ((struct parse
*, struct iaddr
, struct iaddr
,
2955 struct subnet
*, struct pool
*,
2957 isc_result_t
dhcp_lease_free (omapi_object_t
*, const char *, int);
2958 isc_result_t
dhcp_lease_get (omapi_object_t
**, const char *, int);
2959 int find_grouped_subnet
PROTO ((struct subnet
**, struct shared_network
*,
2960 struct iaddr
, const char *, int));
2961 int find_subnet(struct subnet
**, struct iaddr
, const char *, int);
2962 void enter_shared_network
PROTO ((struct shared_network
*));
2963 void new_shared_network_interface
PROTO ((struct parse
*,
2964 struct shared_network
*,
2966 int subnet_inner_than(const struct subnet
*, const struct subnet
*, int);
2967 void enter_subnet
PROTO ((struct subnet
*));
2968 void enter_lease
PROTO ((struct lease
*));
2969 int supersede_lease
PROTO ((struct lease
*, struct lease
*, int, int, int));
2970 void make_binding_state_transition (struct lease
*);
2971 int lease_copy
PROTO ((struct lease
**, struct lease
*, const char *, int));
2972 void release_lease
PROTO ((struct lease
*, struct packet
*));
2973 void abandon_lease
PROTO ((struct lease
*, const char *));
2974 void dissociate_lease
PROTO ((struct lease
*));
2975 void pool_timer
PROTO ((void *));
2976 int find_lease_by_uid
PROTO ((struct lease
**, const unsigned char *,
2977 unsigned, const char *, int));
2978 int find_lease_by_hw_addr
PROTO ((struct lease
**, const unsigned char *,
2979 unsigned, const char *, int));
2980 int find_lease_by_ip_addr
PROTO ((struct lease
**, struct iaddr
,
2981 const char *, int));
2982 void uid_hash_add
PROTO ((struct lease
*));
2983 void uid_hash_delete
PROTO ((struct lease
*));
2984 void hw_hash_add
PROTO ((struct lease
*));
2985 void hw_hash_delete
PROTO ((struct lease
*));
2986 int write_leases
PROTO ((void));
2987 int write_leases6(void);
2988 int lease_enqueue (struct lease
*);
2989 isc_result_t
lease_instantiate(const void *, unsigned, void *);
2990 void expire_all_pools
PROTO ((void));
2991 void dump_subnets
PROTO ((void));
2992 #if defined (DEBUG_MEMORY_LEAKAGE) || \
2993 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
2994 void free_everything (void);
2998 char *ddns_rev_name (struct lease
*, struct lease_state
*, struct packet
*);
2999 char *ddns_fwd_name (struct lease
*, struct lease_state
*, struct packet
*);
3000 int nsupdateA (const char *, const unsigned char *, u_int32_t
, int);
3001 int nsupdatePTR (const char *, const unsigned char *, u_int32_t
, int);
3002 void nsupdate (struct lease
*, struct lease_state
*, struct packet
*, int);
3003 int updateA (const struct data_string
*, const struct data_string
*,
3004 unsigned int, struct lease
*);
3005 int updatePTR (const struct data_string
*, const struct data_string
*,
3006 unsigned int, struct lease
*);
3007 int deleteA (const struct data_string
*, const struct data_string
*,
3009 int deletePTR (const struct data_string
*, const struct data_string
*,
3013 #if defined (FAILOVER_PROTOCOL)
3014 extern dhcp_failover_state_t
*failover_states
;
3015 void dhcp_failover_startup
PROTO ((void));
3016 int dhcp_failover_write_all_states (void);
3017 isc_result_t enter_failover_peer
PROTO ((dhcp_failover_state_t
*));
3018 isc_result_t find_failover_peer
PROTO ((dhcp_failover_state_t
**,
3019 const char *, const char *, int));
3020 isc_result_t dhcp_failover_link_initiate
PROTO ((omapi_object_t
*));
3021 isc_result_t dhcp_failover_link_signal
PROTO ((omapi_object_t
*,
3022 const char *, va_list));
3023 isc_result_t dhcp_failover_link_set_value
PROTO ((omapi_object_t
*,
3025 omapi_data_string_t
*,
3026 omapi_typed_data_t
*));
3027 isc_result_t dhcp_failover_link_get_value
PROTO ((omapi_object_t
*,
3029 omapi_data_string_t
*,
3031 isc_result_t dhcp_failover_link_destroy
PROTO ((omapi_object_t
*,
3032 const char *, int));
3033 isc_result_t dhcp_failover_link_stuff_values
PROTO ((omapi_object_t
*,
3036 isc_result_t dhcp_failover_listen
PROTO ((omapi_object_t
*));
3038 isc_result_t dhcp_failover_listener_signal
PROTO ((omapi_object_t
*,
3041 isc_result_t dhcp_failover_listener_set_value
PROTO ((omapi_object_t
*,
3043 omapi_data_string_t
*,
3044 omapi_typed_data_t
*));
3045 isc_result_t dhcp_failover_listener_get_value
PROTO ((omapi_object_t
*,
3047 omapi_data_string_t
*,
3049 isc_result_t dhcp_failover_listener_destroy
PROTO ((omapi_object_t
*,
3050 const char *, int));
3051 isc_result_t dhcp_failover_listener_stuff
PROTO ((omapi_object_t
*,
3054 isc_result_t dhcp_failover_register
PROTO ((omapi_object_t
*));
3055 isc_result_t dhcp_failover_state_signal
PROTO ((omapi_object_t
*,
3056 const char *, va_list));
3057 isc_result_t
dhcp_failover_state_transition (dhcp_failover_state_t
*,
3059 isc_result_t
dhcp_failover_set_service_state (dhcp_failover_state_t
*state
);
3060 isc_result_t
dhcp_failover_set_state (dhcp_failover_state_t
*,
3061 enum failover_state
);
3062 isc_result_t
dhcp_failover_peer_state_changed (dhcp_failover_state_t
*,
3063 failover_message_t
*);
3064 void dhcp_failover_pool_rebalance (void *);
3065 void dhcp_failover_pool_check (struct pool
*);
3066 int dhcp_failover_state_pool_check (dhcp_failover_state_t
*);
3067 void dhcp_failover_timeout (void *);
3068 void dhcp_failover_send_contact (void *);
3069 isc_result_t
dhcp_failover_send_state (dhcp_failover_state_t
*);
3070 isc_result_t
dhcp_failover_send_updates (dhcp_failover_state_t
*);
3071 int dhcp_failover_queue_update (struct lease
*, int);
3072 int dhcp_failover_send_acks (dhcp_failover_state_t
*);
3073 void dhcp_failover_toack_queue_timeout (void *);
3074 int dhcp_failover_queue_ack (dhcp_failover_state_t
*, failover_message_t
*msg
);
3075 void dhcp_failover_ack_queue_remove (dhcp_failover_state_t
*, struct lease
*);
3076 isc_result_t dhcp_failover_state_set_value
PROTO ((omapi_object_t
*,
3078 omapi_data_string_t
*,
3079 omapi_typed_data_t
*));
3080 void dhcp_failover_keepalive (void *);
3081 void dhcp_failover_reconnect (void *);
3082 void dhcp_failover_startup_timeout (void *);
3083 void dhcp_failover_link_startup_timeout (void *);
3084 void dhcp_failover_listener_restart (void *);
3085 isc_result_t dhcp_failover_state_get_value
PROTO ((omapi_object_t
*,
3087 omapi_data_string_t
*,
3089 isc_result_t dhcp_failover_state_destroy
PROTO ((omapi_object_t
*,
3090 const char *, int));
3091 isc_result_t dhcp_failover_state_stuff
PROTO ((omapi_object_t
*,
3094 isc_result_t dhcp_failover_state_lookup
PROTO ((omapi_object_t
**,
3097 isc_result_t dhcp_failover_state_create
PROTO ((omapi_object_t
**,
3099 isc_result_t dhcp_failover_state_remove
PROTO ((omapi_object_t
*,
3101 int dhcp_failover_state_match (dhcp_failover_state_t
*, u_int8_t
*, unsigned);
3102 int dhcp_failover_state_match_by_name(dhcp_failover_state_t
*,
3103 failover_option_t
*);
3104 const char *dhcp_failover_reject_reason_print (int);
3105 const char *dhcp_failover_state_name_print (enum failover_state
);
3106 const char *dhcp_failover_message_name (unsigned);
3107 const char *dhcp_failover_option_name (unsigned);
3108 failover_option_t
*dhcp_failover_option_printf (unsigned, char *,
3112 __attribute__((__format__(__printf__
,5,6)));
3113 failover_option_t
*dhcp_failover_make_option (unsigned, char *,
3114 unsigned *, unsigned, ...);
3115 isc_result_t
dhcp_failover_put_message (dhcp_failover_link_t
*,
3116 omapi_object_t
*, int, u_int32_t
, ...);
3117 isc_result_t dhcp_failover_send_connect
PROTO ((omapi_object_t
*));
3118 isc_result_t dhcp_failover_send_connectack
PROTO ((omapi_object_t
*,
3119 dhcp_failover_state_t
*,
3120 int, const char *));
3121 isc_result_t dhcp_failover_send_disconnect
PROTO ((omapi_object_t
*,
3122 int, const char *));
3123 isc_result_t
dhcp_failover_send_bind_update (dhcp_failover_state_t
*,
3125 isc_result_t
dhcp_failover_send_bind_ack (dhcp_failover_state_t
*,
3126 failover_message_t
*,
3128 isc_result_t
dhcp_failover_send_poolreq (dhcp_failover_state_t
*);
3129 isc_result_t
dhcp_failover_send_poolresp (dhcp_failover_state_t
*, int);
3130 isc_result_t
dhcp_failover_send_update_request (dhcp_failover_state_t
*);
3131 isc_result_t
dhcp_failover_send_update_request_all (dhcp_failover_state_t
*);
3132 isc_result_t
dhcp_failover_send_update_done (dhcp_failover_state_t
*);
3133 isc_result_t
dhcp_failover_process_bind_update (dhcp_failover_state_t
*,
3134 failover_message_t
*);
3135 isc_result_t
dhcp_failover_process_bind_ack (dhcp_failover_state_t
*,
3136 failover_message_t
*);
3137 isc_result_t
dhcp_failover_generate_update_queue (dhcp_failover_state_t
*,
3139 isc_result_t
dhcp_failover_process_update_request (dhcp_failover_state_t
*,
3140 failover_message_t
*);
3141 isc_result_t
dhcp_failover_process_update_request_all (dhcp_failover_state_t
*,
3142 failover_message_t
*);
3143 isc_result_t
dhcp_failover_process_update_done (dhcp_failover_state_t
*,
3144 failover_message_t
*);
3145 void ia_na_remove_all_iaaddr(struct ia_na
*ia_na
, const char *file
, int line
);
3146 void dhcp_failover_recover_done (void *);
3147 void failover_print
PROTO ((char *, unsigned *, unsigned, const char *));
3148 void update_partner
PROTO ((struct lease
*));
3149 int load_balance_mine (struct packet
*, dhcp_failover_state_t
*);
3150 int peer_wants_lease (struct lease
*);
3151 binding_state_t
normal_binding_state_transition_check (struct lease
*,
3152 dhcp_failover_state_t
*,
3156 conflict_binding_state_transition_check (struct lease
*,
3157 dhcp_failover_state_t
*,
3158 binding_state_t
, u_int32_t
);
3159 int lease_mine_to_reallocate (struct lease
*);
3161 OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_state
, dhcp_failover_state_t
,
3162 dhcp_type_failover_state
)
3163 OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_listener
, dhcp_failover_listener_t
,
3164 dhcp_type_failover_listener
)
3165 OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_link
, dhcp_failover_link_t
,
3166 dhcp_type_failover_link
)
3167 #endif /* FAILOVER_PROTOCOL */
3169 const char *binding_state_print (enum failover_state
);
3173 HASH_FUNCTIONS_DECL(ia_na
, unsigned char *, struct ia_na
, ia_na_hash_t
);
3174 HASH_FUNCTIONS_DECL(iaaddr
, struct in6_addr
*, struct iaaddr
, iaaddr_hash_t
);
3176 isc_result_t
iaaddr_allocate(struct iaaddr
**iaaddr
,
3177 const char *file
, int line
);
3178 isc_result_t
iaaddr_reference(struct iaaddr
**iaaddr
, struct iaaddr
*src
,
3179 const char *file
, int line
);
3180 isc_result_t
iaaddr_dereference(struct iaaddr
**iaaddr
,
3181 const char *file
, int line
);
3183 isc_result_t
ia_na_make_key(struct data_string
*key
, u_int32_t iaid
,
3184 const char *duid
, unsigned int duid_len
,
3185 const char *file
, int line
);
3186 isc_result_t
ia_na_allocate(struct ia_na
**ia_na
, u_int32_t iaid
,
3187 const char *duid
, unsigned int duid_len
,
3188 const char *file
, int line
);
3189 isc_result_t
ia_na_reference(struct ia_na
**ia_na
, struct ia_na
*src
,
3190 const char *file
, int line
);
3191 isc_result_t
ia_na_dereference(struct ia_na
**ia_na
,
3192 const char *file
, int line
);
3193 isc_result_t
ia_na_add_iaaddr(struct ia_na
*ia_na
, struct iaaddr
*iaaddr
,
3194 const char *file
, int line
);
3195 void ia_na_remove_iaaddr(struct ia_na
*ia_na
, struct iaaddr
*iaaddr
,
3196 const char *file
, int line
);
3198 isc_result_t
ipv6_pool_allocate(struct ipv6_pool
**pool
,
3199 const struct in6_addr
*start_addr
, int bits
,
3200 const char *file
, int line
);
3201 isc_result_t
ipv6_pool_reference(struct ipv6_pool
**pool
,
3202 struct ipv6_pool
*src
,
3203 const char *file
, int line
);
3204 isc_result_t
ipv6_pool_dereference(struct ipv6_pool
**pool
,
3205 const char *file
, int line
);
3206 isc_result_t
activate_lease6(struct ipv6_pool
*pool
,
3207 struct iaaddr
**addr
,
3208 unsigned int *attempts
,
3209 const struct data_string
*uid
,
3210 time_t valid_lifetime_end_time
);
3211 isc_result_t
add_lease6(struct ipv6_pool
*pool
,
3212 struct iaaddr
*addr
,
3213 time_t valid_lifetime_end_time
);
3214 isc_result_t
renew_lease6(struct ipv6_pool
*pool
, struct iaaddr
*addr
);
3215 isc_result_t
expire_lease6(struct iaaddr
**addr
,
3216 struct ipv6_pool
*pool
, time_t now
);
3217 isc_result_t
release_lease6(struct ipv6_pool
*pool
, struct iaaddr
*addr
);
3218 isc_result_t
decline_lease6(struct ipv6_pool
*pool
, struct iaaddr
*addr
);
3219 isc_boolean_t
lease6_exists(const struct ipv6_pool
*pool
,
3220 const struct in6_addr
*addr
);
3221 isc_result_t
mark_address_unavailble(struct ipv6_pool
*pool
,
3222 const struct in6_addr
*addr
);
3224 isc_result_t
add_ipv6_pool(struct ipv6_pool
*pool
);
3225 isc_result_t
find_ipv6_pool(struct ipv6_pool
**pool
,
3226 const struct in6_addr
*addr
);
3227 isc_boolean_t
ipv6_addr_in_pool(const struct in6_addr
*addr
,
3228 const struct ipv6_pool
*pool
);
3230 isc_result_t
renew_leases(struct ia_na
*ia_na
);
3231 isc_result_t
release_leases(struct ia_na
*ia_na
);
3232 isc_result_t
decline_leases(struct ia_na
*ia_na
);
3233 void schedule_lease_timeout(struct ipv6_pool
*pool
);
3234 void schedule_all_ipv6_lease_timeouts();
3236 void mark_hosts_unavailable(void);
3237 void mark_interfaces_unavailable(void);