diff options
Diffstat (limited to 'src/dnsmasq.h')
-rw-r--r-- | src/dnsmasq.h | 281 |
1 files changed, 172 insertions, 109 deletions
diff --git a/src/dnsmasq.h b/src/dnsmasq.h index cf1a782..6773b69 100644 --- a/src/dnsmasq.h +++ b/src/dnsmasq.h @@ -1,4 +1,4 @@ -/* dnsmasq is Copyright (c) 2000-2015 Simon Kelley +/* dnsmasq is Copyright (c) 2000-2018 Simon Kelley This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -14,7 +14,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#define COPYRIGHT "Copyright (c) 2000-2015 Simon Kelley" +#define COPYRIGHT "Copyright (c) 2000-2018 Simon Kelley" + +/* We do defines that influence behavior of stdio.h, so complain + if included too early. */ +#ifdef _STDIO_H +# error "Header file stdio.h included too early!" +#endif #ifndef NO_LARGEFILE /* Ensure we can use files >2GB (log files may grow this big) */ @@ -117,7 +123,6 @@ typedef unsigned long long u64; #include <sys/uio.h> #include <syslog.h> #include <dirent.h> -#include <utime.h> #ifndef HAVE_LINUX_NETWORK # include <net/if_dl.h> #endif @@ -125,7 +130,7 @@ typedef unsigned long long u64; #if defined(HAVE_LINUX_NETWORK) #include <linux/capability.h> /* There doesn't seem to be a universally-available - userpace header for these. */ + userspace header for these. */ extern int capset(cap_user_header_t header, cap_user_data_t data); extern int capget(cap_user_header_t header, cap_user_data_t data); #define LINUX_CAPABILITY_VERSION_1 0x19980330 @@ -137,6 +142,10 @@ extern int capget(cap_user_header_t header, cap_user_data_t data); #include <priv.h> #endif +#ifdef HAVE_DNSSEC +# include <nettle/nettle-meta.h> +#endif + /* daemon is function in the C library.... */ #define daemon dnsmasq_daemon @@ -145,30 +154,32 @@ struct event_desc { int event, data, msg_sz; }; -#define EVENT_RELOAD 1 -#define EVENT_DUMP 2 -#define EVENT_ALARM 3 -#define EVENT_TERM 4 -#define EVENT_CHILD 5 -#define EVENT_REOPEN 6 -#define EVENT_EXITED 7 -#define EVENT_KILLED 8 -#define EVENT_EXEC_ERR 9 -#define EVENT_PIPE_ERR 10 -#define EVENT_USER_ERR 11 -#define EVENT_CAP_ERR 12 -#define EVENT_PIDFILE 13 -#define EVENT_HUSER_ERR 14 -#define EVENT_GROUP_ERR 15 -#define EVENT_DIE 16 -#define EVENT_LOG_ERR 17 -#define EVENT_FORK_ERR 18 -#define EVENT_LUA_ERR 19 -#define EVENT_TFTP_ERR 20 -#define EVENT_INIT 21 -#define EVENT_NEWADDR 22 -#define EVENT_NEWROUTE 23 -#define EVENT_TIME_ERR 24 +#define EVENT_RELOAD 1 +#define EVENT_DUMP 2 +#define EVENT_ALARM 3 +#define EVENT_TERM 4 +#define EVENT_CHILD 5 +#define EVENT_REOPEN 6 +#define EVENT_EXITED 7 +#define EVENT_KILLED 8 +#define EVENT_EXEC_ERR 9 +#define EVENT_PIPE_ERR 10 +#define EVENT_USER_ERR 11 +#define EVENT_CAP_ERR 12 +#define EVENT_PIDFILE 13 +#define EVENT_HUSER_ERR 14 +#define EVENT_GROUP_ERR 15 +#define EVENT_DIE 16 +#define EVENT_LOG_ERR 17 +#define EVENT_FORK_ERR 18 +#define EVENT_LUA_ERR 19 +#define EVENT_TFTP_ERR 20 +#define EVENT_INIT 21 +#define EVENT_NEWADDR 22 +#define EVENT_NEWROUTE 23 +#define EVENT_TIME_ERR 24 +#define EVENT_SCRIPT_LOG 25 +#define EVENT_TIME 26 /* Exit codes. */ #define EC_GOOD 0 @@ -179,13 +190,6 @@ struct event_desc { #define EC_MISC 5 #define EC_INIT_OFFSET 10 -/* Min buffer size: we check after adding each record, so there must be - memory for the largest packet, and the largest record so the - min for DNS is PACKETSZ+MAXDNAME+RRFIXEDSZ which is < 1000. - This might be increased is EDNS packet size if greater than the minimum. -*/ -#define DNSMASQ_PACKETSZ PACKETSZ+MAXDNAME+RRFIXEDSZ - /* Trust the compiler dead-code eliminator.... */ #define option_bool(x) (((x) < 32) ? daemon->options & (1u << (x)) : daemon->options2 & (1u << ((x) - 32))) @@ -218,7 +222,7 @@ struct event_desc { #define OPT_TFTP_SECURE 26 #define OPT_TFTP_NOBLOCK 27 #define OPT_LOG_OPTS 28 -#define OPT_TFTP_APREF 29 +#define OPT_TFTP_APREF_IP 29 #define OPT_NO_OVERRIDE 30 #define OPT_NO_REBIND 31 #define OPT_ADD_MAC 32 @@ -242,12 +246,17 @@ struct event_desc { #define OPT_LOOP_DETECT 50 #define OPT_EXTRALOG 51 #define OPT_TFTP_NO_FAIL 52 -#define OPT_LAST 53 +#define OPT_SCRIPT_ARP 53 +#define OPT_MAC_B64 54 +#define OPT_MAC_HEX 55 +#define OPT_TFTP_APREF_MAC 56 +#define OPT_LAST 57 /* extra flags for my_syslog, we use a couple of facilities since they are known not to occupy the same bits as priorities, no matter how syslog.h is set up. */ -#define MS_TFTP LOG_USER -#define MS_DHCP LOG_DAEMON +#define MS_TFTP LOG_USER +#define MS_DHCP LOG_DAEMON +#define MS_SCRIPT LOG_MAIL struct all_addr { union { @@ -256,8 +265,10 @@ struct all_addr { struct in6_addr addr6; #endif /* for log_query */ - unsigned int keytag; - /* for cache_insert if RRSIG, DNSKEY, DS */ + struct { + unsigned short keytag, algo, digest; + } log; + /* for cache_insert of DNSKEY, DS */ struct { unsigned short class, type; } dnssec; @@ -288,6 +299,7 @@ struct naptr { struct naptr *next; }; +#ifndef NO_ID #define TXT_STAT_CACHESIZE 1 #define TXT_STAT_INSERTS 2 #define TXT_STAT_EVICTIONS 3 @@ -295,6 +307,7 @@ struct naptr { #define TXT_STAT_HITS 5 #define TXT_STAT_AUTH 6 #define TXT_STAT_SERVERS 7 +#endif struct txt_record { char *name; @@ -310,8 +323,9 @@ struct ptr_record { }; struct cname { + int ttl, flag; char *alias, *target; - struct cname *next; + struct cname *next, *targetp; }; struct ds_config { @@ -341,11 +355,13 @@ struct auth_zone { struct auth_name_list *next; } *interface_names; struct addrlist *subnet; + struct addrlist *exclude; struct auth_zone *next; }; struct host_record { + int ttl; struct name_list { char *name; struct name_list *next; @@ -398,14 +414,9 @@ struct crec { unsigned char algo; unsigned char digest; } ds; - struct { - struct blockdata *keydata; - unsigned short keylen, type_covered, keytag; - char algo; - } sig; } addr; time_t ttd; /* time to die */ - /* used as class if DNSKEY/DS/RRSIG, index to source for F_HOSTS */ + /* used as class if DNSKEY/DS, index to source for F_HOSTS */ unsigned int uid; unsigned short flags; union { @@ -445,8 +456,8 @@ struct crec { #define F_SECSTAT (1u<<24) #define F_NO_RR (1u<<25) #define F_IPSET (1u<<26) -#define F_NSIGMATCH (1u<<27) -#define F_NOEXTRA (1u<<28) +#define F_NOEXTRA (1u<<27) +#define F_SERVFAIL (1u<<28) /* Values of uid in crecs with F_CONFIG bit set. */ #define SRC_INTERFACE 0 @@ -487,11 +498,14 @@ union mysockaddr { #define SERV_NO_REBIND 2048 /* inhibit dns-rebind protection */ #define SERV_FROM_FILE 4096 /* read from --servers-file */ #define SERV_LOOP 8192 /* server causes forwarding loop */ +#define SERV_DO_DNSSEC 16384 /* Validate DNSSEC when using this server */ +#define SERV_GOT_TCP 32768 /* Got some data from the TCP connection */ struct serverfd { int fd; union mysockaddr source_addr; char interface[IF_NAMESIZE+1]; + unsigned int ifindex, used; struct serverfd *next; }; @@ -506,6 +520,7 @@ struct server { struct serverfd *sfd; char *domain; /* set if this server only handles a domain. */ int flags, tcpfd, edns_pktsz; + time_t pktsz_reduced; unsigned int queries, failed_queries; #ifdef HAVE_LOOP u32 uid; @@ -522,7 +537,7 @@ struct ipsets { struct irec { union mysockaddr addr; struct in_addr netmask; /* only valid for IPv4 */ - int tftp_ok, dhcp_ok, mtu, done, warned, dad, dns_auth, index, multicast_done, found; + int tftp_ok, dhcp_ok, mtu, done, warned, dad, dns_auth, index, multicast_done, found, label; char *name; struct irec *next; }; @@ -541,6 +556,13 @@ struct iname { struct iname *next; }; +/* subnet parameters from command line */ +struct mysubnet { + union mysockaddr addr; + int addr_used; + int mask; +}; + /* resolv-file parms from command-line */ struct resolvc { struct resolvc *next; @@ -579,12 +601,8 @@ struct hostsfile { #define STAT_NEED_KEY 5 #define STAT_TRUNCATED 6 #define STAT_SECURE_WILDCARD 7 -#define STAT_NO_SIG 8 -#define STAT_NO_DS 9 -#define STAT_NO_NS 10 -#define STAT_NEED_DS_NEG 11 -#define STAT_CHASE_CNAME 12 -#define STAT_INSECURE_DS 13 +#define STAT_OK 8 +#define STAT_ABANDONED 9 #define FREC_NOREBIND 1 #define FREC_CHECKING_DISABLED 2 @@ -594,8 +612,8 @@ struct hostsfile { #define FREC_AD_QUESTION 32 #define FREC_DO_QUESTION 64 #define FREC_ADDED_PHEADER 128 -#define FREC_CHECK_NOSIGN 256 -#define FREC_TEST_PKTSZ 512 +#define FREC_TEST_PKTSZ 256 +#define FREC_HAS_EXTRADATA 512 #ifdef HAVE_DNSSEC #define HASH_SIZE 20 /* SHA-1 digest size */ @@ -619,9 +637,7 @@ struct frec { #ifdef HAVE_DNSSEC int class, work_counter; struct blockdata *stash; /* Saved reply, whilst we validate */ - struct blockdata *orig_domain; /* domain of original query, whilst - we're seeing is if in unsigned domain */ - size_t stash_len, name_start, name_len; + size_t stash_len; struct frec *dependent; /* Query awaiting internally-generated DNSKEY or DS query */ struct frec *blocking_query; /* Query which is blocking us. */ #endif @@ -643,6 +659,8 @@ struct frec { #define ACTION_OLD 3 #define ACTION_ADD 4 #define ACTION_TFTP 5 +#define ACTION_ARP 6 +#define ACTION_ARP_DEL 7 #define LEASE_NEW 1 /* newly created */ #define LEASE_CHANGED 2 /* modified */ @@ -701,6 +719,12 @@ struct tag_if { struct tag_if *next; }; +struct delay_config { + int delay; + struct dhcp_netid *netid; + struct delay_config *next; +}; + struct hwaddr_config { int hwaddr_len, hwaddr_type; unsigned char hwaddr[DHCP_CHADDR_MAX]; @@ -787,7 +811,7 @@ struct pxe_service { #define MATCH_REMOTE 4 #define MATCH_SUBSCRIBER 5 -/* vendorclass, userclass, remote-id or cicuit-id */ +/* vendorclass, userclass, remote-id or circuit-id */ struct dhcp_vendor { int len, match_type; unsigned int enterprise; @@ -815,7 +839,7 @@ struct cond_domain { #ifdef HAVE_IPV6 struct in6_addr start6, end6; #endif - int is6; + int is6, indexed; struct cond_domain *next; }; @@ -829,7 +853,8 @@ struct prefix_class { struct ra_interface { char *name; - int interval, lifetime, prio; + char *mtu_name; + int interval, lifetime, prio, mtu; struct ra_interface *next; }; @@ -935,9 +960,9 @@ extern struct daemon { struct auth_zone *auth_zones; struct interface_name *int_names; char *mxtarget; - int addr4_netmask; - int addr6_netmask; - char *lease_file; + struct mysubnet *add_subnet4; + struct mysubnet *add_subnet6; + char *lease_file; char *username, *groupname, *scriptuser; char *luascript; char *authserver, *hostmaster; @@ -956,8 +981,9 @@ extern struct daemon { char *log_file; /* optional log file */ int max_logs; /* queue limit */ int cachesize, ftabsize; - int port, query_port, min_port; - unsigned long local_ttl, neg_ttl, max_ttl, min_cache_ttl, max_cache_ttl, auth_ttl; + int port, query_port, min_port, max_port; + unsigned long local_ttl, neg_ttl, max_ttl, min_cache_ttl, max_cache_ttl, auth_ttl, dhcp_ttl, use_dhcp_ttl; + char *dns_client_id; struct hostsfile *addn_hosts; struct dhcp_context *dhcp, *dhcp6; struct ra_interface *ra_interfaces; @@ -970,13 +996,14 @@ extern struct daemon { struct tag_if *tag_if; struct addr_list *override_relays; struct dhcp_relay *relay4, *relay6; + struct delay_config *delay_conf; int override; int enable_pxe; int doing_ra, doing_dhcp6; struct dhcp_netid_list *dhcp_ignore, *dhcp_ignore_names, *dhcp_gen_names; struct dhcp_netid_list *force_broadcast, *bootp_dynamic; struct hostsfile *dhcp_hosts_file, *dhcp_opts_file, *dynamic_dirs; - int dhcp_max, tftp_max; + int dhcp_max, tftp_max, tftp_mtu; int dhcp_server_port, dhcp_client_port; int start_tftp_port, end_tftp_port; unsigned int min_leasetime; @@ -993,6 +1020,7 @@ extern struct daemon { #endif #ifdef HAVE_DNSSEC struct ds_config *ds; + int dnssec_no_time_check; int back_to_the_future; char *timestamp_file; #endif @@ -1004,6 +1032,8 @@ extern struct daemon { #ifdef HAVE_DNSSEC char *keyname; /* MAXDNAME size buffer */ char *workspacename; /* ditto */ + char *rr_status; /* flags for individual RRs */ + int rr_status_sz; #endif unsigned int local_answer, queries_forwarded, auth_answer; struct frec *frec_list; @@ -1079,7 +1109,9 @@ void cache_add_dhcp_entry(char *host_name, int prot, struct all_addr *host_addre struct in_addr a_record_from_hosts(char *name, time_t now); void cache_unhash_dhcp(void); void dump_cache(time_t now); +#ifndef NO_ID int cache_make_stat(struct txt_record *t); +#endif char *cache_get_name(struct crec *crecp); char *cache_get_cname_target(struct crec *crecp); struct crec *cache_enumerate(int init); @@ -1113,28 +1145,20 @@ unsigned int extract_request(struct dns_header *header, size_t qlen, char *name, unsigned short *typep); size_t setup_reply(struct dns_header *header, size_t qlen, struct all_addr *addrp, unsigned int flags, - unsigned long local_ttl); -int extract_addresses(struct dns_header *header, size_t qlen, char *namebuff, - time_t now, char **ipsets, int is_sign, int checkrebind, - int no_cache, int secure, int *doctored); + unsigned long ttl); +int extract_addresses(struct dns_header *header, size_t qlen, char *name, + time_t now, char **ipsets, int is_sign, int check_rebind, + int no_cache_dnssec, int secure, int *doctored); size_t answer_request(struct dns_header *header, char *limit, size_t qlen, struct in_addr local_addr, struct in_addr local_netmask, - time_t now, int *ad_reqd, int *do_bit); + time_t now, int ad_reqd, int do_bit, int have_pseudoheader); int check_for_bogus_wildcard(struct dns_header *header, size_t qlen, char *name, - struct bogus_addr *addr, time_t now); + struct bogus_addr *baddr, time_t now); int check_for_ignored_address(struct dns_header *header, size_t qlen, struct bogus_addr *baddr); -unsigned char *find_pseudoheader(struct dns_header *header, size_t plen, - size_t *len, unsigned char **p, int *is_sign); int check_for_local_domain(char *name, time_t now); -unsigned int questions_crc(struct dns_header *header, size_t plen, char *buff); +unsigned int questions_crc(struct dns_header *header, size_t plen, char *name); size_t resize_packet(struct dns_header *header, size_t plen, unsigned char *pheader, size_t hlen); -size_t add_mac(struct dns_header *header, size_t plen, char *limit, union mysockaddr *l3); -size_t add_source_addr(struct dns_header *header, size_t plen, char *limit, union mysockaddr *source); -#ifdef HAVE_DNSSEC -size_t add_do_bit(struct dns_header *header, size_t plen, char *limit); -#endif -int check_source(struct dns_header *header, size_t plen, unsigned char *pseudoheader, union mysockaddr *peer); int add_resource_record(struct dns_header *header, char *limit, int *truncp, int nameoffset, unsigned char **pp, unsigned long ttl, int *offset, unsigned short type, unsigned short class, char *format, ...); @@ -1147,29 +1171,39 @@ int private_net(struct in_addr addr, int ban_localhost); /* auth.c */ #ifdef HAVE_AUTH size_t answer_auth(struct dns_header *header, char *limit, size_t qlen, - time_t now, union mysockaddr *peer_addr, int local_query); + time_t now, union mysockaddr *peer_addr, int local_query, + int do_bit, int have_pseudoheader); int in_zone(struct auth_zone *zone, char *name, char **cut); #endif /* dnssec.c */ -size_t dnssec_generate_query(struct dns_header *header, char *end, char *name, int class, int type, union mysockaddr *addr, int edns_pktsz); -int dnssec_validate_by_ds(time_t now, struct dns_header *header, size_t n, char *name, char *keyname, int class); +size_t dnssec_generate_query(struct dns_header *header, unsigned char *end, char *name, int class, int type, union mysockaddr *addr, int edns_pktsz); +int dnssec_validate_by_ds(time_t now, struct dns_header *header, size_t plen, char *name, char *keyname, int class); int dnssec_validate_ds(time_t now, struct dns_header *header, size_t plen, char *name, char *keyname, int class); -int dnssec_validate_reply(time_t now, struct dns_header *header, size_t plen, char *name, char *keyname, int *class, int *neganswer, int *nons); -int dnssec_chase_cname(time_t now, struct dns_header *header, size_t plen, char *name, char *keyname); -int dnskey_keytag(int alg, int flags, unsigned char *rdata, int rdlen); +int dnssec_validate_reply(time_t now, struct dns_header *header, size_t plen, char *name, char *keyname, int *class, + int check_unsigned, int *neganswer, int *nons); +int dnskey_keytag(int alg, int flags, unsigned char *key, int keylen); size_t filter_rrsigs(struct dns_header *header, size_t plen); unsigned char* hash_questions(struct dns_header *header, size_t plen, char *name); int setup_timestamp(void); +/* crypto.c */ +const struct nettle_hash *hash_find(char *name); +int hash_init(const struct nettle_hash *hash, void **ctxp, unsigned char **digestp); +int verify(struct blockdata *key_data, unsigned int key_len, unsigned char *sig, size_t sig_len, + unsigned char *digest, size_t digest_len, int algo); +char *ds_digest_name(int digest); +char *algo_digest_name(int algo); +char *nsec3_digest_name(int digest); + /* util.c */ void rand_init(void); unsigned short rand16(void); u32 rand32(void); u64 rand64(void); -int legal_hostname(char *c); -char *canonicalise(char *s, int *nomem); -unsigned char *do_rfc1035_name(unsigned char *p, char *sval); +int legal_hostname(char *name); +char *canonicalise(char *in, int *nomem); +unsigned char *do_rfc1035_name(unsigned char *p, char *sval, char *limit); void *safe_malloc(size_t size); void safe_pipe(int *fd, int read_noblock); void *whine_malloc(size_t size); @@ -1202,7 +1236,9 @@ int wildcard_matchn(const char* wildcard, const char* match, int num); void die(char *message, char *arg1, int exit_code); int log_start(struct passwd *ent_pw, int errfd); int log_reopen(char *log_file); + void my_syslog(int priority, const char *format, ...); + void set_log_writer(void); void check_log_writer(int force); void flush_log(void); @@ -1230,13 +1266,13 @@ struct frec *get_new_frec(time_t now, int *wait, int force); int send_from(int fd, int nowild, char *packet, size_t len, union mysockaddr *to, struct all_addr *source, unsigned int iface); -void resend_query(); +void resend_query(void); struct randfd *allocate_rfd(int family); void free_rfd(struct randfd *rfd); /* network.c */ int indextoname(int fd, int index, char *name); -int local_bind(int fd, union mysockaddr *addr, char *intname, int is_tcp); +int local_bind(int fd, union mysockaddr *addr, char *intname, unsigned int ifindex, int is_tcp); int random_sock(int family); void pre_allocate_sfds(void); int reload_servers(char *fname); @@ -1250,11 +1286,12 @@ void add_update_server(int flags, void check_servers(void); int enumerate_interfaces(int reset); void create_wildcard_listeners(void); -void create_bound_listeners(int die); +void create_bound_listeners(int dienow); void warn_bound_listeners(void); +void warn_wild_labels(void); void warn_int_names(void); int is_dad_listeners(void); -int iface_check(int family, struct all_addr *addr, char *name, int *auth_dns); +int iface_check(int family, struct all_addr *addr, char *name, int *auth); int loopback_exception(int fd, int family, struct all_addr *addr, char *name); int label_exception(int index, int family, struct all_addr *addr); int fix_fd(int fd); @@ -1275,14 +1312,16 @@ void newaddress(time_t now); void dhcp_init(void); void dhcp_packet(time_t now, int pxe_fd); struct dhcp_context *address_available(struct dhcp_context *context, - struct in_addr addr, + struct in_addr taddr, struct dhcp_netid *netids); struct dhcp_context *narrow_context(struct dhcp_context *context, struct in_addr taddr, struct dhcp_netid *netids); +struct ping_result *do_icmp_ping(time_t now, struct in_addr addr, + unsigned int hash, int loopback); int address_allocate(struct dhcp_context *context, struct in_addr *addrp, unsigned char *hwaddr, int hw_len, - struct dhcp_netid *netids, time_t now); + struct dhcp_netid *netids, time_t now, int loopback); void dhcp_read_ethers(void); struct dhcp_config *config_find_by_address(struct dhcp_config *configs, struct in_addr addr); char *host_from_dns(struct in_addr addr); @@ -1331,7 +1370,8 @@ void lease_add_extradata(struct dhcp_lease *lease, unsigned char *data, /* rfc2131.c */ #ifdef HAVE_DHCP size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index, - size_t sz, time_t now, int unicast_dest, int *is_inform, int pxe_fd, struct in_addr fallback); + size_t sz, time_t now, int unicast_dest, int loopback, + int *is_inform, int pxe, struct in_addr fallback, time_t recvtime); unsigned char *extended_hwaddr(int hwtype, int hwlen, unsigned char *hwaddr, int clid_len, unsigned char *clid, int *len_out); #endif @@ -1340,6 +1380,7 @@ unsigned char *extended_hwaddr(int hwtype, int hwlen, unsigned char *hwaddr, #ifdef HAVE_DHCP int make_icmp_sock(void); int icmp_ping(struct in_addr addr); +int delay_dhcp(time_t start, int sec, int fd, uint32_t addr, unsigned short id); #endif void queue_event(int event); void send_alarm(time_t event, time_t now); @@ -1389,6 +1430,8 @@ void queue_script(int action, struct dhcp_lease *lease, #ifdef HAVE_TFTP void queue_tftp(off_t file_len, char *filename, union mysockaddr *peer); #endif +void queue_arp(int action, unsigned char *mac, int maclen, + int family, struct all_addr *addr); int helper_buf_empty(void); #endif @@ -1425,7 +1468,7 @@ struct dhcp_config *config_find_by_address6(struct dhcp_config *configs, struct void make_duid(time_t now); void dhcp_construct_contexts(time_t now); void get_client_mac(struct in6_addr *client, int iface, unsigned char *mac, - unsigned int *maclenp, unsigned int *mactypep); + unsigned int *maclenp, unsigned int *mactypep, time_t now); #endif /* rfc3315.c */ @@ -1433,7 +1476,8 @@ void get_client_mac(struct in6_addr *client, int iface, unsigned char *mac, unsigned short dhcp6_reply(struct dhcp_context *context, int interface, char *iface_name, struct in6_addr *fallback, struct in6_addr *ll_addr, struct in6_addr *ula_addr, size_t sz, struct in6_addr *client_addr, time_t now); -void relay_upstream6(struct dhcp_relay *relay, ssize_t sz, struct in6_addr *peer_address, u32 scope_id); +void relay_upstream6(struct dhcp_relay *relay, ssize_t sz, struct in6_addr *peer_address, + u32 scope_id, time_t now); unsigned short relay_reply6( struct sockaddr_in6 *peer, ssize_t sz, char *arrival_interface); #endif @@ -1442,10 +1486,10 @@ unsigned short relay_reply6( struct sockaddr_in6 *peer, ssize_t sz, char *arriva #ifdef HAVE_DHCP void dhcp_common_init(void); ssize_t recv_dhcp_packet(int fd, struct msghdr *msg); -struct dhcp_netid *run_tag_if(struct dhcp_netid *input); +struct dhcp_netid *run_tag_if(struct dhcp_netid *tags); struct dhcp_netid *option_filter(struct dhcp_netid *tags, struct dhcp_netid *context_tags, struct dhcp_opt *opts); -int match_netid(struct dhcp_netid *check, struct dhcp_netid *pool, int negonly); +int match_netid(struct dhcp_netid *check, struct dhcp_netid *pool, int tagnotneeded); char *strip_hostname(char *hostname); void log_tags(struct dhcp_netid *netid, u32 xid); int match_bytes(struct dhcp_opt *o, unsigned char *p, int len); @@ -1475,6 +1519,7 @@ void log_relay(int family, struct dhcp_relay *relay); /* outpacket.c */ #ifdef HAVE_DHCP6 void end_opt6(int container); +void reset_counter(void); int save_counter(int newval); void *expand(size_t headroom); int new_opt6(int opt); @@ -1490,7 +1535,7 @@ void put_opt6_string(char *s); void ra_init(time_t now); void icmp6_packet(time_t now); time_t periodic_ra(time_t now); -void ra_start_unsolicted(time_t now, struct dhcp_context *context); +void ra_start_unsolicited(time_t now, struct dhcp_context *context); #endif /* slaac.c */ @@ -1502,13 +1547,13 @@ void slaac_ping_reply(struct in6_addr *sender, unsigned char *packet, char *inte /* loop.c */ #ifdef HAVE_LOOP -void loop_send_probes(); +void loop_send_probes(void); int detect_loop(char *query, int type); #endif /* inotify.c */ #ifdef HAVE_INOTIFY -void inotify_dnsmasq_init(); +void inotify_dnsmasq_init(void); int inotify_check(time_t now); void set_dynamic_inotify(int flag, int total_size, struct crec **rhash, int revhashsz); #endif @@ -1519,3 +1564,21 @@ int poll_check(int fd, short event); void poll_listen(int fd, short event); int do_poll(int timeout); +/* rrfilter.c */ +size_t rrfilter(struct dns_header *header, size_t plen, int mode); +u16 *rrfilter_desc(int type); +int expand_workspace(unsigned char ***wkspc, int *szp, int new); + +/* edns0.c */ +unsigned char *find_pseudoheader(struct dns_header *header, size_t plen, + size_t *len, unsigned char **p, int *is_sign, int *is_last); +size_t add_pseudoheader(struct dns_header *header, size_t plen, unsigned char *limit, + unsigned short udp_sz, int optno, unsigned char *opt, size_t optlen, int set_do, int replace); +size_t add_do_bit(struct dns_header *header, size_t plen, unsigned char *limit); +size_t add_edns0_config(struct dns_header *header, size_t plen, unsigned char *limit, + union mysockaddr *source, time_t now, int *check_subnet); +int check_source(struct dns_header *header, size_t plen, unsigned char *pseudoheader, union mysockaddr *peer); + +/* arp.c */ +int find_mac(union mysockaddr *addr, unsigned char *mac, int lazy, time_t now); +int do_arp_script_run(void); |