ISC DHCP  4.3.4
A reference DHCPv4 and DHCPv6 implementation
dhcpd.h
Go to the documentation of this file.
1 /* dhcpd.h
2 
3  Definitions for dhcpd... */
4 
5 /*
6  * Copyright (c) 2004-2016 by Internet Systems Consortium, Inc. ("ISC")
7  * Copyright (c) 1996-2003 by Internet Software Consortium
8  *
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.
12  *
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.
20  *
21  * Internet Systems Consortium, Inc.
22  * 950 Charter Street
23  * Redwood City, CA 94063
24  * <info@isc.org>
25  * https://www.isc.org/
26  *
27  */
28 
31 #include "config.h"
32 
33 #ifndef __CYGWIN32__
34 #include <sys/types.h>
35 #include <netinet/in.h>
36 #include <sys/socket.h>
37 #include <sys/un.h>
38 #include <arpa/inet.h>
39 #include <errno.h>
40 
41 #include <netdb.h>
42 #else
43 #define fd_set cygwin_fd_set
44 #include <sys/types.h>
45 #endif
46 #include <stddef.h>
47 #include <fcntl.h>
48 #include <stdio.h>
49 #include <unistd.h>
50 #include <string.h>
51 #include <stdlib.h>
52 #include <sys/stat.h>
53 #include <sys/mman.h>
54 #include <ctype.h>
55 #include <time.h>
56 
57 #include <net/if.h>
58 #undef FDDI
59 #include <net/route.h>
60 #include <net/if_arp.h>
61 #if HAVE_NET_IF_DL_H
62 # include <net/if_dl.h>
63 #endif
64 
65 #include <setjmp.h>
66 
67 #include "cdefs.h"
68 #include "osdep.h"
69 
70 #include "arpa/nameser.h"
71 
72 #include "minires.h"
73 
74 struct hash_table;
75 typedef struct hash_table group_hash_t;
76 typedef struct hash_table universe_hash_t;
79 typedef struct hash_table dns_zone_hash_t;
80 typedef struct hash_table lease_ip_hash_t;
81 typedef struct hash_table lease_id_hash_t;
82 typedef struct hash_table host_hash_t;
83 typedef struct hash_table class_hash_t;
84 
85 typedef time_t TIME;
86 
87 #ifndef EOL
88 #define EOL '\n'
89 #endif
90 
91 #include <omapip/isclib.h>
92 #include <omapip/result.h>
93 
94 #include "dhcp.h"
95 #include "dhcp6.h"
96 #include "statement.h"
97 #include "tree.h"
98 #include "inet.h"
99 #include "dhctoken.h"
100 
101 #include <omapip/omapip_p.h>
102 
103 #if defined(LDAP_CONFIGURATION)
104 # include <ldap.h>
105 # include <sys/utsname.h> /* for uname() */
106 #endif
107 
108 #if !defined (BYTE_NAME_HASH_SIZE)
109 # define BYTE_NAME_HASH_SIZE 401 /* Default would be ridiculous. */
110 #endif
111 #if !defined (BYTE_CODE_HASH_SIZE)
112 # define BYTE_CODE_HASH_SIZE 254 /* Default would be ridiculous. */
113 #endif
114 
115 /* Although it is highly improbable that a 16-bit option space might
116  * actually use 2^16 actual defined options, it is the worst case
117  * scenario we must prepare for. Having 4 options per bucket in this
118  * case is pretty reasonable.
119  */
120 #if !defined (WORD_NAME_HASH_SIZE)
121 # define WORD_NAME_HASH_SIZE 20479
122 #endif
123 #if !defined (WORD_CODE_HASH_SIZE)
124 # define WORD_CODE_HASH_SIZE 16384
125 #endif
126 
127 /* Not only is it improbable that the 32-bit spaces might actually use 2^32
128  * defined options, it is infeasible. It would be best for this kind of
129  * space to be dynamically sized. Instead we size it at the word hash's
130  * level.
131  */
132 #if !defined (QUAD_NAME_HASH_SIZE)
133 # define QUAD_NAME_HASH_SIZE WORD_NAME_HASH_SIZE
134 #endif
135 #if !defined (QUAD_CODE_HASH_SIZE)
136 # define QUAD_CODE_HASH_SIZE WORD_CODE_HASH_SIZE
137 #endif
138 
139 #if !defined (DNS_HASH_SIZE)
140 # define DNS_HASH_SIZE 0 /* Default. */
141 #endif
142 
143 /* Default size to use for name/code hashes on user-defined option spaces. */
144 #if !defined (DEFAULT_SPACE_HASH_SIZE)
145 # define DEFAULT_SPACE_HASH_SIZE 11
146 #endif
147 
148 #if !defined (NWIP_HASH_SIZE)
149 # define NWIP_HASH_SIZE 17 /* A really small table. */
150 #endif
151 
152 #if !defined (FQDN_HASH_SIZE)
153 # define FQDN_HASH_SIZE 13 /* A ridiculously small table. */
154 #endif
155 
156 /* I really doubt a given installation is going to have more than a few
157  * hundred vendors involved.
158  */
159 #if !defined (VIVCO_HASH_SIZE)
160 # define VIVCO_HASH_SIZE 127
161 #endif
162 
163 #if !defined (VIVSO_HASH_SIZE)
164 # define VIVSO_HASH_SIZE VIVCO_HASH_SIZE
165 #endif
166 
167 #if !defined (VSIO_HASH_SIZE)
168 # define VSIO_HASH_SIZE VIVCO_HASH_SIZE
169 #endif
170 
171 #if !defined (VIV_ISC_HASH_SIZE)
172 # define VIV_ISC_HASH_SIZE 3 /* An incredulously small table. */
173 #endif
174 
175 #if !defined (UNIVERSE_HASH_SIZE)
176 # define UNIVERSE_HASH_SIZE 13 /* A really small table. */
177 #endif
178 
179 #if !defined (GROUP_HASH_SIZE)
180 # define GROUP_HASH_SIZE 0 /* Default. */
181 #endif
182 
183 /* At least one person has indicated they use ~20k host records.
184  */
185 #if !defined (HOST_HASH_SIZE)
186 # define HOST_HASH_SIZE 22501
187 #endif
188 
189 /* We have user reports of use of ISC DHCP numbering leases in the 200k's.
190  *
191  * We also have reports of folks using 10.0/8 as a dynamic range. The
192  * following is something of a compromise between the two. At the ~2-3
193  * hundred thousand leases, there's ~2-3 leases to search in each bucket.
194  */
195 #if !defined (LEASE_HASH_SIZE)
196 # define LEASE_HASH_SIZE 100003
197 #endif
198 
199 /* It is not known what the worst case subclass hash size is. We estimate
200  * high, I think.
201  */
202 #if !defined (SCLASS_HASH_SIZE)
203 # define SCLASS_HASH_SIZE 12007
204 #endif
205 
206 #if !defined (AGENT_HASH_SIZE)
207 # define AGENT_HASH_SIZE 11 /* A really small table. */
208 #endif
209 
210 /* The server hash size is used for both names and codes. There aren't
211  * many (roughly 50 at the moment), so we use a smaller table. If we
212  * use a 1:1 table size, then we get name collisions due to poor name
213  * hashing. So we use double the space we need, which drastically
214  * reduces collisions.
215  */
216 #if !defined (SERVER_HASH_SIZE)
217 # define SERVER_HASH_SIZE (2*(sizeof(server_options) / sizeof(struct option)))
218 #endif
219 
220 
221 /* How many options are likely to appear in a single packet? */
222 #if !defined (OPTION_HASH_SIZE)
223 # define OPTION_HASH_SIZE 17
224 # define OPTION_HASH_PTWO 32 /* Next power of two above option hash. */
225 # define OPTION_HASH_EXP 5 /* The exponent for that power of two. */
226 #endif
227 
228 #define compute_option_hash(x) \
229  (((x) & (OPTION_HASH_PTWO - 1)) + \
230  (((x) >> OPTION_HASH_EXP) & \
231  (OPTION_HASH_PTWO - 1))) % OPTION_HASH_SIZE;
232 
233 /* Lease queue information. We have two ways of storing leases.
234  * The original is a linear linked list which is slower but uses
235  * less memory while the other adds a binary array on top of that
236  * list to make insertions faster. We define several macros
237  * based on which is in use to allow the code to be cleaner by
238  * avoiding #ifdefs.
239  *
240  * POOL_DESTROYP is used for cleanup
241  */
242 
243 #if !defined (BINARY_LEASES)
244 #define LEASE_STRUCT struct lease *
245 #define LEASE_STRUCT_PTR struct lease **
246 #define LEASE_GET_FIRST(LQ) LQ
247 #define LEASE_GET_FIRSTP(LQ) *(LQ)
248 #define LEASE_GET_NEXT(LQ, LEASE) LEASE->next
249 #define LEASE_GET_NEXTP(LQ, LEASE) LEASE->next
250 #define LEASE_INSERTP(LQ, LEASE) lease_insert(LQ, LEASE)
251 #define LEASE_REMOVEP(LQ, LEASE) lease_remove(LQ, LEASE)
252 #define LEASE_NOT_EMPTY(LQ) LQ
253 #define LEASE_NOT_EMPTYP(LQ) *LQ
254 #define POOL_DESTROYP(LQ) lease_remove_all(LQ)
255 #else
256 #define LEASE_STRUCT struct leasechain
257 #define LEASE_STRUCT_PTR struct leasechain *
258 #define LEASE_GET_FIRST(LQ) lc_get_first_lease(&LQ)
259 #define LEASE_GET_FIRSTP(LQ) lc_get_first_lease(LQ)
260 #define LEASE_GET_NEXT(LQ, LEASE) lc_get_next(&LQ, LEASE)
261 #define LEASE_GET_NEXTP(LQ, LEASE) lc_get_next(LQ, LEASE)
262 #define LEASE_INSERTP(LQ, LEASE) lc_add_sorted_lease(LQ, LEASE)
263 #define LEASE_REMOVEP(LQ, LEASE) lc_unlink_lease(LQ, LEASE)
264 #define LEASE_NOT_EMPTY(LQ) lc_not_empty(&LQ)
265 #define LEASE_NOT_EMPTYP(LQ) lc_not_empty(LQ)
266 #define POOL_DESTROYP(LQ) lc_delete_all(LQ)
267 #endif
268 
275 };
276 
277 /* Client FQDN option, failover FQDN option, etc. */
278 typedef struct {
279  u_int8_t codes [2];
280  unsigned length;
281  u_int8_t *data;
282 } ddns_fqdn_t;
283 
284 #include "failover.h"
285 
286 /* A parsing context. */
287 
288 struct parse {
289  int lexline;
290  int lexchar;
291  char *token_line;
292  char *prev_line;
293  char *cur_line;
294  const char *tlname;
296 
297  /*
298  * In order to give nice output when we have a parsing error
299  * in our file, we keep track of where we are in the line so
300  * that we can show the user.
301  *
302  * We need to keep track of two lines, because we can look
303  * ahead, via the "peek" function, to the next line sometimes.
304  *
305  * The "line1" and "line2" variables act as buffers for this
306  * information. The "lpos" variable tells us where we are in the
307  * line.
308  *
309  * When we "put back" a character from the parsing context, we
310  * do not want to have the character appear twice in the error
311  * output. So, we set a flag, the "ugflag", which the
312  * get_char() function uses to check for this condition.
313  */
314  char line1 [81];
315  char line2 [81];
316  int lpos;
317  int line;
318  int tlpos;
319  int tline;
320  enum dhcp_token token;
321  int ugflag;
322  char *tval;
323  int tlen;
324  char tokbuf [1500];
325 
327  int file;
328  char *inbuf;
329  size_t bufix, buflen;
330  size_t bufsiz;
331 
333 
334 #if defined(LDAP_CONFIGURATION)
335  /*
336  * LDAP configuration uses a call-back to iteratively read config
337  * off of the LDAP repository.
338  * XXX: The token stream can not be rewound reliably, so this must
339  * be addressed for DHCPv6 support.
340  */
341  int (*read_function)(struct parse *);
342 #endif
343 };
344 
345 /* Variable-length array of data. */
346 
347 struct string_list {
348  struct string_list *next;
349  char string [1];
350 };
351 
352 /* A name server, from /etc/resolv.conf. */
353 struct name_server {
354  struct name_server *next;
355  struct sockaddr_in addr;
357 };
358 
359 /* A domain search list element. */
362  char *domain;
364 };
365 
366 /* Option tag structures are used to build chains of option tags, for
367  when we're sure we're not going to have enough of them to justify
368  maintaining an array. */
369 
370 struct option_tag {
371  struct option_tag *next;
372  u_int8_t data [1];
373 };
374 
375 /* An agent option structure. We need a special structure for the
376  Relay Agent Information option because if more than one appears in
377  a message, we have to keep them separate. */
378 
381  int length;
382  struct option_tag *first;
383 };
384 
385 struct option_cache {
386  int refcnt;
389  struct option *option;
391 
392  #define OPTION_HAD_NULLS 0x00000001
393  u_int32_t flags;
394 };
395 
396 struct option_state {
397  int refcnt;
401  void *universes [1];
402 };
403 
404 /* A dhcp packet and the pointers to its option values. */
405 struct packet {
406  struct dhcp_packet *raw;
407  int refcnt;
408  unsigned packet_length;
410 
411  unsigned char dhcpv6_msg_type; /* DHCPv6 message type */
412 
413  /* DHCPv6 transaction ID */
414  unsigned char dhcpv6_transaction_id[3];
415 
416  /* DHCPv6 relay information */
417  unsigned char dhcpv6_hop_count;
418  struct in6_addr dhcpv6_link_address;
419  struct in6_addr dhcpv6_peer_address;
420 
421  /* DHCPv6 packet containing this one, or NULL if none */
423 
424  /* DHCPv4-over-DHCPv6 flags */
425  unsigned char dhcp4o6_flags[3];
426 
427  /* DHCPv4-over-DHCPv6 response, or NULL */
429 
432  struct iaddr client_addr;
433  struct interface_info *interface; /* Interface on which packet
434  was received. */
435  struct hardware *haddr; /* Physical link address
436  of local sender (maybe gateway). */
437 
438  /* Information for relay agent options (see
439  draft-ietf-dhc-agent-options-xx.txt). */
440  u_int8_t *circuit_id; /* Circuit ID of client connection. */
442  u_int8_t *remote_id; /* Remote ID of client. */
444 
445  int got_requested_address; /* True if client sent the
446  dhcp-requested-address option. */
447 
450 
451 #if !defined (PACKET_MAX_CLASSES)
452 # define PACKET_MAX_CLASSES 5
453 #endif
455  struct class *classes [PACKET_MAX_CLASSES];
456 
457  int known;
459 
460  /* If we stash agent options onto the packet option state, to pretend
461  * options we got in a previous exchange were still there, we need
462  * to signal this in a reliable way.
463  */
464  isc_boolean_t agent_options_stashed;
465 
466  /*
467  * ISC_TRUE if packet received unicast (as opposed to multicast).
468  * Only used in DHCPv6.
469  */
470  isc_boolean_t unicast;
471 
472  /* Propogates server value SV_ECHO_CLIENT_ID so it is available
473  * in cons_options() */
475 };
476 
477 /*
478  * A network interface's MAC address.
479  * 20 bytes for the hardware address
480  * and 1 byte for the type tag
481  */
482 
483 #define HARDWARE_ADDR_LEN 20
484 
485 /* ioctl limits hardware addresses to 8 bytes */
486 #define HARDWARE_ADDR_LEN_IOCTL 8
487 
488 struct hardware {
489  u_int8_t hlen;
490  u_int8_t hbuf[HARDWARE_ADDR_LEN + 1];
491 };
492 
493 #if defined(LDAP_CONFIGURATION)
494 # define LDAP_BUFFER_SIZE 8192
495 # define LDAP_METHOD_STATIC 0
496 # define LDAP_METHOD_DYNAMIC 1
497 #if defined (LDAP_USE_SSL)
498 # define LDAP_SSL_OFF 0
499 # define LDAP_SSL_ON 1
500 # define LDAP_SSL_TLS 2
501 # define LDAP_SSL_LDAPS 3
502 #endif
503 
504 /* This is a tree of the current configuration we are building from LDAP */
505 struct ldap_config_stack {
506  LDAPMessage * res; /* Pointer returned from ldap_search */
507  LDAPMessage * ldent; /* Current item in LDAP that we're processing.
508  in res */
509  int close_brace; /* Put a closing } after we're through with
510  this item */
511  int processed; /* We set this flag if this base item has been
512  processed. After this base item is processed,
513  we can start processing the children */
514  struct ldap_config_stack *children;
515  struct ldap_config_stack *next;
516 };
517 #endif
518 
519 typedef enum {
526 
527 typedef struct {
531 
532 /* Lease states: */
533 #define FTS_FREE 1
534 #define FTS_ACTIVE 2
535 #define FTS_EXPIRED 3
536 #define FTS_RELEASED 4
537 #define FTS_ABANDONED 5
538 #define FTS_RESET 6
539 #define FTS_BACKUP 7
540 typedef u_int8_t binding_state_t;
541 
542 /* FTS_LAST is the highest value that is valid for a lease binding state. */
543 #define FTS_LAST FTS_BACKUP
544 
545 /*
546  * A block for the on statements so we can share the structure
547  * between v4 and v6
548  */
549 struct on_star {
553 };
554 
555 /* A dhcp lease declaration structure. */
556 struct lease {
558  struct lease *next;
559 #if defined (BINARY_LEASES)
560  struct lease *prev;
561  struct leasechain *lc;
562 #endif
563  struct lease *n_uid, *n_hw;
564 
565  struct iaddr ip_addr;
566  TIME starts, ends, sort_time;
567 #if defined (BINARY_LEASES)
568  long int sort_tiebreaker;
569 #endif
572  struct host_decl *host;
573  struct subnet *subnet;
574  struct pool *pool;
577 
578  /* insert the structure directly */
579  struct on_star on_star;
580 
581  unsigned char *uid;
582  unsigned short uid_len;
583  unsigned short uid_max;
584  unsigned char uid_buf [7];
585  struct hardware hardware_addr;
586 
587  u_int8_t flags;
588 # define STATIC_LEASE 1
589 # define BOOTP_LEASE 2
590 # define RESERVED_LEASE 4
591 # define MS_NULL_TERMINATION 8
592 # define ON_UPDATE_QUEUE 16
593 # define ON_ACK_QUEUE 32
594 # define ON_QUEUE (ON_UPDATE_QUEUE | ON_ACK_QUEUE)
595 # define UNICAST_BROADCAST_HACK 64
596 # define ON_DEFERRED_QUEUE 128
597 
598 /* Persistent flags are to be preserved on a given lease structure. */
599 # define PERSISTENT_FLAGS (ON_ACK_QUEUE | ON_UPDATE_QUEUE)
600 /* Ephemeral flags are to be preserved on a given lease (copied etc). */
601 # define EPHEMERAL_FLAGS (MS_NULL_TERMINATION | \
602  UNICAST_BROADCAST_HACK | \
603  RESERVED_LEASE | \
604  BOOTP_LEASE)
605 
606  /*
607  * The lease's binding state is its current state. The next binding
608  * state is the next state this lease will move into by expiration,
609  * or timers in general. The desired binding state is used on lease
610  * updates; the caller is attempting to move the lease to the desired
611  * binding state (and this may either succeed or fail, so the binding
612  * state must be preserved).
613  *
614  * The 'rewind' binding state is used in failover processing. It
615  * is used for an optimization when out of communications; it allows
616  * the server to "rewind" a lease to the previous state acknowledged
617  * by the peer, and progress forward from that point.
618  */
623 
625 
626  /*
627  * 'tsfp' is more of an 'effective' tsfp. It may be calculated from
628  * stos+mclt for example if it's an expired lease and the server is
629  * in partner-down state. 'atsfp' is zeroed whenever a lease is
630  * updated - and only set when the peer acknowledges it. This
631  * ensures every state change is transmitted.
632  */
633  TIME tstp; /* Time sent to partner. */
634  TIME tsfp; /* Time sent from partner. */
635  TIME atsfp; /* Actual time sent from partner. */
636  TIME cltt; /* Client last transaction time. */
637  u_int32_t last_xid; /* XID we sent in this lease's BNDUPD */
639 
640  /*
641  * A pointer to the state of the ddns update for this lease.
642  * It should be set while the update is in progress and cleared
643  * when the update finishes. It can be used to cancel the
644  * update if we want to do a different update.
645  */
647 
648  /* Set when a lease has been disqualified for cache-threshold reuse */
649  unsigned short cannot_reuse;
650 };
651 
652 struct lease_state {
653  struct lease_state *next;
654 
656 
657  struct packet *packet; /* The incoming packet. */
658 
660 
662  struct data_string parameter_request_list;
664  unsigned char expiry[4], renewal[4], rebind[4];
665  struct data_string filename, server_name;
668  struct shared_network *shared_network; /* Shared network of interface
669  on which request arrived. */
670 
671  u_int32_t xid;
672  u_int16_t secs;
673  u_int16_t bootp_flags;
674  struct in_addr ciaddr;
675  struct in_addr siaddr;
676  struct in_addr giaddr;
677  u_int8_t hops;
678  u_int8_t offer;
679  struct iaddr from;
680 };
681 
682 #define ROOT_GROUP 0
683 #define HOST_DECL 1
684 #define SHARED_NET_DECL 2
685 #define SUBNET_DECL 3
686 #define CLASS_DECL 4
687 #define GROUP_DECL 5
688 #define POOL_DECL 6
689 
690 /* Possible modes in which discover_interfaces can run. */
691 
692 #define DISCOVER_RUNNING 0
693 #define DISCOVER_SERVER 1
694 #define DISCOVER_UNCONFIGURED 2
695 #define DISCOVER_RELAY 3
696 #define DISCOVER_SERVER46 4
697 #define DISCOVER_REQUESTED 5
698 
699 /* DDNS_UPDATE_STYLE enumerations. */
700 #define DDNS_UPDATE_STYLE_NONE 0
701 #define DDNS_UPDATE_STYLE_AD_HOC 1
702 #define DDNS_UPDATE_STYLE_INTERIM 2
703 #define DDNS_UPDATE_STYLE_STANDARD 3
704 
705 /* Server option names. */
706 
707 #define SV_DEFAULT_LEASE_TIME 1
708 #define SV_MAX_LEASE_TIME 2
709 #define SV_MIN_LEASE_TIME 3
710 #define SV_BOOTP_LEASE_CUTOFF 4
711 #define SV_BOOTP_LEASE_LENGTH 5
712 #define SV_BOOT_UNKNOWN_CLIENTS 6
713 #define SV_DYNAMIC_BOOTP 7
714 #define SV_ALLOW_BOOTP 8
715 #define SV_ALLOW_BOOTING 9
716 #define SV_ONE_LEASE_PER_CLIENT 10
717 #define SV_GET_LEASE_HOSTNAMES 11
718 #define SV_USE_HOST_DECL_NAMES 12
719 #define SV_USE_LEASE_ADDR_FOR_DEFAULT_ROUTE 13
720 #define SV_MIN_SECS 14
721 #define SV_FILENAME 15
722 #define SV_SERVER_NAME 16
723 #define SV_NEXT_SERVER 17
724 #define SV_AUTHORITATIVE 18
725 #define SV_VENDOR_OPTION_SPACE 19
726 #define SV_ALWAYS_REPLY_RFC1048 20
727 #define SV_SITE_OPTION_SPACE 21
728 #define SV_ALWAYS_BROADCAST 22
729 #define SV_DDNS_DOMAIN_NAME 23
730 #define SV_DDNS_HOST_NAME 24
731 #define SV_DDNS_REV_DOMAIN_NAME 25
732 #define SV_LEASE_FILE_NAME 26
733 #define SV_PID_FILE_NAME 27
734 #define SV_DUPLICATES 28
735 #define SV_DECLINES 29
736 #define SV_DDNS_UPDATES 30
737 #define SV_OMAPI_PORT 31
738 #define SV_LOCAL_PORT 32
739 #define SV_LIMITED_BROADCAST_ADDRESS 33
740 #define SV_REMOTE_PORT 34
741 #define SV_LOCAL_ADDRESS 35
742 #define SV_OMAPI_KEY 36
743 #define SV_STASH_AGENT_OPTIONS 37
744 #define SV_DDNS_TTL 38
745 #define SV_DDNS_UPDATE_STYLE 39
746 #define SV_CLIENT_UPDATES 40
747 #define SV_UPDATE_OPTIMIZATION 41
748 #define SV_PING_CHECKS 42
749 #define SV_UPDATE_STATIC_LEASES 43
750 #define SV_LOG_FACILITY 44
751 #define SV_DO_FORWARD_UPDATES 45
752 #define SV_PING_TIMEOUT 46
753 #define SV_RESERVE_INFINITE 47
754 #define SV_DDNS_CONFLICT_DETECT 48
755 #define SV_LEASEQUERY 49
756 #define SV_ADAPTIVE_LEASE_TIME_THRESHOLD 50
757 #define SV_DO_REVERSE_UPDATES 51
758 #define SV_FQDN_REPLY 52
759 #define SV_PREFER_LIFETIME 53
760 #define SV_DHCPV6_LEASE_FILE_NAME 54
761 #define SV_DHCPV6_PID_FILE_NAME 55
762 #define SV_LIMIT_ADDRS_PER_IA 56
763 #define SV_LIMIT_PREFS_PER_IA 57
764 #define SV_DELAYED_ACK 58
765 #define SV_MAX_ACK_DELAY 59
766 #if defined(LDAP_CONFIGURATION)
767 # define SV_LDAP_SERVER 60
768 # define SV_LDAP_PORT 61
769 # define SV_LDAP_USERNAME 62
770 # define SV_LDAP_PASSWORD 63
771 # define SV_LDAP_BASE_DN 64
772 # define SV_LDAP_METHOD 65
773 # define SV_LDAP_DEBUG_FILE 66
774 # define SV_LDAP_DHCP_SERVER_CN 67
775 # define SV_LDAP_REFERRALS 68
776 #if defined (LDAP_USE_SSL)
777 # define SV_LDAP_SSL 69
778 # define SV_LDAP_TLS_REQCERT 70
779 # define SV_LDAP_TLS_CA_FILE 71
780 # define SV_LDAP_TLS_CA_DIR 72
781 # define SV_LDAP_TLS_CERT 73
782 # define SV_LDAP_TLS_KEY 74
783 # define SV_LDAP_TLS_CRLCHECK 75
784 # define SV_LDAP_TLS_CIPHERS 76
785 # define SV_LDAP_TLS_RANDFILE 77
786 #endif
787 # define SV_LDAP_INIT_RETRY 178
788 #if defined (LDAP_USE_GSSAPI)
789 # define SV_LDAP_GSSAPI_KEYTAB 179
790 # define SV_LDAP_GSSAPI_PRINCIPAL 180
791 #endif
792 #endif
793 #define SV_CACHE_THRESHOLD 78
794 #define SV_DONT_USE_FSYNC 79
795 #define SV_DDNS_LOCAL_ADDRESS4 80
796 #define SV_DDNS_LOCAL_ADDRESS6 81
797 #define SV_IGNORE_CLIENT_UIDS 82
798 #define SV_LOG_THRESHOLD_LOW 83
799 #define SV_LOG_THRESHOLD_HIGH 84
800 #define SV_ECHO_CLIENT_ID 85
801 #define SV_SERVER_ID_CHECK 86
802 #define SV_PREFIX_LEN_MODE 87
803 #define SV_DHCPV6_SET_TEE_TIMES 88
804 
805 #if !defined (DEFAULT_PING_TIMEOUT)
806 # define DEFAULT_PING_TIMEOUT 1
807 #endif
808 
809 #if !defined (DEFAULT_DELAYED_ACK)
810 # define DEFAULT_DELAYED_ACK 28 /* default SO_SNDBUF size / 576 bytes */
811 #endif
812 
813 #if !defined (DEFAULT_ACK_DELAY_SECS)
814 # define DEFAULT_ACK_DELAY_SECS 0
815 #endif
816 
817 #if !defined (DEFAULT_ACK_DELAY_USECS)
818 # define DEFAULT_ACK_DELAY_USECS 250000 /* 1/4 of a second */
819 #endif
820 
821 #if !defined (DEFAULT_MIN_ACK_DELAY_USECS)
822 # define DEFAULT_MIN_ACK_DELAY_USECS 10000 /* 1/100 second */
823 #endif
824 
825 #if !defined (DEFAULT_CACHE_THRESHOLD)
826 # define DEFAULT_CACHE_THRESHOLD 25
827 #endif
828 
829 #if !defined (DEFAULT_DEFAULT_LEASE_TIME)
830 # define DEFAULT_DEFAULT_LEASE_TIME 43200
831 #endif
832 
833 #if !defined (DEFAULT_MIN_LEASE_TIME)
834 # define DEFAULT_MIN_LEASE_TIME 300
835 #endif
836 
837 #if !defined (DEFAULT_MAX_LEASE_TIME)
838 # define DEFAULT_MAX_LEASE_TIME 86400
839 #endif
840 
841 #if !defined (DEFAULT_DDNS_TTL)
842 # define DEFAULT_DDNS_TTL 3600
843 #endif
844 #if !defined (MAX_DEFAULT_DDNS_TTL)
845 # define MAX_DEFAULT_DDNS_TTL 3600
846 #endif
847 
848 #if !defined (MIN_LEASE_WRITE)
849 # define MIN_LEASE_WRITE 15
850 #endif
851 
852 #define PLM_IGNORE 0
853 #define PLM_PREFER 1
854 #define PLM_EXACT 2
855 #define PLM_MINIMUM 3
856 #define PLM_MAXIMUM 4
857 
858 /* Client option names */
859 
860 #define CL_TIMEOUT 1
861 #define CL_SELECT_INTERVAL 2
862 #define CL_REBOOT_TIMEOUT 3
863 #define CL_RETRY_INTERVAL 4
864 #define CL_BACKOFF_CUTOFF 5
865 #define CL_INITIAL_INTERVAL 6
866 #define CL_BOOTP_POLICY 7
867 #define CL_SCRIPT_NAME 8
868 #define CL_REQUESTED_OPTIONS 9
869 #define CL_REQUESTED_LEASE_TIME 10
870 #define CL_SEND_OPTIONS 11
871 #define CL_MEDIA 12
872 #define CL_REJECT_LIST 13
873 
874 #ifndef CL_DEFAULT_TIMEOUT
875 # define CL_DEFAULT_TIMEOUT 60
876 #endif
877 
878 #ifndef CL_DEFAULT_SELECT_INTERVAL
879 # define CL_DEFAULT_SELECT_INTERVAL 0
880 #endif
881 
882 #ifndef CL_DEFAULT_REBOOT_TIMEOUT
883 # define CL_DEFAULT_REBOOT_TIMEOUT 10
884 #endif
885 
886 #ifndef CL_DEFAULT_RETRY_INTERVAL
887 # define CL_DEFAULT_RETRY_INTERVAL 300
888 #endif
889 
890 #ifndef CL_DEFAULT_BACKOFF_CUTOFF
891 # define CL_DEFAULT_BACKOFF_CUTOFF 120
892 #endif
893 
894 #ifndef CL_DEFAULT_INITIAL_INTERVAL
895 # define CL_DEFAULT_INITIAL_INTERVAL 10
896 #endif
897 
898 #ifndef CL_DEFAULT_BOOTP_POLICY
899 # define CL_DEFAULT_BOOTP_POLICY P_ACCEPT
900 #endif
901 
902 #ifndef CL_DEFAULT_REQUESTED_OPTIONS
903 # define CL_DEFAULT_REQUESTED_OPTIONS \
904  { DHO_SUBNET_MASK, \
905  DHO_BROADCAST_ADDRESS, \
906  DHO_TIME_OFFSET, \
907  DHO_ROUTERS, \
908  DHO_DOMAIN_NAME, \
909  DHO_DOMAIN_NAME_SERVERS, \
910  DHO_HOST_NAME }
911 #endif
912 
913 struct group_object {
915 
917  struct group *group;
918  char *name;
919  int flags;
920 #define GROUP_OBJECT_DELETED 1
921 #define GROUP_OBJECT_DYNAMIC 2
922 #define GROUP_OBJECT_STATIC 4
923 };
924 
925 /* Group of declarations that share common parameters. */
926 struct group {
927  struct group *next;
928 
929  int refcnt;
931  struct subnet *subnet;
935 };
936 
937 /* A dhcp host declaration structure. */
938 struct host_decl {
942  char *name;
943  struct hardware interface;
944  struct data_string client_identifier;
946  struct data_string host_id;
947  /* XXXSK: fixed_addr should be an array of iaddr values,
948  not an option_cache, but it's referenced in a lot of
949  places, so we'll leave it for now. */
952  struct group *group;
954  struct data_string auth_key_id;
955  int flags;
956 #define HOST_DECL_DELETED 1
957 #define HOST_DECL_DYNAMIC 2
958 #define HOST_DECL_STATIC 4
959  /* For v6 the host-identifer option can specify which relay
960  to use when trying to look up an option. We store the
961  value here. */
962  int relays;
963 };
964 
965 struct permit {
966  struct permit *next;
967  enum {
976  } type;
977  struct class *class;
978  TIME after; /* date after which this clause applies */
979 };
980 
981 #if defined (BINARY_LEASES)
982 struct leasechain {
983  struct lease **list; /* lease list */
984  size_t total; /* max number of elements in this list,
985  * including free pointers at the end if any */
986  size_t nelem; /* the number of elements, also the next index to use */
987  size_t growth; /* the growth factor to use when increase an array
988  * this is set after parsing the pools and before
989  * creatin an array. */
990 };
991 #endif
992 
993 struct pool {
995  struct pool *next;
996  struct group *group;
1010  int index;
1011  TIME valid_from; /* deny pool use before this date */
1012  TIME valid_until; /* deny pool use after this date */
1013 
1014 #if defined (FAILOVER_PROTOCOL)
1015  dhcp_failover_state_t *failover_peer;
1016 #endif
1017  int logged; /* already logged a message */
1018  int low_threshold; /* low threshold to restart logging */
1019 };
1020 
1024  char *name;
1025 
1026 #define SHARED_IMPLICIT 1 /* This network was synthesized. */
1027  int flags;
1028 
1029  struct subnet *subnets;
1031  struct pool *pools;
1033  struct group *group;
1034 #if defined (FAILOVER_PROTOCOL)
1035  dhcp_failover_state_t *failover_peer;
1036 #endif
1037 };
1038 
1039 struct subnet {
1045  struct iaddr interface_address;
1046  struct iaddr net;
1047  struct iaddr netmask;
1048  int prefix_len; /* XXX: currently for IPv6 only */
1049  struct group *group;
1050 };
1051 
1052 struct collection {
1053  struct collection *next;
1054 
1055  const char *name;
1056  struct class *classes;
1057 };
1058 
1059 /* Used as an argument to parse_clasS_decl() */
1060 #define CLASS_TYPE_VENDOR 0
1061 #define CLASS_TYPE_USER 1
1062 #define CLASS_TYPE_CLASS 2
1063 #define CLASS_TYPE_SUBCLASS 3
1064 
1065 /* XXX classes must be reference-counted. */
1066 struct class {
1068  struct class *nic; /* Next in collection. */
1069  struct class *superclass; /* Set for spawned classes only. */
1070  char *name; /* Not set for spawned classes. */
1071 
1072  /* A class may be configured to permit a limited number of leases. */
1076 
1077  /* If nonzero, class has not been saved since it was last
1078  modified. */
1079  int dirty;
1080 
1081  /* Hash table containing subclasses. */
1083  struct data_string hash_string;
1084 
1085  /* Expression used to match class. */
1086  struct expression *expr;
1087 
1088  /* Expression used to compute subclass identifiers for spawning
1089  and to do subclass matching. */
1092 
1093  struct group *group;
1094 
1095  /* Statements to execute if class matches. */
1097 
1098 #define CLASS_DECL_DELETED 1
1099 #define CLASS_DECL_DYNAMIC 2
1100 #define CLASS_DECL_STATIC 4
1101 #define CLASS_DECL_SUBCLASS 8
1102 
1103  int flags;
1104 };
1105 
1106 /* DHCP client lease structure... */
1108  struct client_lease *next; /* Next lease in list. */
1109  TIME expiry, renewal, rebind; /* Lease timeouts. */
1110  struct iaddr address; /* Address being leased. */
1111  char *server_name; /* Name of boot server. */
1112  char *filename; /* Name of file we're supposed to boot. */
1113  struct string_list *medium; /* Network medium. */
1114  struct auth_key *key; /* Key used in basic DHCP authentication. */
1115 
1116  unsigned int is_static : 1; /* If set, lease is from config file. */
1117  unsigned int is_bootp: 1; /* If set, lease was acquired with BOOTP. */
1118 
1119  struct option_state *options; /* Options supplied with lease. */
1120  struct iaddr next_srv_addr; /* Address of the next server to use */
1121 };
1122 
1123 /* DHCPv6 lease structures */
1124 struct dhc6_addr {
1125  struct dhc6_addr *next;
1126  struct iaddr address;
1127  u_int8_t plen;
1128 
1129  /* Address state flags. */
1130  #define DHC6_ADDR_DEPREFFED 0x01
1131  #define DHC6_ADDR_EXPIRED 0x02
1132  u_int8_t flags;
1133 
1135  u_int32_t preferred_life;
1136  u_int32_t max_life;
1137 
1139 };
1140 
1141 struct dhc6_ia {
1142  struct dhc6_ia *next;
1143  unsigned char iaid[4];
1144  u_int16_t ia_type;
1145 
1147  u_int32_t renew;
1148  u_int32_t rebind;
1149  struct dhc6_addr *addrs;
1150 
1152 };
1153 
1154 struct dhc6_lease {
1155  struct dhc6_lease *next;
1156  struct data_string server_id;
1157 
1158  isc_boolean_t released;
1159  int score;
1160  u_int8_t pref;
1161 
1162  unsigned char dhcpv6_transaction_id[3];
1164 
1166 };
1167 
1168 /* Possible states in which the client can be. */
1171  S_INIT = 2,
1174  S_BOUND = 5,
1179 };
1180 
1181 /* Possible pending client operations. */
1183  P_NONE = 0,
1186 };
1187 
1188 /* Authentication and BOOTP policy possibilities (not all values work
1189  for each). */
1191 
1192 /* Configuration information from the config file... */
1194  /*
1195  * When a message has been received, run these statements
1196  * over it.
1197  */
1199 
1200  /*
1201  * When a message is sent, run these statements.
1202  */
1204 
1205  struct option **required_options; /* Options that MUST be present. */
1206  struct option **requested_options; /* Options to request (ORO/PRL). */
1207 
1208  TIME timeout; /* Start to panic if we don't get a
1209  lease in this time period when
1210  SELECTING. */
1211  TIME initial_delay; /* Set initial delay before first
1212  transmission. */
1213  TIME initial_interval; /* All exponential backoff intervals
1214  start here. */
1215  TIME retry_interval; /* If the protocol failed to produce
1216  an address before the timeout,
1217  try the protocol again after this
1218  many seconds. */
1219  TIME select_interval; /* Wait this many seconds from the
1220  first DHCPDISCOVER before
1221  picking an offered lease. */
1222  TIME reboot_timeout; /* When in INIT-REBOOT, wait this
1223  long before giving up and going
1224  to INIT. */
1225  TIME backoff_cutoff; /* When doing exponential backoff,
1226  never back off to an interval
1227  longer than this amount. */
1228  u_int32_t requested_lease; /* Requested lease time, if user
1229  doesn't configure one. */
1230  struct string_list *media; /* Possible network media values. */
1231  char *script_name; /* Name of config script. */
1232  char *vendor_space_name; /* Name of config script. */
1233  enum policy bootp_policy;
1234  /* Ignore, accept or prefer BOOTP
1235  responses. */
1236  enum policy auth_policy;
1237  /* Require authentication, prefer
1238  authentication, or don't try to
1239  authenticate. */
1240  struct string_list *medium; /* Current network medium. */
1241 
1242  struct iaddrmatchlist *reject_list; /* Servers to reject. */
1243 
1244  int omapi_port; /* port on which to accept OMAPI
1245  connections, or -1 for no
1246  listener. */
1247  int do_forward_update; /* If nonzero, and if we have the
1248  information we need, update the
1249  A record for the address we get. */
1250 
1251  int lease_id_format; /* format for IDs in lease file,
1252  TOKEN_OCTAL or TOKEN_HEX */
1253 
1254  int bootp_broadcast_always; /* If nonzero, always set the BOOTP_BROADCAST
1255  flag in requests */
1256 };
1257 
1258 /* Per-interface state used in the dhcp client... */
1259 /* XXX: consider union {}'ing this for v4/v6. */
1263  char *name;
1264 
1265  /* Common values. */
1266  struct client_config *config; /* Client configuration. */
1267  struct string_list *env; /* Client script environment. */
1268  int envc; /* Number of entries in environment. */
1269  struct option_state *sent_options; /* Options we sent. */
1270  enum dhcp_state state; /* Current state for this interface. */
1271  TIME last_write; /* Last time this state was written. */
1272  enum dhcp_pending pending; /* Current pending operation. */
1273 
1274  /* DHCPv4 values. */
1275  struct client_lease *active; /* Currently active lease. */
1276  struct client_lease *new; /* New lease. */
1277  struct client_lease *offered_leases; /* Leases offered to us. */
1278  struct client_lease *leases; /* Leases we currently hold. */
1279  struct client_lease *alias; /* Alias lease. */
1280 
1281  struct iaddr destination; /* Where to send packet. */
1282  u_int32_t xid; /* Transaction ID. */
1283  u_int16_t secs; /* secs value from DHCPDISCOVER. */
1284  TIME first_sending; /* When was first copy sent? */
1285  TIME interval; /* What's the current resend interval? */
1286  struct string_list *medium; /* Last media type tried. */
1287  struct dhcp_packet packet; /* Outgoing DHCP packet. */
1288  unsigned packet_length; /* Actual length of generated packet. */
1289 
1290  struct iaddr requested_address; /* Address we would like to get. */
1291 
1292  /* DHCPv6 values. */
1293  unsigned char dhcpv6_transaction_id[3];
1294  u_int8_t refresh_type;
1295 
1301 
1302  struct timeval start_time;
1303  u_int16_t elapsed;
1304  int txcount;
1305 
1306  /* See RFC3315 section 14. */
1307  TIME RT; /* In hundredths of seconds. */
1308  TIME IRT; /* In hundredths of seconds. */
1309  TIME MRC; /* Count. */
1310  TIME MRT; /* In hundredths of seconds. */
1311  TIME MRD; /* In seconds, relative. */
1312  TIME next_MRD; /* In seconds, absolute. */
1313 
1314  /* Rather than a state, we use a function that shifts around
1315  * depending what stage of life the v6 state machine is in.
1316  * This is where incoming packets are dispatched to (sometimes
1317  * a no-op).
1318  */
1319  void (*v6_handler)(struct packet *, struct client_state *);
1320 
1321  /*
1322  * A pointer to the state of the ddns update for this lease.
1323  * It should be set while the update is in progress and cleared
1324  * when the update finishes. It can be used to cancel the
1325  * update if we want to do a different update.
1326  */
1328 };
1329 
1332  const char *prefix;
1333 };
1334 
1337  struct iaddr address;
1339 };
1340 
1341 /* Information about each network interface. */
1342 
1345  struct interface_info *next; /* Next interface in list... */
1347  /* Networks connected to this interface. */
1348  struct hardware hw_address; /* Its physical address. */
1349  u_int8_t bcast_addr[20]; /* Infiniband broadcast address */
1350  struct in_addr *addresses; /* Addresses associated with this
1351  * interface.
1352  */
1353  int address_count; /* Number of addresses stored. */
1354  int address_max; /* Size of addresses buffer. */
1355  struct in6_addr *v6addresses; /* IPv6 addresses associated with
1356  this interface. */
1357  int v6address_count; /* Number of IPv6 addresses associated
1358  with this interface. */
1359  int v6address_max; /* Maximum number of IPv6 addresses
1360  we can store in current buffer. */
1361 
1362  u_int8_t *circuit_id; /* Circuit ID associated with this
1363  interface. */
1364  unsigned circuit_id_len; /* Length of Circuit ID, if there
1365  is one. */
1366  u_int8_t *remote_id; /* Remote ID associated with this
1367  interface (if any). */
1368  unsigned remote_id_len; /* Length of Remote ID. */
1369 
1370  char name [IFNAMSIZ]; /* Its name... */
1371  int index; /* Its if_nametoindex(). */
1372  int rfdesc; /* Its read file descriptor. */
1373  int wfdesc; /* Its write file descriptor, if
1374  different. */
1375  unsigned char *rbuf; /* Read buffer, if required. */
1376  unsigned int rbuf_max; /* Size of read buffer. */
1377  size_t rbuf_offset; /* Current offset into buffer. */
1378  size_t rbuf_len; /* Length of data in buffer. */
1379 
1380  struct ifreq *ifp; /* Pointer to ifreq struct. */
1381  int configured; /* If set to 1, interface has at least
1382  * one valid IP address.
1383  */
1384  u_int32_t flags; /* Control flags... */
1385 #define INTERFACE_REQUESTED 1
1386 #define INTERFACE_AUTOMATIC 2
1387 #define INTERFACE_RUNNING 4
1388 #define INTERFACE_DOWNSTREAM 8
1389 #define INTERFACE_UPSTREAM 16
1390 #define INTERFACE_STREAMS (INTERFACE_DOWNSTREAM | INTERFACE_UPSTREAM)
1391 
1392  /* Only used by DHCP client code. */
1394 # if defined(USE_DLPI_SEND) || defined(USE_DLPI_RECEIVE) || \
1395  defined(USE_DLPI_HWADDR)
1396  int dlpi_sap_length;
1397  struct hardware dlpi_broadcast_addr;
1398 # endif /* DLPI_SEND || DLPI_RECEIVE */
1399  struct hardware anycast_mac_addr;
1400 };
1401 
1404  char name [IFNAMSIZ];
1405  struct hardware address;
1406 };
1407 
1408 struct leasequeue {
1409  struct leasequeue *prev;
1410  struct leasequeue *next;
1411  struct lease *lease;
1412 };
1413 
1414 typedef void (*tvref_t)(void *, void *, const char *, int);
1415 typedef void (*tvunref_t)(void *, const char *, int);
1416 struct timeout {
1417  struct timeout *next;
1418  struct timeval when;
1419  void (*func) (void *);
1420  void *what;
1423  isc_timer_t *isc_timeout;
1424 };
1425 
1426 struct eventqueue {
1427  struct eventqueue *next;
1428  void (*handler)(void *);
1429 };
1430 
1431 struct protocol {
1432  struct protocol *next;
1433  int fd;
1434  void (*handler) (struct protocol *);
1435  void *local;
1436 };
1437 
1438 struct dns_query; /* forward */
1439 
1440 struct dns_wakeup {
1441  struct dns_wakeup *next; /* Next wakeup in chain. */
1442  void (*func) (struct dns_query *);
1443 };
1444 
1446  u_int16_t type; /* Type of query. */
1447  u_int16_t class; /* Class of query. */
1448  unsigned char data [1]; /* Query data. */
1449 };
1450 
1451 struct dns_answer {
1452  u_int16_t type; /* Type of answer. */
1453  u_int16_t class; /* Class of answer. */
1454  int count; /* Number of answers. */
1455  unsigned char *answers[1]; /* Pointers to answers. */
1456 };
1457 
1458 struct dns_query {
1459  struct dns_query *next; /* Next query in hash bucket. */
1460  u_int32_t hash; /* Hash bucket index. */
1461  TIME expiry; /* Query expiry time (zero if not yet
1462  answered. */
1463  u_int16_t id; /* Query ID (also hash table index) */
1464  caddr_t waiters; /* Pointer to list of things waiting
1465  on this query. */
1466 
1467  struct dns_question *question; /* Question, internal format. */
1468  struct dns_answer *answer; /* Answer, internal format. */
1469 
1470  unsigned char *query; /* Query formatted for DNS server. */
1471  unsigned len; /* Length of entire query. */
1472  int sent; /* The query has been sent. */
1473  struct dns_wakeup *wakeups; /* Wakeups to call if this query is
1474  answered. */
1475  struct name_server *next_server; /* Next server to try. */
1476  int backoff; /* Current backoff, in seconds. */
1477 };
1478 
1479 #define DNS_ZONE_ACTIVE 0
1480 #define DNS_ZONE_INACTIVE 1
1481 struct dns_zone {
1482  int refcnt;
1484  char *name;
1489  struct auth_key *key;
1490  u_int16_t flags;
1491 };
1492 
1493 struct icmp_state {
1495  int socket;
1496  void (*icmp_handler) (struct iaddr, u_int8_t *, int);
1497 };
1498 
1499 #include "ctrace.h"
1500 
1501 /* Bitmask of dhcp option codes. */
1502 typedef unsigned char option_mask [16];
1503 
1504 /* DHCP Option mask manipulation macros... */
1505 #define OPTION_ZERO(mask) (memset (mask, 0, 16))
1506 #define OPTION_SET(mask, bit) (mask [bit >> 8] |= (1 << (bit & 7)))
1507 #define OPTION_CLR(mask, bit) (mask [bit >> 8] &= ~(1 << (bit & 7)))
1508 #define OPTION_ISSET(mask, bit) (mask [bit >> 8] & (1 << (bit & 7)))
1509 #define OPTION_ISCLR(mask, bit) (!OPTION_ISSET (mask, bit))
1510 
1511 /* An option occupies its length plus two header bytes (code and
1512  length) for every 255 bytes that must be stored. */
1513 #define OPTION_SPACE(x) ((x) + 2 * ((x) / 255 + 1))
1514 
1515 /* Default path to dhcpd config file. */
1516 #ifdef DEBUG
1517 #undef _PATH_DHCPD_CONF
1518 #define _PATH_DHCPD_CONF "dhcpd.conf"
1519 #undef _PATH_DHCPD_DB
1520 #define _PATH_DHCPD_DB "dhcpd.leases"
1521 #undef _PATH_DHCPD6_DB
1522 #define _PATH_DHCPD6_DB "dhcpd6.leases"
1523 #undef _PATH_DHCPD_PID
1524 #define _PATH_DHCPD_PID "dhcpd.pid"
1525 #undef _PATH_DHCPD6_PID
1526 #define _PATH_DHCPD6_PID "dhcpd6.pid"
1527 #else /* !DEBUG */
1528 
1529 #ifndef _PATH_DHCPD_CONF
1530 #define _PATH_DHCPD_CONF "/etc/dhcp/dhcpd.conf"
1531 #endif /* DEBUG */
1532 
1533 #ifndef _PATH_DHCPD_DB
1534 #define _PATH_DHCPD_DB LOCALSTATEDIR"/db/dhcpd.leases"
1535 #endif
1536 
1537 #ifndef _PATH_DHCPD6_DB
1538 #define _PATH_DHCPD6_DB LOCALSTATEDIR"/db/dhcpd6.leases"
1539 #endif
1540 
1541 #ifndef _PATH_DHCPD_PID
1542 #define _PATH_DHCPD_PID LOCALSTATEDIR"/run/dhcpd.pid"
1543 #endif
1544 
1545 #ifndef _PATH_DHCPD6_PID
1546 #define _PATH_DHCPD6_PID LOCALSTATEDIR"/run/dhcpd6.pid"
1547 #endif
1548 
1549 #endif /* DEBUG */
1550 
1551 #ifndef _PATH_DHCLIENT_CONF
1552 #define _PATH_DHCLIENT_CONF "/etc/dhcp/dhclient.conf"
1553 #endif
1554 
1555 #ifndef _PATH_DHCLIENT_SCRIPT
1556 #define _PATH_DHCLIENT_SCRIPT "/usr/sbin/dhclient-script"
1557 #endif
1558 
1559 #ifndef _PATH_DHCLIENT_PID
1560 #define _PATH_DHCLIENT_PID LOCALSTATEDIR"/run/dhclient.pid"
1561 #endif
1562 
1563 #ifndef _PATH_DHCLIENT6_PID
1564 #define _PATH_DHCLIENT6_PID LOCALSTATEDIR"/run/dhclient6.pid"
1565 #endif
1566 
1567 #ifndef _PATH_DHCLIENT_DB
1568 #define _PATH_DHCLIENT_DB LOCALSTATEDIR"/db/dhclient.leases"
1569 #endif
1570 
1571 #ifndef _PATH_DHCLIENT6_DB
1572 #define _PATH_DHCLIENT6_DB LOCALSTATEDIR"/db/dhclient6.leases"
1573 #endif
1574 
1575 #ifndef _PATH_RESOLV_CONF
1576 #define _PATH_RESOLV_CONF "/etc/resolv.conf"
1577 #endif
1578 
1579 #ifndef _PATH_DHCRELAY_PID
1580 #define _PATH_DHCRELAY_PID LOCALSTATEDIR"/run/dhcrelay.pid"
1581 #endif
1582 
1583 #ifndef _PATH_DHCRELAY6_PID
1584 #define _PATH_DHCRELAY6_PID LOCALSTATEDIR"/run/dhcrelay6.pid"
1585 #endif
1586 
1587 #ifndef DHCPD_LOG_FACILITY
1588 #define DHCPD_LOG_FACILITY LOG_DAEMON
1589 #endif
1590 
1591 #define MAX_TIME 0x7fffffff
1592 #define MIN_TIME 0
1593 
1594 #ifdef USE_LOG_PID
1595 /* include the pid in the syslog messages */
1596 #define DHCP_LOG_OPTIONS LOG_NDELAY | LOG_PID
1597 #else
1598 #define DHCP_LOG_OPTIONS LOG_NDELAY
1599 #endif
1600  /* these are referenced */
1601 typedef struct hash_table ia_hash_t;
1603 
1604  /* IAADDR/IAPREFIX lease */
1605 
1606 struct iasubopt {
1607  int refcnt; /* reference count */
1608  struct in6_addr addr; /* IPv6 address/prefix */
1609  u_int8_t plen; /* iaprefix prefix length */
1610  binding_state_t state; /* state */
1611  struct binding_scope *scope; /* "set var = value;" */
1612  time_t hard_lifetime_end_time; /* time address expires */
1613  time_t soft_lifetime_end_time; /* time ephemeral expires */
1614  u_int32_t prefer; /* cached preferred lifetime */
1615  u_int32_t valid; /* cached valid lifetime */
1616  struct ia_xx *ia; /* IA for this lease */
1617  struct ipv6_pool *ipv6_pool; /* pool for this lease */
1618 /*
1619  * For now, just pick an arbitrary time to keep old hard leases
1620  * around (value in seconds).
1621  */
1622 #define EXPIRED_IPV6_CLEANUP_TIME (60*60)
1623 
1624  int heap_index; /* index into heap, or -1
1625  (internal use only) */
1626 
1627  /*
1628  * A pointer to the state of the ddns update for this lease.
1629  * It should be set while the update is in progress and cleared
1630  * when the update finishes. It can be used to cancel the
1631  * update if we want to do a different update.
1632  */
1634 
1635  /* space for the on * executable statements */
1637 };
1638 
1639 struct ia_xx {
1640  int refcnt; /* reference count */
1641  struct data_string iaid_duid; /* from the client */
1642  u_int16_t ia_type; /* IA_XX */
1643  int num_iasubopt; /* number of IAADDR/PREFIX */
1644  int max_iasubopt; /* space available for IAADDR/PREFIX */
1645  time_t cltt; /* client last transaction time */
1646  struct iasubopt **iasubopt; /* pointers to the IAADDR/IAPREFIXs */
1647 };
1648 
1649 extern ia_hash_t *ia_na_active;
1650 extern ia_hash_t *ia_ta_active;
1651 extern ia_hash_t *ia_pd_active;
1652 
1673 struct ipv6_pool {
1674  int refcnt; /* reference count */
1675  u_int16_t pool_type; /* IA_xx */
1676  struct in6_addr start_addr; /* first IPv6 address */
1677  int bits; /* number of bits, CIDR style */
1678  int units; /* allocation unit in bits */
1679  iasubopt_hash_t *leases; /* non-free leases */
1680  isc_uint64_t num_active; /* count of active leases */
1681  isc_uint64_t num_abandoned; /* count of abandoned leases */
1682  isc_heap_t *active_timeouts; /* timeouts for active leases */
1683  int num_inactive; /* count of inactive leases */
1684  isc_heap_t *inactive_timeouts; /* timeouts for expired or
1685  released leases */
1686  struct shared_network *shared_network; /* shared_network for
1687  this pool */
1688  struct subnet *subnet; /* subnet for this pool */
1689  struct ipv6_pond *ipv6_pond; /* pond for this pool */
1690 };
1691 
1703 struct ipv6_pond {
1704  int refcnt;
1705  struct ipv6_pond *next;
1706  struct group *group;
1707  struct shared_network *shared_network; /* backpointer to the enclosing
1708  shared network */
1709  struct permit *permit_list; /* allow clients from this list */
1710  struct permit *prohibit_list; /* deny clients from this list */
1711  TIME valid_from; /* deny pool use before this date */
1712  TIME valid_until; /* deny pool use after this date */
1713 
1714  struct ipv6_pool **ipv6_pools; /* NULL-terminated array */
1715  int last_ipv6_pool; /* offset of last IPv6 pool
1716  used to issue a lease */
1717  isc_uint64_t num_total; /* Total number of elements in the pond */
1718  isc_uint64_t num_active; /* Number of elements in the pond in use */
1719  isc_uint64_t num_abandoned; /* count of abandoned leases */
1720  int logged; /* already logged a message */
1721  isc_uint64_t low_threshold; /* low threshold to restart logging */
1723 };
1724 
1725 /*
1726  * Max addresses in a pond that can be supported by log threshold
1727  * Currently based on max value supported by isc_uint64_t.
1728 */
1729 #define POND_TRACK_MAX ISC_UINT64_MAX
1730 
1731 /* Flags and state for dhcp_ddns_cb_t */
1732 #define DDNS_UPDATE_ADDR 0x01
1733 #define DDNS_UPDATE_PTR 0x02
1734 #define DDNS_INCLUDE_RRSET 0x04
1735 #define DDNS_CONFLICT_OVERRIDE 0x08
1736 #define DDNS_CLIENT_DID_UPDATE 0x10
1737 #define DDNS_EXECUTE_NEXT 0x20
1738 #define DDNS_ABORT 0x40
1739 #define DDNS_STATIC_LEASE 0x80
1740 #define DDNS_ACTIVE_LEASE 0x100
1741 /*
1742  * The following two groups are separate and we could reuse
1743  * values but not reusing them may be useful in the future.
1744  */
1745 #define DDNS_STATE_CLEANUP 0 // The previous step failed, cleanup
1746 
1747 #define DDNS_STATE_ADD_FW_NXDOMAIN 1
1748 #define DDNS_STATE_ADD_FW_YXDHCID 2
1749 #define DDNS_STATE_ADD_PTR 3
1750 
1751 #define DDNS_STATE_REM_FW_YXDHCID 17
1752 #define DDNS_STATE_REM_FW_NXRR 18
1753 #define DDNS_STATE_REM_PTR 19
1754 
1755 /*
1756  * Flags for the dns print function
1757  */
1758 #define DDNS_PRINT_INBOUND 1
1759 #define DDNS_PRINT_OUTBOUND 0
1760 
1761 struct dhcp_ddns_cb;
1762 
1763 typedef void (*ddns_action_t)(struct dhcp_ddns_cb *ddns_cb,
1764  isc_result_t result);
1765 
1766 typedef struct dhcp_ddns_cb {
1767  struct data_string fwd_name;
1768  struct data_string rev_name;
1769  struct data_string dhcid;
1770  struct iaddr address;
1772 
1773  unsigned long ttl;
1774 
1775  unsigned char zone_name[DHCP_MAXDNS_WIRE];
1776  isc_sockaddrlist_t zone_server_list;
1777  isc_sockaddr_t zone_addrs[DHCP_MAXNS];
1779  struct dns_zone *zone;
1780 
1781  u_int16_t flags;
1783  int state;
1785 
1787 
1788  /* Lease or client state that triggered the ddns operation */
1789  void *lease;
1791 
1793  void *dataspace;
1794 
1795  dns_rdataclass_t dhcid_class;
1796  char *lease_tag;
1797 } dhcp_ddns_cb_t;
1798 
1799 extern struct ipv6_pool **pools;
1800 extern int num_pools;
1801 
1802 /* External definitions... */
1803 
1804 HASH_FUNCTIONS_DECL (group, const char *, struct group_object, group_hash_t)
1805 HASH_FUNCTIONS_DECL (universe, const char *, struct universe, universe_hash_t)
1806 HASH_FUNCTIONS_DECL (option_name, const char *, struct option,
1808 HASH_FUNCTIONS_DECL (option_code, const unsigned *, struct option,
1810 HASH_FUNCTIONS_DECL (dns_zone, const char *, struct dns_zone, dns_zone_hash_t)
1811 HASH_FUNCTIONS_DECL(lease_ip, const unsigned char *, struct lease,
1813 HASH_FUNCTIONS_DECL(lease_id, const unsigned char *, struct lease,
1815 HASH_FUNCTIONS_DECL (host, const unsigned char *, struct host_decl, host_hash_t)
1816 HASH_FUNCTIONS_DECL (class, const char *, struct class, class_hash_t)
1817 
1818 /* options.c */
1819 
1820 extern struct option *vendor_cfg_option;
1821 int parse_options (struct packet *);
1822 int parse_option_buffer (struct option_state *, const unsigned char *,
1823  unsigned, struct universe *);
1824 struct universe *find_option_universe (struct option *, const char *);
1825 int parse_encapsulated_suboptions (struct option_state *, struct option *,
1826  const unsigned char *, unsigned,
1827  struct universe *, const char *);
1828 int cons_options (struct packet *, struct dhcp_packet *, struct lease *,
1829  struct client_state *,
1830  int, struct option_state *, struct option_state *,
1831  struct binding_scope **,
1832  int, int, int, struct data_string *, const char *);
1833 int fqdn_universe_decode (struct option_state *,
1834  const unsigned char *, unsigned, struct universe *);
1835 struct option_cache *
1836 lookup_fqdn6_option(struct universe *universe, struct option_state *options,
1837  unsigned code);
1838 void
1839 save_fqdn6_option(struct universe *universe, struct option_state *options,
1840  struct option_cache *oc, isc_boolean_t appendp);
1841 void
1842 delete_fqdn6_option(struct universe *universe, struct option_state *options,
1843  int code);
1844 void
1845 fqdn6_option_space_foreach(struct packet *packet, struct lease *lease,
1846  struct client_state *client_state,
1847  struct option_state *in_options,
1848  struct option_state *cfg_options,
1849  struct binding_scope **scope,
1850  struct universe *u, void *stuff,
1851  void (*func)(struct option_cache *,
1852  struct packet *,
1853  struct lease *,
1854  struct client_state *,
1855  struct option_state *,
1856  struct option_state *,
1857  struct binding_scope **,
1858  struct universe *, void *));
1859 int
1860 fqdn6_option_space_encapsulate(struct data_string *result,
1861  struct packet *packet, struct lease *lease,
1862  struct client_state *client_state,
1863  struct option_state *in_options,
1864  struct option_state *cfg_options,
1865  struct binding_scope **scope,
1866  struct universe *universe);
1867 int
1868 fqdn6_universe_decode(struct option_state *options,
1869  const unsigned char *buffer, unsigned length,
1870  struct universe *u);
1871 int append_option(struct data_string *dst, struct universe *universe,
1872  struct option *option, struct data_string *src);
1873 int
1874 store_options(int *ocount,
1875  unsigned char *buffer, unsigned buflen, unsigned index,
1876  struct packet *packet, struct lease *lease,
1877  struct client_state *client_state,
1878  struct option_state *in_options,
1879  struct option_state *cfg_options,
1880  struct binding_scope **scope,
1881  unsigned *priority_list, int priority_len,
1882  unsigned first_cutoff, int second_cutoff, int terminate,
1883  const char *vuname);
1884 int store_options6(char *, int, struct option_state *, struct packet *,
1885  const int *, struct data_string *);
1886 int format_has_text(const char *);
1887 int format_min_length(const char *, struct option_cache *);
1888 const char *pretty_print_option (struct option *, const unsigned char *,
1889  unsigned, int, int);
1890 int pretty_escape(char **, char *, const unsigned char **,
1891  const unsigned char *);
1892 int get_option (struct data_string *, struct universe *,
1893  struct packet *, struct lease *, struct client_state *,
1894  struct option_state *, struct option_state *,
1895  struct option_state *, struct binding_scope **, unsigned,
1896  const char *, int);
1897 int get_option_int (int *, struct universe *,
1898  struct packet *, struct lease *, struct client_state *,
1899  struct option_state *, struct option_state *,
1900  struct option_state *, struct binding_scope **, unsigned,
1901  const char *, int);
1902 void set_option (struct universe *, struct option_state *,
1903  struct option_cache *, enum statement_op);
1904 struct option_cache *lookup_option (struct universe *,
1905  struct option_state *, unsigned);
1906 struct option_cache *lookup_hashed_option (struct universe *,
1907  struct option_state *,
1908  unsigned);
1909 struct option_cache *next_hashed_option(struct universe *,
1910  struct option_state *,
1911  struct option_cache *);
1912 int save_option_buffer (struct universe *, struct option_state *,
1913  struct buffer *, unsigned char *, unsigned,
1914  unsigned, int);
1915 int append_option_buffer(struct universe *, struct option_state *,
1916  struct buffer *, unsigned char *, unsigned,
1917  unsigned, int);
1918 void build_server_oro(struct data_string *, struct option_state *,
1919  const char *, int);
1920 void save_option(struct universe *, struct option_state *,
1921  struct option_cache *);
1922 void also_save_option(struct universe *, struct option_state *,
1923  struct option_cache *);
1924 void save_hashed_option(struct universe *, struct option_state *,
1925  struct option_cache *, isc_boolean_t appendp);
1926 void delete_option (struct universe *, struct option_state *, int);
1927 void delete_hashed_option (struct universe *,
1928  struct option_state *, int);
1929 int option_cache_dereference (struct option_cache **,
1930  const char *, int);
1931 int hashed_option_state_dereference (struct universe *,
1932  struct option_state *,
1933  const char *, int);
1934 int store_option (struct data_string *,
1935  struct universe *, struct packet *, struct lease *,
1936  struct client_state *,
1937  struct option_state *, struct option_state *,
1938  struct binding_scope **, struct option_cache *);
1939 int option_space_encapsulate (struct data_string *,
1940  struct packet *, struct lease *,
1941  struct client_state *,
1942  struct option_state *,
1943  struct option_state *,
1944  struct binding_scope **,
1945  struct data_string *);
1946 int hashed_option_space_encapsulate (struct data_string *,
1947  struct packet *, struct lease *,
1948  struct client_state *,
1949  struct option_state *,
1950  struct option_state *,
1951  struct binding_scope **,
1952  struct universe *);
1953 int nwip_option_space_encapsulate (struct data_string *,
1954  struct packet *, struct lease *,
1955  struct client_state *,
1956  struct option_state *,
1957  struct option_state *,
1958  struct binding_scope **,
1959  struct universe *);
1960 int fqdn_option_space_encapsulate (struct data_string *,
1961  struct packet *, struct lease *,
1962  struct client_state *,
1963  struct option_state *,
1964  struct option_state *,
1965  struct binding_scope **,
1966  struct universe *);
1967 void suboption_foreach (struct packet *, struct lease *, struct client_state *,
1968  struct option_state *, struct option_state *,
1969  struct binding_scope **, struct universe *, void *,
1970  void (*) (struct option_cache *, struct packet *,
1971  struct lease *, struct client_state *,
1972  struct option_state *, struct option_state *,
1973  struct binding_scope **,
1974  struct universe *, void *),
1975  struct option_cache *, const char *);
1976 void option_space_foreach (struct packet *, struct lease *,
1977  struct client_state *,
1978  struct option_state *,
1979  struct option_state *,
1980  struct binding_scope **,
1981  struct universe *, void *,
1982  void (*) (struct option_cache *,
1983  struct packet *,
1984  struct lease *, struct client_state *,
1985  struct option_state *,
1986  struct option_state *,
1987  struct binding_scope **,
1988  struct universe *, void *));
1989 void hashed_option_space_foreach (struct packet *, struct lease *,
1990  struct client_state *,
1991  struct option_state *,
1992  struct option_state *,
1993  struct binding_scope **,
1994  struct universe *, void *,
1995  void (*) (struct option_cache *,
1996  struct packet *,
1997  struct lease *,
1998  struct client_state *,
1999  struct option_state *,
2000  struct option_state *,
2001  struct binding_scope **,
2002  struct universe *, void *));
2003 int linked_option_get (struct data_string *, struct universe *,
2004  struct packet *, struct lease *,
2005  struct client_state *,
2006  struct option_state *, struct option_state *,
2007  struct option_state *, struct binding_scope **,
2008  unsigned);
2009 int linked_option_state_dereference (struct universe *,
2010  struct option_state *,
2011  const char *, int);
2012 void save_linked_option(struct universe *, struct option_state *,
2013  struct option_cache *, isc_boolean_t appendp);
2014 void linked_option_space_foreach (struct packet *, struct lease *,
2015  struct client_state *,
2016  struct option_state *,
2017  struct option_state *,
2018  struct binding_scope **,
2019  struct universe *, void *,
2020  void (*) (struct option_cache *,
2021  struct packet *,
2022  struct lease *,
2023  struct client_state *,
2024  struct option_state *,
2025  struct option_state *,
2026  struct binding_scope **,
2027  struct universe *, void *));
2028 int linked_option_space_encapsulate (struct data_string *, struct packet *,
2029  struct lease *, struct client_state *,
2030  struct option_state *,
2031  struct option_state *,
2032  struct binding_scope **,
2033  struct universe *);
2034 void delete_linked_option (struct universe *, struct option_state *, int);
2035 struct option_cache *lookup_linked_option (struct universe *,
2036  struct option_state *, unsigned);
2037 void do_packet (struct interface_info *,
2038  struct dhcp_packet *, unsigned,
2039  unsigned int, struct iaddr, struct hardware *);
2040 void do_packet6(struct interface_info *, const char *,
2041  int, int, const struct iaddr *, isc_boolean_t);
2042 int packet6_len_okay(const char *, int);
2043 
2044 int validate_packet(struct packet *);
2045 
2046 int add_option(struct option_state *options,
2047  unsigned int option_num,
2048  void *data,
2049  unsigned int data_len);
2050 
2051 void parse_vendor_option(struct packet *packet,
2052  struct lease *lease,
2053  struct client_state *client_state,
2054  struct option_state *in_options,
2055  struct option_state *out_options,
2056  struct binding_scope **scope);
2057 
2058 /* dhcp4o6.c */
2059 #if defined(DHCP4o6)
2060 extern int dhcp4o6_fd;
2061 extern omapi_object_t *dhcp4o6_object;
2062 extern omapi_object_type_t *dhcp4o6_type;
2063 extern void dhcp4o6_setup(u_int16_t);
2064 
2065 /* dependency */
2066 extern isc_result_t dhcpv4o6_handler(omapi_object_t *);
2067 
2068 #endif
2069 /* dhcpd.c */
2070 extern struct timeval cur_tv;
2071 #define cur_time cur_tv.tv_sec
2072 
2073 extern int ddns_update_style;
2074 extern int dont_use_fsync;
2075 extern int server_id_check;
2076 
2077 extern int prefix_length_mode;
2078 extern int authoring_byte_order;
2079 extern int lease_id_format;
2080 
2081 extern const char *path_dhcpd_conf;
2082 extern const char *path_dhcpd_db;
2083 extern const char *path_dhcpd_pid;
2084 
2086 extern struct eventqueue *rw_queue_empty;
2087 
2088 #if defined (PARANOIA)
2089 extern uid_t set_uid;
2090 extern gid_t set_gid;
2091 #endif
2092 
2093 int main(int, char **);
2094 void postconf_initialization(int);
2095 void postdb_startup(void);
2096 void cleanup (void);
2097 void lease_pinged (struct iaddr, u_int8_t *, int);
2098 void lease_ping_timeout (void *);
2099 int dhcpd_interface_setup_hook (struct interface_info *ip, struct iaddr *ia);
2101 isc_result_t dhcp_io_shutdown (omapi_object_t *, void *);
2102 isc_result_t dhcp_set_control_state (control_object_state_t oldstate,
2103  control_object_state_t newstate);
2104 
2105 #if defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
2106 void relinquish_ackqueue(void);
2107 #endif
2108 
2109 /* conflex.c */
2110 isc_result_t new_parse (struct parse **, int,
2111  char *, unsigned, const char *, int);
2112 isc_result_t end_parse (struct parse **);
2113 isc_result_t save_parse_state(struct parse *cfile);
2114 isc_result_t restore_parse_state(struct parse *cfile);
2115 enum dhcp_token next_token (const char **, unsigned *, struct parse *);
2116 enum dhcp_token peek_token (const char **, unsigned *, struct parse *);
2117 enum dhcp_token next_raw_token(const char **rval, unsigned *rlen,
2118  struct parse *cfile);
2119 enum dhcp_token peek_raw_token(const char **rval, unsigned *rlen,
2120  struct parse *cfile);
2121 /*
2122  * Use skip_token when we are skipping a token we have previously
2123  * used peek_token on as we know what the result will be in this case.
2124  */
2125 #define skip_token(a,b,c) ((void) next_token((a),(b),(c)))
2126 
2127 
2128 /* confpars.c */
2129 void parse_trace_setup (void);
2130 isc_result_t readconf (void);
2131 isc_result_t read_conf_file (const char *, struct group *, int, int);
2132 #if defined (TRACING)
2133 void trace_conf_input (trace_type_t *, unsigned, char *);
2134 void trace_conf_stop (trace_type_t *ttype);
2135 #endif
2136 isc_result_t conf_file_subparse (struct parse *, struct group *, int);
2137 isc_result_t lease_file_subparse (struct parse *);
2138 int parse_statement (struct parse *, struct group *, int,
2139  struct host_decl *, int);
2140 #if defined (FAILOVER_PROTOCOL)
2141 void parse_failover_peer (struct parse *, struct group *, int);
2143  dhcp_failover_state_t *);
2144 void parse_failover_state (struct parse *,
2145  enum failover_state *, TIME *);
2146 #endif
2147 int permit_list_match (struct permit *, struct permit *);
2148 void parse_pool_statement (struct parse *, struct group *, int);
2149 int parse_lbrace (struct parse *);
2150 void parse_host_declaration (struct parse *, struct group *);
2151 int parse_class_declaration (struct class **, struct parse *,
2152  struct group *, int);
2153 void parse_shared_net_declaration (struct parse *, struct group *);
2154 void parse_subnet_declaration (struct parse *,
2155  struct shared_network *);
2156 void parse_subnet6_declaration (struct parse *,
2157  struct shared_network *);
2158 void parse_group_declaration (struct parse *, struct group *);
2159 int parse_fixed_addr_param (struct option_cache **,
2160  struct parse *, enum dhcp_token);
2161 int parse_lease_declaration (struct lease **, struct parse *);
2162 int parse_ip6_addr(struct parse *, struct iaddr *);
2163 int parse_ip6_addr_expr(struct expression **, struct parse *);
2164 int parse_ip6_prefix(struct parse *, struct iaddr *, u_int8_t *);
2165 void parse_address_range (struct parse *, struct group *, int,
2166  struct pool *, struct lease **);
2167 void parse_address_range6(struct parse *cfile, struct group *group,
2168  struct ipv6_pond *);
2169 void parse_prefix6(struct parse *cfile, struct group *group,
2170  struct ipv6_pond *);
2171 void parse_fixed_prefix6(struct parse *cfile, struct host_decl *host_decl);
2172 void parse_ia_na_declaration(struct parse *);
2173 void parse_ia_ta_declaration(struct parse *);
2174 void parse_ia_pd_declaration(struct parse *);
2175 void parse_server_duid(struct parse *cfile);
2176 void parse_server_duid_conf(struct parse *cfile);
2177 void parse_pool6_statement (struct parse *, struct group *, int);
2178 uint32_t parse_byte_order_uint32(const void *source);
2179 
2180 /* ddns.c */
2181 int ddns_updates(struct packet *, struct lease *, struct lease *,
2182  struct iasubopt *, struct iasubopt *, struct option_state *);
2183 isc_result_t ddns_removals(struct lease *, struct iasubopt *,
2184  struct dhcp_ddns_cb *, isc_boolean_t);
2185 #if defined (TRACING)
2186 void trace_ddns_init(void);
2187 #endif
2188 
2189 /* parse.c */
2190 void add_enumeration (struct enumeration *);
2191 struct enumeration *find_enumeration (const char *, int);
2192 struct enumeration_value *find_enumeration_value (const char *, int,
2193  unsigned *,
2194  const char *);
2195 void skip_to_semi (struct parse *);
2196 void skip_to_rbrace (struct parse *, int);
2197 int parse_semi (struct parse *);
2198 int parse_string (struct parse *, char **, unsigned *);
2199 char *parse_host_name (struct parse *);
2200 int parse_ip_addr_or_hostname (struct expression **,
2201  struct parse *, int);
2202 void parse_hardware_param (struct parse *, struct hardware *);
2203 void parse_lease_time (struct parse *, TIME *);
2204 unsigned char *parse_numeric_aggregate (struct parse *,
2205  unsigned char *, unsigned *,
2206  int, int, unsigned);
2207 void convert_num (struct parse *, unsigned char *, const char *,
2208  int, unsigned);
2209 TIME parse_date (struct parse *);
2210 TIME parse_date_core(struct parse *);
2211 isc_result_t parse_option_name (struct parse *, int, int *,
2212  struct option **);
2213 void parse_option_space_decl (struct parse *);
2214 int parse_option_code_definition (struct parse *, struct option *);
2215 int parse_base64 (struct data_string *, struct parse *);
2216 int parse_cshl (struct data_string *, struct parse *);
2218  struct parse *, int *,
2219  enum expression_context);
2221  struct parse *, int *,
2222  enum expression_context);
2223 int parse_zone (struct dns_zone *, struct parse *);
2224 int parse_key (struct parse *);
2226  struct parse *, int *);
2228  struct parse *, int *);
2230  struct parse *, int *,
2231  enum expression_context);
2233  struct parse *, int *);
2234 int parse_boolean_expression (struct expression **,
2235  struct parse *, int *);
2236 int parse_boolean (struct parse *);
2237 int parse_data_expression (struct expression **,
2238  struct parse *, int *);
2239 int parse_numeric_expression (struct expression **,
2240  struct parse *, int *);
2241 int parse_dns_expression (struct expression **, struct parse *, int *);
2242 int parse_non_binary (struct expression **, struct parse *, int *,
2243  enum expression_context);
2244 int parse_expression (struct expression **, struct parse *, int *,
2245  enum expression_context,
2246  struct expression **, enum expr_op);
2247 int parse_option_data(struct expression **expr, struct parse *cfile,
2248  int lookups, struct option *option);
2250  struct parse *, int,
2251  struct option *, enum statement_op);
2252 int parse_option_token (struct expression **, struct parse *,
2253  const char **, struct expression *, int, int);
2254 int parse_allow_deny (struct option_cache **, struct parse *, int);
2255 int parse_auth_key (struct data_string *, struct parse *);
2256 int parse_warn (struct parse *, const char *, ...)
2257  __attribute__((__format__(__printf__,2,3)));
2258 struct expression *parse_domain_list(struct parse *cfile, int);
2259 
2260 
2261 /* tree.c */
2262 extern struct binding_scope *global_scope;
2263 pair cons (caddr_t, pair);
2264 int make_const_option_cache (struct option_cache **, struct buffer **,
2265  u_int8_t *, unsigned, struct option *,
2266  const char *, int);
2267 int make_host_lookup (struct expression **, const char *);
2268 int enter_dns_host (struct dns_host_entry **, const char *);
2269 int make_const_data (struct expression **,
2270  const unsigned char *, unsigned, int, int,
2271  const char *, int);
2272 int make_const_int (struct expression **, unsigned long);
2273 int make_concat (struct expression **,
2274  struct expression *, struct expression *);
2275 int make_encapsulation (struct expression **, struct data_string *);
2276 int make_substring (struct expression **, struct expression *,
2277  struct expression *, struct expression *);
2278 int make_limit (struct expression **, struct expression *, int);
2279 int make_let (struct executable_statement **, const char *);
2280 int option_cache (struct option_cache **, struct data_string *,
2281  struct expression *, struct option *,
2282  const char *, int);
2283 int evaluate_expression (struct binding_value **, struct packet *,
2284  struct lease *, struct client_state *,
2285  struct option_state *, struct option_state *,
2286  struct binding_scope **, struct expression *,
2287  const char *, int);
2288 int binding_value_dereference (struct binding_value **, const char *, int);
2289 int evaluate_boolean_expression (int *,
2290  struct packet *, struct lease *,
2291  struct client_state *,
2292  struct option_state *,
2293  struct option_state *,
2294  struct binding_scope **,
2295  struct expression *);
2296 int evaluate_data_expression (struct data_string *,
2297  struct packet *, struct lease *,
2298  struct client_state *,
2299  struct option_state *,
2300  struct option_state *,
2301  struct binding_scope **,
2302  struct expression *,
2303  const char *, int);
2304 int evaluate_numeric_expression (unsigned long *, struct packet *,
2305  struct lease *, struct client_state *,
2306  struct option_state *, struct option_state *,
2307  struct binding_scope **,
2308  struct expression *);
2309 int evaluate_option_cache (struct data_string *,
2310  struct packet *, struct lease *,
2311  struct client_state *,
2312  struct option_state *, struct option_state *,
2313  struct binding_scope **,
2314  struct option_cache *,
2315  const char *, int);
2317  struct packet *, struct lease *,
2318  struct client_state *,
2319  struct option_state *,
2320  struct option_state *,
2321  struct binding_scope **,
2322  struct option_cache *,
2323  const char *, int);
2325  struct packet *, struct lease *,
2326  struct client_state *,
2327  struct option_state *,
2328  struct option_state *,
2329  struct binding_scope **,
2330  struct expression *);
2331 void expression_dereference (struct expression **, const char *, int);
2332 int is_dns_expression (struct expression *);
2333 int is_boolean_expression (struct expression *);
2334 int is_data_expression (struct expression *);
2335 int is_numeric_expression (struct expression *);
2336 int is_compound_expression (struct expression *);
2337 int op_precedence (enum expr_op, enum expr_op);
2338 enum expression_context expression_context (struct expression *);
2339 enum expression_context op_context (enum expr_op);
2340 int write_expression (FILE *, struct expression *, int, int, int);
2341 struct binding *find_binding (struct binding_scope *, const char *);
2342 int free_bindings (struct binding_scope *, const char *, int);
2343 int binding_scope_dereference (struct binding_scope **,
2344  const char *, int);
2345 int fundef_dereference (struct fundef **, const char *, int);
2346 int data_subexpression_length (int *, struct expression *);
2347 int expr_valid_for_context (struct expression *, enum expression_context);
2348 struct binding *create_binding (struct binding_scope **, const char *);
2349 int bind_ds_value (struct binding_scope **,
2350  const char *, struct data_string *);
2351 int find_bound_string (struct data_string *,
2352  struct binding_scope *, const char *);
2353 int unset (struct binding_scope *, const char *);
2354 int data_string_sprintfa(struct data_string *ds, const char *fmt, ...);
2355 int concat_dclists (struct data_string *, struct data_string *,
2356  struct data_string *);
2357 
2358 /* dhcp.c */
2359 extern int outstanding_pings;
2360 extern int max_outstanding_acks;
2361 extern int max_ack_delay_secs;
2362 extern int max_ack_delay_usecs;
2363 
2364 void dhcp (struct packet *);
2365 void dhcpdiscover (struct packet *, int);
2366 void dhcprequest (struct packet *, int, struct lease *);
2367 void dhcprelease (struct packet *, int);
2368 void dhcpdecline (struct packet *, int);
2369 void dhcpinform (struct packet *, int);
2370 void nak_lease (struct packet *, struct iaddr *cip, struct group*);
2371 void ack_lease (struct packet *, struct lease *,
2372  unsigned int, TIME, char *, int, struct host_decl *);
2373 void echo_client_id(struct packet*, struct lease*, struct option_state*,
2374  struct option_state*);
2375 
2376 void dhcp_reply (struct lease *);
2377 int find_lease (struct lease **, struct packet *,
2378  struct shared_network *, int *, int *, struct lease *,
2379  const char *, int);
2380 int mockup_lease (struct lease **, struct packet *,
2381  struct shared_network *,
2382  struct host_decl *);
2383 void static_lease_dereference (struct lease *, const char *, int);
2384 
2385 int allocate_lease (struct lease **, struct packet *,
2386  struct pool *, int *);
2387 int permitted (struct packet *, struct permit *);
2388 int locate_network (struct packet *);
2389 int parse_agent_information_option (struct packet *, int, u_int8_t *);
2390 unsigned cons_agent_information_options (struct option_state *,
2391  struct dhcp_packet *,
2392  unsigned, unsigned);
2393 void get_server_source_address(struct in_addr *from,
2394  struct option_state *options,
2395  struct option_state *out_options,
2396  struct packet *packet);
2397 
2398 void eval_network_statements(struct option_state **options,
2399  struct packet *packet,
2400  struct group *network_group);
2401 
2402 /* dhcpleasequery.c */
2403 void dhcpleasequery (struct packet *, int);
2404 void dhcpv6_leasequery (struct data_string *, struct packet *);
2405 
2406 /* dhcpv6.c */
2407 isc_boolean_t server_duid_isset(void);
2408 void copy_server_duid(struct data_string *ds, const char *file, int line);
2409 void set_server_duid(struct data_string *new_duid);
2410 isc_result_t set_server_duid_from_option(void);
2411 void set_server_duid_type(int type);
2412 isc_result_t generate_new_server_duid(void);
2413 isc_result_t get_client_id(struct packet *, struct data_string *);
2414 void dhcpv6(struct packet *);
2415 
2416 /* bootp.c */
2417 void bootp(struct packet *);
2418 void use_host_decl_name(struct packet *, struct lease* , struct option_state *);
2419 
2420 /* memory.c */
2421 extern int (*group_write_hook) (struct group_object *);
2422 extern struct group *root_group;
2424 isc_result_t delete_group (struct group_object *, int);
2425 isc_result_t supersede_group (struct group_object *, int);
2426 int clone_group (struct group **, struct group *, const char *, int);
2427 int write_group (struct group_object *);
2428 
2429 /* salloc.c */
2430 void relinquish_lease_hunks (void);
2431 struct lease *new_leases (unsigned, const char *, int);
2432 #if defined (DEBUG_MEMORY_LEAKAGE) || \
2433  defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
2434 void relinquish_free_lease_states (void);
2435 #endif
2436 OMAPI_OBJECT_ALLOC_DECL (lease, struct lease, dhcp_type_lease)
2437 OMAPI_OBJECT_ALLOC_DECL (class, struct class, dhcp_type_class)
2438 OMAPI_OBJECT_ALLOC_DECL (subclass, struct class, dhcp_type_subclass)
2439 OMAPI_OBJECT_ALLOC_DECL (pool, struct pool, dhcp_type_pool)
2440 OMAPI_OBJECT_ALLOC_DECL (host, struct host_decl, dhcp_type_host)
2441 
2442 /* alloc.c */
2444 OMAPI_OBJECT_ALLOC_DECL (shared_network, struct shared_network,
2446 OMAPI_OBJECT_ALLOC_DECL (group_object, struct group_object, dhcp_type_group)
2447 OMAPI_OBJECT_ALLOC_DECL (dhcp_control,
2449 
2450 #if defined (DEBUG_MEMORY_LEAKAGE) || \
2451  defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
2452 void relinquish_free_pairs (void);
2453 void relinquish_free_expressions (void);
2454 void relinquish_free_binding_values (void);
2455 void relinquish_free_option_caches (void);
2456 void relinquish_free_packets (void);
2457 #endif
2458 
2460  const char *, int);
2462  struct option_chain_head *,
2463  const char *, int);
2465  const char *, int);
2466 int group_allocate (struct group **, const char *, int);
2467 int group_reference (struct group **, struct group *, const char *, int);
2468 int group_dereference (struct group **, const char *, int);
2469 struct dhcp_packet *new_dhcp_packet (const char *, int);
2470 struct protocol *new_protocol (const char *, int);
2471 struct lease_state *new_lease_state (const char *, int);
2472 struct domain_search_list *new_domain_search_list (const char *, int);
2473 struct name_server *new_name_server (const char *, int);
2474 void free_name_server (struct name_server *, const char *, int);
2475 struct option *new_option (const char *, const char *, int);
2476 int option_reference(struct option **dest, struct option *src,
2477  const char * file, int line);
2478 int option_dereference(struct option **dest, const char *file, int line);
2479 struct universe *new_universe (const char *, int);
2480 void free_universe (struct universe *, const char *, int);
2482  const char *, int);
2483 void free_lease_state (struct lease_state *, const char *, int);
2484 void free_protocol (struct protocol *, const char *, int);
2485 void free_dhcp_packet (struct dhcp_packet *, const char *, int);
2486 struct client_lease *new_client_lease (const char *, int);
2487 void free_client_lease (struct client_lease *, const char *, int);
2488 struct permit *new_permit (const char *, int);
2489 void free_permit (struct permit *, const char *, int);
2490 pair new_pair (const char *, int);
2491 void free_pair (pair, const char *, int);
2492 int expression_allocate (struct expression **, const char *, int);
2493 int expression_reference (struct expression **,
2494  struct expression *, const char *, int);
2495 void free_expression (struct expression *, const char *, int);
2496 int binding_value_allocate (struct binding_value **,
2497  const char *, int);
2498 int binding_value_reference (struct binding_value **,
2499  struct binding_value *,
2500  const char *, int);
2501 void free_binding_value (struct binding_value *, const char *, int);
2502 int fundef_allocate (struct fundef **, const char *, int);
2503 int fundef_reference (struct fundef **,
2504  struct fundef *, const char *, int);
2505 int option_cache_allocate (struct option_cache **, const char *, int);
2506 int option_cache_reference (struct option_cache **,
2507  struct option_cache *, const char *, int);
2508 int buffer_allocate (struct buffer **, unsigned, const char *, int);
2509 int buffer_reference (struct buffer **, struct buffer *,
2510  const char *, int);
2511 int buffer_dereference (struct buffer **, const char *, int);
2512 int dns_host_entry_allocate (struct dns_host_entry **,
2513  const char *, const char *, int);
2514 int dns_host_entry_reference (struct dns_host_entry **,
2515  struct dns_host_entry *,
2516  const char *, int);
2517 int dns_host_entry_dereference (struct dns_host_entry **,
2518  const char *, int);
2519 int option_state_allocate (struct option_state **, const char *, int);
2520 int option_state_reference (struct option_state **,
2521  struct option_state *, const char *, int);
2522 int option_state_dereference (struct option_state **,
2523  const char *, int);
2524 int data_string_new(struct data_string *, const char *, unsigned int,
2525  const char *, int);
2526 void data_string_copy(struct data_string *, const struct data_string *,
2527  const char *, int);
2528 void data_string_forget (struct data_string *, const char *, int);
2529 void data_string_truncate (struct data_string *, int);
2530 int data_string_terminate (struct data_string *, const char *, int);
2531 int executable_statement_allocate (struct executable_statement **,
2532  const char *, int);
2533 int executable_statement_reference (struct executable_statement **,
2534  struct executable_statement *,
2535  const char *, int);
2536 int packet_allocate (struct packet **, const char *, int);
2537 int packet_reference (struct packet **,
2538  struct packet *, const char *, int);
2539 int packet_dereference (struct packet **, const char *, int);
2540 int binding_scope_allocate (struct binding_scope **,
2541  const char *, int);
2542 int binding_scope_reference (struct binding_scope **,
2543  struct binding_scope *,
2544  const char *, int);
2545 int dns_zone_allocate (struct dns_zone **, const char *, int);
2546 int dns_zone_reference (struct dns_zone **,
2547  struct dns_zone *, const char *, int);
2548 /* print.c */
2549 #define DEFAULT_TIME_FORMAT 0
2550 #define LOCAL_TIME_FORMAT 1
2551 extern int db_time_format;
2552 char *quotify_string (const char *, const char *, int);
2553 char *quotify_buf (const unsigned char *, unsigned, const char,
2554  const char *, int);
2555 char *print_base64 (const unsigned char *, unsigned, const char *, int);
2556 char *print_hw_addr (const int, const int, const unsigned char *);
2557 void print_lease (struct lease *);
2558 void dump_raw (const unsigned char *, unsigned);
2559 void dump_packet_option (struct option_cache *, struct packet *,
2560  struct lease *, struct client_state *,
2561  struct option_state *, struct option_state *,
2562  struct binding_scope **, struct universe *, void *);
2563 void dump_packet (struct packet *);
2564 void hash_dump (struct hash_table *);
2565 char *print_hex (unsigned, const u_int8_t *, unsigned, unsigned);
2566 void print_hex_only (unsigned, const u_int8_t *, unsigned, char *);
2567 void print_hex_or_string (unsigned, const u_int8_t *, unsigned, char *);
2568 #define print_hex_1(len, data, limit) print_hex(len, data, limit, 0)
2569 #define print_hex_2(len, data, limit) print_hex(len, data, limit, 1)
2570 #define print_hex_3(len, data, limit) print_hex(len, data, limit, 2)
2571 char *print_dotted_quads (unsigned, const u_int8_t *);
2572 char *print_dec_1 (unsigned long);
2573 char *print_dec_2 (unsigned long);
2574 void print_expression (const char *, struct expression *);
2575 int token_print_indent_concat (FILE *, int, int,
2576  const char *, const char *, ...);
2577 int token_indent_data_string (FILE *, int, int, const char *, const char *,
2578  struct data_string *);
2579 int token_print_indent (FILE *, int, int,
2580  const char *, const char *, const char *);
2581 void indent_spaces (FILE *, int);
2582 #if defined (NSUPDATE)
2583 void print_dns_status (int, struct dhcp_ddns_cb *, isc_result_t);
2584 #endif
2585 const char *print_time(TIME);
2586 
2587 void get_hw_addr(struct interface_info *info);
2588 char *buf_to_hex (const unsigned char *s, unsigned len,
2589  const char *file, int line);
2590 char *format_lease_id(const unsigned char *s, unsigned len, int format,
2591  const char *file, int line);
2592 /* socket.c */
2593 #if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_RECEIVE) \
2594  || defined (USE_SOCKET_FALLBACK)
2595 int if_register_socket(struct interface_info *, int, int *, struct in6_addr *);
2596 
2597 void set_multicast_hop_limit(struct interface_info* info, int hop_limit);
2598 #endif
2599 
2600 #if defined (USE_SOCKET_FALLBACK) && !defined (USE_SOCKET_SEND)
2601 void if_reinitialize_fallback (struct interface_info *);
2602 void if_register_fallback (struct interface_info *);
2603 ssize_t send_fallback (struct interface_info *,
2604  struct packet *, struct dhcp_packet *, size_t,
2605  struct in_addr,
2606  struct sockaddr_in *, struct hardware *);
2607 ssize_t send_fallback6(struct interface_info *, struct packet *,
2608  struct dhcp_packet *, size_t, struct in6_addr *,
2609  struct sockaddr_in6 *, struct hardware *);
2610 #endif
2611 
2612 #ifdef USE_SOCKET_SEND
2613 void if_reinitialize_send (struct interface_info *);
2614 void if_register_send (struct interface_info *);
2615 void if_deregister_send (struct interface_info *);
2616 ssize_t send_packet (struct interface_info *,
2617  struct packet *, struct dhcp_packet *, size_t,
2618  struct in_addr,
2619  struct sockaddr_in *, struct hardware *);
2620 #endif
2621 ssize_t send_packet6(struct interface_info *, const unsigned char *, size_t,
2622  struct sockaddr_in6 *);
2623 #ifdef USE_SOCKET_RECEIVE
2624 void if_reinitialize_receive (struct interface_info *);
2625 void if_register_receive (struct interface_info *);
2626 void if_deregister_receive (struct interface_info *);
2627 ssize_t receive_packet (struct interface_info *,
2628  unsigned char *, size_t,
2629  struct sockaddr_in *, struct hardware *);
2630 #endif
2631 
2632 #if defined (USE_SOCKET_FALLBACK)
2633 isc_result_t fallback_discard (omapi_object_t *);
2634 #endif
2635 
2636 #if defined (USE_SOCKET_SEND)
2637 int can_unicast_without_arp (struct interface_info *);
2638 int can_receive_unicast_unconfigured (struct interface_info *);
2639 int supports_multiple_interfaces (struct interface_info *);
2640 void maybe_setup_fallback (void);
2641 #endif
2642 
2643 void if_register6(struct interface_info *info, int do_multicast);
2644 void if_register_linklocal6(struct interface_info *info);
2645 ssize_t receive_packet6(struct interface_info *interface,
2646  unsigned char *buf, size_t len,
2647  struct sockaddr_in6 *from, struct in6_addr *to_addr,
2648  unsigned int *if_index);
2649 void if_deregister6(struct interface_info *info);
2650 
2651 
2652 /* bpf.c */
2653 #if defined (USE_BPF_SEND) || defined (USE_BPF_RECEIVE)
2654 int if_register_bpf (struct interface_info *);
2655 #endif
2656 #ifdef USE_BPF_SEND
2657 void if_reinitialize_send (struct interface_info *);
2658 void if_register_send (struct interface_info *);
2659 void if_deregister_send (struct interface_info *);
2660 ssize_t send_packet (struct interface_info *,
2661  struct packet *, struct dhcp_packet *, size_t,
2662  struct in_addr,
2663  struct sockaddr_in *, struct hardware *);
2664 #endif
2665 #ifdef USE_BPF_RECEIVE
2666 void if_reinitialize_receive (struct interface_info *);
2667 void if_register_receive (struct interface_info *);
2668 void if_deregister_receive (struct interface_info *);
2669 ssize_t receive_packet (struct interface_info *,
2670  unsigned char *, size_t,
2671  struct sockaddr_in *, struct hardware *);
2672 #endif
2673 #if defined (USE_BPF_SEND)
2674 int can_unicast_without_arp (struct interface_info *);
2675 int can_receive_unicast_unconfigured (struct interface_info *);
2676 int supports_multiple_interfaces (struct interface_info *);
2677 void maybe_setup_fallback (void);
2678 #endif
2679 
2680 /* lpf.c */
2681 #if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE)
2682 int if_register_lpf (struct interface_info *);
2683 #endif
2684 #ifdef USE_LPF_SEND
2685 void if_reinitialize_send (struct interface_info *);
2686 void if_register_send (struct interface_info *);
2687 void if_deregister_send (struct interface_info *);
2688 ssize_t send_packet (struct interface_info *,
2689  struct packet *, struct dhcp_packet *, size_t,
2690  struct in_addr,
2691  struct sockaddr_in *, struct hardware *);
2692 #endif
2693 #ifdef USE_LPF_RECEIVE
2694 void if_reinitialize_receive (struct interface_info *);
2695 void if_register_receive (struct interface_info *);
2696 void if_deregister_receive (struct interface_info *);
2697 ssize_t receive_packet (struct interface_info *,
2698  unsigned char *, size_t,
2699  struct sockaddr_in *, struct hardware *);
2700 #endif
2701 #if defined (USE_LPF_SEND)
2702 int can_unicast_without_arp (struct interface_info *);
2703 int can_receive_unicast_unconfigured (struct interface_info *);
2704 int supports_multiple_interfaces (struct interface_info *);
2705 void maybe_setup_fallback (void);
2706 #endif
2707 
2708 /* nit.c */
2709 #if defined (USE_NIT_SEND) || defined (USE_NIT_RECEIVE)
2710 int if_register_nit (struct interface_info *);
2711 #endif
2712 
2713 #ifdef USE_NIT_SEND
2714 void if_reinitialize_send (struct interface_info *);
2715 void if_register_send (struct interface_info *);
2716 void if_deregister_send (struct interface_info *);
2717 ssize_t send_packet (struct interface_info *,
2718  struct packet *, struct dhcp_packet *, size_t,
2719  struct in_addr,
2720  struct sockaddr_in *, struct hardware *);
2721 #endif
2722 #ifdef USE_NIT_RECEIVE
2723 void if_reinitialize_receive (struct interface_info *);
2724 void if_register_receive (struct interface_info *);
2725 void if_deregister_receive (struct interface_info *);
2726 ssize_t receive_packet (struct interface_info *,
2727  unsigned char *, size_t,
2728  struct sockaddr_in *, struct hardware *);
2729 #endif
2730 #if defined (USE_NIT_SEND)
2731 int can_unicast_without_arp (struct interface_info *);
2732 int can_receive_unicast_unconfigured (struct interface_info *);
2733 int supports_multiple_interfaces (struct interface_info *);
2734 void maybe_setup_fallback (void);
2735 #endif
2736 
2737 /* dlpi.c */
2738 #if defined (USE_DLPI_SEND) || defined (USE_DLPI_RECEIVE)
2739 int if_register_dlpi (struct interface_info *);
2740 #endif
2741 
2742 #ifdef USE_DLPI_SEND
2743 int can_unicast_without_arp (struct interface_info *);
2744 int can_receive_unicast_unconfigured (struct interface_info *);
2745 void if_reinitialize_send (struct interface_info *);
2746 void if_register_send (struct interface_info *);
2747 void if_deregister_send (struct interface_info *);
2748 ssize_t send_packet (struct interface_info *,
2749  struct packet *, struct dhcp_packet *, size_t,
2750  struct in_addr,
2751  struct sockaddr_in *, struct hardware *);
2752 int supports_multiple_interfaces (struct interface_info *);
2753 void maybe_setup_fallback (void);
2754 #endif
2755 #ifdef USE_DLPI_RECEIVE
2756 void if_reinitialize_receive (struct interface_info *);
2757 void if_register_receive (struct interface_info *);
2758 void if_deregister_receive (struct interface_info *);
2759 ssize_t receive_packet (struct interface_info *,
2760  unsigned char *, size_t,
2761  struct sockaddr_in *, struct hardware *);
2762 #endif
2763 
2764 
2765 /* raw.c */
2766 #ifdef USE_RAW_SEND
2767 void if_reinitialize_send (struct interface_info *);
2768 void if_register_send (struct interface_info *);
2769 void if_deregister_send (struct interface_info *);
2770 ssize_t send_packet (struct interface_info *, struct packet *,
2771  struct dhcp_packet *, size_t, struct in_addr,
2772  struct sockaddr_in *, struct hardware *);
2773 int can_unicast_without_arp (struct interface_info *);
2774 int can_receive_unicast_unconfigured (struct interface_info *);
2775 int supports_multiple_interfaces (struct interface_info *);
2776 void maybe_setup_fallback (void);
2777 #endif
2778 
2779 /* discover.c */
2780 extern struct interface_info *interfaces,
2782 extern struct protocol *protocols;
2783 extern int quiet_interface_discovery;
2784 isc_result_t interface_setup (void);
2785 void interface_trace_setup (void);
2786 
2787 extern struct in_addr limited_broadcast;
2788 extern int local_family;
2789 extern struct in_addr local_address;
2790 
2791 extern u_int16_t local_port;
2792 extern u_int16_t remote_port;
2793 extern int dhcpv4_over_dhcpv6;
2794 extern int (*dhcp_interface_setup_hook) (struct interface_info *,
2795  struct iaddr *);
2796 extern int (*dhcp_interface_discovery_hook) (struct interface_info *);
2797 extern isc_result_t (*dhcp_interface_startup_hook) (struct interface_info *);
2798 
2799 extern void (*bootp_packet_handler) (struct interface_info *,
2800  struct dhcp_packet *, unsigned,
2801  unsigned int,
2802  struct iaddr, struct hardware *);
2803 extern void (*dhcpv6_packet_handler)(struct interface_info *,
2804  const char *, int,
2805  int, const struct iaddr *, isc_boolean_t);
2806 extern struct timeout *timeouts;
2808 #if defined (TRACING)
2812 #endif
2813 extern struct interface_info **interface_vector;
2814 extern int interface_count;
2815 extern int interface_max;
2816 isc_result_t interface_initialize(omapi_object_t *, const char *, int);
2817 void discover_interfaces(int);
2818 int setup_fallback (struct interface_info **, const char *, int);
2820 void reinitialize_interfaces (void);
2821 
2822 /* dispatch.c */
2823 void set_time(TIME);
2824 struct timeval *process_outstanding_timeouts (struct timeval *);
2825 void dispatch (void);
2826 isc_result_t got_one(omapi_object_t *);
2827 isc_result_t got_one_v6(omapi_object_t *);
2832 isc_result_t interface_destroy (omapi_object_t *, const char *, int);
2834  const char *, va_list);
2835 isc_result_t interface_stuff_values (omapi_object_t *,
2836  omapi_object_t *,
2837  omapi_object_t *);
2838 
2839 void add_timeout (struct timeval *, void (*) (void *), void *,
2840  tvref_t, tvunref_t);
2841 void cancel_timeout (void (*) (void *), void *);
2842 void cancel_all_timeouts (void);
2843 void relinquish_timeouts (void);
2844 
2845 OMAPI_OBJECT_ALLOC_DECL (interface,
2846  struct interface_info, dhcp_type_interface)
2847 
2848 /* tables.c */
2849 extern char *default_option_format;
2850 extern struct universe dhcp_universe;
2851 extern struct universe dhcpv6_universe;
2852 extern struct universe nwip_universe;
2853 extern struct universe fqdn_universe;
2854 extern struct universe vsio_universe;
2855 extern int dhcp_option_default_priority_list [];
2857 extern const char *hardware_types [256];
2858 extern int universe_count, universe_max;
2859 extern struct universe **universes;
2862 extern struct universe *config_universe;
2863 
2864 /* stables.c */
2865 #if defined (FAILOVER_PROTOCOL)
2866 extern failover_option_t null_failover_option;
2867 extern failover_option_t skip_failover_option;
2868 extern struct failover_option_info ft_options [];
2869 extern u_int32_t fto_allowed [];
2870 extern int ft_sizes [];
2871 extern const char *dhcp_flink_state_names [];
2872 #endif
2873 extern const char *binding_state_names [];
2874 
2875 extern struct universe agent_universe;
2876 extern struct universe server_universe;
2877 
2878 extern struct enumeration ddns_styles;
2879 extern struct enumeration syslog_enum;
2881 
2882 extern struct enumeration prefix_length_modes;
2883 
2884 /* inet.c */
2885 struct iaddr subnet_number (struct iaddr, struct iaddr);
2886 struct iaddr ip_addr (struct iaddr, struct iaddr, u_int32_t);
2887 struct iaddr broadcast_addr (struct iaddr, struct iaddr);
2888 u_int32_t host_addr (struct iaddr, struct iaddr);
2889 int addr_eq (struct iaddr, struct iaddr);
2890 int addr_match(struct iaddr *, struct iaddrmatch *);
2891 int addr_cmp(const struct iaddr *a1, const struct iaddr *a2);
2892 int addr_or(struct iaddr *result,
2893  const struct iaddr *a1, const struct iaddr *a2);
2894 int addr_and(struct iaddr *result,
2895  const struct iaddr *a1, const struct iaddr *a2);
2896 isc_boolean_t is_cidr_mask_valid(const struct iaddr *addr, int bits);
2897 isc_result_t range2cidr(struct iaddrcidrnetlist **result,
2898  const struct iaddr *lo, const struct iaddr *hi);
2899 isc_result_t free_iaddrcidrnetlist(struct iaddrcidrnetlist **result);
2900 const char *piaddr (struct iaddr);
2901 const char *pdestdesc (struct iaddr);
2902 char *piaddrmask(struct iaddr *, struct iaddr *);
2903 char *piaddrcidr(const struct iaddr *, unsigned int);
2904 u_int16_t validate_port(char *);
2905 u_int16_t validate_port_pair(char *);
2906 
2907 /* dhclient.c */
2908 extern int nowait;
2909 
2910 extern int wanted_ia_na;
2911 extern int wanted_ia_ta;
2912 extern int wanted_ia_pd;
2913 extern int require_all_ias;
2914 
2915 extern const char *path_dhclient_conf;
2916 extern const char *path_dhclient_db;
2917 extern const char *path_dhclient_pid;
2918 extern char *path_dhclient_script;
2919 extern int interfaces_requested;
2920 extern struct data_string default_duid;
2921 extern int duid_type;
2922 extern const char *path_dhclient_duid;
2923 
2924 extern struct client_config top_level_config;
2925 
2926 void dhcpoffer (struct packet *);
2927 void dhcpack (struct packet *);
2928 void dhcpnak (struct packet *);
2929 
2930 void send_discover (void *);
2931 void send_request (void *);
2932 void send_release (void *);
2933 void send_decline (void *);
2934 
2935 void state_reboot (void *);
2936 void state_init (void *);
2937 void state_selecting (void *);
2938 void state_requesting (void *);
2939 void state_bound (void *);
2940 void state_stop (void *);
2941 void state_panic (void *);
2942 
2943 void bind_lease (struct client_state *);
2944 
2945 void make_client_options (struct client_state *,
2946  struct client_lease *, u_int8_t *,
2947  struct option_cache *, struct iaddr *,
2948  struct option **, struct option_state **);
2949 void make_discover (struct client_state *, struct client_lease *);
2950 void make_request (struct client_state *, struct client_lease *);
2951 void make_decline (struct client_state *, struct client_lease *);
2952 void make_release (struct client_state *, struct client_lease *);
2953 
2954 void destroy_client_lease (struct client_lease *);
2955 void rewrite_client_leases (void);
2956 void write_lease_option (struct option_cache *, struct packet *,
2957  struct lease *, struct client_state *,
2958  struct option_state *, struct option_state *,
2959  struct binding_scope **, struct universe *, void *);
2960 int write_client_lease (struct client_state *, struct client_lease *, int, int);
2961 isc_result_t write_client6_lease(struct client_state *client,
2962  struct dhc6_lease *lease,
2963  int rewrite, int sync);
2964 int dhcp_option_ev_name (char *, size_t, struct option *);
2965 
2966 void script_init (struct client_state *, const char *,
2967  struct string_list *);
2968 void client_option_envadd (struct option_cache *, struct packet *,
2969  struct lease *, struct client_state *,
2970  struct option_state *, struct option_state *,
2971  struct binding_scope **, struct universe *, void *);
2972 void script_write_params (struct client_state *, const char *,
2973  struct client_lease *);
2974 void script_write_requested (struct client_state *);
2975 int script_go (struct client_state *);
2976 void client_envadd (struct client_state *,
2977  const char *, const char *, const char *, ...)
2978  __attribute__((__format__(__printf__,4,5)));
2979 
2980 struct client_lease *packet_to_lease (struct packet *, struct client_state *);
2981 void go_daemon (void);
2982 void write_client_pid_file (void);
2983 void client_location_changed (void);
2984 void do_release (struct client_state *);
2985 int dhclient_interface_shutdown_hook (struct interface_info *);
2986 int dhclient_interface_discovery_hook (struct interface_info *);
2987 isc_result_t dhclient_interface_startup_hook (struct interface_info *);
2988 void dhclient_schedule_updates(struct client_state *client,
2989  struct iaddr *addr, int offset);
2990 void client_dns_update_timeout (void *cp);
2991 isc_result_t client_dns_update(struct client_state *client,
2992  dhcp_ddns_cb_t *ddns_cb);
2993 void client_dns_remove(struct client_state *client, struct iaddr *addr);
2994 
2995 void dhcpv4_client_assignments(void);
2996 void dhcpv6_client_assignments(void);
2997 isc_result_t form_duid(struct data_string *duid, const char *file, int line);
2998 
2999 void dhcp4o6_start(void);
3000 
3001 /* dhc6.c */
3002 void dhc6_lease_destroy(struct dhc6_lease **src, const char *file, int line);
3003 void start_init6(struct client_state *client);
3004 void start_info_request6(struct client_state *client);
3005 void start_confirm6(struct client_state *client);
3006 void start_release6(struct client_state *client);
3007 void start_selecting6(struct client_state *client);
3008 void unconfigure6(struct client_state *client, const char *reason);
3009 
3010 /* db.c */
3011 int write_lease (struct lease *);
3012 int write_host (struct host_decl *);
3013 int write_server_duid(void);
3014 #if defined (FAILOVER_PROTOCOL)
3015 int write_failover_state (dhcp_failover_state_t *);
3016 #endif
3017 int db_printable (const unsigned char *);
3018 int db_printable_len (const unsigned char *, unsigned);
3019 isc_result_t write_named_billing_class(const void *, unsigned, void *);
3020 void write_billing_classes (void);
3021 int write_billing_class (struct class *);
3022 void commit_leases_timeout (void *);
3023 int commit_leases (void);
3024 int commit_leases_timed (void);
3025 void db_startup (int);
3026 int new_lease_file (void);
3027 int group_writer (struct group_object *);
3028 int write_ia(const struct ia_xx *);
3029 
3030 /* packet.c */
3031 u_int32_t checksum (unsigned char *, unsigned, u_int32_t);
3032 u_int32_t wrapsum (u_int32_t);
3033 void assemble_hw_header (struct interface_info *, unsigned char *,
3034  unsigned *, struct hardware *);
3035 void assemble_udp_ip_header (struct interface_info *, unsigned char *,
3036  unsigned *, u_int32_t, u_int32_t,
3037  u_int32_t, unsigned char *, unsigned);
3038 ssize_t decode_hw_header (struct interface_info *, unsigned char *,
3039  unsigned, struct hardware *);
3040 ssize_t decode_udp_ip_header (struct interface_info *, unsigned char *,
3041  unsigned, struct sockaddr_in *,
3042  unsigned, unsigned *, int);
3043 
3044 /* ethernet.c */
3045 void assemble_ethernet_header (struct interface_info *, unsigned char *,
3046  unsigned *, struct hardware *);
3047 ssize_t decode_ethernet_header (struct interface_info *,
3048  unsigned char *,
3049  unsigned, struct hardware *);
3050 
3051 /* tr.c */
3052 void assemble_tr_header (struct interface_info *, unsigned char *,
3053  unsigned *, struct hardware *);
3054 ssize_t decode_tr_header (struct interface_info *,
3055  unsigned char *,
3056  unsigned, struct hardware *);
3057 
3058 /* dhxpxlt.c */
3059 void convert_statement (struct parse *);
3060 void convert_host_statement (struct parse *, jrefproto);
3061 void convert_host_name (struct parse *, jrefproto);
3062 void convert_class_statement (struct parse *, jrefproto, int);
3063 void convert_class_decl (struct parse *, jrefproto);
3064 void convert_lease_time (struct parse *, jrefproto, char *);
3066 void convert_subnet_statement (struct parse *, jrefproto);
3067 void convert_subnet_decl (struct parse *, jrefproto);
3068 void convert_host_decl (struct parse *, jrefproto);
3069 void convert_hardware_decl (struct parse *, jrefproto);
3070 void convert_hardware_addr (struct parse *, jrefproto);
3071 void convert_filename_decl (struct parse *, jrefproto);
3072 void convert_servername_decl (struct parse *, jrefproto);
3073 void convert_ip_addr_or_hostname (struct parse *, jrefproto, int);
3074 void convert_fixed_addr_decl (struct parse *, jrefproto);
3075 void convert_option_decl (struct parse *, jrefproto);
3076 void convert_lease_statement (struct parse *, jrefproto);
3077 void convert_address_range (struct parse *, jrefproto);
3078 void convert_date (struct parse *, jrefproto, char *);
3079 void convert_numeric_aggregate (struct parse *, jrefproto, int, int, int, int);
3080 void indent (int);
3081 
3082 /* route.c */
3083 void add_route_direct (struct interface_info *, struct in_addr);
3084 void add_route_net (struct interface_info *, struct in_addr, struct in_addr);
3085 void add_route_default_gateway (struct interface_info *, struct in_addr);
3086 void remove_routes (struct in_addr);
3087 void remove_if_route (struct interface_info *, struct in_addr);
3088 void remove_all_if_routes (struct interface_info *);
3089 void set_netmask (struct interface_info *, struct in_addr);
3090 void set_broadcast_addr (struct interface_info *, struct in_addr);
3091 void set_ip_address (struct interface_info *, struct in_addr);
3092 
3093 /* clparse.c */
3094 isc_result_t read_client_conf (void);
3095 int read_client_conf_file (const char *,
3096  struct interface_info *, struct client_config *);
3097 void read_client_leases (void);
3098 void read_client_duid (void);
3099 void parse_client_statement (struct parse *, struct interface_info *,
3100  struct client_config *);
3101 int parse_X (struct parse *, u_int8_t *, unsigned);
3102 int parse_option_list (struct parse *, struct option ***);
3103 void parse_interface_declaration (struct parse *,
3104  struct client_config *, char *);
3105 int interface_or_dummy (struct interface_info **, const char *);
3106 void make_client_state (struct client_state **);
3107 void make_client_config (struct client_state *, struct client_config *);
3108 void parse_client_lease_statement (struct parse *, int);
3109 void parse_client_lease_declaration (struct parse *,
3110  struct client_lease *,
3111  struct interface_info **,
3112  struct client_state **);
3113 int parse_option_decl (struct option_cache **, struct parse *);
3114 void parse_string_list (struct parse *, struct string_list **, int);
3115 int parse_ip_addr (struct parse *, struct iaddr *);
3116 int parse_destination_descriptor (struct parse *, struct iaddr *);
3117 int parse_ip_addr_with_subnet(struct parse *, struct iaddrmatch *);
3118 void parse_reject_statement (struct parse *, struct client_config *);
3119 
3120 /* icmp.c */
3121 OMAPI_OBJECT_ALLOC_DECL (icmp_state, struct icmp_state, dhcp_type_icmp)
3122 extern struct icmp_state *icmp_state;
3123 void icmp_startup (int, void (*) (struct iaddr, u_int8_t *, int));
3125 int icmp_echorequest (struct iaddr *);
3126 isc_result_t icmp_echoreply (omapi_object_t *);
3127 
3128 /* dns.c */
3129 isc_result_t enter_dns_zone (struct dns_zone *);
3130 isc_result_t dns_zone_lookup (struct dns_zone **, const char *);
3131 int dns_zone_dereference (struct dns_zone **, const char *, int);
3132 #if defined (NSUPDATE)
3133 #define FIND_FORWARD 0
3134 #define FIND_REVERSE 1
3135 isc_result_t find_tsig_key (ns_tsig_key **, const char *, struct dns_zone *);
3136 void tkey_free (ns_tsig_key **);
3137 isc_result_t find_cached_zone (dhcp_ddns_cb_t *, int);
3138 void forget_zone (struct dns_zone **);
3139 void repudiate_zone (struct dns_zone **);
3140 int get_dhcid (dhcp_ddns_cb_t *, int, const u_int8_t *, unsigned);
3141 void dhcid_tolease (struct data_string *, struct data_string *);
3142 isc_result_t dhcid_fromlease (struct data_string *, struct data_string *);
3143 isc_result_t ddns_update_fwd(struct data_string *, struct iaddr,
3144  struct data_string *, unsigned long, unsigned,
3145  unsigned);
3146 isc_result_t ddns_remove_fwd(struct data_string *,
3147  struct iaddr, struct data_string *);
3148 #endif /* NSUPDATE */
3149 
3150 dhcp_ddns_cb_t *ddns_cb_alloc(const char *file, int line);
3151 void ddns_cb_free (dhcp_ddns_cb_t *ddns_cb, const char *file, int line);
3152 void ddns_cb_forget_zone (dhcp_ddns_cb_t *ddns_cb);
3153 isc_result_t
3154 ddns_modify_fwd(dhcp_ddns_cb_t *ddns_cb, const char *file, int line);
3155 isc_result_t
3156 ddns_modify_ptr(dhcp_ddns_cb_t *ddns_cb, const char *file, int line);
3157 void
3158 ddns_cancel(dhcp_ddns_cb_t *ddns_cb, const char *file, int line);
3159 
3160 /* resolv.c */
3161 extern char path_resolv_conf [];
3162 extern struct name_server *name_servers;
3163 extern struct domain_search_list *domains;
3164 
3165 void read_resolv_conf (TIME);
3166 struct name_server *first_name_server (void);
3167 
3168 /* inet_addr.c */
3169 #ifdef NEED_INET_ATON
3170 int inet_aton (const char *, struct in_addr *);
3171 #endif
3172 
3173 /* class.c */
3174 extern int have_billing_classes;
3175 struct class unknown_class;
3176 struct class known_class;
3179 extern struct executable_statement *default_classification_rules;
3180 
3181 void classification_setup (void);
3182 void classify_client (struct packet *);
3183 int check_collection (struct packet *, struct lease *, struct collection *);
3184 void classify (struct packet *, struct class *);
3185 isc_result_t unlink_class (struct class **class);
3186 isc_result_t find_class (struct class **, const char *,
3187  const char *, int);
3188 void unbill_class (struct lease *);
3189 int bill_class (struct lease *, struct class *);
3190 
3191 /* execute.c */
3192 int execute_statements (struct binding_value **result,
3193  struct packet *, struct lease *,
3194  struct client_state *,
3195  struct option_state *, struct option_state *,
3196  struct binding_scope **,
3197  struct executable_statement *,
3198  struct on_star *);
3199 void execute_statements_in_scope (struct binding_value **result,
3200  struct packet *, struct lease *,
3201  struct client_state *,
3202  struct option_state *,
3203  struct option_state *,
3204  struct binding_scope **,
3205  struct group *, struct group *,
3206  struct on_star *);
3207 int executable_statement_dereference (struct executable_statement **,
3208  const char *, int);
3209 void write_statements (FILE *, struct executable_statement *, int);
3210 int find_matching_case (struct executable_statement **,
3211  struct packet *, struct lease *, struct client_state *,
3212  struct option_state *, struct option_state *,
3213  struct binding_scope **,
3214  struct expression *, struct executable_statement *);
3215 int executable_statement_foreach (struct executable_statement *,
3216  int (*) (struct executable_statement *,
3217  void *, int), void *, int);
3218 
3219 /* comapi.c */
3225 
3226 void dhcp_common_objects_setup (void);
3227 
3228 isc_result_t dhcp_group_set_value (omapi_object_t *, omapi_object_t *,
3230  omapi_typed_data_t *);
3231 isc_result_t dhcp_group_get_value (omapi_object_t *, omapi_object_t *,
3233  omapi_value_t **);
3234 isc_result_t dhcp_group_destroy (omapi_object_t *, const char *, int);
3235 isc_result_t dhcp_group_signal_handler (omapi_object_t *,
3236  const char *, va_list);
3237 isc_result_t dhcp_group_stuff_values (omapi_object_t *,
3238  omapi_object_t *,
3239  omapi_object_t *);
3240 isc_result_t dhcp_group_lookup (omapi_object_t **,
3241  omapi_object_t *, omapi_object_t *);
3242 isc_result_t dhcp_group_create (omapi_object_t **,
3243  omapi_object_t *);
3244 isc_result_t dhcp_group_remove (omapi_object_t *,
3245  omapi_object_t *);
3246 
3247 isc_result_t dhcp_control_set_value (omapi_object_t *, omapi_object_t *,
3249  omapi_typed_data_t *);
3250 isc_result_t dhcp_control_get_value (omapi_object_t *, omapi_object_t *,
3252  omapi_value_t **);
3253 isc_result_t dhcp_control_destroy (omapi_object_t *, const char *, int);
3254 isc_result_t dhcp_control_signal_handler (omapi_object_t *,
3255  const char *, va_list);
3256 isc_result_t dhcp_control_stuff_values (omapi_object_t *,
3257  omapi_object_t *,
3258  omapi_object_t *);
3259 isc_result_t dhcp_control_lookup (omapi_object_t **,
3260  omapi_object_t *, omapi_object_t *);
3261 isc_result_t dhcp_control_create (omapi_object_t **,
3262  omapi_object_t *);
3263 isc_result_t dhcp_control_remove (omapi_object_t *,
3264  omapi_object_t *);
3265 
3266 isc_result_t dhcp_subnet_set_value (omapi_object_t *, omapi_object_t *,
3268  omapi_typed_data_t *);
3269 isc_result_t dhcp_subnet_get_value (omapi_object_t *, omapi_object_t *,
3271  omapi_value_t **);
3272 isc_result_t dhcp_subnet_destroy (omapi_object_t *, const char *, int);
3273 isc_result_t dhcp_subnet_signal_handler (omapi_object_t *,
3274  const char *, va_list);
3275 isc_result_t dhcp_subnet_stuff_values (omapi_object_t *,
3276  omapi_object_t *,
3277  omapi_object_t *);
3278 isc_result_t dhcp_subnet_lookup (omapi_object_t **,
3279  omapi_object_t *, omapi_object_t *);
3280 isc_result_t dhcp_subnet_create (omapi_object_t **,
3281  omapi_object_t *);
3282 isc_result_t dhcp_subnet_remove (omapi_object_t *,
3283  omapi_object_t *);
3284 
3285 isc_result_t dhcp_shared_network_set_value (omapi_object_t *,
3286  omapi_object_t *,
3288  omapi_typed_data_t *);
3289 isc_result_t dhcp_shared_network_get_value (omapi_object_t *,
3290  omapi_object_t *,
3292  omapi_value_t **);
3293 isc_result_t dhcp_shared_network_destroy (omapi_object_t *, const char *, int);
3294 isc_result_t dhcp_shared_network_signal_handler (omapi_object_t *,
3295  const char *, va_list);
3296 isc_result_t dhcp_shared_network_stuff_values (omapi_object_t *,
3297  omapi_object_t *,
3298  omapi_object_t *);
3299 isc_result_t dhcp_shared_network_lookup (omapi_object_t **,
3300  omapi_object_t *, omapi_object_t *);
3301 isc_result_t dhcp_shared_network_create (omapi_object_t **,
3302  omapi_object_t *);
3303 isc_result_t dhcp_shared_network_remove (omapi_object_t *,
3304  omapi_object_t *);
3305 
3306 /* omapi.c */
3307 extern int (*dhcp_interface_shutdown_hook) (struct interface_info *);
3308 
3313 
3314 #if defined (FAILOVER_PROTOCOL)
3318 #endif
3319 
3320 void dhcp_db_objects_setup (void);
3321 
3322 isc_result_t dhcp_lease_set_value (omapi_object_t *, omapi_object_t *,
3324  omapi_typed_data_t *);
3325 isc_result_t dhcp_lease_get_value (omapi_object_t *, omapi_object_t *,
3327  omapi_value_t **);
3328 isc_result_t dhcp_lease_destroy (omapi_object_t *, const char *, int);
3329 isc_result_t dhcp_lease_signal_handler (omapi_object_t *,
3330  const char *, va_list);
3331 isc_result_t dhcp_lease_stuff_values (omapi_object_t *,
3332  omapi_object_t *,
3333  omapi_object_t *);
3334 isc_result_t dhcp_lease_lookup (omapi_object_t **,
3335  omapi_object_t *, omapi_object_t *);
3336 isc_result_t dhcp_lease_create (omapi_object_t **,
3337  omapi_object_t *);
3338 isc_result_t dhcp_lease_remove (omapi_object_t *,
3339  omapi_object_t *);
3340 isc_result_t dhcp_host_set_value (omapi_object_t *, omapi_object_t *,
3342  omapi_typed_data_t *);
3343 isc_result_t dhcp_host_get_value (omapi_object_t *, omapi_object_t *,
3345  omapi_value_t **);
3346 isc_result_t dhcp_host_destroy (omapi_object_t *, const char *, int);
3347 isc_result_t dhcp_host_signal_handler (omapi_object_t *,
3348  const char *, va_list);
3349 isc_result_t dhcp_host_stuff_values (omapi_object_t *,
3350  omapi_object_t *,
3351  omapi_object_t *);
3352 isc_result_t dhcp_host_lookup (omapi_object_t **,
3353  omapi_object_t *, omapi_object_t *);
3354 isc_result_t dhcp_host_create (omapi_object_t **,
3355  omapi_object_t *);
3356 isc_result_t dhcp_host_remove (omapi_object_t *,
3357  omapi_object_t *);
3358 isc_result_t dhcp_pool_set_value (omapi_object_t *, omapi_object_t *,
3360  omapi_typed_data_t *);
3361 isc_result_t dhcp_pool_get_value (omapi_object_t *, omapi_object_t *,
3363  omapi_value_t **);
3364 isc_result_t dhcp_pool_destroy (omapi_object_t *, const char *, int);
3365 isc_result_t dhcp_pool_signal_handler (omapi_object_t *,
3366  const char *, va_list);
3367 isc_result_t dhcp_pool_stuff_values (omapi_object_t *,
3368  omapi_object_t *,
3369  omapi_object_t *);
3370 isc_result_t dhcp_pool_lookup (omapi_object_t **,
3371  omapi_object_t *, omapi_object_t *);
3372 isc_result_t dhcp_pool_create (omapi_object_t **,
3373  omapi_object_t *);
3374 isc_result_t dhcp_pool_remove (omapi_object_t *,
3375  omapi_object_t *);
3376 isc_result_t dhcp_class_set_value (omapi_object_t *, omapi_object_t *,
3378  omapi_typed_data_t *);
3379 isc_result_t dhcp_class_get_value (omapi_object_t *, omapi_object_t *,
3381  omapi_value_t **);
3382 isc_result_t dhcp_class_destroy (omapi_object_t *, const char *, int);
3383 isc_result_t dhcp_class_signal_handler (omapi_object_t *,
3384  const char *, va_list);
3385 isc_result_t dhcp_class_stuff_values (omapi_object_t *,
3386  omapi_object_t *,
3387  omapi_object_t *);
3388 isc_result_t dhcp_class_lookup (omapi_object_t **,
3389  omapi_object_t *, omapi_object_t *);
3390 isc_result_t dhcp_class_create (omapi_object_t **,
3391  omapi_object_t *);
3392 isc_result_t dhcp_class_remove (omapi_object_t *,
3393  omapi_object_t *);
3394 isc_result_t dhcp_subclass_set_value (omapi_object_t *, omapi_object_t *,
3396  omapi_typed_data_t *);
3397 isc_result_t dhcp_subclass_get_value (omapi_object_t *, omapi_object_t *,
3399  omapi_value_t **);
3400 isc_result_t dhcp_subclass_destroy (omapi_object_t *, const char *, int);
3401 isc_result_t dhcp_subclass_signal_handler (omapi_object_t *,
3402  const char *, va_list);
3403 isc_result_t dhcp_subclass_stuff_values (omapi_object_t *,
3404  omapi_object_t *,
3405  omapi_object_t *);
3406 isc_result_t dhcp_subclass_lookup (omapi_object_t **,
3407  omapi_object_t *, omapi_object_t *);
3408 isc_result_t dhcp_subclass_create (omapi_object_t **,
3409  omapi_object_t *);
3410 isc_result_t dhcp_subclass_remove (omapi_object_t *,
3411  omapi_object_t *);
3412 isc_result_t dhcp_interface_set_value (omapi_object_t *,
3413  omapi_object_t *,
3415  omapi_typed_data_t *);
3416 isc_result_t dhcp_interface_get_value (omapi_object_t *,
3417  omapi_object_t *,
3419  omapi_value_t **);
3420 isc_result_t dhcp_interface_destroy (omapi_object_t *,
3421  const char *, int);
3422 isc_result_t dhcp_interface_signal_handler (omapi_object_t *,
3423  const char *,
3424  va_list ap);
3425 isc_result_t dhcp_interface_stuff_values (omapi_object_t *,
3426  omapi_object_t *,
3427  omapi_object_t *);
3428 isc_result_t dhcp_interface_lookup (omapi_object_t **,
3429  omapi_object_t *,
3430  omapi_object_t *);
3431 isc_result_t dhcp_interface_create (omapi_object_t **,
3432  omapi_object_t *);
3433 isc_result_t dhcp_interface_remove (omapi_object_t *,
3434  omapi_object_t *);
3435 void interface_stash (struct interface_info *);
3436 void interface_snorf (struct interface_info *, int);
3437 
3438 isc_result_t binding_scope_set_value (struct binding_scope *, int,
3440  omapi_typed_data_t *);
3441 isc_result_t binding_scope_get_value (omapi_value_t **,
3442  struct binding_scope *,
3444 isc_result_t binding_scope_stuff_values (omapi_object_t *,
3445  struct binding_scope *);
3446 
3447 void register_eventhandler(struct eventqueue **, void (*handler)(void *));
3448 void unregister_eventhandler(struct eventqueue **, void (*handler)(void *));
3449 void trigger_event(struct eventqueue **);
3450 
3451 /* mdb.c */
3452 
3453 extern struct subnet *subnets;
3454 extern struct shared_network *shared_networks;
3456 extern host_hash_t *host_uid_hash;
3457 extern host_hash_t *host_name_hash;
3461 
3463 
3464 extern int numclasseswritten;
3465 
3466 
3467 isc_result_t enter_class (struct class *, int, int);
3468 isc_result_t delete_class (struct class *, int);
3469 isc_result_t enter_host (struct host_decl *, int, int);
3470 isc_result_t delete_host (struct host_decl *, int);
3471 void change_host_uid(struct host_decl *host, const char *data, int len);
3472 int find_hosts_by_haddr (struct host_decl **, int,
3473  const unsigned char *, unsigned,
3474  const char *, int);
3475 int find_hosts_by_uid (struct host_decl **, const unsigned char *,
3476  unsigned, const char *, int);
3477 int find_hosts_by_option(struct host_decl **, struct packet *,
3478  struct option_state *, const char *, int);
3479 int find_host_for_network (struct subnet **, struct host_decl **,
3480  struct iaddr *, struct shared_network *);
3481 
3482 void new_address_range (struct parse *, struct iaddr, struct iaddr,
3483  struct subnet *, struct pool *,
3484  struct lease **);
3485 isc_result_t dhcp_lease_free (omapi_object_t *, const char *, int);
3486 isc_result_t dhcp_lease_get (omapi_object_t **, const char *, int);
3487 int find_grouped_subnet (struct subnet **, struct shared_network *,
3488  struct iaddr, const char *, int);
3489 int find_subnet(struct subnet **, struct iaddr, const char *, int);
3490 void enter_shared_network (struct shared_network *);
3491 void new_shared_network_interface (struct parse *,
3492  struct shared_network *,
3493  const char *);
3494 int subnet_inner_than(const struct subnet *, const struct subnet *, int);
3495 void enter_subnet (struct subnet *);
3496 void enter_lease (struct lease *);
3497 int supersede_lease (struct lease *, struct lease *, int, int, int, int);
3498 void make_binding_state_transition (struct lease *);
3499 int lease_copy (struct lease **, struct lease *, const char *, int);
3500 void release_lease (struct lease *, struct packet *);
3501 void abandon_lease (struct lease *, const char *);
3502 #if 0
3503 /* this appears to be unused and I plan to remove it SAR */
3504 void dissociate_lease (struct lease *);
3505 #endif
3506 void pool_timer (void *);
3507 int find_lease_by_uid (struct lease **, const unsigned char *,
3508  unsigned, const char *, int);
3509 int find_lease_by_hw_addr (struct lease **, const unsigned char *,
3510  unsigned, const char *, int);
3511 int find_lease_by_ip_addr (struct lease **, struct iaddr,
3512  const char *, int);
3513 void uid_hash_add (struct lease *);
3514 void uid_hash_delete (struct lease *);
3515 void hw_hash_add (struct lease *);
3516 void hw_hash_delete (struct lease *);
3517 int write_leases (void);
3518 int write_leases6(void);
3519 #if !defined(BINARY_LEASES)
3520 void lease_insert(struct lease **, struct lease *);
3521 void lease_remove(struct lease **, struct lease *);
3522 void lease_remove_all(struct lease **);
3523 #endif
3524 int lease_enqueue (struct lease *);
3525 isc_result_t lease_instantiate(const void *, unsigned, void *);
3526 void expire_all_pools (void);
3527 void dump_subnets (void);
3528 #if defined (DEBUG_MEMORY_LEAKAGE) || \
3529  defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
3530 void free_everything (void);
3531 #endif
3532 
3533 /* failover.c */
3534 #if defined (FAILOVER_PROTOCOL)
3535 extern dhcp_failover_state_t *failover_states;
3536 void dhcp_failover_startup (void);
3538 isc_result_t enter_failover_peer (dhcp_failover_state_t *);
3539 isc_result_t find_failover_peer (dhcp_failover_state_t **,
3540  const char *, const char *, int);
3541 isc_result_t dhcp_failover_link_initiate (omapi_object_t *);
3542 isc_result_t dhcp_failover_link_signal (omapi_object_t *,
3543  const char *, va_list);
3544 isc_result_t dhcp_failover_link_set_value (omapi_object_t *,
3545  omapi_object_t *,
3547  omapi_typed_data_t *);
3548 isc_result_t dhcp_failover_link_get_value (omapi_object_t *,
3549  omapi_object_t *,
3551  omapi_value_t **);
3552 isc_result_t dhcp_failover_link_destroy (omapi_object_t *,
3553  const char *, int);
3554 isc_result_t dhcp_failover_link_stuff_values (omapi_object_t *,
3555  omapi_object_t *,
3556  omapi_object_t *);
3557 isc_result_t dhcp_failover_listen (omapi_object_t *);
3558 
3559 isc_result_t dhcp_failover_listener_signal (omapi_object_t *,
3560  const char *,
3561  va_list);
3562 isc_result_t dhcp_failover_listener_set_value (omapi_object_t *,
3563  omapi_object_t *,
3565  omapi_typed_data_t *);
3566 isc_result_t dhcp_failover_listener_get_value (omapi_object_t *,
3567  omapi_object_t *,
3569  omapi_value_t **);
3570 isc_result_t dhcp_failover_listener_destroy (omapi_object_t *,
3571  const char *, int);
3572 isc_result_t dhcp_failover_listener_stuff (omapi_object_t *,
3573  omapi_object_t *,
3574  omapi_object_t *);
3575 isc_result_t dhcp_failover_register (omapi_object_t *);
3576 isc_result_t dhcp_failover_state_signal (omapi_object_t *,
3577  const char *, va_list);
3578 isc_result_t dhcp_failover_state_transition (dhcp_failover_state_t *,
3579  const char *);
3580 isc_result_t dhcp_failover_set_service_state (dhcp_failover_state_t *state);
3581 void dhcp_failover_rescind_updates (dhcp_failover_state_t *);
3582 isc_result_t dhcp_failover_set_state (dhcp_failover_state_t *,
3583  enum failover_state);
3584 isc_result_t dhcp_failover_peer_state_changed (dhcp_failover_state_t *,
3585  failover_message_t *);
3586 void dhcp_failover_pool_rebalance (void *);
3587 void dhcp_failover_pool_check (struct pool *);
3588 int dhcp_failover_state_pool_check (dhcp_failover_state_t *);
3589 void dhcp_failover_timeout (void *);
3590 void dhcp_failover_send_contact (void *);
3591 isc_result_t dhcp_failover_send_state (dhcp_failover_state_t *);
3592 isc_result_t dhcp_failover_send_updates (dhcp_failover_state_t *);
3593 int dhcp_failover_queue_update (struct lease *, int);
3594 int dhcp_failover_send_acks (dhcp_failover_state_t *);
3595 void dhcp_failover_toack_queue_timeout (void *);
3596 int dhcp_failover_queue_ack (dhcp_failover_state_t *, failover_message_t *msg);
3597 void dhcp_failover_ack_queue_remove (dhcp_failover_state_t *, struct lease *);
3598 isc_result_t dhcp_failover_state_set_value (omapi_object_t *,
3599  omapi_object_t *,
3601  omapi_typed_data_t *);
3602 void dhcp_failover_keepalive (void *);
3603 void dhcp_failover_reconnect (void *);
3604 void dhcp_failover_startup_timeout (void *);
3606 void dhcp_failover_listener_restart (void *);
3607 void dhcp_failover_auto_partner_down(void *vs);
3608 isc_result_t dhcp_failover_state_get_value (omapi_object_t *,
3609  omapi_object_t *,
3611  omapi_value_t **);
3612 isc_result_t dhcp_failover_state_destroy (omapi_object_t *,
3613  const char *, int);
3614 isc_result_t dhcp_failover_state_stuff (omapi_object_t *,
3615  omapi_object_t *,
3616  omapi_object_t *);
3617 isc_result_t dhcp_failover_state_lookup (omapi_object_t **,
3618  omapi_object_t *,
3619  omapi_object_t *);
3620 isc_result_t dhcp_failover_state_create (omapi_object_t **,
3621  omapi_object_t *);
3622 isc_result_t dhcp_failover_state_remove (omapi_object_t *,
3623  omapi_object_t *);
3624 int dhcp_failover_state_match (dhcp_failover_state_t *, u_int8_t *, unsigned);
3625 int dhcp_failover_state_match_by_name(dhcp_failover_state_t *,
3626  failover_option_t *);
3627 const char *dhcp_failover_reject_reason_print (int);
3629 const char *dhcp_failover_message_name (unsigned);
3630 const char *dhcp_failover_option_name (unsigned);
3631 failover_option_t *dhcp_failover_option_printf (unsigned, char *,
3632  unsigned *,
3633  unsigned,
3634  const char *, ...)
3635  __attribute__((__format__(__printf__,5,6)));
3636 failover_option_t *dhcp_failover_make_option (unsigned, char *,
3637  unsigned *, unsigned, ...);
3638 isc_result_t dhcp_failover_put_message (dhcp_failover_link_t *,
3639  omapi_object_t *, int, u_int32_t, ...);
3640 isc_result_t dhcp_failover_send_connect (omapi_object_t *);
3641 isc_result_t dhcp_failover_send_connectack (omapi_object_t *,
3642  dhcp_failover_state_t *,
3643  int, const char *);
3644 isc_result_t dhcp_failover_send_disconnect (omapi_object_t *,
3645  int, const char *);
3646 isc_result_t dhcp_failover_send_bind_update (dhcp_failover_state_t *,
3647  struct lease *);
3648 isc_result_t dhcp_failover_send_bind_ack (dhcp_failover_state_t *,
3649  failover_message_t *,
3650  int, const char *);
3651 isc_result_t dhcp_failover_send_poolreq (dhcp_failover_state_t *);
3652 isc_result_t dhcp_failover_send_poolresp (dhcp_failover_state_t *, int);
3653 isc_result_t dhcp_failover_send_update_request (dhcp_failover_state_t *);
3654 isc_result_t dhcp_failover_send_update_request_all (dhcp_failover_state_t *);
3655 isc_result_t dhcp_failover_send_update_done (dhcp_failover_state_t *);
3656 isc_result_t dhcp_failover_process_bind_update (dhcp_failover_state_t *,
3657  failover_message_t *);
3658 isc_result_t dhcp_failover_process_bind_ack (dhcp_failover_state_t *,
3659  failover_message_t *);
3660 isc_result_t dhcp_failover_generate_update_queue (dhcp_failover_state_t *,
3661  int);
3662 isc_result_t dhcp_failover_process_update_request (dhcp_failover_state_t *,
3663  failover_message_t *);
3664 isc_result_t dhcp_failover_process_update_request_all (dhcp_failover_state_t *,
3665  failover_message_t *);
3666 isc_result_t dhcp_failover_process_update_done (dhcp_failover_state_t *,
3667  failover_message_t *);
3668 void ia_remove_all_lease(struct ia_xx *ia, const char *file, int line);
3669 void dhcp_failover_recover_done (void *);
3670 void failover_print (char *, unsigned *, unsigned, const char *);
3671 void update_partner (struct lease *);
3672 int load_balance_mine (struct packet *, dhcp_failover_state_t *);
3673 int peer_wants_lease (struct lease *);
3675  dhcp_failover_state_t *,
3677  u_int32_t);
3678 binding_state_t
3680  dhcp_failover_state_t *,
3681  binding_state_t, u_int32_t);
3682 int lease_mine_to_reallocate (struct lease *);
3683 
3684 OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_state, dhcp_failover_state_t,
3685  dhcp_type_failover_state)
3687  dhcp_type_failover_listener)
3688 OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_link, dhcp_failover_link_t,
3689  dhcp_type_failover_link)
3690 #endif /* FAILOVER_PROTOCOL */
3691 
3692 const char *binding_state_print (enum failover_state);
3693 
3694 /* ldap.c */
3695 #if defined(LDAP_CONFIGURATION)
3696 extern struct enumeration ldap_methods;
3697 #if defined (LDAP_USE_SSL)
3698 extern struct enumeration ldap_ssl_usage_enum;
3699 extern struct enumeration ldap_tls_reqcert_enum;
3700 extern struct enumeration ldap_tls_crlcheck_enum;
3701 #endif
3702 isc_result_t ldap_read_config (void);
3703 int find_haddr_in_ldap (struct host_decl **, int, unsigned,
3704  const unsigned char *, const char *, int);
3705 int find_subclass_in_ldap (struct class *, struct class **,
3706  struct data_string *);
3707 int find_client_in_ldap (struct host_decl **, struct packet*,
3708  struct option_state *, const char *, int);
3709 #endif
3710 
3711 /* mdb6.c */
3712 HASH_FUNCTIONS_DECL(ia, unsigned char *, struct ia_xx, ia_hash_t)
3713 HASH_FUNCTIONS_DECL(iasubopt, struct in6_addr *, struct iasubopt,
3715 
3716 isc_result_t iasubopt_allocate(struct iasubopt **iasubopt,
3717  const char *file, int line);
3718 isc_result_t iasubopt_reference(struct iasubopt **iasubopt,
3719  struct iasubopt *src,
3720  const char *file, int line);
3721 isc_result_t iasubopt_dereference(struct iasubopt **iasubopt,
3722  const char *file, int line);
3723 
3724 isc_result_t ia_make_key(struct data_string *key, u_int32_t iaid,
3725  const char *duid, unsigned int duid_len,
3726  const char *file, int line);
3727 isc_result_t ia_allocate(struct ia_xx **ia, u_int32_t iaid,
3728  const char *duid, unsigned int duid_len,
3729  const char *file, int line);
3730 isc_result_t ia_reference(struct ia_xx **ia, struct ia_xx *src,
3731  const char *file, int line);
3732 isc_result_t ia_dereference(struct ia_xx **ia,
3733  const char *file, int line);
3734 isc_result_t ia_add_iasubopt(struct ia_xx *ia, struct iasubopt *iasubopt,
3735  const char *file, int line);
3736 void ia_remove_iasubopt(struct ia_xx *ia, struct iasubopt *iasubopt,
3737  const char *file, int line);
3738 isc_boolean_t ia_equal(const struct ia_xx *a, const struct ia_xx *b);
3739 
3740 isc_result_t ipv6_pool_allocate(struct ipv6_pool **pool, u_int16_t type,
3741  const struct in6_addr *start_addr,
3742  int bits, int units,
3743  const char *file, int line);
3744 isc_result_t ipv6_pool_reference(struct ipv6_pool **pool,
3745  struct ipv6_pool *src,
3746  const char *file, int line);
3747 isc_result_t ipv6_pool_dereference(struct ipv6_pool **pool,
3748  const char *file, int line);
3749 isc_result_t create_lease6(struct ipv6_pool *pool,
3750  struct iasubopt **addr,
3751  unsigned int *attempts,
3752  const struct data_string *uid,
3753  time_t soft_lifetime_end_time);
3754 isc_result_t add_lease6(struct ipv6_pool *pool,
3755  struct iasubopt *lease,
3756  time_t valid_lifetime_end_time);
3757 isc_result_t renew_lease6(struct ipv6_pool *pool, struct iasubopt *lease);
3758 isc_result_t expire_lease6(struct iasubopt **leasep,
3759  struct ipv6_pool *pool, time_t now);
3760 isc_result_t release_lease6(struct ipv6_pool *pool, struct iasubopt *lease);
3761 isc_result_t decline_lease6(struct ipv6_pool *pool, struct iasubopt *lease);
3762 isc_boolean_t lease6_exists(const struct ipv6_pool *pool,
3763  const struct in6_addr *addr);
3764 isc_boolean_t lease6_usable(struct iasubopt *lease);
3765 isc_result_t cleanup_lease6(ia_hash_t *ia_table,
3766  struct ipv6_pool *pool,
3767  struct iasubopt *lease,
3768  struct ia_xx *ia);
3769 isc_result_t mark_lease_unavailble(struct ipv6_pool *pool,
3770  const struct in6_addr *addr);
3771 isc_result_t create_prefix6(struct ipv6_pool *pool,
3772  struct iasubopt **pref,
3773  unsigned int *attempts,
3774  const struct data_string *uid,
3775  time_t soft_lifetime_end_time);
3776 isc_boolean_t prefix6_exists(const struct ipv6_pool *pool,
3777  const struct in6_addr *pref, u_int8_t plen);
3778 
3779 isc_result_t add_ipv6_pool(struct ipv6_pool *pool);
3780 isc_result_t find_ipv6_pool(struct ipv6_pool **pool, u_int16_t type,
3781  const struct in6_addr *addr);
3782 isc_boolean_t ipv6_in_pool(const struct in6_addr *addr,
3783  const struct ipv6_pool *pool);
3784 isc_result_t ipv6_pond_allocate(struct ipv6_pond **pond,
3785  const char *file, int line);
3786 isc_result_t ipv6_pond_reference(struct ipv6_pond **pond,
3787  struct ipv6_pond *src,
3788  const char *file, int line);
3789 isc_result_t ipv6_pond_dereference(struct ipv6_pond **pond,
3790  const char *file, int line);
3791 
3792 isc_result_t renew_leases(struct ia_xx *ia);
3793 isc_result_t release_leases(struct ia_xx *ia);
3794 isc_result_t decline_leases(struct ia_xx *ia);
3795 void schedule_lease_timeout(struct ipv6_pool *pool);
3797 
3798 void mark_hosts_unavailable(void);
3799 void mark_phosts_unavailable(void);
3800 void mark_interfaces_unavailable(void);
3801 void report_jumbo_ranges();
3802 
3803 #if defined(DHCPv6)
3804 int find_hosts6(struct host_decl** host, struct packet* packet,
3805  const struct data_string* client_id, char* file, int line);
3806 #endif
3807 
3808 #if defined (BINARY_LEASES)
3809 /* leasechain.c */
3810 int lc_not_empty(struct leasechain *lc);
3811 void lc_add_sorted_lease(struct leasechain *lc, struct lease *lp);
3812 void lc_unlink_lease(struct leasechain *lc, struct lease *lp);
3813 struct lease *lc_get_first_lease(struct leasechain *lc);
3814 struct lease *lc_get_next(struct leasechain *lc, struct lease *lp);
3815 void lc_init_growth(struct leasechain *lc, size_t growth);
3816 void lc_delete_all(struct leasechain *lc);
3817 #endif /* BINARY_LEASES */
3818 
3819 #define MAX_ADDRESS_STRING_LEN \
3820  (sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"))
3821 
3822 /* Find the percentage of count. We need to try two different
3823  * ways to avoid rounding mistakes.
3824  */
3825 #define FIND_PERCENT(count, percent) \
3826  ((count) > (INT_MAX / 100) ? \
3827  ((count) / 100) * (percent) : ((count) * (percent)) / 100)
3828 
3829 #define FIND_POND6_PERCENT(count, percent) \
3830  ((count) > (POND_TRACK_MAX / 100) ? \
3831  ((count) / 100) * (percent) : ((count) * (percent)) / 100)
3832 
void parse_subnet6_declaration(struct parse *, struct shared_network *)
Definition: confpars.c:2830
isc_result_t dhcp_failover_state_signal(omapi_object_t *, const char *, va_list)
u_int16_t validate_port_pair(char *)
Definition: inet.c:685
int txcount
Definition: dhcpd.h:1304
void convert_subnet_decl(struct parse *, jrefproto)
void do_packet6(struct interface_info *, const char *, int, int, const struct iaddr *, isc_boolean_t)
void tkey_free(ns_tsig_key **)
struct lease_state * next
Definition: dhcpd.h:653
int supersede_lease(struct lease *, struct lease *, int, int, int, int)
Definition: mdb.c:1133
isc_result_t end_parse(struct parse **)
Definition: conflex.c:103
isc_result_t dhcp_group_create(omapi_object_t **, omapi_object_t *)
Definition: comapi.c:399
ia_hash_t * ia_ta_active
void if_register_send(struct interface_info *)
void hash_dump(struct hash_table *)
Definition: print.c:344
LEASE_STRUCT reserved
Definition: dhcpd.h:1005
int backoff
Definition: dhcpd.h:1476
void initialize_server_option_spaces(void)
Definition: stables.c:437
struct in_addr limited_broadcast
Definition: discover.c:53
isc_result_t dhcp_failover_send_poolreq(dhcp_failover_state_t *)
TIME IRT
Definition: dhcpd.h:1308
struct leasechain * lc
Definition: dhcpd.h:561
isc_result_t renew_lease6(struct ipv6_pool *pool, struct iasubopt *lease)
Renew a lease in the pool.
Definition: mdb6.c:1444
struct ipv6_pond * next
Definition: dhcpd.h:1705
void(* dhcpv6_packet_handler)(struct interface_info *, const char *, int, int, const struct iaddr *, isc_boolean_t)
int find_grouped_subnet(struct subnet **, struct shared_network *, struct iaddr, const char *, int)
Definition: mdb.c:931
int mockup_lease(struct lease **, struct packet *, struct shared_network *, struct host_decl *)
Definition: dhcp.c:4772
struct class * nic
Definition: dhcpd.h:1068
Definition: tree.h:31
int expression_allocate(struct expression **, const char *, int)
Definition: alloc.c:426
int line
Definition: dhcpd.h:317
TIME valid_from
Definition: dhcpd.h:1711
int group_dereference(struct group **, const char *, int)
Definition: alloc.c:205
struct client_lease * alias
Definition: dhcpd.h:1279
int parse_ip6_addr_expr(struct expression **, struct parse *)
Definition: parse.c:461
struct lease * new_leases(unsigned, const char *, int)
isc_result_t dhcp_subnet_create(omapi_object_t **, omapi_object_t *)
Definition: comapi.c:736
isc_result_t dhcp_host_lookup(omapi_object_t **, omapi_object_t *, omapi_object_t *)
Definition: omapi.c:1369
int find_lease(struct lease **, struct packet *, struct shared_network *, int *, int *, struct lease *, const char *, int)
Definition: dhcp.c:4020
void mark_hosts_unavailable(void)
Definition: mdb6.c:2292
TIME RT
Definition: dhcpd.h:1307
struct group * root_group
Definition: memory.c:31
void(* bootp_packet_handler)(struct interface_info *, struct dhcp_packet *, unsigned, unsigned int, struct iaddr, struct hardware *)
Definition: discover.c:58
TIME interval
Definition: dhcpd.h:1285
isc_result_t dhcp_failover_state_stuff(omapi_object_t *, omapi_object_t *, omapi_object_t *)
lease_id_hash_t * lease_uid_hash
Definition: mdb.c:37
const char int line
Definition: dhcpd.h:3717
struct class known_class
Definition: dhcpd.h:3176
void make_client_options(struct client_state *, struct client_lease *, u_int8_t *, struct option_cache *, struct iaddr *, struct option **, struct option_state **)
Definition: dhclient.c:3360
void parse_server_duid_conf(struct parse *cfile)
void start_selecting6(struct client_state *client)
int quiet_interface_discovery
Definition: discover.c:44
isc_result_t dhcp_host_signal_handler(omapi_object_t *, const char *, va_list)
Definition: omapi.c:1218
int score
Definition: dhcpd.h:1159
int data_string_sprintfa(struct data_string *ds, const char *fmt,...)
Definition: tree.c:56
isc_result_t dhcp_failover_send_connectack(omapi_object_t *, dhcp_failover_state_t *, int, const char *)
isc_result_t dhcp_failover_link_get_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_value_t **)
LEASE_STRUCT expired
Definition: dhcpd.h:1001
u_int32_t flags
Definition: dhcpd.h:393
void assemble_ethernet_header(struct interface_info *, unsigned char *, unsigned *, struct hardware *)
u_int8_t plen
Definition: dhcpd.h:1127
void parse_trace_setup(void)
struct agent_options * next
Definition: dhcpd.h:380
u_int32_t checksum(unsigned char *, unsigned, u_int32_t)
Definition: packet.c:45
struct dns_zone * zone
Definition: dhcpd.h:1779
void parse_host_declaration(struct parse *, struct group *)
Definition: confpars.c:1943
void trace_conf_input(trace_type_t *, unsigned, char *)
u_int32_t xid
Definition: dhcpd.h:671
isc_result_t interface_get_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_value_t **)
void state_bound(void *)
Definition: dhclient.c:1899
isc_result_t find_tsig_key(ns_tsig_key **, const char *, struct dns_zone *)
isc_result_t ddns_remove_fwd(struct data_string *, struct iaddr, struct data_string *)
int write_failover_state(dhcp_failover_state_t *)
int dhcp_failover_state_match_by_name(dhcp_failover_state_t *, failover_option_t *)
isc_result_t dhcp_failover_listener_set_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_typed_data_t *)
void dhcprequest(struct packet *, int, struct lease *)
Definition: dhcp.c:480
int parse_executable_statement(struct executable_statement **, struct parse *, int *, enum expression_context)
Definition: parse.c:2129
failover_option_t failover_option_t * dhcp_failover_make_option(unsigned, char *, unsigned *, unsigned,...)
void client_option_envadd(struct option_cache *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *)
Definition: dhclient.c:4431
struct dns_question * question
Definition: dhcpd.h:1467
int op_precedence(enum expr_op, enum expr_op)
Definition: tree.c:3200
isc_result_t dhcp_set_control_state(control_object_state_t oldstate, control_object_state_t newstate)
Definition: dhclient.c:5145
struct enumeration * find_enumeration(const char *, int)
Definition: parse.c:43
int struct expression * parse_domain_list(struct parse *cfile, int)
Definition: parse.c:5670
char * parse_host_name(struct parse *)
Definition: parse.c:192
struct eventqueue * rw_queue_empty
Definition: dispatch.c:37
isc_result_t dhcp_failover_send_connect(omapi_object_t *)
int dhcp_max_agent_option_packet_length
Definition: dhclient.c:66
omapi_object_type_t * dhcp_type_shared_network
struct subnet * subnets
Definition: dhcpd.h:1029
void read_resolv_conf(TIME)
Definition: resolv.c:36
void assemble_udp_ip_header(struct interface_info *, unsigned char *, unsigned *, u_int32_t, u_int32_t, u_int32_t, unsigned char *, unsigned)
int icmp_echorequest(struct iaddr *)
Definition: icmp.c:129
struct group * on_receipt
Definition: dhcpd.h:1198
void dhcpleasequery(struct packet *, int)
int parse_non_binary(struct expression **, struct parse *, int *, enum expression_context)
Definition: parse.c:3588
isc_result_t add_lease6(struct ipv6_pool *pool, struct iasubopt *lease, time_t valid_lifetime_end_time)
Definition: mdb6.c:1234
Definition: dhcpd.h:556
isc_result_t ia_make_key(struct data_string *key, u_int32_t iaid, const char *duid, unsigned int duid_len, const char *file, int line)
Definition: mdb6.c:310
#define LEASE_STRUCT
Definition: dhcpd.h:256
const char * hardware_types[256]
Definition: tables.c:704
isc_uint64_t num_active
Definition: dhcpd.h:1718
isc_result_t dhcp_subnet_signal_handler(omapi_object_t *, const char *, va_list)
Definition: comapi.c:676
int find_host_for_network(struct subnet **, struct host_decl **, struct iaddr *, struct shared_network *)
Definition: mdb.c:714
Definition: tree.h:94
struct shared_network * shared_network
Definition: dhcpd.h:1346
int parse_on_statement(struct executable_statement **, struct parse *, int *)
Definition: parse.c:3140
struct group * group
Definition: dhcpd.h:996
u_int8_t hlen
Definition: dhcpd.h:489
omapi_object_type_t * dhcp_type_failover_link
omapi_object_type_t * dhcp_type_pool
Definition: omapi.c:47
int evaluate_numeric_expression(unsigned long *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct expression *)
Definition: tree.c:2229
struct shared_network * shared_networks
Definition: mdb.c:33
int do_forward_update
Definition: dhcpd.h:1247
struct dhcp_ddns_cb * ddns_cb
Definition: dhcpd.h:646
int parse_option_code_definition(struct parse *, struct option *)
Definition: parse.c:1568
Definition: dhcpd.h:1639
isc_result_t dhcp_group_set_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_typed_data_t *)
Definition: comapi.c:128
dhcp_state
Definition: dhcpd.h:1169
unsigned char * uid
Definition: dhcpd.h:581
isc_result_t dhcp_subnet_set_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_typed_data_t *)
Definition: comapi.c:604
void parse_fixed_prefix6(struct parse *cfile, struct host_decl *host_decl)
struct name_server * name_servers
Definition: resolv.c:32
u_int16_t id
Definition: dhcpd.h:1463
void discover_interfaces(int)
Definition: discover.c:555
struct permit * new_permit(const char *, int)
int got_requested_address
Definition: dhcpd.h:666
u_int32_t renew
Definition: dhcpd.h:1147
struct binding_scope * global_scope
Definition: tree.c:38
void expire_all_pools(void)
Definition: mdb.c:2803
isc_boolean_t server_duid_isset(void)
struct in_addr local_address
Definition: discover.c:56
struct executable_statement * default_classification_rules
Definition: class.c:39
Definition: dhcpd.h:1190
void if_reinitialize_send(struct interface_info *)
int get_dhcid(dhcp_ddns_cb_t *, int, const u_int8_t *, unsigned)
void parse_interface_declaration(struct parse *, struct client_config *, char *)
Definition: clparse.c:986
u_int8_t pref
Definition: dhcpd.h:1160
isc_result_t dhcp_host_destroy(omapi_object_t *, const char *, int)
Definition: omapi.c:1190
int parse_ip_addr(struct parse *, struct iaddr *)
Definition: parse.c:332
struct group_object * n_dynamic
Definition: dhcpd.h:916
struct isc_heap isc_heap_t
Definition: heap.h:47
int outstanding_pings
Definition: dhcp.c:43
tvunref_t unref
Definition: dhcpd.h:1422
Definition: dhcpd.h:1183
int authoring_byte_order
Definition: dhcpd.c:83
u_int16_t secs
Definition: dhcpd.h:672
int units
Definition: dhcpd.h:1678
int max_iasubopt
Definition: dhcpd.h:1644
void icmp_startup(int, void(*)(struct iaddr, u_int8_t *, int))
enum dhcp_token peek_raw_token(const char **rval, unsigned *rlen, struct parse *cfile)
Definition: conflex.c:454
void start_release6(struct client_state *client)
int prefix_length_mode
Definition: dhcpd.c:81
int get_option_int(int *, struct universe *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct option_state *, struct binding_scope **, unsigned, const char *, int)
Definition: options.c:2203
void dhcpv6_leasequery(struct data_string *, struct packet *)
u_int16_t type
Definition: dhcpd.h:1446
unsigned len
Definition: dhcpd.h:1471
isc_result_t ia_dereference(struct ia_xx **ia, const char *file, int line)
Definition: mdb6.c:402
struct lease_state * state
Definition: dhcpd.h:624
struct class * superclass
Definition: dhcpd.h:1069
int lc_not_empty(struct leasechain *lc)
void start_info_request6(struct client_state *client)
void parse_pool6_statement(struct parse *, struct group *, int)
void state_init(void *)
Definition: dhclient.c:1533
void dhcpack(struct packet *)
Definition: dhclient.c:1655
const char * path_dhclient_duid
Definition: dhclient.c:61
int leases_consumed
Definition: dhcpd.h:1074
int evaluate_option_cache(struct data_string *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct option_cache *, const char *, int)
Definition: tree.c:2699
int permit_list_match(struct permit *, struct permit *)
Definition: confpars.c:1672
int fd
Definition: dhcpd.h:1433
Definition: dhcpd.h:1039
struct universe server_universe
Definition: stables.c:175
void convert_numeric_aggregate(struct parse *, jrefproto, int, int, int, int)
isc_result_t interface_signal_handler(omapi_object_t *, const char *, va_list)
isc_result_t supersede_group(struct group_object *, int)
Definition: memory.c:74
char * domain
Definition: dhcpd.h:362
int write_billing_class(struct class *)
Definition: db.c:970
void dhcp_failover_pool_check(struct pool *)
int binding_scope_allocate(struct binding_scope **, const char *, int)
Definition: alloc.c:1194
TIME first_sending
Definition: dhcpd.h:1284
void script_init(struct client_state *, const char *, struct string_list *)
Definition: dhclient.c:4400
isc_result_t unlink_class(struct class **class)
Definition: class.c:217
ssize_t decode_udp_ip_header(struct interface_info *, unsigned char *, unsigned, struct sockaddr_in *, unsigned, unsigned *, int)
isc_result_t dhcp_subclass_signal_handler(omapi_object_t *, const char *, va_list)
Definition: omapi.c:2324
universe_hash_t * universe_hash
Definition: tables.c:962
void interface_snorf(struct interface_info *, int)
Definition: discover.c:1505
int pretty_escape(char **, char *, const unsigned char **, const unsigned char *)
Definition: options.c:4130
control_object_state_t state
Definition: dhcpd.h:529
ssize_t decode_tr_header(struct interface_info *, unsigned char *, unsigned, struct hardware *)
int write_client_lease(struct client_state *, struct client_lease *, int, int)
Definition: dhclient.c:4256
void bootp(struct packet *)
Definition: dhclient.c:1987
int write_lease(struct lease *)
Definition: dhclient.c:1970
void do_packet(struct interface_info *, struct dhcp_packet *, unsigned, unsigned int, struct iaddr, struct hardware *)
Definition: options.c:3888
int max_outstanding_acks
trace_type_t * interface_trace
size_t buflen
Definition: dhcpd.h:329
const char * pretty_print_option(struct option *, const unsigned char *, unsigned, int, int)
Definition: options.c:1676
void classify(struct packet *, struct class *)
Definition: dhclient.c:1411
void client_dns_update_timeout(void *cp)
struct ipv6_pond * ipv6_pond
Definition: dhcpd.h:1032
void set_option(struct universe *, struct option_state *, struct option_cache *, enum statement_op)
Definition: options.c:2248
dhcp_pending
Definition: dhcpd.h:1182
isc_boolean_t lease6_usable(struct iasubopt *lease)
Check if address is available to a lease.
Definition: mdb6.c:1372
isc_result_t ddns_modify_ptr(dhcp_ddns_cb_t *ddns_cb, const char *file, int line)
char * quotify_buf(const unsigned char *, unsigned, const char, const char *, int)
Definition: print.c:71
int heap_index
Definition: dhcpd.h:1624
isc_result_t dhcp_failover_register(omapi_object_t *)
int find_hosts_by_option(struct host_decl **, struct packet *, struct option_state *, const char *, int)
Definition: mdb.c:638
void lease_remove(struct lease **lq, struct lease *comp)
Definition: mdb.c:2549
struct client_config top_level_config
Definition: clparse.c:32
char * vendor_space_name
Definition: dhcpd.h:1232
isc_result_t dhcp_failover_link_initiate(omapi_object_t *)
struct timeout * timeouts
Definition: dispatch.c:33
isc_result_t dhcp_lease_get_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_value_t **)
Definition: omapi.c:391
Definition: dhcpd.h:1171
isc_result_t got_one(omapi_object_t *)
Definition: discover.c:1029
int option_state_reference(struct option_state **, struct option_state *, const char *, int)
Definition: alloc.c:883
struct client_state * client
Definition: dhcpd.h:1336
int write_host(struct host_decl *)
Definition: dhclient.c:1976
int lease_id_format
Definition: dhcpd.h:1251
int bind_ds_value(struct binding_scope **, const char *, struct data_string *)
Definition: tree.c:4080
int check_collection(struct packet *, struct lease *, struct collection *)
Definition: dhclient.c:1403
omapi_object_type_t * dhcp_type_interface
Definition: discover.c:71
isc_result_t dhcp_class_create(omapi_object_t **, omapi_object_t *)
Definition: omapi.c:2252
int refcnt
Definition: dhcpd.h:407
int parse_boolean(struct parse *)
Definition: parse.c:3494
isc_result_t dhcp_interface_signal_handler(omapi_object_t *, const char *, va_list ap)
Definition: discover.c:1235
failover_state
Definition: failover.h:288
OMAPI_OBJECT_PREAMBLE
Definition: dhcpd.h:914
class_hash_t * hash
Definition: dhcpd.h:1082
isc_result_t delete_group(struct group_object *, int)
Definition: memory.c:35
int tlpos
Definition: dhcpd.h:318
struct universe nwip_universe
Definition: tables.c:282
isc_result_t dhcp_host_stuff_values(omapi_object_t *, omapi_object_t *, omapi_object_t *)
Definition: omapi.c:1266
u_int32_t wrapsum(u_int32_t)
Definition: packet.c:84
int parse_ip6_addr(struct parse *, struct iaddr *)
Definition: parse.c:401
struct group * on_transmission
Definition: dhcpd.h:1203
int parse_option_token(struct expression **, struct parse *, const char **, struct expression *, int, int)
Definition: parse.c:4974
int interface_or_dummy(struct interface_info **, const char *)
Definition: clparse.c:1049
int packet_dereference(struct packet **, const char *, int)
Definition: alloc.c:1081
struct dhcp_ddns_cb * ddns_cb
Definition: dhcpd.h:1633
host_hash_t * host_uid_hash
Definition: mdb.c:35
u_int16_t type
Definition: dhcpd.h:1452
void dhcpinform(struct packet *, int)
Definition: dhcp.c:1095
struct lease * next_pending
Definition: dhcpd.h:638
omapi_object_type_t * dhcp_type_lease
Definition: omapi.c:46
TIME select_interval
Definition: dhcpd.h:1219
isc_result_t ddns_update_fwd(struct data_string *, struct iaddr, struct data_string *, unsigned long, unsigned, unsigned)
struct client_state * client
Definition: dhcpd.h:1393
int option_space_encapsulate(struct data_string *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct data_string *)
Definition: options.c:3006
void assemble_tr_header(struct interface_info *, unsigned char *, unsigned *, struct hardware *)
int can_receive_unicast_unconfigured(struct interface_info *)
struct dns_wakeup * next
Definition: dhcpd.h:1441
int icmp_readsocket(omapi_object_t *)
Definition: icmp.c:120
size_t total
Definition: dhcpd.h:984
isc_result_t dhcp_failover_state_create(omapi_object_t **, omapi_object_t *)
isc_result_t dhcp_shared_network_set_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_typed_data_t *)
Definition: comapi.c:748
char * piaddrmask(struct iaddr *, struct iaddr *)
Definition: inet.c:606
void print_lease(struct lease *)
Definition: print.c:194
void eval_network_statements(struct option_state **options, struct packet *packet, struct group *network_group)
Builds option set from statements at the global and network scope.
Definition: dhcp.c:5374
int last_ipv6_pool
Definition: dhcpd.h:1715
uint32_t parse_byte_order_uint32(const void *source)
int is_numeric_expression(struct expression *)
Definition: tree.c:3078
int is_data_expression(struct expression *)
Definition: tree.c:3048
struct executable_statement * on_release
Definition: dhcpd.h:552
void lease_ping_timeout(void *)
Definition: dhcpd.c:1333
struct client_state * next
Definition: dhcpd.h:1261
void lease_pinged(struct iaddr, u_int8_t *, int)
Definition: dhcpd.c:1284
isc_result_t dhcp_failover_listener_stuff(omapi_object_t *, omapi_object_t *, omapi_object_t *)
isc_result_t dhcp_host_create(omapi_object_t **, omapi_object_t *)
Definition: omapi.c:1576
struct string_list * env
Definition: dhcpd.h:1267
void uid_hash_add(struct lease *)
Definition: mdb.c:2102
struct group * group
Definition: dhcpd.h:1033
struct in_addr * addresses
Definition: dhcpd.h:1350
u_int16_t elapsed
Definition: dhcpd.h:1303
struct name_server * next_server
Definition: dhcpd.h:1475
struct binding * find_binding(struct binding_scope *, const char *)
Definition: tree.c:3755
char * print_dotted_quads(unsigned, const u_int8_t *)
Definition: print.c:481
struct binding * create_binding(struct binding_scope **, const char *)
Definition: tree.c:4049
int wanted_ia_ta
Definition: dhclient.c:104
int dhclient_interface_shutdown_hook(struct interface_info *)
Definition: dhclient.c:4946
int local_family
Definition: discover.c:55
void free_client_lease(struct client_lease *, const char *, int)
Definition: alloc.c:369
struct universe dhcp_universe
const char * path_dhclient_db
Definition: dhclient.c:57
int dhcpv4_over_dhcpv6
Definition: discover.c:47
struct interface_info * ip
Definition: dhcpd.h:655
struct option_state * options
Definition: dhcpd.h:1138
dhcp_ddns_cb_t * ddns_cb_alloc(const char *file, int line)
void read_client_leases(void)
Definition: clparse.c:366
void dhcp_failover_keepalive(void *)
struct option_cache * next
Definition: dhcpd.h:387
struct protocol * new_protocol(const char *, int)
isc_result_t lease_file_subparse(struct parse *)
Definition: confpars.c:269
struct option_cache * next_hashed_option(struct universe *, struct option_state *, struct option_cache *)
struct shared_network * shared_network
Definition: dhcpd.h:1707
isc_result_t dhcp_failover_send_update_request(dhcp_failover_state_t *)
isc_result_t ipv6_pond_reference(struct ipv6_pond **pond, struct ipv6_pond *src, const char *file, int line)
reference an IPv6 pond structure.
Definition: mdb6.c:2434
int parse_zone(struct dns_zone *, struct parse *)
Definition: parse.c:2812
int lpos
Definition: dhcpd.h:316
void expression_dereference(struct expression **, const char *, int)
Definition: tree.c:2813
omapi_object_type_t * dhcp_type_failover_state
void dhcpdecline(struct packet *, int)
Definition: dhcp.c:956
void cancel_timeout(void(*)(void *), void *)
Definition: dispatch.c:390
int wanted_ia_pd
Definition: dhclient.c:105
isc_result_t dhcp_interface_stuff_values(omapi_object_t *, omapi_object_t *, omapi_object_t *)
Definition: discover.c:1271
int parse_auth_key(struct data_string *, struct parse *)
void free_binding_value(struct binding_value *, const char *, int)
Definition: alloc.c:548
isc_result_t dhcp_class_lookup(omapi_object_t **, omapi_object_t *, omapi_object_t *)
Definition: omapi.c:2246
void hw_hash_delete(struct lease *)
Definition: mdb.c:2299
int append_option(struct data_string *dst, struct universe *universe, struct option *option, struct data_string *src)
Definition: options.c:2886
struct option_cache * fixed_addr
Definition: dhcpd.h:950
struct class * billing_class
Definition: dhcpd.h:575
const char * dhcp_failover_option_name(unsigned)
void parse_address_range(struct parse *, struct group *, int, struct pool *, struct lease **)
Definition: confpars.c:3752
void client_location_changed(void)
Definition: dhclient.c:4834
int site_universe
Definition: dhcpd.h:399
struct dhc6_ia * next
Definition: dhcpd.h:1142
void print_dns_status(int, struct dhcp_ddns_cb *, isc_result_t)
char * lease_tag
Definition: dhcpd.h:1796
char * print_base64(const unsigned char *, unsigned, const char *, int)
Definition: print.c:121
isc_result_t dhcp_control_destroy(omapi_object_t *, const char *, int)
Definition: comapi.c:495
struct class unknown_class
Definition: dhcpd.h:3175
int parse_lease_declaration(struct lease **, struct parse *)
Definition: confpars.c:3115
const char * path_dhcpd_db
Definition: dhcpd.c:87
TIME last_write
Definition: dhcpd.h:1271
u_int32_t valid
Definition: dhcpd.h:1615
void if_reinitialize_fallback(struct interface_info *)
isc_result_t dhcp_shared_network_signal_handler(omapi_object_t *, const char *, va_list)
Definition: comapi.c:836
struct collection * collections
Definition: dhcpd.h:3178
isc_result_t dhcp_host_get_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_value_t **)
Definition: omapi.c:1121
isc_result_t find_class(struct class **, const char *, const char *, int)
Definition: dhclient.c:1397
lease_id_hash_t * lease_hw_addr_hash
Definition: mdb.c:39
int find_bound_string(struct data_string *, struct binding_scope *, const char *)
Definition: tree.c:4103
time_t cltt
Definition: dhcpd.h:1645
void cancel_all_timeouts(void)
int num_inactive
Definition: dhcpd.h:1683
void free_permit(struct permit *, const char *, int)
Definition: salloc.c:245
int dhcp_option_ev_name(char *, size_t, struct option *)
Definition: dhclient.c:4725
int known
Definition: dhcpd.h:457
struct binding_scope * scope
Definition: dhcpd.h:1611
dhcp_failover_state_t * failover_peer
Definition: dhcpd.h:1035
isc_result_t dhcp_interface_lookup(omapi_object_t **, omapi_object_t *, omapi_object_t *)
Definition: discover.c:1305
void * local
Definition: dhcpd.h:1435
isc_result_t dhcp_class_stuff_values(omapi_object_t *, omapi_object_t *, omapi_object_t *)
Definition: omapi.c:2146
struct ipv6_pond * ipv6_pond
Definition: dhcpd.h:1689
failover_option_t * dhcp_failover_option_printf(unsigned, char *, unsigned *, unsigned, const char *,...) __attribute__((__format__(__printf__
void copy_server_duid(struct data_string *ds, const char *file, int line)
void dump_packet(struct packet *)
unsigned short uid_max
Definition: dhcpd.h:583
const char * print_time(TIME)
Definition: print.c:1485
void(* tvunref_t)(void *, const char *, int)
Definition: dhcpd.h:1415
size_t growth
Definition: dhcpd.h:987
struct subnet * subnets
Definition: mdb.c:32
TIME initial_delay
Definition: dhcpd.h:1211
struct option_cache * secondary6
Definition: dhcpd.h:1488
void fqdn6_option_space_foreach(struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct universe *u, void *stuff, void(*func)(struct option_cache *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *))
Definition: options.c:3415
int executable_statement_reference(struct executable_statement **, struct executable_statement *, const char *, int)
Definition: alloc.c:972
const char * tlname
Definition: dhcpd.h:294
struct protocol * protocols
int site_code_min
Definition: dhcpd.h:400
void relinquish_lease_hunks(void)
int allocate_lease(struct lease **, struct packet *, struct pool *, int *)
Definition: dhcp.c:4822
isc_result_t dhcp_control_set_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_typed_data_t *)
Definition: comapi.c:435
struct option_cache * lookup_linked_option(struct universe *, struct option_state *, unsigned)
Definition: options.c:3821
dhcp_failover_state_t * failover_peer
Definition: dhcpd.h:1015
int parse_fixed_addr_param(struct option_cache **, struct parse *, enum dhcp_token)
Definition: confpars.c:3044
void release_lease(struct lease *, struct packet *)
Definition: mdb.c:1733
int dhclient_interface_discovery_hook(struct interface_info *)
Definition: dhclient.c:4953
TIME backoff_cutoff
Definition: dhcpd.h:1225
struct option_cache * lookup_option(struct universe *, struct option_state *, unsigned)
Definition: options.c:2348
OMAPI_OBJECT_ALLOC_DECL(shared_network, struct shared_network, dhcp_type_shared_network) OMAPI_OBJECT_ALLOC_DECL(dhcp_control
isc_result_t dhcp_shared_network_lookup(omapi_object_t **, omapi_object_t *, omapi_object_t *)
Definition: comapi.c:884
int find_hosts_by_haddr(struct host_decl **, int, const unsigned char *, unsigned, const char *, int)
Definition: mdb.c:610
int wanted_ia_na
Definition: dhclient.c:103
int parse_lbrace(struct parse *)
Definition: confpars.c:1925
int refcnt
Definition: dhcpd.h:1704
void state_reboot(void *)
Definition: dhclient.c:1480
#define jrefproto
Definition: osdep.h:200
void dhcp4o6_start(void)
void make_decline(struct client_state *, struct client_lease *)
Definition: dhclient.c:3665
int logged
Definition: dhcpd.h:1720
struct dhc6_ia * bindings
Definition: dhcpd.h:1163
TIME next_MRD
Definition: dhcpd.h:1312
int(* dhcp_interface_discovery_hook)(struct interface_info *)
Definition: discover.c:49
void if_deregister_receive(struct interface_info *)
void convert_host_name(struct parse *, jrefproto)
char * piaddrcidr(const struct iaddr *, unsigned int)
Definition: inet.c:637
int option_cache_reference(struct option_cache **, struct option_cache *, const char *, int)
Definition: alloc.c:651
int evaluate_boolean_expression(int *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct expression *)
Definition: tree.c:694
int packet_reference(struct packet **, struct packet *, const char *, int)
Definition: alloc.c:1053
void state_selecting(void *)
Definition: dhclient.c:1570
void db_startup(int)
Definition: dhclient.c:1982
void dhcp_failover_recover_done(void *)
u_int8_t flags
Definition: dhcpd.h:1132
isc_result_t write_client6_lease(struct client_state *client, struct dhc6_lease *lease, int rewrite, int sync)
Definition: dhclient.c:4102
isc_result_t restore_parse_state(struct parse *cfile)
Definition: conflex.c:159
isc_result_t(* dhcp_interface_startup_hook)(struct interface_info *)
Definition: discover.c:50
struct expression * expression
Definition: dhcpd.h:388
struct permit * prohibit_list
Definition: dhcpd.h:1710
int is_compound_expression(struct expression *)
Definition: tree.c:3097
Definition: dhcpd.h:549
u_int8_t refresh_type
Definition: dhcpd.h:1294
void free_expression(struct expression *, const char *, int)
Definition: alloc.c:474
void parse_client_lease_statement(struct parse *, int)
Definition: clparse.c:1137
int addr_eq(struct iaddr, struct iaddr)
Definition: inet.c:166
struct parse * saved_state
Definition: dhcpd.h:332
void save_hashed_option(struct universe *, struct option_state *, struct option_cache *, isc_boolean_t appendp)
Definition: options.c:2684
void forget_zone(struct dns_zone **)
void script_write_params(struct client_state *, const char *, struct client_lease *)
Definition: dhclient.c:4472
failover_option_t null_failover_option
void reinitialize_interfaces(void)
Definition: discover.c:1014
int evaluate_data_expression(struct data_string *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct expression *, const char *, int)
Definition: tree.c:1126
isc_result_t decline_leases(struct ia_xx *ia)
Definition: mdb6.c:2189
void get_hw_addr(struct interface_info *info)
caddr_t waiters
Definition: dhcpd.h:1464
char * filename
Definition: dhcpd.h:1112
void(* tvref_t)(void *, void *, const char *, int)
Definition: dhcpd.h:1414
const char * binding_state_print(enum failover_state state)
Definition: failover.c:6472
void mark_interfaces_unavailable(void)
Definition: mdb6.c:2347
struct option_state * options
Definition: dhcpd.h:449
void parse_client_statement(struct parse *, struct interface_info *, struct client_config *)
Definition: clparse.c:435
isc_result_t enter_class(struct class *, int, int)
Definition: mdb.c:72
int hashed_option_state_dereference(struct universe *, struct option_state *, const char *, int)
Definition: options.c:2848
Definition: dhcpd.h:288
void ddns_cb_free(dhcp_ddns_cb_t *ddns_cb, const char *file, int line)
isc_boolean_t ia_equal(const struct ia_xx *a, const struct ia_xx *b)
Definition: mdb6.c:517
unsigned long ttl
Definition: dhcpd.h:1773
Definition: tree.h:302
int db_printable_len(const unsigned char *, unsigned)
unsigned length
Definition: dhcpd.h:280
unsigned char dhcpv6_hop_count
Definition: dhcpd.h:417
char * name
Definition: dhcpd.h:1070
LEASE_STRUCT free
Definition: dhcpd.h:1002
void parse_failover_state_declaration(struct parse *, dhcp_failover_state_t *)
isc_result_t dhcp_failover_send_bind_ack(dhcp_failover_state_t *, failover_message_t *, int, const char *)
int low_threshold
Definition: dhcpd.h:1018
struct client_lease * new_client_lease(const char *, int)
struct name_server * next
Definition: dhcpd.h:354
void * lease
Definition: dhcpd.h:1789
void maybe_setup_fallback(void)
struct dhc6_lease * held_leases
Definition: dhcpd.h:1300
unsigned char dhcpv6_msg_type
Definition: dhcpd.h:411
int locate_network(struct packet *)
Definition: dhcp.c:5163
void free_name_server(struct name_server *, const char *, int)
Definition: alloc.c:292
isc_boolean_t lease6_exists(const struct ipv6_pool *pool, const struct in6_addr *addr)
Definition: mdb6.c:1344
unsigned char iaid[4]
Definition: dhcpd.h:1143
tvref_t ref
Definition: dhcpd.h:1421
TIME MRT
Definition: dhcpd.h:1310
int write_leases6(void)
struct interface_info * fallback_interface
Definition: discover.c:42
int eol_token
Definition: dhcpd.h:295
int binding_value_dereference(struct binding_value **, const char *, int)
Definition: tree.c:652
void if_deregister_send(struct interface_info *)
size_t rbuf_len
Definition: dhcpd.h:1378
isc_result_t dhcp_failover_send_poolresp(dhcp_failover_state_t *, int)
isc_boolean_t is_cidr_mask_valid(const struct iaddr *addr, int bits)
Definition: inet.c:303
int group_allocate(struct group **, const char *, int)
Definition: alloc.c:145
#define DHCP_MAXNS
Definition: isclib.h:107
const char * dhcp_flink_state_names[]
isc_result_t dhcp_failover_link_destroy(omapi_object_t *, const char *, int)
int save_option_buffer(struct universe *, struct option_state *, struct buffer *, unsigned char *, unsigned, unsigned, int)
Definition: options.c:2390
int parse_option_buffer(struct option_state *, const unsigned char *, unsigned, struct universe *)
Definition: options.c:117
int client_port
Definition: dhcpd.h:431
void convert_subnet_statement(struct parse *, jrefproto)
int binding_scope_dereference(struct binding_scope **, const char *, int)
Definition: tree.c:3786
int parse_semi(struct parse *)
Definition: parse.c:135
void indent_spaces(FILE *, int)
Definition: print.c:1288
int option_state_dereference(struct option_state **, const char *, int)
Definition: alloc.c:911
int enter_dns_host(struct dns_host_entry **, const char *)
Definition: tree.c:204
void dhcprelease(struct packet *, int)
Definition: dhcp.c:802
void send_discover(void *)
Definition: dhclient.c:2644
int remote_id_len
Definition: dhcpd.h:443
void dhcp(struct packet *)
Definition: dhclient.c:2020
isc_result_t icmp_echoreply(omapi_object_t *)
Definition: icmp.c:205
void parse_ia_ta_declaration(struct parse *)
Definition: confpars.c:5153
int parse_if_statement(struct executable_statement **, struct parse *, int *)
Definition: parse.c:3335
struct executable_statement * statements
Definition: dhcpd.h:934
void convert_num(struct parse *, unsigned char *, const char *, int, unsigned)
Definition: parse.c:836
struct option_state * options
Definition: dhcpd.h:661
void lc_delete_all(struct leasechain *lc)
OMAPI_OBJECT_PREAMBLE
Definition: dhcpd.h:557
void convert_ip_addr_or_hostname(struct parse *, jrefproto, int)
isc_result_t binding_scope_stuff_values(omapi_object_t *, struct binding_scope *)
Definition: omapi.c:2541
void dhcid_tolease(struct data_string *, struct data_string *)
void get_server_source_address(struct in_addr *from, struct option_state *options, struct option_state *out_options, struct packet *packet)
Definition: dhcp.c:5288
int executable_statement_allocate(struct executable_statement **, const char *, int)
Definition: alloc.c:958
int dns_zone_allocate(struct dns_zone **, const char *, int)
Definition: alloc.c:1134
int buffer_dereference(struct buffer **, const char *, int)
Definition: alloc.c:726
const char * dhcp_failover_message_name(unsigned)
void interface_trace_setup(void)
isc_result_t dhcp_failover_state_transition(dhcp_failover_state_t *, const char *)
void convert_statement(struct parse *)
u_int32_t fto_allowed[]
void parse_string_list(struct parse *, struct string_list **, int)
Definition: clparse.c:2233
int fqdn6_option_space_encapsulate(struct data_string *result, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct universe *universe)
Definition: options.c:3437
struct dhcp_packet * raw
Definition: dhcpd.h:406
isc_result_t dhcp_failover_state_destroy(omapi_object_t *, const char *, int)
isc_result_t decline_lease6(struct ipv6_pool *pool, struct iasubopt *lease)
Definition: mdb6.c:1597
void dump_subnets(void)
Definition: mdb.c:2901
size_t rbuf_offset
Definition: dhcpd.h:1377
int parse_executable_statements(struct executable_statement **, struct parse *, int *, enum expression_context)
Definition: parse.c:2113
enum dhcp_token next_raw_token(const char **rval, unsigned *rlen, struct parse *cfile)
Definition: conflex.c:380
isc_result_t interface_destroy(omapi_object_t *, const char *, int)
isc_result_t dhcp_group_lookup(omapi_object_t **, omapi_object_t *, omapi_object_t *)
Definition: comapi.c:334
struct iaddr subnet_number(struct iaddr, struct iaddr)
Definition: inet.c:34
isc_result_t dhcp_shared_network_create(omapi_object_t **, omapi_object_t *)
Definition: comapi.c:897
void pool_timer(void *)
Definition: mdb.c:1882
int binding_value_reference(struct binding_value **, struct binding_value *, const char *, int)
Definition: alloc.c:520
int fundef_allocate(struct fundef **, const char *, int)
Definition: alloc.c:572
void free_lease_state(struct lease_state *, const char *, int)
Definition: salloc.c:198
unsigned cons_agent_information_options(struct option_state *, struct dhcp_packet *, unsigned, unsigned)
Definition: dhclient.c:5058
isc_result_t dhcp_subnet_stuff_values(omapi_object_t *, omapi_object_t *, omapi_object_t *)
Definition: comapi.c:699
int make_substring(struct expression **, struct expression *, struct expression *, struct expression *)
Definition: tree.c:313
int parse_ip6_prefix(struct parse *, struct iaddr *, u_int8_t *)
Definition: parse.c:475
group_hash_t * group_name_hash
Definition: memory.c:32
struct option_state * options
Definition: dhcpd.h:1165
int find_hosts6(struct host_decl **host, struct packet *packet, const struct data_string *client_id, char *file, int line)
Definition: mdb6.c:2771
int fundef_reference(struct fundef **, struct fundef *, const char *, int)
Definition: alloc.c:586
int parse_option_data(struct expression **expr, struct parse *cfile, int lookups, struct option *option)
Definition: parse.c:4808
void postdb_startup(void)
Definition: dhcpd.c:1266
int setup_fallback(struct interface_info **, const char *, int)
Definition: discover.c:995
int evaluate_expression(struct binding_value **, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct expression *, const char *, int)
Definition: tree.c:500
void bind_lease(struct client_state *)
Definition: dhclient.c:1824
isc_result_t mark_lease_unavailble(struct ipv6_pool *pool, const struct in6_addr *addr)
isc_result_t dhcp_interface_destroy(omapi_object_t *, const char *, int)
Definition: discover.c:1206
isc_result_t dhcp_subclass_lookup(omapi_object_t **, omapi_object_t *, omapi_object_t *)
Definition: omapi.c:2351
isc_result_t ipv6_pool_allocate(struct ipv6_pool **pool, u_int16_t type, const struct in6_addr *start_addr, int bits, int units, const char *file, int line)
Create a new IPv6 lease pool structure.
Definition: mdb6.c:635
int linked_option_get(struct data_string *, struct universe *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct option_state *, struct binding_scope **, unsigned)
omapi_object_type_t * dhcp_type_failover_listener
int(* dhcp_interface_shutdown_hook)(struct interface_info *)
Definition: discover.c:51
int get_option(struct data_string *, struct universe *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct option_state *, struct binding_scope **, unsigned, const char *, int)
Definition: options.c:2168
void relinquish_timeouts(void)
failover_option_t skip_failover_option
void change_host_uid(struct host_decl *host, const char *data, int len)
Definition: mdb.c:184
isc_result_t readconf(void)
Definition: confpars.c:64
int dhcp_option_default_priority_list_count
void if_deregister6(struct interface_info *info)
struct string_list * medium
Definition: dhcpd.h:1240
isc_result_t release_lease6(struct ipv6_pool *pool, struct iasubopt *lease)
Definition: mdb6.c:1622
int subnet_inner_than(const struct subnet *, const struct subnet *, int)
Definition: mdb.c:954
void skip_to_semi(struct parse *)
Definition: parse.c:77
void schedule_lease_timeout(struct ipv6_pool *pool)
Definition: mdb6.c:1986
struct enumeration_value * find_enumeration_value(const char *, int, unsigned *, const char *)
Definition: parse.c:54
char * name
Definition: dhcpd.h:1263
isc_result_t dhcp_failover_listen(omapi_object_t *)
isc_result_t dhcp_lease_signal_handler(omapi_object_t *, const char *, va_list)
Definition: omapi.c:541
int lease_id_format
Definition: dhcpd.c:84
struct universe ** universes
Definition: tables.c:963
isc_result_t dhcp_host_set_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_typed_data_t *)
Definition: omapi.c:926
unsigned packet_length
Definition: dhcpd.h:1288
isc_result_t dhcp_group_signal_handler(omapi_object_t *, const char *, va_list)
Definition: comapi.c:257
void suboption_foreach(struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *, void(*)(struct option_cache *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *), struct option_cache *, const char *)
void destroy_client_lease(struct client_lease *)
Definition: dhclient.c:3782
void dispatch(void)
Definition: dispatch.c:109
char * print_hex(unsigned, const u_int8_t *, unsigned, unsigned)
Definition: print.c:444
time_t hard_lifetime_end_time
Definition: dhcpd.h:1612
int refcnt
Definition: dhcpd.h:386
struct universe fqdn_universe
Definition: tables.c:310
void save_option(struct universe *, struct option_state *, struct option_cache *)
Definition: options.c:2663
void make_release(struct client_state *, struct client_lease *)
Definition: dhclient.c:3725
int store_options(int *ocount, unsigned char *buffer, unsigned buflen, unsigned index, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, unsigned *priority_list, int priority_len, unsigned first_cutoff, int second_cutoff, int terminate, const char *vuname)
Definition: options.c:1123
void set_time(TIME)
Definition: dispatch.c:36
isc_result_t dhcp_failover_state_remove(omapi_object_t *, omapi_object_t *)
isc_result_t dhcp_lease_remove(omapi_object_t *, omapi_object_t *)
Definition: omapi.c:920
isc_result_t dhcp_failover_set_state(dhcp_failover_state_t *, enum failover_state)
struct permit * prohibit_list
Definition: dhcpd.h:999
struct lease * lease
Definition: dhcpd.h:1411
TIME expiry
Definition: dhcpd.h:1109
void if_register_linklocal6(struct interface_info *info)
Definition: tree.h:346
void build_server_oro(struct data_string *, struct option_state *, const char *, int)
Definition: options.c:2598
isc_result_t dhcp_failover_process_bind_ack(dhcp_failover_state_t *, failover_message_t *)
int parse_option_list(struct parse *, struct option ***)
Definition: clparse.c:912
lease_id_hash_t extern struct option * vendor_cfg_option
Definition: dhcpd.h:1820
int parse_option_statement(struct executable_statement **, struct parse *, int, struct option *, enum statement_op)
Definition: parse.c:4915
isc_result_t dhcp_control_create(omapi_object_t **, omapi_object_t *)
Definition: comapi.c:589
struct option_state * options
Definition: dhcpd.h:1119
void static_lease_dereference(struct lease *, const char *, int)
void parse_subnet_declaration(struct parse *, struct shared_network *)
Definition: confpars.c:2742
void free_domain_search_list(struct domain_search_list *, const char *, int)
Definition: alloc.c:337
void dhc6_lease_destroy(struct dhc6_lease **src, const char *file, int line)
host_hash_t * host_name_hash
Definition: mdb.c:36
void ia_remove_all_lease(struct ia_xx *ia, const char *file, int line)
Definition: mdb6.c:503
struct option ** requested_options
Definition: dhcpd.h:1206
char * name
Definition: dhcpd.h:1484
TIME after
Definition: dhcpd.h:978
void mark_phosts_unavailable(void)
Definition: mdb6.c:2342
isc_result_t dhcp_failover_state_set_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_typed_data_t *)
void convert_class_decl(struct parse *, jrefproto)
void set_netmask(struct interface_info *, struct in_addr)
u_int16_t bootp_flags
Definition: dhcpd.h:673
struct leasequeue * prev
Definition: dhcpd.h:1409
int circuit_id_len
Definition: dhcpd.h:441
int parse_cshl(struct data_string *, struct parse *)
Definition: parse.c:2036
void write_billing_classes(void)
Definition: db.c:954
char * quotify_string(const char *, const char *, int)
Definition: print.c:33
int max_ack_delay_secs
void lease_remove_all(struct lease **lq)
Definition: mdb.c:2510
isc_result_t new_parse(struct parse **, int, char *, unsigned, const char *, int)
Definition: conflex.c:41
ssize_t send_fallback6(struct interface_info *, struct packet *, struct dhcp_packet *, size_t, struct in6_addr *, struct sockaddr_in6 *, struct hardware *)
isc_result_t delete_host(struct host_decl *, int)
Definition: mdb.c:468
void send_request(void *)
Definition: dhclient.c:2884
void enter_shared_network(struct shared_network *)
Definition: mdb.c:1033
void dhcp_failover_pool_rebalance(void *)
isc_result_t dhcp_failover_generate_update_queue(dhcp_failover_state_t *, int)
void state_requesting(void *)
isc_result_t dhcp_shared_network_remove(omapi_object_t *, omapi_object_t *)
Definition: comapi.c:903
Definition: dhcpd.h:993
int dns_zone_dereference(struct dns_zone **, const char *, int)
Definition: dns.c:736
isc_result_t cleanup_lease6(ia_hash_t *ia_table, struct ipv6_pool *pool, struct iasubopt *lease, struct ia_xx *ia)
Cleans up leases when reading from a lease file.
Definition: mdb6.c:1124
int execute_statements(struct binding_value **result, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct executable_statement *, struct on_star *)
Definition: execute.c:34
void abandon_lease(struct lease *, const char *)
Definition: mdb.c:1808
int addr_and(struct iaddr *result, const struct iaddr *a1, const struct iaddr *a2)
Definition: inet.c:267
int universe_max
Definition: tables.c:964
uid_t set_uid
struct dns_answer * answer
Definition: dhcpd.h:1468
binding_state_t binding_state
Definition: dhcpd.h:619
isc_timer_t * isc_timeout
Definition: dhcpd.h:1423
int parse_key(struct parse *)
Definition: parse.c:2992
u_int8_t offer
Definition: dhcpd.h:678
int options_valid
Definition: dhcpd.h:430
gid_t set_gid
int parse_string(struct parse *, char **, unsigned *)
Definition: parse.c:152
dns_rdataclass_t dhcid_class
Definition: dhcpd.h:1795
struct dns_query * next
Definition: dhcpd.h:1459
int option_reference(struct option **dest, struct option *src, const char *file, int line)
Definition: tables.c:980
void parse_vendor_option(struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *out_options, struct binding_scope **scope)
Parse a vendor option (option 43)
Definition: options.c:4404
ia_hash_t * ia_na_active
struct ipv6_pool * ipv6_pool
Definition: dhcpd.h:1617
int parse_options(struct packet *)
Definition: options.c:47
isc_result_t dhcp_failover_put_message(dhcp_failover_link_t *, omapi_object_t *, int, u_int32_t,...)
int parse_allow_deny(struct option_cache **, struct parse *, int)
Definition: clparse.c:2347
int option_cache_allocate(struct option_cache **, const char *, int)
Definition: alloc.c:630
int packet6_len_okay(const char *, int)
Definition: options.c:3978
isc_result_t dhcp_failover_state_get_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_value_t **)
struct auth_key * key
Definition: dhcpd.h:1489
void dhcp_failover_rescind_updates(dhcp_failover_state_t *)
int dns_host_entry_dereference(struct dns_host_entry **, const char *, int)
Definition: alloc.c:813
struct eventqueue * next
Definition: dhcpd.h:1427
TIME timeout
Definition: dhcpd.h:1782
int addr_cmp(const struct iaddr *a1, const struct iaddr *a2)
Definition: inet.c:211
char * default_option_format
Definition: tables.c:976
isc_result_t dhcp_control_remove(omapi_object_t *, omapi_object_t *)
Definition: comapi.c:596
void script_write_requested(struct client_state *)
Definition: dhclient.c:4592
struct interface_info * interface
Definition: dhcpd.h:433
void(* handler)(void *)
Definition: dhcpd.h:1428
void dhcp_failover_listener_restart(void *)
isc_result_t dhcp_failover_process_update_request_all(dhcp_failover_state_t *, failover_message_t *)
void postconf_initialization(int)
Definition: dhcpd.c:957
int require_all_ias
Definition: dhclient.c:106
isc_result_t dhcp_failover_send_disconnect(omapi_object_t *, int, const char *)
omapi_object_type_t * dhcp_type_control
ssize_t send_packet6(struct interface_info *, const unsigned char *, size_t, struct sockaddr_in6 *)
isc_result_t dhcp_failover_peer_state_changed(dhcp_failover_state_t *, failover_message_t *)
struct dhcp_ddns_cb * next_op
Definition: dhcpd.h:1786
TIME valid_until
Definition: dhcpd.h:1012
unsigned circuit_id_len
Definition: dhcpd.h:1364
struct group * next
Definition: dhcpd.h:927
int find_matching_case(struct executable_statement **, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct expression *, struct executable_statement *)
Definition: execute.c:1034
isc_result_t dhcp_failover_process_update_request(dhcp_failover_state_t *, failover_message_t *)
void save_linked_option(struct universe *, struct option_state *, struct option_cache *, isc_boolean_t appendp)
Definition: options.c:3712
char * print_dec_1(unsigned long)
Definition: print.c:512
void convert_servername_decl(struct parse *, jrefproto)
trace_type_t * inpacket_trace
const char * prefix
Definition: dhcpd.h:1332
struct expression * expr
Definition: dhcpd.h:1086
void enter_lease(struct lease *)
Definition: mdb.c:1090
isc_result_t renew_leases(struct ia_xx *ia)
Definition: mdb6.c:2173
Definition: dhcpd.h:405
int socket
Definition: dhcpd.h:1495
int parse_numeric_expression(struct expression **, struct parse *, int *)
Definition: parse.c:3565
int write_server_duid(void)
struct pool * pool
Definition: dhcpd.h:574
void assemble_hw_header(struct interface_info *, unsigned char *, unsigned *, struct hardware *)
char * name
Definition: dhcpd.h:942
void commit_leases_timeout(void *)
Definition: db.c:1003
struct option_cache * lookup_fqdn6_option(struct universe *universe, struct option_state *options, unsigned code)
Definition: options.c:3380
int make_const_int(struct expression **, unsigned long)
Definition: tree.c:254
isc_result_t dhcp_class_set_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_typed_data_t *)
Definition: omapi.c:1948
int dns_host_entry_allocate(struct dns_host_entry **, const char *, const char *, int)
Definition: alloc.c:768
void unregister_eventhandler(struct eventqueue **, void(*handler)(void *))
Definition: dispatch.c:70
int find_lease_by_hw_addr(struct lease **, const unsigned char *, unsigned, const char *, int)
Definition: mdb.c:2035
int if_register_lpf(struct interface_info *)
omapi_object_type_t * dhcp_type_subclass
Definition: omapi.c:49
isc_result_t dhcp_subclass_get_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_value_t **)
Definition: omapi.c:2299
dhcp_shutdown_state
Definition: dhcpd.h:269
void do_release(struct client_state *)
Definition: dhclient.c:4868
int linked_option_space_encapsulate(struct data_string *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *)
Definition: options.c:3756
host_hash_t * host_hw_addr_hash
Definition: mdb.c:34
int dhcp_failover_queue_ack(dhcp_failover_state_t *, failover_message_t *msg)
dhcp_failover_listener_t
Definition: dhcpd.h:3686
u_int8_t plen
Definition: dhcpd.h:1609
TIME atsfp
Definition: dhcpd.h:635
int parse_switch_statement(struct executable_statement **, struct parse *, int *)
Definition: parse.c:3220
int tline
Definition: dhcpd.h:319
int authoritative
Definition: dhcpd.h:933
isc_result_t interface_set_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_typed_data_t *)
void delete_hashed_option(struct universe *, struct option_state *, int)
Definition: options.c:2763
u_int8_t * data
Definition: dhcpd.h:281
void parse_pool_statement(struct parse *, struct group *, int)
Parse a pool statement.
Definition: confpars.c:1716
int clone_group(struct group **, struct group *, const char *, int)
Definition: memory.c:130
struct iaddr ip_addr(struct iaddr, struct iaddr, u_int32_t)
Definition: inet.c:63
const char * path_dhcpd_pid
Definition: dhcpd.c:88
struct lease * n_hw
Definition: dhcpd.h:563
int free_leases
Definition: dhcpd.h:1008
Definition: ip.h:47
const char * name
Definition: dhcpd.h:1055
ssize_t send_packet(struct interface_info *, struct packet *, struct dhcp_packet *, size_t, struct in_addr, struct sockaddr_in *, struct hardware *)
isc_result_t dhcp_failover_link_signal(omapi_object_t *, const char *, va_list)
struct lease * n_uid
Definition: dhcpd.h:563
void convert_host_decl(struct parse *, jrefproto)
struct dhc6_lease * advertised_leases
Definition: dhcpd.h:1298
pair cons(caddr_t, pair)
Definition: tree.c:137
int refcnt
Definition: dhcpd.h:1640
TIME starts
Definition: dhcpd.h:566
const char * dhcp_failover_state_name_print(enum failover_state)
int parse_ip_addr_with_subnet(struct parse *, struct iaddrmatch *)
Definition: parse.c:518
int evaluate_boolean_option_cache(int *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct option_cache *, const char *, int)
Definition: tree.c:2733
omapi_object_type_t * dhcp_type_host
Definition: mdb.c:70
struct expression * submatch
Definition: dhcpd.h:1090
isc_result_t dhcp_subclass_stuff_values(omapi_object_t *, omapi_object_t *, omapi_object_t *)
Definition: omapi.c:2334
int db_time_format
Definition: print.c:31
isc_result_t dhcp_subnet_destroy(omapi_object_t *, const char *, int)
Definition: comapi.c:653
u_int8_t flags
Definition: dhcpd.h:587
void hashed_option_space_foreach(struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *, void(*)(struct option_cache *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *))
int(* group_write_hook)(struct group_object *)
Definition: memory.c:33
isc_result_t got_one_v6(omapi_object_t *)
binding_state_t normal_binding_state_transition_check(struct lease *, dhcp_failover_state_t *, binding_state_t, u_int32_t)
void start_confirm6(struct client_state *client)
struct in_addr giaddr
Definition: dhclient.c:74
struct hardware * haddr
Definition: dhcpd.h:435
void set_server_duid(struct data_string *new_duid)
isc_result_t dhcid_fromlease(struct data_string *, struct data_string *)
int executable_statement_dereference(struct executable_statement **, const char *, int)
Definition: execute.c:622
isc_result_t add_ipv6_pool(struct ipv6_pool *pool)
Definition: mdb6.c:1845
int tlen
Definition: dhcpd.h:323
u_int32_t max_life
Definition: dhcpd.h:1136
struct dhcp_ddns_cb dhcp_ddns_cb_t
int addr_match(struct iaddr *, struct iaddrmatch *)
Definition: inet.c:184
struct permit * next
Definition: dhcpd.h:966
struct client_lease * next
Definition: dhcpd.h:1108
void ddns_cancel(dhcp_ddns_cb_t *ddns_cb, const char *file, int line)
isc_result_t create_lease6(struct ipv6_pool *pool, struct iasubopt **addr, unsigned int *attempts, const struct data_string *uid, time_t soft_lifetime_end_time)
Definition: mdb6.c:953
int lease_count
Definition: dhcpd.h:1007
int parse_boolean_expression(struct expression **, struct parse *, int *)
Definition: parse.c:3471
u_int32_t prefer
Definition: dhcpd.h:1614
isc_result_t dhcp_lease_lookup(omapi_object_t **, omapi_object_t *, omapi_object_t *)
Definition: omapi.c:748
void parse_reject_statement(struct parse *, struct client_config *)
Definition: clparse.c:2283
struct host_decl * n_ipaddr
Definition: dhcpd.h:940
isc_result_t dhcp_failover_link_stuff_values(omapi_object_t *, omapi_object_t *, omapi_object_t *)
TIME valid_until
Definition: dhcpd.h:1712
int bits
Definition: dhcpd.h:1677
struct option_state * sent_options
Definition: dhcpd.h:1269
int dns_zone_reference(struct dns_zone **, struct dns_zone *, const char *, int)
Definition: alloc.c:1166
enum permit::@0 type
isc_result_t dhcp_pool_stuff_values(omapi_object_t *, omapi_object_t *, omapi_object_t *)
Definition: omapi.c:1719
long int sort_tiebreaker
Definition: dhcpd.h:568
TIME parse_date(struct parse *)
Definition: parse.c:1184
char * format_lease_id(const unsigned char *s, unsigned len, int format, const char *file, int line)
Definition: print.c:1600
int jumbo_range
Definition: dhcpd.h:1722
enum dhcp_token next_token(const char **, unsigned *, struct parse *)
Definition: conflex.c:369
struct lease * lc_get_first_lease(struct leasechain *lc)
int refcnt
Definition: dhcpd.h:1607
void uid_hash_delete(struct lease *)
Definition: mdb.c:2169
int main(int, char **)
Definition: dhclient.c:205
dhcp_failover_state_t * failover_states
isc_result_t dhcp_subclass_remove(omapi_object_t *, omapi_object_t *)
Definition: omapi.c:2378
int free_bindings(struct binding_scope *, const char *, int)
Definition: tree.c:3770
int make_let(struct executable_statement **, const char *)
Definition: tree.c:377
int load_balance_mine(struct packet *, dhcp_failover_state_t *)
unsigned char option_mask[16]
Definition: dhcpd.h:1502
void parse_shared_net_declaration(struct parse *, struct group *)
Definition: confpars.c:2585
void convert_class_statement(struct parse *, jrefproto, int)
int packet_type
Definition: dhcpd.h:409
void dhcp_failover_link_startup_timeout(void *)
isc_result_t dhcp_control_get_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_value_t **)
Definition: comapi.c:470
void convert_hardware_decl(struct parse *, jrefproto)
struct name_server * first_name_server(void)
Definition: resolv.c:170
u_int16_t remote_port
Definition: dhclient.c:92
struct client_state * client
Definition: dhcpd.h:1331
isc_result_t dhcp_interface_set_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_typed_data_t *)
Definition: discover.c:1161
iasubopt_hash_t * leases
Definition: dhcpd.h:1679
isc_result_t dhcp_pool_remove(omapi_object_t *, omapi_object_t *)
Definition: omapi.c:1783
int permitted(struct packet *, struct permit *)
Definition: dhcp.c:4978
struct option_state * options
Definition: dhcpd.h:1151
int refcnt
Definition: dhcpd.h:929
void free_universe(struct universe *, const char *, int)
Definition: alloc.c:329
int omapi_port
Definition: dhcpd.h:1244
struct option * option
Definition: dhcpd.h:389
void rewrite_client_leases(void)
Definition: dhclient.c:3796
void trigger_event(struct eventqueue **)
Definition: dispatch.c:91
int nwip_option_space_encapsulate(struct data_string *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *)
Definition: options.c:3137
struct dhc6_lease * selected_lease
Definition: dhcpd.h:1299
isc_result_t dhcp_shared_network_get_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_value_t **)
Definition: comapi.c:774
void unbill_class(struct lease *)
Definition: dhclient.c:1417
int lease_limit
Definition: dhcpd.h:1073
void set_server_duid_type(int type)
int max_ack_delay_usecs
control_object_state_t
Definition: dhcpd.h:519
dhcp_type_control int option_chain_head_allocate(struct option_chain_head **, const char *, int)
Definition: alloc.c:35
void dhcp_db_objects_setup(void)
Definition: omapi.c:57
isc_sockaddrlist_t zone_server_list
Definition: dhcpd.h:1776
int option_chain_head_reference(struct option_chain_head **, struct option_chain_head *, const char *, int)
Definition: alloc.c:67
void repudiate_zone(struct dns_zone **)
int num_iasubopt
Definition: dhcpd.h:1643
isc_result_t dhcp_subclass_destroy(omapi_object_t *, const char *, int)
struct ipv6_pool ** ipv6_pools
Definition: dhcpd.h:1714
char * print_hw_addr(const int, const int, const unsigned char *)
struct option_tag * first
Definition: dhcpd.h:382
u_int16_t ia_type
Definition: dhcpd.h:1642
void dhcpnak(struct packet *)
Definition: dhclient.c:2565
isc_result_t write_named_billing_class(const void *, unsigned, void *)
Definition: db.c:858
int universe_count
Definition: tables.c:964
isc_result_t interface_initialize(omapi_object_t *, const char *, int)
Definition: discover.c:121
struct subnet * subnet
Definition: dhcpd.h:573
binding_state_t state
Definition: dhcpd.h:1610
struct universe * new_universe(const char *, int)
Definition: tree.h:288
isc_result_t interface_stuff_values(omapi_object_t *, omapi_object_t *, omapi_object_t *)
struct class * classes
Definition: dhcpd.h:1056
int parse_destination_descriptor(struct parse *, struct iaddr *)
Definition: parse.c:350
int make_host_lookup(struct expression **, const char *)
Definition: tree.c:188
void new_address_range(struct parse *, struct iaddr, struct iaddr, struct subnet *, struct pool *, struct lease **)
Definition: mdb.c:760
isc_result_t find_failover_peer(dhcp_failover_state_t **, const char *, const char *, int)
void add_route_net(struct interface_info *, struct in_addr, struct in_addr)
unsigned short cannot_reuse
Definition: dhcpd.h:649
int option_state_allocate(struct option_state **, const char *, int)
Definition: alloc.c:846
int token_print_indent(FILE *, int, int, const char *, const char *, const char *)
Definition: print.c:1250
const char * path_dhclient_conf
Definition: dhclient.c:56
int interfaces_requested
Definition: dhclient.c:68
unsigned char dhcp4o6_flags[3]
Definition: dhcpd.h:425
u_int32_t flags
Definition: dhcpd.h:1384
struct shared_network * shared_network
Definition: dhcpd.h:1043
u_int16_t validate_port(char *)
Definition: inet.c:659
void parse_lease_time(struct parse *, TIME *)
Definition: parse.c:686
isc_result_t ipv6_pool_dereference(struct ipv6_pool **pool, const char *file, int line)
de-reference an IPv6 pool structure.
Definition: mdb6.c:772
isc_result_t find_ipv6_pool(struct ipv6_pool **pool, u_int16_t type, const struct in6_addr *addr)
Definition: mdb6.c:2112
int refcnt
Definition: dhcpd.h:1482
int write_leases(void)
Definition: mdb.c:2402
int prefix_len
Definition: dhcpd.h:1048
int find_hosts_by_uid(struct host_decl **, const unsigned char *, unsigned, const char *, int)
Definition: mdb.c:630
struct interface_info * interfaces
Definition: discover.c:42
int parse_option_decl(struct option_cache **, struct parse *)
Definition: parse.c:5263
struct timeout * next
Definition: dhcpd.h:1417
void print_expression(const char *, struct expression *)
isc_result_t dhcp_control_stuff_values(omapi_object_t *, omapi_object_t *, omapi_object_t *)
Definition: comapi.c:525
int fqdn_universe_decode(struct option_state *, const unsigned char *, unsigned, struct universe *)
Definition: options.c:345
int write_group(struct group_object *)
Definition: db.c:449
isc_result_t delete_class(struct class *, int)
Definition: mdb.c:436
int make_encapsulation(struct expression **, struct data_string *)
Definition: tree.c:298
isc_result_t enter_failover_peer(dhcp_failover_state_t *)
struct group * group
Definition: dhcpd.h:1049
u_int32_t rebind
Definition: dhcpd.h:1148
u_int32_t last_xid
Definition: dhcpd.h:637
struct subnet * next_subnet
Definition: dhcpd.h:1041
int option_cache_dereference(struct option_cache **, const char *, int)
Definition: options.c:2798
void dhcpv4_client_assignments(void)
Definition: dhclient.c:5534
isc_boolean_t ipv6_in_pool(const struct in6_addr *addr, const struct ipv6_pool *pool)
Definition: mdb6.c:2094
void convert_shared_net_statement(struct parse *, jrefproto)
int v6address_count
Definition: dhcpd.h:1357
isc_result_t free_iaddrcidrnetlist(struct iaddrcidrnetlist **result)
Definition: inet.c:503
void free_pair(pair, const char *, int)
Definition: alloc.c:400
int binding_value_allocate(struct binding_value **, const char *, int)
Definition: alloc.c:500
void delete_fqdn6_option(struct universe *universe, struct option_state *options, int code)
Definition: options.c:3401
isc_uint64_t num_active
Definition: dhcpd.h:1680
struct option ** required_options
Definition: dhcpd.h:1205
ssize_t decode_ethernet_header(struct interface_info *, unsigned char *, unsigned, struct hardware *)
omapi_object_type_t * dhcp_type_class
Definition: omapi.c:48
struct dhc6_addr * addrs
Definition: dhcpd.h:1149
int zone_addr_count
Definition: dhcpd.h:1778
void convert_filename_decl(struct parse *, jrefproto)
int token_print_indent_concat(FILE *, int, int, const char *, const char *,...)
Definition: print.c:1169
char * name
Definition: dhcpd.h:918
struct dhcp_packet * new_dhcp_packet(const char *, int)
int make_concat(struct expression **, struct expression *, struct expression *)
Definition: tree.c:268
omapi_object_type_t * dhcp_type_group
int length
Definition: dhcpd.h:381
TIME retry_interval
Definition: dhcpd.h:1215
void write_client_pid_file(void)
Definition: dhclient.c:4807
isc_result_t dhcp_subnet_lookup(omapi_object_t **, omapi_object_t *, omapi_object_t *)
Definition: comapi.c:723
void cleanup(void)
char * token_line
Definition: dhcpd.h:291
int(* dhcp_interface_setup_hook)(struct interface_info *, struct iaddr *)
Definition: discover.c:48
int parse_base64(struct data_string *, struct parse *)
Definition: parse.c:1895
void add_timeout(struct timeval *, void(*)(void *), void *, tvref_t, tvunref_t)
Definition: dispatch.c:198
struct shared_network * shared_network
Definition: dhcpd.h:932
dhcp_token
Definition: dhctoken.h:34
void make_request(struct client_state *, struct client_lease *)
Definition: dhclient.c:3575
int parse_expression(struct expression **, struct parse *, int *, enum expression_context, struct expression **, enum expr_op)
Definition: parse.c:4497
int if_readsocket(omapi_object_t *)
Definition: discover.c:984
isc_result_t dhcp_lease_get(omapi_object_t **, const char *, int)
int group_reference(struct group **, struct group *, const char *, int)
Definition: alloc.c:177
dhcp_control_object_t * dhcp_control_object
int address_max
Definition: dhcpd.h:1354
isc_result_t dhcp_host_remove(omapi_object_t *, omapi_object_t *)
Definition: omapi.c:1592
TIME cltt
Definition: dhcpd.h:636
struct universe vsio_universe
Definition: tables.c:689
void echo_client_id(struct packet *, struct lease *, struct option_state *, struct option_state *)
Adds a dhcp-client-id option to a set of options Given a set of input options, it searches for echo-c...
Definition: dhcp.c:1990
struct lease ** billed_leases
Definition: dhcpd.h:1075
void dhcpdiscover(struct packet *, int)
Definition: dhcp.c:322
void dhcp_failover_reconnect(void *)
int server_id_check
Definition: dhcpd.c:80
isc_result_t get_client_id(struct packet *, struct data_string *)
const char * path_dhcpd_conf
Definition: dhcpd.c:86
unsigned char * query
Definition: dhcpd.h:1470
void set_broadcast_addr(struct interface_info *, struct in_addr)
void use_host_decl_name(struct packet *, struct lease *, struct option_state *)
Adds hostname option when use-host-decl-names is enabled.
Definition: dhcp.c:5533
struct lease * prev
Definition: dhcpd.h:560
int address_type
Definition: dhcpd.h:1771
Definition: inet.h:31
void delete_linked_option(struct universe *, struct option_state *, int)
Definition: options.c:3792
void dhcp_failover_startup(void)
TIME valid_from
Definition: dhcpd.h:1011
ipv6_pool structure
Definition: dhcpd.h:1673
struct option_cache * secondary
Definition: dhcpd.h:1486
Definition: dhcpd.h:965
int parse_dns_expression(struct expression **, struct parse *, int *)
void convert_host_statement(struct parse *, jrefproto)
u_int8_t * circuit_id
Definition: dhcpd.h:1362
int sv_echo_client_id
Definition: dhcpd.h:474
struct lease * lc_get_next(struct leasechain *lc, struct lease *lp)
void if_register6(struct interface_info *info, int do_multicast)
u_int8_t * circuit_id
Definition: dhcpd.h:440
OMAPI_OBJECT_PREAMBLE
Definition: dhcpd.h:1344
void convert_date(struct parse *, jrefproto, char *)
void set_ip_address(struct interface_info *, struct in_addr)
int find_subnet(struct subnet **, struct iaddr, const char *, int)
Definition: dhclient.c:1422
void option_space_foreach(struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *, void(*)(struct option_cache *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *))
int have_billing_classes
Definition: class.c:41
struct client_lease * active
Definition: dhcpd.h:1275
isc_result_t dhcp_lease_stuff_values(omapi_object_t *, omapi_object_t *, omapi_object_t *)
Definition: omapi.c:563
int data_string_new(struct data_string *, const char *, unsigned int, const char *, int)
Constructs a null-terminated data_string from a char* and length.
Definition: alloc.c:1272
void nak_lease(struct packet *, struct iaddr *cip, struct group *)
Constructs and sends a DHCP Nak.
Definition: dhcp.c:1753
unsigned short uid_len
Definition: dhcpd.h:582
isc_result_t dhcp_class_destroy(omapi_object_t *, const char *, int)
Definition: omapi.c:1984
int refcnt
Definition: dhcpd.h:1674
int parse_X(struct parse *, u_int8_t *, unsigned)
Definition: parse.c:5566
int hashed_option_space_encapsulate(struct data_string *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *)
Definition: options.c:3094
int authenticated
Definition: dhcpd.h:458
int parse_statement(struct parse *, struct group *, int, struct host_decl *, int)
Definition: confpars.c:356
isc_result_t client_dns_update(struct client_state *client, dhcp_ddns_cb_t *ddns_cb)
isc_result_t dhclient_interface_startup_hook(struct interface_info *)
Definition: dhclient.c:4996
struct data_string * dhcp4o6_response
Definition: dhcpd.h:428
isc_result_t release_leases(struct ia_xx *ia)
Definition: mdb6.c:2181
isc_result_t dhcp_group_remove(omapi_object_t *, omapi_object_t *)
Definition: comapi.c:415
struct iaddrcidrnetlist * fixed_prefix
Definition: dhcpd.h:951
void update_partner(struct lease *)
isc_result_t dhcp_failover_send_update_done(dhcp_failover_state_t *)
OMAPI_OBJECT_PREAMBLE
Definition: dhcpd.h:1040
u_int32_t preferred_life
Definition: dhcpd.h:1135
void make_discover(struct client_state *, struct client_lease *)
Definition: dhclient.c:3510
ia_hash_t * ia_pd_active
void start_init6(struct client_state *client)
isc_result_t dns_zone_lookup(struct dns_zone **, const char *)
Definition: dns.c:703
struct group_object * named_group
Definition: dhcpd.h:953
Definition: dhcpd.h:926
struct dhc6_addr * next
Definition: dhcpd.h:1125
int nowait
Definition: dhclient.c:101
isc_result_t ddns_removals(struct lease *, struct iasubopt *, struct dhcp_ddns_cb *, isc_boolean_t)
enum dhcp_shutdown_state shutdown_state
Definition: dhcpd.c:1416
void parse_client_lease_declaration(struct parse *, struct client_lease *, struct interface_info **, struct client_state **)
Definition: clparse.c:1266
void dhcpv6(struct packet *)
isc_result_t dhcp_class_get_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_value_t **)
Definition: omapi.c:1959
int commit_leases_timed(void)
Definition: db.c:1043
expr_op
Definition: tree.h:132
void indent(int)
struct timeval cur_tv
Definition: dispatch.c:35
void trace_ddns_init(void)
isc_result_t ipv6_pond_allocate(struct ipv6_pond **pond, const char *file, int line)
Create a new IPv6 pond structure.
Definition: mdb6.c:2391
int envc
Definition: dhcpd.h:1268
struct auth_key * key
Definition: dhcpd.h:1114
ddns_action_t cur_func
Definition: dhcpd.h:1784
void unconfigure6(struct client_state *client, const char *reason)
void client_dns_remove(struct client_state *client, struct iaddr *addr)
isc_result_t dhcp_pool_signal_handler(omapi_object_t *, const char *, va_list)
Definition: omapi.c:1697
struct shared_network * shared_network
Definition: dhcpd.h:448
char * prev_line
Definition: dhcpd.h:292
int sent
Definition: dhcpd.h:1472
int got_server_identifier
Definition: dhcpd.h:667
struct universe * config_universe
Definition: tables.c:970
void also_save_option(struct universe *, struct option_state *, struct option_cache *)
Definition: options.c:2674
int lease_enqueue(struct lease *)
Definition: mdb.c:2647
void register_eventhandler(struct eventqueue **, void(*handler)(void *))
const char * path_dhclient_pid
Definition: dhclient.c:58
struct executable_statement * statements
Definition: dhcpd.h:1096
int parse_agent_information_option(struct packet *, int, u_int8_t *)
Definition: dhclient.c:5048
binding_state_t rewind_binding_state
Definition: dhcpd.h:622
TIME tstp
Definition: dhcpd.h:633
int peer_wants_lease(struct lease *)
void parse_failover_state(struct parse *, enum failover_state *, TIME *)
isc_uint64_t low_threshold
Definition: dhcpd.h:1721
struct interface_info * next
Definition: dhcpd.h:1345
isc_boolean_t prefix6_exists(const struct ipv6_pool *pool, const struct in6_addr *pref, u_int8_t plen)
Definition: mdb6.c:1804
void dhcp_failover_ack_queue_remove(dhcp_failover_state_t *, struct lease *)
void state_stop(void *)
Definition: dhclient.c:1941
isc_heap_t * inactive_timeouts
Definition: dhcpd.h:1684
isc_result_t dhcp_failover_set_service_state(dhcp_failover_state_t *state)
struct subnet * subnet
Definition: dhcpd.h:931
isc_result_t dhcp_io_shutdown(omapi_object_t *, void *)
Definition: dhcpd.c:1418
void if_register_fallback(struct interface_info *)
int ddns_updates(struct packet *, struct lease *, struct lease *, struct iasubopt *, struct iasubopt *, struct option_state *)
void convert_address_range(struct parse *, jrefproto)
int parse_encapsulated_suboptions(struct option_state *, struct option *, const unsigned char *, unsigned, struct universe *, const char *)
Definition: options.c:316
int interface_max
Definition: discover.c:79
int warnings_occurred
Definition: dhcpd.h:326
int parse_data_expression(struct expression **, struct parse *, int *)
Definition: parse.c:3538
void schedule_all_ipv6_lease_timeouts()
Definition: mdb6.c:2029
struct host_decl * host
Definition: dhcpd.h:572
void make_binding_state_transition(struct lease *)
Definition: mdb.c:1481
int script_go(struct client_state *)
Definition: dhclient.c:4611
int max_message_size
Definition: dhcpd.h:663
struct string_list * next
Definition: dhcpd.h:348
size_t bufsiz
Definition: dhcpd.h:330
void parse_failover_peer(struct parse *, struct group *, int)
#define DHCP_MAXDNS_WIRE
Definition: isclib.h:106
void parse_address_range6(struct parse *cfile, struct group *group, struct ipv6_pond *)
TIME initial_interval
Definition: dhcpd.h:1213
int addr_or(struct iaddr *result, const struct iaddr *a1, const struct iaddr *a2)
Definition: inet.c:238
const char int
Definition: omapip.h:443
size_t nelem
Definition: dhcpd.h:986
isc_result_t iasubopt_dereference(struct iasubopt **iasubopt, const char *file, int line)
Definition: mdb6.c:260
int validate_packet(struct packet *)
Definition: options.c:4324
TIME timeout
Definition: dhcpd.h:1483
void failover_print(char *, unsigned *, unsigned, const char *)
int is_boolean_expression(struct expression *)
Definition: tree.c:3031
int dhcp_failover_queue_update(struct lease *, int)
int db_printable(const unsigned char *)
void execute_statements_in_scope(struct binding_value **result, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct group *, struct group *, struct on_star *)
Definition: execute.c:562
void convert_lease_time(struct parse *, jrefproto, char *)
void ack_lease(struct packet *, struct lease *, unsigned int, TIME, char *, int, struct host_decl *)
Definition: dhcp.c:2133
isc_uint64_t num_abandoned
Definition: dhcpd.h:1719
void report_jumbo_ranges()
Definition: mdb6.c:2510
void skip_to_rbrace(struct parse *, int)
Definition: parse.c:94
isc_result_t set_server_duid_from_option(void)
void add_route_direct(struct interface_info *, struct in_addr)
struct shared_network * shared_network
Definition: dhcpd.h:668
struct domain_search_list * new_domain_search_list(const char *, int)
struct failover_option_info ft_options[]
void parse_prefix6(struct parse *cfile, struct group *group, struct ipv6_pond *)
pair new_pair(const char *, int)
struct option * host_id_option
Definition: dhcpd.h:945
int format_min_length(const char *, struct option_cache *)
int universe_count
Definition: dhcpd.h:398
int duid_type
Definition: dhclient.c:76
void save_fqdn6_option(struct universe *universe, struct option_state *options, struct option_cache *oc, isc_boolean_t appendp)
Definition: options.c:3391
isc_result_t ia_allocate(struct ia_xx **ia, u_int32_t iaid, const char *duid, unsigned int duid_len, const char *file, int line)
Definition: mdb6.c:338
int parse_class_declaration(struct class **, struct parse *, struct group *, int)
Definition: confpars.c:2207
enum dhcp_token peek_token(const char **, unsigned *, struct parse *)
Definition: conflex.c:443
isc_result_t enter_dns_zone(struct dns_zone *)
Definition: dns.c:678
int dont_use_fsync
Definition: dhcpd.c:79
time_t TIME
Definition: dhcpd.h:85
void parse_ia_pd_declaration(struct parse *)
Definition: confpars.c:5589
ssize_t send_fallback(struct interface_info *, struct packet *, struct dhcp_packet *, size_t, struct in_addr, struct sockaddr_in *, struct hardware *)
int read_client_conf_file(const char *, struct interface_info *, struct client_config *)
Definition: clparse.c:291
isc_result_t dhcp_shared_network_stuff_values(omapi_object_t *, omapi_object_t *, omapi_object_t *)
Definition: comapi.c:860
void data_string_forget(struct data_string *, const char *, int)
Definition: alloc.c:1339
void free_dhcp_packet(struct dhcp_packet *, const char *, int)
Definition: alloc.c:353
isc_result_t dhcp_class_signal_handler(omapi_object_t *, const char *, va_list)
Definition: omapi.c:2100
struct option_cache * primary6
Definition: dhcpd.h:1487
char * script_name
Definition: dhcpd.h:1231
binding_state_t desired_binding_state
Definition: dhcpd.h:621
isc_boolean_t agent_options_stashed
Definition: dhcpd.h:464
int dns_host_entry_reference(struct dns_host_entry **, struct dns_host_entry *, const char *, int)
Definition: alloc.c:785
struct subnet * next_sibling
Definition: dhcpd.h:1042
isc_boolean_t unicast
Definition: dhcpd.h:470
int new_lease_file(void)
Definition: db.c:1108
isc_result_t ia_add_iasubopt(struct ia_xx *ia, struct iasubopt *iasubopt, const char *file, int line)
Definition: mdb6.c:438
int dhcp_failover_write_all_states(void)
int write_expression(FILE *, struct expression *, int, int, int)
Definition: tree.c:3298
isc_uint64_t num_abandoned
Definition: dhcpd.h:1681
int count
Definition: dhcpd.h:1454
int data_string_terminate(struct data_string *, const char *, int)
Definition: alloc.c:1382
void dhcpoffer(struct packet *)
Definition: dhclient.c:2307
isc_result_t dhcp_failover_listener_destroy(omapi_object_t *, const char *, int)
void convert_fixed_addr_decl(struct parse *, jrefproto)
void convert_hardware_addr(struct parse *, jrefproto)
Definition: tree.h:61
isc_heap_t * active_timeouts
Definition: dhcpd.h:1682
TIME parse_date_core(struct parse *)
Definition: parse.c:974
isc_result_t binding_scope_set_value(struct binding_scope *, int, omapi_data_string_t *, omapi_typed_data_t *)
Definition: omapi.c:2395
char * buf_to_hex(const unsigned char *s, unsigned len, const char *file, int line)
Definition: print.c:1545
OMAPI_OBJECT_PREAMBLE
Definition: dhcpd.h:1022
void initialize_common_option_spaces(void)
Definition: tables.c:1049
int lexchar
Definition: dhcpd.h:290
struct interface_info * interface
Definition: dhcpd.h:1030
struct client_lease * offered_leases
Definition: dhcpd.h:1277
u_int32_t xid
Definition: dhcpd.h:1282
int index
Definition: dhcpd.h:1010
isc_result_t ipv6_pond_dereference(struct ipv6_pond **pond, const char *file, int line)
de-reference an IPv6 pond structure.
Definition: mdb6.c:2474
time_t soft_lifetime_end_time
Definition: dhcpd.h:1613
int find_lease_by_uid(struct lease **, const unsigned char *, unsigned, const char *, int)
Definition: mdb.c:2027
int fundef_dereference(struct fundef **, const char *, int)
Definition: tree.c:3829
int supports_multiple_interfaces(struct interface_info *)
int state
Definition: dhcpd.h:1783
void parse_option_space_decl(struct parse *)
Definition: parse.c:1345
u_int8_t * remote_id
Definition: dhcpd.h:1366
int evaluate_boolean_expression_result(int *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct expression *)
Definition: tree.c:2780
isc_result_t dhcp_failover_send_bind_update(dhcp_failover_state_t *, struct lease *)
struct string_list * media
Definition: dhcpd.h:1230
void enter_subnet(struct subnet *)
Definition: mdb.c:986
isc_result_t dhcp_failover_send_state(dhcp_failover_state_t *)
struct iaddr broadcast_addr(struct iaddr, struct iaddr)
Definition: inet.c:112
TIME renewal
Definition: dhcpd.h:1109
int ddns_update_style
Definition: dhcpd.c:78
int fqdn6_universe_decode(struct option_state *options, const unsigned char *buffer, unsigned length, struct universe *u)
Definition: options.c:3537
TIME tsfp
Definition: dhcpd.h:634
#define __attribute__(x)
Definition: cdefs.h:40
void(* func)(struct dns_query *)
Definition: dhcpd.h:1442
isc_result_t dhcp_subnet_remove(omapi_object_t *, omapi_object_t *)
Definition: comapi.c:742
isc_result_t dhcp_subclass_create(omapi_object_t **, omapi_object_t *)
Definition: omapi.c:2360
isc_result_t enter_host(struct host_decl *, int, int)
Definition: mdb.c:221
enum expression_context op_context(enum expr_op)
Definition: tree.c:3217
TIME expiry
Definition: dhcpd.h:1461
int flags
Definition: dhcpd.h:919
void dhcp_failover_timeout(void *)
struct universe * find_option_universe(struct option *, const char *)
Definition: options.c:271
int add_option(struct option_state *options, unsigned int option_num, void *data, unsigned int data_len)
Definition: options.c:4273
int refcnt
Definition: dhcpd.h:397
void lc_add_sorted_lease(struct leasechain *lc, struct lease *lp)
isc_result_t dhcp_group_get_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_value_t **)
Definition: comapi.c:202
u_int32_t hash
Definition: dhcpd.h:1460
OMAPI_OBJECT_PREAMBLE
Definition: dhcpd.h:939
void lc_unlink_lease(struct leasechain *lc, struct lease *lp)
int make_const_data(struct expression **, const unsigned char *, unsigned, int, int, const char *, int)
Definition: tree.c:219
int dhcp_failover_state_match(dhcp_failover_state_t *, u_int8_t *, unsigned)
int dhcpd_interface_setup_hook(struct interface_info *ip, struct iaddr *ia)
Definition: dhcpd.c:1356
isc_result_t dhcp_lease_destroy(omapi_object_t *, const char *, int)
Definition: omapi.c:467
int token_indent_data_string(FILE *, int, int, const char *, const char *, struct data_string *)
Definition: print.c:1207
int flags
Definition: dhcpd.h:1103
void write_lease_option(struct option_cache *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *)
Definition: dhclient.c:3858
void dhcpv6_client_assignments(void)
void dhcp_failover_toack_queue_timeout(void *)
isc_result_t dhcp_pool_destroy(omapi_object_t *, const char *, int)
Definition: omapi.c:1654
int parse_case_statement(struct executable_statement **, struct parse *, int *, enum expression_context)
Definition: parse.c:3288
void interface_stash(struct interface_info *)
Definition: discover.c:1467
void delete_option(struct universe *, struct option_state *, int)
Definition: options.c:2751
void dump_raw(const unsigned char *, unsigned)
int packet_allocate(struct packet **, const char *, int)
Definition: alloc.c:1015
int unset(struct binding_scope *, const char *)
Definition: tree.c:4134
void print_hex_only(unsigned, const u_int8_t *, unsigned, char *)
Definition: print.c:380
void read_client_duid(void)
Definition: clparse.c:330
struct binding_scope ** scope
Definition: dhcpd.h:1790
int class_count
Definition: dhcpd.h:454
int address_count
Definition: dhcpd.h:1353
void send_decline(void *)
Definition: dhclient.c:3083
struct iaddrmatchlist * reject_list
Definition: dhcpd.h:1242
struct string_list * medium
Definition: dhcpd.h:1113
isc_result_t dhcp_lease_set_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_typed_data_t *)
Definition: omapi.c:200
int cons_options(struct packet *, struct dhcp_packet *, struct lease *, struct client_state *, int, struct option_state *, struct option_state *, struct binding_scope **, int, int, int, struct data_string *, const char *)
Definition: options.c:517
struct lease * next
Definition: dhcpd.h:558
expression_context
Definition: tree.h:84
struct option_cache * lookup_hashed_option(struct universe *, struct option_state *, unsigned)
Definition: options.c:2363
struct client_config * config
Definition: dhcpd.h:1266
OMAPI_OBJECT_PREAMBLE
Definition: dhcpd.h:994
u_int8_t data[1]
Definition: dhcpd.h:372
isc_result_t read_client_conf(void)
Definition: clparse.c:55
u_int16_t flags
Definition: dhcpd.h:1781
isc_result_t dhcp_lease_create(omapi_object_t **, omapi_object_t *)
Definition: omapi.c:914
struct protocol * next
Definition: dhcpd.h:1432
int interface_count
Definition: discover.c:78
struct interface_info ** interface_vector
Definition: discover.c:77
unsigned remote_id_len
Definition: dhcpd.h:1368
void(* ddns_action_t)(struct dhcp_ddns_cb *ddns_cb, isc_result_t result)
Definition: dhcpd.h:1763
void free_protocol(struct protocol *, const char *, int)
Definition: alloc.c:345
struct universe agent_universe
Definition: stables.c:165
ipv6_pond structure
Definition: dhcpd.h:1703
#define HARDWARE_ADDR_LEN
Definition: dhcpd.h:483
isc_result_t parse_option_name(struct parse *, int, int *, struct option **)
Definition: parse.c:1204
void * transaction
Definition: dhcpd.h:1792
void dhclient_schedule_updates(struct client_state *client, struct iaddr *addr, int offset)
Definition: tree.h:118
void state_panic(void *)
Definition: dhclient.c:2774
void set_multicast_hop_limit(struct interface_info *info, int hop_limit)
const char * piaddr(struct iaddr)
Definition: inet.c:579
isc_result_t dhcp_lease_free(omapi_object_t *, const char *, int)
int make_limit(struct expression **, struct expression *, int)
Definition: tree.c:331
TIME rebind
Definition: dhcpd.h:1109
isc_uint64_t num_total
Definition: dhcpd.h:1717
char path_resolv_conf[]
Definition: resolv.c:34
u_int16_t local_port
Definition: dhclient.c:91
void * dataspace
Definition: dhcpd.h:1793
isc_result_t dhcp_class_remove(omapi_object_t *, omapi_object_t *)
Definition: omapi.c:2271
ssize_t receive_packet(struct interface_info *, unsigned char *, size_t, struct sockaddr_in *, struct hardware *)
int option_dereference(struct option **dest, const char *file, int line)
Definition: tables.c:1002
struct ipv6_pool ** pools
isc_result_t save_parse_state(struct parse *cfile)
Definition: conflex.c:128
void ddns_cb_forget_zone(dhcp_ddns_cb_t *ddns_cb)
OMAPI_OBJECT_PREAMBLE
Definition: dhcpd.h:1067
int commit_leases(void)
Definition: dhclient.c:1965
OMAPI_OBJECT_PREAMBLE
Definition: dhcpd.h:1494
struct iasubopt ** iasubopt
Definition: dhcpd.h:1646
struct dhc6_lease * next
Definition: dhcpd.h:1155
void classification_setup(void)
Definition: class.c:45
TIME next_event_time
Definition: dhcpd.h:1006
void(* handler)(struct protocol *)
Definition: dhcpd.h:1434
unsigned int rbuf_max
Definition: dhcpd.h:1376
int write_ia(const struct ia_xx *)
Definition: db.c:518
void dump_packet_option(struct option_cache *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *)
int ugflag
Definition: dhcpd.h:321
void lc_init_growth(struct leasechain *lc, size_t growth)
struct option * new_option(const char *, const char *, int)
struct ia_xx * ia
Definition: dhcpd.h:1616
int flags
Definition: dhcpd.h:955
char * cur_line
Definition: dhcpd.h:293
void parse_server_duid(struct parse *cfile)
struct universe dhcpv6_universe
Definition: tables.c:343
int fqdn_option_space_encapsulate(struct data_string *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *)
Definition: options.c:3262
int numclasseswritten
Definition: mdb.c:68
void remove_if_route(struct interface_info *, struct in_addr)
int ft_sizes[]
int store_option(struct data_string *, struct universe *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct option_cache *)
Definition: options.c:2936
isc_result_t dhcp_failover_listener_signal(omapi_object_t *, const char *, va_list)
const char * binding_state_names[]
Definition: stables.c:161
struct executable_statement * on_expiry
Definition: dhcpd.h:550
TIME timeout
Definition: dhcpd.h:1208
u_int8_t * remote_id
Definition: dhcpd.h:442
int linked_option_state_dereference(struct universe *, struct option_state *, const char *, int)
Definition: options.c:3846
const char * pdestdesc(struct iaddr)
Definition: inet.c:557
struct shared_network * next
Definition: dhcpd.h:1023
int group_writer(struct group_object *)
Definition: db.c:1247
isc_result_t dhcp_group_stuff_values(omapi_object_t *, omapi_object_t *, omapi_object_t *)
Definition: comapi.c:302
struct collection default_collection
Definition: dhcpd.h:3177
struct shared_network * shared_network
Definition: dhcpd.h:997
void add_enumeration(struct enumeration *)
Definition: parse.c:37
struct string_list * medium
Definition: dhcpd.h:1286
isc_result_t dhcp_group_destroy(omapi_object_t *, const char *, int)
Definition: comapi.c:227
void client_envadd(struct client_state *, const char *, const char *, const char *,...) __attribute__((__format__(__printf__
void dhcp_reply(struct lease *)
Definition: dhcp.c:3742
const char * file
Definition: dhcpd.h:3717
isc_result_t find_cached_zone(dhcp_ddns_cb_t *, int)
struct dhcp_ddns_cb * ddns_cb
Definition: dhcpd.h:1327
isc_result_t dhcp_interface_get_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_value_t **)
Definition: discover.c:1198
char * name
Definition: dhcpd.h:1024
struct enumeration syslog_enum
Definition: stables.c:431
void new_shared_network_interface(struct parse *, struct shared_network *, const char *)
Definition: mdb.c:1044
struct permit * permit_list
Definition: dhcpd.h:998
char * inbuf
Definition: dhcpd.h:328
int make_const_option_cache(struct option_cache **, struct buffer **, u_int8_t *, unsigned, struct option *, const char *, int)
Definition: tree.c:149
LEASE_STRUCT active
Definition: dhcpd.h:1000
int configured
Definition: dhcpd.h:1381
isc_result_t create_prefix6(struct ipv6_pool *pool, struct iasubopt **pref, unsigned int *attempts, const struct data_string *uid, time_t soft_lifetime_end_time)
Definition: mdb6.c:1715
struct subnet * subnet
Definition: dhcpd.h:1688
const char * dhcp_failover_reject_reason_print(int)
struct leasequeue * next
Definition: dhcpd.h:1410
struct domain_search_list * domains
Definition: resolv.c:33
TIME rcdate
Definition: dhcpd.h:356
int dhcp_failover_send_acks(dhcp_failover_state_t *)
ssize_t decode_hw_header(struct interface_info *, unsigned char *, unsigned, struct hardware *)
void if_reinitialize_receive(struct interface_info *)
struct collection * next
Definition: dhcpd.h:1053
int can_unicast_without_arp(struct interface_info *)
struct lease_state * new_lease_state(const char *, int)
void convert_lease_statement(struct parse *, jrefproto)
isc_result_t read_conf_file(const char *, struct group *, int, int)
Definition: confpars.c:79
void * what
Definition: dhcpd.h:1420
void if_register_receive(struct interface_info *)
int bill_class(struct lease *, struct class *)
Definition: class.c:303
struct shared_network * shared_network
Definition: dhcpd.h:1686
void trace_conf_stop(trace_type_t *ttype)
isc_result_t dhcp_failover_send_updates(dhcp_failover_state_t *)
unsigned char * parse_numeric_aggregate(struct parse *, unsigned char *, unsigned *, int, int, unsigned)
Definition: parse.c:730
int format_has_text(const char *)
isc_result_t ia_reference(struct ia_xx **ia, struct ia_xx *src, const char *file, int line)
Definition: mdb6.c:376
void make_client_config(struct client_state *, struct client_config *)
Definition: clparse.c:1112
struct executable_statement * on_commit
Definition: dhcpd.h:551
isc_result_t dhcp_interface_remove(omapi_object_t *, omapi_object_t *)
Definition: discover.c:1405
isc_result_t dhcp_pool_set_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_typed_data_t *)
Definition: omapi.c:1607
void data_string_truncate(struct data_string *, int)
Definition: alloc.c:1352
void dhcp_failover_startup_timeout(void *)
void print_hex_or_string(unsigned, const u_int8_t *, unsigned, char *)
Definition: print.c:407
isc_result_t dhcp_shared_network_destroy(omapi_object_t *, const char *, int)
Definition: comapi.c:798
Definition: dhcpd.h:1066
isc_result_t dhcp_failover_send_update_request_all(dhcp_failover_state_t *)
const unsigned char * data
Definition: tree.h:79
struct interface_info * interface
Definition: dhcpd.h:1262
policy
Definition: dhcpd.h:1190
void dhcp_common_objects_setup(void)
trace_type_t * outpacket_trace
isc_result_t generate_new_server_duid(void)
isc_result_t conf_file_subparse(struct parse *, struct group *, int)
Definition: confpars.c:242
struct binding_scope * scope
Definition: dhcpd.h:571
void parse_group_declaration(struct parse *, struct group *)
Definition: confpars.c:2951
u_int16_t ia_type
Definition: dhcpd.h:1144
struct domain_search_list * next
Definition: dhcpd.h:361
isc_boolean_t released
Definition: dhcpd.h:1158
unsigned packet_length
Definition: dhcpd.h:408
isc_result_t ipv6_pool_reference(struct ipv6_pool **pool, struct ipv6_pool *src, const char *file, int line)
reference an IPv6 pool structure.
Definition: mdb6.c:701
binding_state_t conflict_binding_state_transition_check(struct lease *, dhcp_failover_state_t *, binding_state_t, u_int32_t)
unsigned char * rbuf
Definition: dhcpd.h:1375
void parse_hardware_param(struct parse *, struct hardware *)
Definition: parse.c:611
int v6address_max
Definition: dhcpd.h:1359
isc_result_t dhcp_failover_state_lookup(omapi_object_t **, omapi_object_t *, omapi_object_t *)
isc_result_t lease_instantiate(const void *, unsigned, void *)
Definition: mdb.c:2733
struct permit * permit_list
Definition: dhcpd.h:1709
LEASE_STRUCT backup
Definition: dhcpd.h:1003
TIME offered_expiry
Definition: dhcpd.h:659
struct enumeration prefix_length_modes
Definition: stables.c:361
u_int16_t pool_type
Definition: dhcpd.h:1675
char * path_dhclient_script
Definition: dhclient.c:60
struct host_decl * n_dynamic
Definition: dhcpd.h:941
isc_result_t dhcp_pool_lookup(omapi_object_t **, omapi_object_t *, omapi_object_t *)
Definition: omapi.c:1765
struct lease ** list
Definition: dhcpd.h:983
int got_requested_address
Definition: dhcpd.h:445
int option_chain_head_dereference(struct option_chain_head **, const char *, int)
Definition: alloc.c:95
isc_result_t dhcp_interface_create(omapi_object_t **, omapi_object_t *)
Definition: discover.c:1389
int find_lease_by_ip_addr(struct lease **, struct iaddr, const char *, int)
Definition: mdb.c:2020
isc_result_t fallback_discard(omapi_object_t *)
int data_subexpression_length(int *, struct expression *)
int append_option_buffer(struct universe *, struct option_state *, struct buffer *, unsigned char *, unsigned, unsigned, int)
Definition: options.c:2414
struct client_lease * leases
Definition: dhcpd.h:1278
void parse_ia_na_declaration(struct parse *)
Definition: confpars.c:4717
struct data_string default_duid
Definition: dhclient.c:75
struct ifreq * ifp
Definition: dhcpd.h:1380
struct group * group
Definition: dhcpd.h:917
isc_result_t dhcp_failover_listener_get_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_value_t **)
struct dhc6_lease * old_lease
Definition: dhcpd.h:1297
HASH_FUNCTIONS_DECL(option_name, const char *, struct option, option_name_hash_t) HASH_FUNCTIONS_DECL(option_code
u_int32_t requested_lease
Definition: dhcpd.h:1228
struct name_server * new_name_server(const char *, int)
struct packet * packet
Definition: dhcpd.h:657
int relays
Definition: dhcpd.h:962
isc_result_t dhcp_subnet_get_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_value_t **)
Definition: comapi.c:630
u_int8_t hops
Definition: dhcpd.h:677
int dhcp_option_default_priority_list[]
isc_result_t form_duid(struct data_string *duid, const char *file, int line)
Definition: dhclient.c:3982
int expr_valid_for_context(struct expression *, enum expression_context)
TIME MRD
Definition: dhcpd.h:1311
struct timeval * process_outstanding_timeouts(struct timeval *)
Definition: dispatch.c:46
isc_result_t dhcp_control_lookup(omapi_object_t **, omapi_object_t *, omapi_object_t *)
Definition: comapi.c:558
void make_client_state(struct client_state **)
Definition: clparse.c:1103
isc_result_t dhcp_failover_link_set_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_typed_data_t *)
int dirty
Definition: dhcpd.h:1079
binding_state_t next_binding_state
Definition: dhcpd.h:620
int store_options6(char *, int, struct option_state *, struct packet *, const int *, struct data_string *)
Definition: options.c:931
int concat_dclists(struct data_string *, struct data_string *, struct data_string *)
Adds two Dc-formatted lists into a single Dc-formatted list.
Definition: tree.c:4177
struct enumeration ddns_styles
Definition: stables.c:346
int expression_reference(struct expression **, struct expression *, const char *, int)
Definition: alloc.c:446
u_int16_t flags
Definition: dhcpd.h:1490
void ia_remove_iasubopt(struct ia_xx *ia, struct iasubopt *iasubopt, const char *file, int line)
Definition: mdb6.c:475
TIME starts
Definition: dhcpd.h:1146
void go_daemon(void)
Definition: dhclient.c:4765
u_int8_t binding_state_t
Definition: dhcpd.h:540
int if_register_socket(struct interface_info *, int, int *, struct in6_addr *)
struct interface_info * interface
Definition: dhcpd.h:1044
void convert_option_decl(struct parse *, jrefproto)
int dhcp_failover_state_pool_check(dhcp_failover_state_t *)
LEASE_STRUCT abandoned
Definition: dhcpd.h:1004
void hw_hash_add(struct lease *)
Definition: mdb.c:2219
void classify_client(struct packet *)
Definition: class.c:63
omapi_object_type_t * dhcp_type_subnet
struct group * group
Definition: dhcpd.h:1706
isc_result_t dhcp_control_signal_handler(omapi_object_t *, const char *, va_list)
Definition: comapi.c:505
struct dhc6_lease * active_lease
Definition: dhcpd.h:1296
int parse_ip_addr_or_hostname(struct expression **, struct parse *, int)
Definition: parse.c:264
isc_result_t dhcp_pool_create(omapi_object_t **, omapi_object_t *)
Definition: omapi.c:1777
#define PACKET_MAX_CLASSES
Definition: dhcpd.h:452
isc_result_t dhcp_failover_process_bind_update(dhcp_failover_state_t *, failover_message_t *)
struct group_object * object
Definition: dhcpd.h:930
struct pool * pools
Definition: dhcpd.h:1031
lease_ip_hash_t * lease_ip_addr_hash
Definition: mdb.c:38
char * tval
Definition: dhcpd.h:322
char * print_dec_2(unsigned long)
Definition: print.c:520
isc_result_t dhcp_failover_process_update_done(dhcp_failover_state_t *, failover_message_t *)
void linked_option_space_foreach(struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *, void(*)(struct option_cache *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *))
int buffer_reference(struct buffer **, struct buffer *, const char *, int)
Definition: alloc.c:698
int file
Definition: dhcpd.h:327
int spawning
Definition: dhcpd.h:1091
TIME reboot_timeout
Definition: dhcpd.h:1222
void remove_routes(struct in_addr)
u_int32_t host_addr(struct iaddr, struct iaddr)
Definition: inet.c:138
int lease_mine_to_reallocate(struct lease *)
isc_result_t expire_lease6(struct iasubopt **leasep, struct ipv6_pool *pool, time_t now)
Definition: mdb6.c:1563
struct group * group
Definition: dhcpd.h:952
TIME starts
Definition: dhcpd.h:1134
struct pool * next
Definition: dhcpd.h:995
int logged
Definition: dhcpd.h:1017
void lease_insert(struct lease **lq, struct lease *comp)
Definition: mdb.c:2587
void dhcp_failover_send_contact(void *)
void write_statements(FILE *, struct executable_statement *, int)
Definition: execute.c:751
isc_result_t dhcp_subclass_set_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_typed_data_t *)
Definition: omapi.c:2287
isc_result_t range2cidr(struct iaddrcidrnetlist **result, const struct iaddr *lo, const struct iaddr *hi)
Definition: inet.c:360
isc_result_t dhcp_pool_get_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_value_t **)
Definition: omapi.c:1632
int buffer_allocate(struct buffer **, unsigned, const char *, int)
Definition: alloc.c:679
char * client_hostname
Definition: dhcpd.h:570
struct dns_wakeup * wakeups
Definition: dhcpd.h:1473
TIME MRC
Definition: dhcpd.h:1309
struct group * group
Definition: dhcpd.h:1093
int lease_copy(struct lease **, struct lease *, const char *, int)
Definition: mdb.c:1659
void add_route_default_gateway(struct interface_info *, struct in_addr)
void data_string_copy(struct data_string *, const struct data_string *, const char *, int)
Definition: alloc.c:1323
u_int16_t secs
Definition: dhcpd.h:1283
int binding_scope_reference(struct binding_scope **, struct binding_scope *, const char *, int)
Definition: alloc.c:1227
struct option_chain_head * agent_options
Definition: dhcpd.h:576
int lexline
Definition: dhcpd.h:289
void struct client_lease * packet_to_lease(struct packet *, struct client_state *)
Definition: dhclient.c:2442
isc_result_t interface_setup(void)
Definition: discover.c:83
int backup_leases
Definition: dhcpd.h:1009
int parse_warn(struct parse *, const char *,...) __attribute__((__format__(__printf__
struct option_tag * next
Definition: dhcpd.h:371
void send_release(void *)
Definition: dhclient.c:3122
struct packet * dhcpv6_container_packet
Definition: dhcpd.h:422
int dns_update_timeout
Definition: dhcpd.h:1338
struct option_cache * primary
Definition: dhcpd.h:1485
char * server_name
Definition: dhcpd.h:1111
ssize_t receive_packet6(struct interface_info *interface, unsigned char *buf, size_t len, struct sockaddr_in6 *from, struct in6_addr *to_addr, unsigned int *if_index)
isc_result_t ddns_modify_fwd(dhcp_ddns_cb_t *ddns_cb, const char *file, int line)
isc_result_t binding_scope_get_value(omapi_value_t **, struct binding_scope *, omapi_data_string_t *)
Definition: omapi.c:2471
struct in6_addr * v6addresses
Definition: dhcpd.h:1355
int is_dns_expression(struct expression *)
dhcp_control_object_t
Definition: dhcpd.h:2448
isc_result_t iasubopt_reference(struct iasubopt **iasubopt, struct iasubopt *src, const char *file, int line)
Definition: mdb6.c:233
void remove_all_if_routes(struct interface_info *)
void dhcp_failover_auto_partner_down(void *vs)
struct interface_info * dummy_interfaces
Definition: discover.c:42
int executable_statement_foreach(struct executable_statement *, int(*)(struct executable_statement *, void *, int), void *, int)
int bootp_broadcast_always
Definition: dhcpd.h:1254
int num_pools