"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/dnsmasq.h" between
dnsmasq-2.80.tar.gz and dnsmasq-2.81.tar.xz

About: Dnsmasq is a lightweight caching DNS forwarder and DHCP server.

dnsmasq.h  (dnsmasq-2.80):dnsmasq.h  (dnsmasq-2.81.tar.xz)
/* dnsmasq is Copyright (c) 2000-2018 Simon Kelley /* dnsmasq is Copyright (c) 2000-2020 Simon Kelley
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 dated June, 1991, or the Free Software Foundation; version 2 dated June, 1991, or
(at your option) version 3 dated 29 June, 2007. (at your option) version 3 dated 29 June, 2007.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#define COPYRIGHT "Copyright (c) 2000-2018 Simon Kelley" #define COPYRIGHT "Copyright (c) 2000-2020 Simon Kelley"
/* We do defines that influence behavior of stdio.h, so complain /* We do defines that influence behavior of stdio.h, so complain
if included too early. */ if included too early. */
#ifdef _STDIO_H #ifdef _STDIO_H
# error "Header file stdio.h included too early!" # error "Header file stdio.h included too early!"
#endif #endif
#ifndef NO_LARGEFILE #ifndef NO_LARGEFILE
/* Ensure we can use files >2GB (log files may grow this big) */ /* Ensure we can use files >2GB (log files may grow this big) */
# define _LARGEFILE_SOURCE 1 # define _LARGEFILE_SOURCE 1
skipping to change at line 98 skipping to change at line 98
# include <locale.h> # include <locale.h>
# define _(S) gettext(S) # define _(S) gettext(S)
#endif #endif
#include <arpa/inet.h> #include <arpa/inet.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#if defined(HAVE_SOLARIS_NETWORK) #if defined(HAVE_SOLARIS_NETWORK)
# include <sys/sockio.h> # include <sys/sockio.h>
#endif #endif
#include <sys/poll.h> #if defined(HAVE_POLL_H)
# include <poll.h>
#else
# include <sys/poll.h>
#endif
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/un.h> #include <sys/un.h>
#include <limits.h> #include <limits.h>
#include <net/if.h> #include <net/if.h>
#if defined(HAVE_SOLARIS_NETWORK) && !defined(ifr_mtu) #if defined(HAVE_SOLARIS_NETWORK) && !defined(ifr_mtu)
/* Some solaris net/if./h omit this. */ /* Some solaris net/if./h omit this. */
# define ifr_mtu ifr_ifru.ifru_metric # define ifr_mtu ifr_ifru.ifru_metric
#endif #endif
#include <unistd.h> #include <unistd.h>
skipping to change at line 129 skipping to change at line 133
#include <grp.h> #include <grp.h>
#include <stdarg.h> #include <stdarg.h>
#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__sun__) || defined ( __sun) || defined (__ANDROID__) #if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__sun__) || defined ( __sun) || defined (__ANDROID__)
# include <netinet/if_ether.h> # include <netinet/if_ether.h>
#else #else
# include <net/ethernet.h> # include <net/ethernet.h>
#endif #endif
#include <net/if_arp.h> #include <net/if_arp.h>
#include <netinet/in_systm.h> #include <netinet/in_systm.h>
#include <netinet/ip.h> #include <netinet/ip.h>
#ifdef HAVE_IPV6
#include <netinet/ip6.h> #include <netinet/ip6.h>
#endif
#include <netinet/ip_icmp.h> #include <netinet/ip_icmp.h>
#include <netinet/tcp.h>
#include <sys/uio.h> #include <sys/uio.h>
#include <syslog.h> #include <syslog.h>
#include <dirent.h> #include <dirent.h>
#ifndef HAVE_LINUX_NETWORK #ifndef HAVE_LINUX_NETWORK
# include <net/if_dl.h> # include <net/if_dl.h>
#endif #endif
#if defined(HAVE_LINUX_NETWORK) #if defined(HAVE_LINUX_NETWORK)
#include <linux/version.h>
#include <linux/sockios.h>
#include <linux/capability.h> #include <linux/capability.h>
/* There doesn't seem to be a universally-available /* There doesn't seem to be a universally-available
userspace header for these. */ userspace header for these. */
extern int capset(cap_user_header_t header, cap_user_data_t data); 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); extern int capget(cap_user_header_t header, cap_user_data_t data);
#define LINUX_CAPABILITY_VERSION_1 0x19980330 #define LINUX_CAPABILITY_VERSION_1 0x19980330
#define LINUX_CAPABILITY_VERSION_2 0x20071026 #define LINUX_CAPABILITY_VERSION_2 0x20071026
#define LINUX_CAPABILITY_VERSION_3 0x20080522 #define LINUX_CAPABILITY_VERSION_3 0x20080522
#include <sys/prctl.h> #include <sys/prctl.h>
skipping to change at line 162 skipping to change at line 167
#include <priv.h> #include <priv.h>
#endif #endif
#ifdef HAVE_DNSSEC #ifdef HAVE_DNSSEC
# include <nettle/nettle-meta.h> # include <nettle/nettle-meta.h>
#endif #endif
/* daemon is function in the C library.... */ /* daemon is function in the C library.... */
#define daemon dnsmasq_daemon #define daemon dnsmasq_daemon
#define ADDRSTRLEN INET6_ADDRSTRLEN
/* Async event queue */ /* Async event queue */
struct event_desc { struct event_desc {
int event, data, msg_sz; int event, data, msg_sz;
}; };
#define EVENT_RELOAD 1 #define EVENT_RELOAD 1
#define EVENT_DUMP 2 #define EVENT_DUMP 2
#define EVENT_ALARM 3 #define EVENT_ALARM 3
#define EVENT_TERM 4 #define EVENT_TERM 4
#define EVENT_CHILD 5 #define EVENT_CHILD 5
skipping to change at line 203 skipping to change at line 210
/* Exit codes. */ /* Exit codes. */
#define EC_GOOD 0 #define EC_GOOD 0
#define EC_BADCONF 1 #define EC_BADCONF 1
#define EC_BADNET 2 #define EC_BADNET 2
#define EC_FILE 3 #define EC_FILE 3
#define EC_NOMEM 4 #define EC_NOMEM 4
#define EC_MISC 5 #define EC_MISC 5
#define EC_INIT_OFFSET 10 #define EC_INIT_OFFSET 10
/* Trust the compiler dead-code eliminator.... */
#define option_bool(x) (((x) < 32) ? daemon->options & (1u << (x)) : daemon->opt
ions2 & (1u << ((x) - 32)))
#define OPT_BOGUSPRIV 0 #define OPT_BOGUSPRIV 0
#define OPT_FILTER 1 #define OPT_FILTER 1
#define OPT_LOG 2 #define OPT_LOG 2
#define OPT_SELFMX 3 #define OPT_SELFMX 3
#define OPT_NO_HOSTS 4 #define OPT_NO_HOSTS 4
#define OPT_NO_POLL 5 #define OPT_NO_POLL 5
#define OPT_DEBUG 6 #define OPT_DEBUG 6
#define OPT_ORDER 7 #define OPT_ORDER 7
#define OPT_NO_RESOLV 8 #define OPT_NO_RESOLV 8
#define OPT_EXPAND 9 #define OPT_EXPAND 9
skipping to change at line 265 skipping to change at line 269
#define OPT_LOCAL_SERVICE 49 #define OPT_LOCAL_SERVICE 49
#define OPT_LOOP_DETECT 50 #define OPT_LOOP_DETECT 50
#define OPT_EXTRALOG 51 #define OPT_EXTRALOG 51
#define OPT_TFTP_NO_FAIL 52 #define OPT_TFTP_NO_FAIL 52
#define OPT_SCRIPT_ARP 53 #define OPT_SCRIPT_ARP 53
#define OPT_MAC_B64 54 #define OPT_MAC_B64 54
#define OPT_MAC_HEX 55 #define OPT_MAC_HEX 55
#define OPT_TFTP_APREF_MAC 56 #define OPT_TFTP_APREF_MAC 56
#define OPT_RAPID_COMMIT 57 #define OPT_RAPID_COMMIT 57
#define OPT_UBUS 58 #define OPT_UBUS 58
#define OPT_LAST 59 #define OPT_IGNORE_CLID 59
#define OPT_SINGLE_PORT 60
#define OPT_LEASE_RENEW 61
#define OPT_LAST 62
#define OPTION_BITS (sizeof(unsigned int)*8)
#define OPTION_SIZE ( (OPT_LAST/OPTION_BITS)+((OPT_LAST%OPTION_BITS)!=0) )
#define option_var(x) (daemon->options[(x) / OPTION_BITS])
#define option_val(x) ((1u) << ((x) % OPTION_BITS))
#define option_bool(x) (option_var(x) & option_val(x))
/* extra flags for my_syslog, we use a couple of facilities since they are known /* 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. */ not to occupy the same bits as priorities, no matter how syslog.h is set up. */
#define MS_TFTP LOG_USER #define MS_TFTP LOG_USER
#define MS_DHCP LOG_DAEMON #define MS_DHCP LOG_DAEMON
#define MS_SCRIPT LOG_MAIL #define MS_SCRIPT LOG_MAIL
struct all_addr { /* Note that this is used widely as a container for IPv4/IPv6 addresses,
union { so for that reason, was well as to avoid wasting memory in almost every
struct in_addr addr4; cache entry, the other variants should not be larger than
#ifdef HAVE_IPV6 sizeof(struct in6_addr) - 16 bytes.
struct in6_addr addr6; */
#endif union all_addr {
/* for log_query */ struct in_addr addr4;
struct { struct in6_addr addr6;
unsigned short keytag, algo, digest; struct {
} log; union {
/* for log_query */ struct crec *cache;
struct { char *name;
unsigned int rcode; } target;
} rcode; unsigned int uid;
/* for cache_insert of DNSKEY, DS */ int is_name_ptr; /* disciminates target union */
struct { } cname;
unsigned short class, type; struct {
} dnssec; struct blockdata *keydata;
} addr; unsigned short keylen, flags, keytag;
unsigned char algo;
} key;
struct {
struct blockdata *keydata;
unsigned short keylen, keytag;
unsigned char algo;
unsigned char digest;
} ds;
struct {
struct blockdata *target;
unsigned short targetlen, srvport, priority, weight;
} srv;
/* for log_query */
struct {
unsigned short keytag, algo, digest, rcode;
} log;
}; };
struct bogus_addr { struct bogus_addr {
struct in_addr addr; struct in_addr addr;
struct bogus_addr *next; struct bogus_addr *next;
}; };
/* dns doctor param */ /* dns doctor param */
struct doctor { struct doctor {
struct in_addr in, end, out, mask; struct in_addr in, end, out, mask;
skipping to change at line 353 skipping to change at line 382
char *alias, *target; char *alias, *target;
struct cname *next, *targetp; struct cname *next, *targetp;
}; };
struct ds_config { struct ds_config {
char *name, *digest; char *name, *digest;
int digestlen, class, algo, keytag, digest_type; int digestlen, class, algo, keytag, digest_type;
struct ds_config *next; struct ds_config *next;
}; };
#define ADDRLIST_LITERAL 1 #define ADDRLIST_LITERAL 1
#define ADDRLIST_IPV6 2 #define ADDRLIST_IPV6 2
#define ADDRLIST_REVONLY 4 #define ADDRLIST_REVONLY 4
#define ADDRLIST_PREFIX 8
#define ADDRLIST_WILDCARD 16
#define ADDRLIST_DECLINED 32
struct addrlist { struct addrlist {
struct all_addr addr; union all_addr addr;
int flags, prefixlen; int flags, prefixlen;
time_t decline_time;
struct addrlist *next; struct addrlist *next;
}; };
#define AUTH6 1 #define AUTH6 1
#define AUTH4 2 #define AUTH4 2
struct auth_zone { struct auth_zone {
char *domain; char *domain;
struct auth_name_list { struct auth_name_list {
char *name; char *name;
int flags; int flags;
struct auth_name_list *next; struct auth_name_list *next;
} *interface_names; } *interface_names;
struct addrlist *subnet; struct addrlist *subnet;
struct addrlist *exclude; struct addrlist *exclude;
struct auth_zone *next; struct auth_zone *next;
}; };
#define HR_6 1
#define HR_4 2
struct host_record { struct host_record {
int ttl; int ttl, flags;
struct name_list { struct name_list {
char *name; char *name;
struct name_list *next; struct name_list *next;
} *names; } *names;
struct in_addr addr; struct in_addr addr;
#ifdef HAVE_IPV6
struct in6_addr addr6; struct in6_addr addr6;
#endif
struct host_record *next; struct host_record *next;
}; };
struct interface_name { struct interface_name {
char *name; /* domain name */ char *name; /* domain name */
char *intr; /* interface name */ char *intr; /* interface name */
int family; /* AF_INET, AF_INET6 or zero for both */ int family; /* AF_INET, AF_INET6 or zero for both */
struct addrlist *addr; struct addrlist *addr;
struct interface_name *next; struct interface_name *next;
}; };
skipping to change at line 411 skipping to change at line 445
union bigname *next; /* freelist */ union bigname *next; /* freelist */
}; };
struct blockdata { struct blockdata {
struct blockdata *next; struct blockdata *next;
unsigned char key[KEYBLOCK_LEN]; unsigned char key[KEYBLOCK_LEN];
}; };
struct crec { struct crec {
struct crec *next, *prev, *hash_next; struct crec *next, *prev, *hash_next;
/* union is 16 bytes when doing IPv6, 8 bytes on 32 bit machines without IPv6 union all_addr addr;
*/
union {
struct all_addr addr;
struct {
union {
struct crec *cache;
struct interface_name *int_name;
} target;
unsigned int uid; /* 0 if union is interface-name */
} cname;
struct {
struct blockdata *keydata;
unsigned short keylen, flags, keytag;
unsigned char algo;
} key;
struct {
struct blockdata *keydata;
unsigned short keylen, keytag;
unsigned char algo;
unsigned char digest;
} ds;
} addr;
time_t ttd; /* time to die */ time_t ttd; /* time to die */
/* used as class if DNSKEY/DS, index to source for F_HOSTS */ /* used as class if DNSKEY/DS, index to source for F_HOSTS */
unsigned int uid; unsigned int uid;
unsigned short flags; unsigned int flags;
union { union {
char sname[SMALLDNAME]; char sname[SMALLDNAME];
union bigname *bname; union bigname *bname;
char *namep; char *namep;
} name; } name;
}; };
#define SIZEOF_BARE_CREC (sizeof(struct crec) - SMALLDNAME) #define SIZEOF_BARE_CREC (sizeof(struct crec) - SMALLDNAME)
#define SIZEOF_POINTER_CREC (sizeof(struct crec) + sizeof(char *) - SMALLDNAME) #define SIZEOF_POINTER_CREC (sizeof(struct crec) + sizeof(char *) - SMALLDNAME)
skipping to change at line 463 skipping to change at line 476
#define F_HOSTS (1u<<6) #define F_HOSTS (1u<<6)
#define F_IPV4 (1u<<7) #define F_IPV4 (1u<<7)
#define F_IPV6 (1u<<8) #define F_IPV6 (1u<<8)
#define F_BIGNAME (1u<<9) #define F_BIGNAME (1u<<9)
#define F_NXDOMAIN (1u<<10) #define F_NXDOMAIN (1u<<10)
#define F_CNAME (1u<<11) #define F_CNAME (1u<<11)
#define F_DNSKEY (1u<<12) #define F_DNSKEY (1u<<12)
#define F_CONFIG (1u<<13) #define F_CONFIG (1u<<13)
#define F_DS (1u<<14) #define F_DS (1u<<14)
#define F_DNSSECOK (1u<<15) #define F_DNSSECOK (1u<<15)
/* below here are only valid as args to log_query: cache
entries are limited to 16 bits */
#define F_UPSTREAM (1u<<16) #define F_UPSTREAM (1u<<16)
#define F_RRNAME (1u<<17) #define F_RRNAME (1u<<17)
#define F_SERVER (1u<<18) #define F_SERVER (1u<<18)
#define F_QUERY (1u<<19) #define F_QUERY (1u<<19)
#define F_NOERR (1u<<20) #define F_NOERR (1u<<20)
#define F_AUTH (1u<<21) #define F_AUTH (1u<<21)
#define F_DNSSEC (1u<<22) #define F_DNSSEC (1u<<22)
#define F_KEYTAG (1u<<23) #define F_KEYTAG (1u<<23)
#define F_SECSTAT (1u<<24) #define F_SECSTAT (1u<<24)
#define F_NO_RR (1u<<25) #define F_NO_RR (1u<<25)
#define F_IPSET (1u<<26) #define F_IPSET (1u<<26)
#define F_NOEXTRA (1u<<27) #define F_NOEXTRA (1u<<27)
#define F_SERVFAIL (1u<<28) #define F_SERVFAIL (1u<<28) /* currently unused. */
#define F_RCODE (1u<<29) #define F_RCODE (1u<<29)
#define F_SRV (1u<<30)
#define UID_NONE 0 #define UID_NONE 0
/* Values of uid in crecs with F_CONFIG bit set. */ /* Values of uid in crecs with F_CONFIG bit set. */
/* cname to uid SRC_INTERFACE are to interface names,
so use UID_NONE for that to eliminate clashes with
any other uid */
#define SRC_INTERFACE UID_NONE
#define SRC_CONFIG 1 #define SRC_CONFIG 1
#define SRC_HOSTS 2 #define SRC_HOSTS 2
#define SRC_AH 3 #define SRC_AH 3
/* struct sockaddr is not large enough to hold any address, /* struct sockaddr is not large enough to hold any address,
and specifically not big enough to hold an IPv6 address. and specifically not big enough to hold an IPv6 address.
Blech. Roll our own. */ Blech. Roll our own. */
union mysockaddr { union mysockaddr {
struct sockaddr sa; struct sockaddr sa;
struct sockaddr_in in; struct sockaddr_in in;
#if defined(HAVE_IPV6)
struct sockaddr_in6 in6; struct sockaddr_in6 in6;
#endif
}; };
/* bits in flag param to IPv6 callbacks from iface_enumerate() */ /* bits in flag param to IPv6 callbacks from iface_enumerate() */
#define IFACE_TENTATIVE 1 #define IFACE_TENTATIVE 1
#define IFACE_DEPRECATED 2 #define IFACE_DEPRECATED 2
#define IFACE_PERMANENT 4 #define IFACE_PERMANENT 4
#define SERV_FROM_RESOLV 1 /* 1 for servers from resolv, 0 for command li ne. */ #define SERV_FROM_RESOLV 1 /* 1 for servers from resolv, 0 for command li ne. */
#define SERV_NO_ADDR 2 /* no server, this domain is local only */ #define SERV_NO_ADDR 2 /* no server, this domain is local only */
#define SERV_LITERAL_ADDRESS 4 /* addr is the answer, not the server */ #define SERV_LITERAL_ADDRESS 4 /* addr is the answer, not the server */
skipping to change at line 656 skipping to change at line 661
#define FREC_HAS_EXTRADATA 512 #define FREC_HAS_EXTRADATA 512
#ifdef HAVE_DNSSEC #ifdef HAVE_DNSSEC
#define HASH_SIZE 20 /* SHA-1 digest size */ #define HASH_SIZE 20 /* SHA-1 digest size */
#else #else
#define HASH_SIZE sizeof(int) #define HASH_SIZE sizeof(int)
#endif #endif
struct frec { struct frec {
union mysockaddr source; union mysockaddr source;
struct all_addr dest; union all_addr dest;
struct server *sentto; /* NULL means free */ struct server *sentto; /* NULL means free */
struct randfd *rfd4; struct randfd *rfd4;
#ifdef HAVE_IPV6
struct randfd *rfd6; struct randfd *rfd6;
#endif
unsigned int iface; unsigned int iface;
unsigned short orig_id, new_id; unsigned short orig_id, new_id;
int log_id, fd, forwardall, flags; int log_id, fd, forwardall, flags;
time_t time; time_t time;
unsigned char *hash[HASH_SIZE]; unsigned char *hash[HASH_SIZE];
#ifdef HAVE_DNSSEC #ifdef HAVE_DNSSEC
int class, work_counter; int class, work_counter;
struct blockdata *stash; /* Saved reply, whilst we validate */ struct blockdata *stash; /* Saved reply, whilst we validate */
size_t stash_len; size_t stash_len;
struct frec *dependent; /* Query awaiting internally-generated DNSKEY or DS qu ery */ struct frec *dependent; /* Query awaiting internally-generated DNSKEY or DS qu ery */
skipping to change at line 703 skipping to change at line 706
#define ACTION_ARP_DEL 7 #define ACTION_ARP_DEL 7
#define LEASE_NEW 1 /* newly created */ #define LEASE_NEW 1 /* newly created */
#define LEASE_CHANGED 2 /* modified */ #define LEASE_CHANGED 2 /* modified */
#define LEASE_AUX_CHANGED 4 /* CLID or expiry changed */ #define LEASE_AUX_CHANGED 4 /* CLID or expiry changed */
#define LEASE_AUTH_NAME 8 /* hostname came from config, not from client */ #define LEASE_AUTH_NAME 8 /* hostname came from config, not from client */
#define LEASE_USED 16 /* used this DHCPv6 transaction */ #define LEASE_USED 16 /* used this DHCPv6 transaction */
#define LEASE_NA 32 /* IPv6 no-temporary lease */ #define LEASE_NA 32 /* IPv6 no-temporary lease */
#define LEASE_TA 64 /* IPv6 temporary lease */ #define LEASE_TA 64 /* IPv6 temporary lease */
#define LEASE_HAVE_HWADDR 128 /* Have set hwaddress */ #define LEASE_HAVE_HWADDR 128 /* Have set hwaddress */
#define LEASE_EXP_CHANGED 256 /* Lease expiry time changed */
struct dhcp_lease { struct dhcp_lease {
int clid_len; /* length of client identifier */ int clid_len; /* length of client identifier */
unsigned char *clid; /* clientid */ unsigned char *clid; /* clientid */
char *hostname, *fqdn; /* name from client-hostname option or config */ char *hostname, *fqdn; /* name from client-hostname option or config */
char *old_hostname; /* hostname before it moved to another lease */ char *old_hostname; /* hostname before it moved to another lease */
int flags; int flags;
time_t expires; /* lease expiry */ time_t expires; /* lease expiry */
#ifdef HAVE_BROKEN_RTC #ifdef HAVE_BROKEN_RTC
unsigned int length; unsigned int length;
skipping to change at line 724 skipping to change at line 728
int hwaddr_len, hwaddr_type; int hwaddr_len, hwaddr_type;
unsigned char hwaddr[DHCP_CHADDR_MAX]; unsigned char hwaddr[DHCP_CHADDR_MAX];
struct in_addr addr, override, giaddr; struct in_addr addr, override, giaddr;
unsigned char *extradata; unsigned char *extradata;
unsigned int extradata_len, extradata_size; unsigned int extradata_len, extradata_size;
int last_interface; int last_interface;
int new_interface; /* save possible originated interface */ int new_interface; /* save possible originated interface */
int new_prefixlen; /* and its prefix length */ int new_prefixlen; /* and its prefix length */
#ifdef HAVE_DHCP6 #ifdef HAVE_DHCP6
struct in6_addr addr6; struct in6_addr addr6;
int iaid; unsigned int iaid;
struct slaac_address { struct slaac_address {
struct in6_addr addr; struct in6_addr addr;
time_t ping_time; time_t ping_time;
int backoff; /* zero -> confirmed */ int backoff; /* zero -> confirmed */
struct slaac_address *next; struct slaac_address *next;
} *slaac_address; } *slaac_address;
int vendorclass_count; int vendorclass_count;
#endif #endif
struct dhcp_lease *next; struct dhcp_lease *next;
}; };
skipping to change at line 771 skipping to change at line 775
unsigned int wildcard_mask; unsigned int wildcard_mask;
struct hwaddr_config *next; struct hwaddr_config *next;
}; };
struct dhcp_config { struct dhcp_config {
unsigned int flags; unsigned int flags;
int clid_len; /* length of client identifier */ int clid_len; /* length of client identifier */
unsigned char *clid; /* clientid */ unsigned char *clid; /* clientid */
char *hostname, *domain; char *hostname, *domain;
struct dhcp_netid_list *netid; struct dhcp_netid_list *netid;
struct dhcp_netid *filter;
#ifdef HAVE_DHCP6 #ifdef HAVE_DHCP6
struct in6_addr addr6; struct addrlist *addr6;
#endif #endif
struct in_addr addr; struct in_addr addr;
time_t decline_time; time_t decline_time;
unsigned int lease_time; unsigned int lease_time;
struct hwaddr_config *hwaddr; struct hwaddr_config *hwaddr;
struct dhcp_config *next; struct dhcp_config *next;
}; };
#define have_config(config, mask) ((config) && ((config)->flags & (mask))) #define have_config(config, mask) ((config) && ((config)->flags & (mask)))
skipping to change at line 794 skipping to change at line 799
#define CONFIG_CLID 2 #define CONFIG_CLID 2
#define CONFIG_TIME 8 #define CONFIG_TIME 8
#define CONFIG_NAME 16 #define CONFIG_NAME 16
#define CONFIG_ADDR 32 #define CONFIG_ADDR 32
#define CONFIG_NOCLID 128 #define CONFIG_NOCLID 128
#define CONFIG_FROM_ETHERS 256 /* entry created by /etc/ethers */ #define CONFIG_FROM_ETHERS 256 /* entry created by /etc/ethers */
#define CONFIG_ADDR_HOSTS 512 /* address added by from /etc/hosts */ #define CONFIG_ADDR_HOSTS 512 /* address added by from /etc/hosts */
#define CONFIG_DECLINED 1024 /* address declined by client */ #define CONFIG_DECLINED 1024 /* address declined by client */
#define CONFIG_BANK 2048 /* from dhcp hosts file */ #define CONFIG_BANK 2048 /* from dhcp hosts file */
#define CONFIG_ADDR6 4096 #define CONFIG_ADDR6 4096
#define CONFIG_WILDCARD 8192 #define CONFIG_ADDR6_HOSTS 16384 /* address added by from /etc/hosts */
struct dhcp_opt { struct dhcp_opt {
int opt, len, flags; int opt, len, flags;
union { union {
int encap; int encap;
unsigned int wildcard_mask; unsigned int wildcard_mask;
unsigned char *vendor_class; unsigned char *vendor_class;
} u; } u;
unsigned char *val; unsigned char *val;
struct dhcp_netid *netid; struct dhcp_netid *netid;
skipping to change at line 876 skipping to change at line 881
}; };
struct dhcp_bridge { struct dhcp_bridge {
char iface[IF_NAMESIZE]; char iface[IF_NAMESIZE];
struct dhcp_bridge *alias, *next; struct dhcp_bridge *alias, *next;
}; };
struct cond_domain { struct cond_domain {
char *domain, *prefix; char *domain, *prefix;
struct in_addr start, end; struct in_addr start, end;
#ifdef HAVE_IPV6
struct in6_addr start6, end6; struct in6_addr start6, end6;
#endif
int is6, indexed; int is6, indexed;
struct cond_domain *next; struct cond_domain *next;
}; };
#ifdef OPTION6_PREFIX_CLASS
struct prefix_class {
int class;
struct dhcp_netid tag;
struct prefix_class *next;
};
#endif
struct ra_interface { struct ra_interface {
char *name; char *name;
char *mtu_name; char *mtu_name;
int interval, lifetime, prio, mtu; int interval, lifetime, prio, mtu;
struct ra_interface *next; struct ra_interface *next;
}; };
struct dhcp_context { struct dhcp_context {
unsigned int lease_time, addr_epoch; unsigned int lease_time, addr_epoch;
struct in_addr netmask, broadcast; struct in_addr netmask, broadcast;
skipping to change at line 916 skipping to change at line 911
int prefix, if_index; int prefix, if_index;
unsigned int valid, preferred, saved_valid; unsigned int valid, preferred, saved_valid;
time_t ra_time, ra_short_period_start, address_lost_time; time_t ra_time, ra_short_period_start, address_lost_time;
char *template_interface; char *template_interface;
#endif #endif
int flags; int flags;
struct dhcp_netid netid, *filter; struct dhcp_netid netid, *filter;
struct dhcp_context *next, *current; struct dhcp_context *next, *current;
}; };
struct shared_network {
int if_index;
struct in_addr match_addr, shared_addr;
#ifdef HAVE_DHCP6
/* shared_addr == 0 for IP6 entries. */
struct in6_addr match_addr6, shared_addr6;
#endif
struct shared_network *next;
};
#define CONTEXT_STATIC (1u<<0) #define CONTEXT_STATIC (1u<<0)
#define CONTEXT_NETMASK (1u<<1) #define CONTEXT_NETMASK (1u<<1)
#define CONTEXT_BRDCAST (1u<<2) #define CONTEXT_BRDCAST (1u<<2)
#define CONTEXT_PROXY (1u<<3) #define CONTEXT_PROXY (1u<<3)
#define CONTEXT_RA_ROUTER (1u<<4) #define CONTEXT_RA_ROUTER (1u<<4)
#define CONTEXT_RA_DONE (1u<<5) #define CONTEXT_RA_DONE (1u<<5)
#define CONTEXT_RA_NAME (1u<<6) #define CONTEXT_RA_NAME (1u<<6)
#define CONTEXT_RA_STATELESS (1u<<7) #define CONTEXT_RA_STATELESS (1u<<7)
#define CONTEXT_DHCP (1u<<8) #define CONTEXT_DHCP (1u<<8)
#define CONTEXT_DEPRECATE (1u<<9) #define CONTEXT_DEPRECATE (1u<<9)
skipping to change at line 958 skipping to change at line 963
char filename[]; char filename[];
}; };
struct tftp_transfer { struct tftp_transfer {
int sockfd; int sockfd;
time_t timeout; time_t timeout;
int backoff; int backoff;
unsigned int block, blocksize, expansion; unsigned int block, blocksize, expansion;
off_t offset; off_t offset;
union mysockaddr peer; union mysockaddr peer;
union all_addr source;
int if_index;
char opt_blocksize, opt_transize, netascii, carrylf; char opt_blocksize, opt_transize, netascii, carrylf;
struct tftp_file *file; struct tftp_file *file;
struct tftp_transfer *next; struct tftp_transfer *next;
}; };
struct addr_list { struct addr_list {
struct in_addr addr; struct in_addr addr;
struct addr_list *next; struct addr_list *next;
}; };
struct tftp_prefix { struct tftp_prefix {
char *interface; char *interface;
char *prefix; char *prefix;
int missing; int missing;
struct tftp_prefix *next; struct tftp_prefix *next;
}; };
struct dhcp_relay { struct dhcp_relay {
struct all_addr local, server; union all_addr local, server;
char *interface; /* Allowable interface for replies from server, and dest for IPv6 multicast */ char *interface; /* Allowable interface for replies from server, and dest for IPv6 multicast */
int iface_index; /* working - interface in which requests arrived, for return */ int iface_index; /* working - interface in which requests arrived, for return */
struct dhcp_relay *current, *next; struct dhcp_relay *current, *next;
}; };
extern struct daemon { extern struct daemon {
/* datastuctures representing the command-line and /* datastuctures representing the command-line and
config file arguments. All set (including defaults) config file arguments. All set (including defaults)
in option.c */ in option.c */
unsigned int options, options2; unsigned int options[OPTION_SIZE];
struct resolvc default_resolv, *resolv_files; struct resolvc default_resolv, *resolv_files;
time_t last_resolv; time_t last_resolv;
char *servers_file; char *servers_file;
struct mx_srv_record *mxnames; struct mx_srv_record *mxnames;
struct naptr *naptr; struct naptr *naptr;
struct txt_record *txt, *rr; struct txt_record *txt, *rr;
struct ptr_record *ptr; struct ptr_record *ptr;
struct host_record *host_records, *host_records_tail; struct host_record *host_records, *host_records_tail;
struct cname *cnames; struct cname *cnames;
struct auth_zone *auth_zones; struct auth_zone *auth_zones;
skipping to change at line 1055 skipping to change at line 1062
int dhcp_server_port, dhcp_client_port; int dhcp_server_port, dhcp_client_port;
int start_tftp_port, end_tftp_port; int start_tftp_port, end_tftp_port;
unsigned int min_leasetime; unsigned int min_leasetime;
struct doctor *doctors; struct doctor *doctors;
unsigned short edns_pktsz; unsigned short edns_pktsz;
char *tftp_prefix; char *tftp_prefix;
struct tftp_prefix *if_prefix; /* per-interface TFTP prefixes */ struct tftp_prefix *if_prefix; /* per-interface TFTP prefixes */
unsigned int duid_enterprise, duid_config_len; unsigned int duid_enterprise, duid_config_len;
unsigned char *duid_config; unsigned char *duid_config;
char *dbus_name; char *dbus_name;
char *ubus_name;
char *dump_file; char *dump_file;
int dump_mask; int dump_mask;
unsigned long soa_sn, soa_refresh, soa_retry, soa_expiry; unsigned long soa_sn, soa_refresh, soa_retry, soa_expiry;
u32 metrics[__METRIC_MAX]; u32 metrics[__METRIC_MAX];
#ifdef OPTION6_PREFIX_CLASS
struct prefix_class *prefix_classes;
#endif
#ifdef HAVE_DNSSEC #ifdef HAVE_DNSSEC
struct ds_config *ds; struct ds_config *ds;
char *timestamp_file; char *timestamp_file;
#endif #endif
/* globally used stuff for DNS */ /* globally used stuff for DNS */
char *packet; /* packet buffer */ char *packet; /* packet buffer */
int packet_buff_sz; /* size of above */ int packet_buff_sz; /* size of above */
char *namebuff; /* MAXDNAME size buffer */ char *namebuff; /* MAXDNAME size buffer */
#ifdef HAVE_DNSSEC #ifdef HAVE_DNSSEC
char *keyname; /* MAXDNAME size buffer */ char *keyname; /* MAXDNAME size buffer */
char *workspacename; /* ditto */ char *workspacename; /* ditto */
char *rr_status; /* flags for individual RRs */ unsigned long *rr_status; /* ceiling in TTL from DNSSEC or zero for insecure * /
int rr_status_sz; int rr_status_sz;
int dnssec_no_time_check; int dnssec_no_time_check;
int back_to_the_future; int back_to_the_future;
#endif #endif
struct frec *frec_list; struct frec *frec_list;
struct serverfd *sfds; struct serverfd *sfds;
struct irec *interfaces; struct irec *interfaces;
struct listener *listeners; struct listener *listeners;
struct server *last_server; struct server *last_server;
time_t forwardtime; time_t forwardtime;
int forwardcount; int forwardcount;
struct server *srv_save; /* Used for resend on DoD */ struct server *srv_save; /* Used for resend on DoD */
size_t packet_len; /* " " */ size_t packet_len; /* " " */
struct randfd *rfd_save; /* " " */ struct randfd *rfd_save; /* " " */
pid_t tcp_pids[MAX_PROCS]; pid_t tcp_pids[MAX_PROCS];
int tcp_pipes[MAX_PROCS];
int pipe_to_parent;
struct randfd randomsocks[RANDOM_SOCKS]; struct randfd randomsocks[RANDOM_SOCKS];
int v6pktinfo; int v6pktinfo;
struct addrlist *interface_addrs; /* list of all addresses/prefix lengths asso ciated with all local interfaces */ struct addrlist *interface_addrs; /* list of all addresses/prefix lengths asso ciated with all local interfaces */
int log_id, log_display_id; /* ids of transactions for logging */ int log_id, log_display_id; /* ids of transactions for logging */
union mysockaddr *log_source_addr; union mysockaddr *log_source_addr;
/* DHCP state */ /* DHCP state */
int dhcpfd, helperfd, pxefd; int dhcpfd, helperfd, pxefd;
#ifdef HAVE_INOTIFY #ifdef HAVE_INOTIFY
int inotifyfd; int inotifyfd;
#endif #endif
#if defined(HAVE_LINUX_NETWORK) #if defined(HAVE_LINUX_NETWORK)
int netlinkfd; int netlinkfd, kernel_version;
#elif defined(HAVE_BSD_NETWORK) #elif defined(HAVE_BSD_NETWORK)
int dhcp_raw_fd, dhcp_icmp_fd, routefd; int dhcp_raw_fd, dhcp_icmp_fd, routefd;
#endif #endif
struct iovec dhcp_packet; struct iovec dhcp_packet;
char *dhcp_buff, *dhcp_buff2, *dhcp_buff3; char *dhcp_buff, *dhcp_buff2, *dhcp_buff3;
struct ping_result *ping_results; struct ping_result *ping_results;
FILE *lease_stream; FILE *lease_stream;
struct dhcp_bridge *bridges; struct dhcp_bridge *bridges;
struct shared_network *shared_networks;
#ifdef HAVE_DHCP6 #ifdef HAVE_DHCP6
int duid_len; int duid_len;
unsigned char *duid; unsigned char *duid;
struct iovec outpacket; struct iovec outpacket;
int dhcp6fd, icmp6fd; int dhcp6fd, icmp6fd;
#endif #endif
/* DBus stuff */ /* DBus stuff */
/* void * here to avoid depending on dbus headers outside dbus.c */ /* void * here to avoid depending on dbus headers outside dbus.c */
void *dbus; void *dbus;
#ifdef HAVE_DBUS #ifdef HAVE_DBUS
struct watch *watches; struct watch *watches;
#endif #endif
/* UBus stuff */
#ifdef HAVE_UBUS
/* void * here to avoid depending on ubus headers outside ubus.c */
void *ubus;
#endif
/* TFTP stuff */ /* TFTP stuff */
struct tftp_transfer *tftp_trans, *tftp_done_trans; struct tftp_transfer *tftp_trans, *tftp_done_trans;
/* utility string buffer, hold max sized IP address as string */ /* utility string buffer, hold max sized IP address as string */
char *addrbuff; char *addrbuff;
char *addrbuff2; /* only allocated when OPT_EXTRALOG */ char *addrbuff2; /* only allocated when OPT_EXTRALOG */
#ifdef HAVE_DUMPFILE #ifdef HAVE_DUMPFILE
/* file for packet dumps. */ /* file for packet dumps. */
int dumpfd; int dumpfd;
#endif #endif
} *daemon; } *daemon;
/* cache.c */ /* cache.c */
void cache_init(void); void cache_init(void);
void next_uid(struct crec *crecp); void next_uid(struct crec *crecp);
void log_query(unsigned int flags, char *name, struct all_addr *addr, char *arg) ; void log_query(unsigned int flags, char *name, union all_addr *addr, char *arg);
char *record_source(unsigned int index); char *record_source(unsigned int index);
char *querystr(char *desc, unsigned short type); char *querystr(char *desc, unsigned short type);
int cache_find_non_terminal(char *name, time_t now); int cache_find_non_terminal(char *name, time_t now);
struct crec *cache_find_by_addr(struct crec *crecp, struct crec *cache_find_by_addr(struct crec *crecp,
struct all_addr *addr, time_t now, union all_addr *addr, time_t now,
unsigned int prot); unsigned int prot);
struct crec *cache_find_by_name(struct crec *crecp, struct crec *cache_find_by_name(struct crec *crecp,
char *name, time_t now, unsigned int prot); char *name, time_t now, unsigned int prot);
void cache_end_insert(void); void cache_end_insert(void);
void cache_start_insert(void); void cache_start_insert(void);
struct crec *cache_insert(char *name, struct all_addr *addr, int cache_recv_insert(time_t now, int fd);
time_t now, unsigned long ttl, unsigned short flags); struct crec *cache_insert(char *name, union all_addr *addr, unsigned short class
,
time_t now, unsigned long ttl, unsigned int flags);
void cache_reload(void); void cache_reload(void);
void cache_add_dhcp_entry(char *host_name, int prot, struct all_addr *host_addre ss, time_t ttd); void cache_add_dhcp_entry(char *host_name, int prot, union all_addr *host_addres s, time_t ttd);
struct in_addr a_record_from_hosts(char *name, time_t now); struct in_addr a_record_from_hosts(char *name, time_t now);
void cache_unhash_dhcp(void); void cache_unhash_dhcp(void);
void dump_cache(time_t now); void dump_cache(time_t now);
#ifndef NO_ID #ifndef NO_ID
int cache_make_stat(struct txt_record *t); int cache_make_stat(struct txt_record *t);
#endif #endif
char *cache_get_name(struct crec *crecp); char *cache_get_name(struct crec *crecp);
char *cache_get_cname_target(struct crec *crecp); char *cache_get_cname_target(struct crec *crecp);
struct crec *cache_enumerate(int init); struct crec *cache_enumerate(int init);
int read_hostsfile(char *filename, unsigned int index, int cache_size, int read_hostsfile(char *filename, unsigned int index, int cache_size,
struct crec **rhash, int hashsz); struct crec **rhash, int hashsz);
/* blockdata.c */ /* blockdata.c */
#ifdef HAVE_DNSSEC
void blockdata_init(void); void blockdata_init(void);
void blockdata_report(void); void blockdata_report(void);
struct blockdata *blockdata_alloc(char *data, size_t len); struct blockdata *blockdata_alloc(char *data, size_t len);
void *blockdata_retrieve(struct blockdata *block, size_t len, void *data); void *blockdata_retrieve(struct blockdata *block, size_t len, void *data);
struct blockdata *blockdata_read(int fd, size_t len);
void blockdata_write(struct blockdata *block, size_t len, int fd);
void blockdata_free(struct blockdata *blocks); void blockdata_free(struct blockdata *blocks);
#endif
/* domain.c */ /* domain.c */
char *get_domain(struct in_addr addr); char *get_domain(struct in_addr addr);
#ifdef HAVE_IPV6
char *get_domain6(struct in6_addr *addr); char *get_domain6(struct in6_addr *addr);
#endif int is_name_synthetic(int flags, char *name, union all_addr *addr);
int is_name_synthetic(int flags, char *name, struct all_addr *addr); int is_rev_synth(int flag, union all_addr *addr, char *name);
int is_rev_synth(int flag, struct all_addr *addr, char *name);
/* rfc1035.c */ /* rfc1035.c */
int extract_name(struct dns_header *header, size_t plen, unsigned char **pp, int extract_name(struct dns_header *header, size_t plen, unsigned char **pp,
char *name, int isExtract, int extrabytes); char *name, int isExtract, int extrabytes);
unsigned char *skip_name(unsigned char *ansp, struct dns_header *header, size_t plen, int extrabytes); unsigned char *skip_name(unsigned char *ansp, struct dns_header *header, size_t plen, int extrabytes);
unsigned char *skip_questions(struct dns_header *header, size_t plen); unsigned char *skip_questions(struct dns_header *header, size_t plen);
unsigned char *skip_section(unsigned char *ansp, int count, struct dns_header *h eader, size_t plen); unsigned char *skip_section(unsigned char *ansp, int count, struct dns_header *h eader, size_t plen);
unsigned int extract_request(struct dns_header *header, size_t qlen, unsigned int extract_request(struct dns_header *header, size_t qlen,
char *name, unsigned short *typep); char *name, unsigned short *typep);
size_t setup_reply(struct dns_header *header, size_t qlen, size_t setup_reply(struct dns_header *header, size_t qlen,
struct all_addr *addrp, unsigned int flags, union all_addr *addrp, unsigned int flags,
unsigned long ttl); unsigned long ttl);
int extract_addresses(struct dns_header *header, size_t qlen, char *name, int extract_addresses(struct dns_header *header, size_t qlen, char *name,
time_t now, char **ipsets, int is_sign, int check_rebind, time_t now, char **ipsets, int is_sign, int check_rebind,
int no_cache_dnssec, int secure, int *doctored); int no_cache_dnssec, int secure, int *doctored);
size_t answer_request(struct dns_header *header, char *limit, size_t qlen, size_t answer_request(struct dns_header *header, char *limit, size_t qlen,
struct in_addr local_addr, struct in_addr local_netmask, struct in_addr local_addr, struct in_addr local_netmask,
time_t now, int ad_reqd, int do_bit, int have_pseudoheader) ; 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, int check_for_bogus_wildcard(struct dns_header *header, size_t qlen, char *name,
struct bogus_addr *baddr, time_t now); struct bogus_addr *baddr, time_t now);
int check_for_ignored_address(struct dns_header *header, size_t qlen, struct bog us_addr *baddr); int check_for_ignored_address(struct dns_header *header, size_t qlen, struct bog us_addr *baddr);
int check_for_local_domain(char *name, time_t now); int check_for_local_domain(char *name, time_t now);
unsigned int questions_crc(struct dns_header *header, size_t plen, char *name); unsigned int questions_crc(struct dns_header *header, size_t plen, char *name);
size_t resize_packet(struct dns_header *header, size_t plen, size_t resize_packet(struct dns_header *header, size_t plen,
unsigned char *pheader, size_t hlen); unsigned char *pheader, size_t hlen);
int add_resource_record(struct dns_header *header, char *limit, int *truncp, int add_resource_record(struct dns_header *header, char *limit, int *truncp,
int nameoffset, unsigned char **pp, unsigned long ttl, int nameoffset, unsigned char **pp, unsigned long ttl,
int *offset, unsigned short type, unsigned short class, c har *format, ...); int *offset, unsigned short type, unsigned short class, c har *format, ...);
unsigned char *skip_questions(struct dns_header *header, size_t plen); int in_arpa_name_2_addr(char *namein, union all_addr *addrp);
int extract_name(struct dns_header *header, size_t plen, unsigned char **pp,
char *name, int isExtract, int extrabytes);
int in_arpa_name_2_addr(char *namein, struct all_addr *addrp);
int private_net(struct in_addr addr, int ban_localhost); int private_net(struct in_addr addr, int ban_localhost);
/* auth.c */ /* auth.c */
#ifdef HAVE_AUTH #ifdef HAVE_AUTH
size_t answer_auth(struct dns_header *header, char *limit, size_t qlen, 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 do_bit, int have_pseudoheader);
int in_zone(struct auth_zone *zone, char *name, char **cut); int in_zone(struct auth_zone *zone, char *name, char **cut);
#endif #endif
/* dnssec.c */ /* dnssec.c */
size_t dnssec_generate_query(struct dns_header *header, unsigned char *end, char *name, int class, int type, int edns_pktsz); size_t dnssec_generate_query(struct dns_header *header, unsigned char *end, char *name, int class, int type, int edns_pktsz);
int dnssec_validate_by_ds(time_t now, struct dns_header *header, size_t plen, ch ar *name, char *keyname, int class); int dnssec_validate_by_ds(time_t now, struct dns_header *header, size_t plen, ch ar *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_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, ch ar *name, char *keyname, int *class, int dnssec_validate_reply(time_t now, struct dns_header *header, size_t plen, ch ar *name, char *keyname, int *class,
int check_unsigned, int *neganswer, int *nons); int check_unsigned, int *neganswer, int *nons, int *nse c_ttl);
int dnskey_keytag(int alg, int flags, unsigned char *key, int keylen); int dnskey_keytag(int alg, int flags, unsigned char *key, int keylen);
size_t filter_rrsigs(struct dns_header *header, size_t plen); size_t filter_rrsigs(struct dns_header *header, size_t plen);
unsigned char* hash_questions(struct dns_header *header, size_t plen, char *name ); unsigned char* hash_questions(struct dns_header *header, size_t plen, char *name );
int setup_timestamp(void); int setup_timestamp(void);
/* crypto.c */ /* crypto.c */
const struct nettle_hash *hash_find(char *name); const struct nettle_hash *hash_find(char *name);
int hash_init(const struct nettle_hash *hash, void **ctxp, unsigned char **diges tp); int hash_init(const struct nettle_hash *hash, void **ctxp, unsigned char **diges tp);
int verify(struct blockdata *key_data, unsigned int key_len, unsigned char *sig, size_t sig_len, 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); unsigned char *digest, size_t digest_len, int algo);
skipping to change at line 1264 skipping to change at line 1273
void safe_strncpy(char *dest, const char *src, size_t size); void safe_strncpy(char *dest, const char *src, size_t size);
void safe_pipe(int *fd, int read_noblock); void safe_pipe(int *fd, int read_noblock);
void *whine_malloc(size_t size); void *whine_malloc(size_t size);
int sa_len(union mysockaddr *addr); int sa_len(union mysockaddr *addr);
int sockaddr_isequal(union mysockaddr *s1, union mysockaddr *s2); int sockaddr_isequal(union mysockaddr *s1, union mysockaddr *s2);
int hostname_isequal(const char *a, const char *b); int hostname_isequal(const char *a, const char *b);
int hostname_issubdomain(char *a, char *b); int hostname_issubdomain(char *a, char *b);
time_t dnsmasq_time(void); time_t dnsmasq_time(void);
int netmask_length(struct in_addr mask); int netmask_length(struct in_addr mask);
int is_same_net(struct in_addr a, struct in_addr b, struct in_addr mask); int is_same_net(struct in_addr a, struct in_addr b, struct in_addr mask);
#ifdef HAVE_IPV6
int is_same_net6(struct in6_addr *a, struct in6_addr *b, int prefixlen); int is_same_net6(struct in6_addr *a, struct in6_addr *b, int prefixlen);
u64 addr6part(struct in6_addr *addr); u64 addr6part(struct in6_addr *addr);
void setaddr6part(struct in6_addr *addr, u64 host); void setaddr6part(struct in6_addr *addr, u64 host);
#endif
int retry_send(ssize_t rc); int retry_send(ssize_t rc);
void prettyprint_time(char *buf, unsigned int t); void prettyprint_time(char *buf, unsigned int t);
int prettyprint_addr(union mysockaddr *addr, char *buf); int prettyprint_addr(union mysockaddr *addr, char *buf);
int parse_hex(char *in, unsigned char *out, int maxlen, int parse_hex(char *in, unsigned char *out, int maxlen,
unsigned int *wildcard_mask, int *mac_type); unsigned int *wildcard_mask, int *mac_type);
int memcmp_masked(unsigned char *a, unsigned char *b, int len, int memcmp_masked(unsigned char *a, unsigned char *b, int len,
unsigned int mask); unsigned int mask);
int expand_buf(struct iovec *iov, size_t size); int expand_buf(struct iovec *iov, size_t size);
char *print_mac(char *buff, unsigned char *mac, int len); char *print_mac(char *buff, unsigned char *mac, int len);
int read_write(int fd, unsigned char *packet, int size, int rw); int read_write(int fd, unsigned char *packet, int size, int rw);
void close_fds(long max_fd, int spare1, int spare2, int spare3);
int wildcard_match(const char* wildcard, const char* match); int wildcard_match(const char* wildcard, const char* match);
int wildcard_matchn(const char* wildcard, const char* match, int num); int wildcard_matchn(const char* wildcard, const char* match, int num);
#ifdef HAVE_LINUX_NETWORK
int kernel_version(void);
#endif
/* log.c */ /* log.c */
void die(char *message, char *arg1, int exit_code) ATTRIBUTE_NORETURN; void die(char *message, char *arg1, int exit_code) ATTRIBUTE_NORETURN;
int log_start(struct passwd *ent_pw, int errfd); int log_start(struct passwd *ent_pw, int errfd);
int log_reopen(char *log_file); int log_reopen(char *log_file);
void my_syslog(int priority, const char *format, ...); void my_syslog(int priority, const char *format, ...);
void set_log_writer(void); void set_log_writer(void);
void check_log_writer(int force); void check_log_writer(int force);
skipping to change at line 1313 skipping to change at line 1323
char *parse_server(char *arg, union mysockaddr *addr, char *parse_server(char *arg, union mysockaddr *addr,
union mysockaddr *source_addr, char *interface, int *flags); union mysockaddr *source_addr, char *interface, int *flags);
int option_read_dynfile(char *file, int flags); int option_read_dynfile(char *file, int flags);
/* forward.c */ /* forward.c */
void reply_query(int fd, int family, time_t now); void reply_query(int fd, int family, time_t now);
void receive_query(struct listener *listen, time_t now); void receive_query(struct listener *listen, time_t now);
unsigned char *tcp_request(int confd, time_t now, unsigned char *tcp_request(int confd, time_t now,
union mysockaddr *local_addr, struct in_addr netmask, int auth_dns); union mysockaddr *local_addr, struct in_addr netmask, int auth_dns);
void server_gone(struct server *server); void server_gone(struct server *server);
struct frec *get_new_frec(time_t now, int *wait, int force); struct frec *get_new_frec(time_t now, int *wait, struct frec *force);
int send_from(int fd, int nowild, char *packet, size_t len, int send_from(int fd, int nowild, char *packet, size_t len,
union mysockaddr *to, struct all_addr *source, union mysockaddr *to, union all_addr *source,
unsigned int iface); unsigned int iface);
void resend_query(void); void resend_query(void);
struct randfd *allocate_rfd(int family); struct randfd *allocate_rfd(int family);
void free_rfd(struct randfd *rfd); void free_rfd(struct randfd *rfd);
/* network.c */ /* network.c */
int indextoname(int fd, int index, char *name); int indextoname(int fd, int index, char *name);
int local_bind(int fd, union mysockaddr *addr, char *intname, unsigned int ifind ex, int is_tcp); int local_bind(int fd, union mysockaddr *addr, char *intname, unsigned int ifind ex, int is_tcp);
int random_sock(int family); int random_sock(int family);
void pre_allocate_sfds(void); void pre_allocate_sfds(void);
skipping to change at line 1342 skipping to change at line 1352
const char *interface, const char *interface,
const char *domain); const char *domain);
void check_servers(void); void check_servers(void);
int enumerate_interfaces(int reset); int enumerate_interfaces(int reset);
void create_wildcard_listeners(void); void create_wildcard_listeners(void);
void create_bound_listeners(int dienow); void create_bound_listeners(int dienow);
void warn_bound_listeners(void); void warn_bound_listeners(void);
void warn_wild_labels(void); void warn_wild_labels(void);
void warn_int_names(void); void warn_int_names(void);
int is_dad_listeners(void); int is_dad_listeners(void);
int iface_check(int family, struct all_addr *addr, char *name, int *auth); int iface_check(int family, union all_addr *addr, char *name, int *auth);
int loopback_exception(int fd, int family, struct all_addr *addr, char *name); int loopback_exception(int fd, int family, union all_addr *addr, char *name);
int label_exception(int index, int family, struct all_addr *addr); int label_exception(int index, int family, union all_addr *addr);
int fix_fd(int fd); int fix_fd(int fd);
int tcp_interface(int fd, int af); int tcp_interface(int fd, int af);
#ifdef HAVE_IPV6
int set_ipv6pktinfo(int fd); int set_ipv6pktinfo(int fd);
#endif
#ifdef HAVE_DHCP6 #ifdef HAVE_DHCP6
void join_multicast(int dienow); void join_multicast(int dienow);
#endif #endif
#if defined(HAVE_LINUX_NETWORK) || defined(HAVE_BSD_NETWORK) #if defined(HAVE_LINUX_NETWORK) || defined(HAVE_BSD_NETWORK)
void newaddress(time_t now); void newaddress(time_t now);
#endif #endif
/* dhcp.c */ /* dhcp.c */
#ifdef HAVE_DHCP #ifdef HAVE_DHCP
void dhcp_init(void); void dhcp_init(void);
skipping to change at line 1386 skipping to change at line 1394
/* lease.c */ /* lease.c */
#ifdef HAVE_DHCP #ifdef HAVE_DHCP
void lease_update_file(time_t now); void lease_update_file(time_t now);
void lease_update_dns(int force); void lease_update_dns(int force);
void lease_init(time_t now); void lease_init(time_t now);
struct dhcp_lease *lease4_allocate(struct in_addr addr); struct dhcp_lease *lease4_allocate(struct in_addr addr);
#ifdef HAVE_DHCP6 #ifdef HAVE_DHCP6
struct dhcp_lease *lease6_allocate(struct in6_addr *addrp, int lease_type); struct dhcp_lease *lease6_allocate(struct in6_addr *addrp, int lease_type);
struct dhcp_lease *lease6_find(unsigned char *clid, int clid_len, struct dhcp_lease *lease6_find(unsigned char *clid, int clid_len,
int lease_type, int iaid, struct in6_addr *addr); int lease_type, unsigned int iaid, struct in6_addr *addr);
void lease6_reset(void); void lease6_reset(void);
struct dhcp_lease *lease6_find_by_client(struct dhcp_lease *first, int lease_typ struct dhcp_lease *lease6_find_by_client(struct dhcp_lease *first, int lease_typ
e, unsigned char *clid, int clid_len, int iaid); e,
unsigned char *clid, int clid_len, unsig
ned int iaid);
struct dhcp_lease *lease6_find_by_addr(struct in6_addr *net, int prefix, u64 add r); struct dhcp_lease *lease6_find_by_addr(struct in6_addr *net, int prefix, u64 add r);
u64 lease_find_max_addr6(struct dhcp_context *context); u64 lease_find_max_addr6(struct dhcp_context *context);
void lease_ping_reply(struct in6_addr *sender, unsigned char *packet, char *inte rface); void lease_ping_reply(struct in6_addr *sender, unsigned char *packet, char *inte rface);
void lease_update_slaac(time_t now); void lease_update_slaac(time_t now);
void lease_set_iaid(struct dhcp_lease *lease, int iaid); void lease_set_iaid(struct dhcp_lease *lease, unsigned int iaid);
void lease_make_duid(time_t now); void lease_make_duid(time_t now);
#endif #endif
void lease_set_hwaddr(struct dhcp_lease *lease, const unsigned char *hwaddr, void lease_set_hwaddr(struct dhcp_lease *lease, const unsigned char *hwaddr,
const unsigned char *clid, int hw_len, int hw_type, const unsigned char *clid, int hw_len, int hw_type,
int clid_len, time_t now, int force); int clid_len, time_t now, int force);
void lease_set_hostname(struct dhcp_lease *lease, const char *name, int auth, ch ar *domain, char *config_domain); void lease_set_hostname(struct dhcp_lease *lease, const char *name, int auth, ch ar *domain, char *config_domain);
void lease_set_expires(struct dhcp_lease *lease, unsigned int len, time_t now); void lease_set_expires(struct dhcp_lease *lease, unsigned int len, time_t now);
void lease_set_interface(struct dhcp_lease *lease, int interface, time_t now); void lease_set_interface(struct dhcp_lease *lease, int interface, time_t now);
struct dhcp_lease *lease_find_by_client(unsigned char *hwaddr, int hw_len, int h w_type, struct dhcp_lease *lease_find_by_client(unsigned char *hwaddr, int hw_len, int h w_type,
unsigned char *clid, int clid_len); unsigned char *clid, int clid_len);
skipping to change at line 1467 skipping to change at line 1476
char *dbus_init(void); char *dbus_init(void);
void check_dbus_listeners(void); void check_dbus_listeners(void);
void set_dbus_listeners(void); void set_dbus_listeners(void);
# ifdef HAVE_DHCP # ifdef HAVE_DHCP
void emit_dbus_signal(int action, struct dhcp_lease *lease, char *hostname); void emit_dbus_signal(int action, struct dhcp_lease *lease, char *hostname);
# endif # endif
#endif #endif
/* ubus.c */ /* ubus.c */
#ifdef HAVE_UBUS #ifdef HAVE_UBUS
void ubus_init(void);
void set_ubus_listeners(void); void set_ubus_listeners(void);
void check_ubus_listeners(void); void check_ubus_listeners(void);
void ubus_event_bcast(const char *type, const char *mac, const char *ip, const c har *name, const char *interface); void ubus_event_bcast(const char *type, const char *mac, const char *ip, const c har *name, const char *interface);
#endif #endif
/* ipset.c */ /* ipset.c */
#ifdef HAVE_IPSET #ifdef HAVE_IPSET
void ipset_init(void); void ipset_init(void);
int add_to_ipset(const char *setname, const struct all_addr *ipaddr, int flags, int remove); int add_to_ipset(const char *setname, const union all_addr *ipaddr, int flags, i nt remove);
#endif #endif
/* helper.c */ /* helper.c */
#if defined(HAVE_SCRIPT) #if defined(HAVE_SCRIPT)
int create_helper(int event_fd, int err_fd, uid_t uid, gid_t gid, long max_fd); int create_helper(int event_fd, int err_fd, uid_t uid, gid_t gid, long max_fd);
void helper_write(void); void helper_write(void);
void queue_script(int action, struct dhcp_lease *lease, void queue_script(int action, struct dhcp_lease *lease,
char *hostname, time_t now); char *hostname, time_t now);
#ifdef HAVE_TFTP #ifdef HAVE_TFTP
void queue_tftp(off_t file_len, char *filename, union mysockaddr *peer); void queue_tftp(off_t file_len, char *filename, union mysockaddr *peer);
#endif #endif
void queue_arp(int action, unsigned char *mac, int maclen, void queue_arp(int action, unsigned char *mac, int maclen,
int family, struct all_addr *addr); int family, union all_addr *addr);
int helper_buf_empty(void); int helper_buf_empty(void);
#endif #endif
/* tftp.c */ /* tftp.c */
#ifdef HAVE_TFTP #ifdef HAVE_TFTP
void tftp_request(struct listener *listen, time_t now); void tftp_request(struct listener *listen, time_t now);
void check_tftp_listeners(time_t now); void check_tftp_listeners(time_t now);
int do_tftp_script_run(void); int do_tftp_script_run(void);
#endif #endif
/* conntrack.c */ /* conntrack.c */
#ifdef HAVE_CONNTRACK #ifdef HAVE_CONNTRACK
int get_incoming_mark(union mysockaddr *peer_addr, struct all_addr *local_addr, int get_incoming_mark(union mysockaddr *peer_addr, union all_addr *local_addr,
int istcp, unsigned int *markp); int istcp, unsigned int *markp);
#endif #endif
/* dhcp6.c */ /* dhcp6.c */
#ifdef HAVE_DHCP6 #ifdef HAVE_DHCP6
void dhcp6_init(void); void dhcp6_init(void);
void dhcp6_packet(time_t now); void dhcp6_packet(time_t now);
struct dhcp_context *address6_allocate(struct dhcp_context *context, unsigned c har *clid, int clid_len, int temp_addr, struct dhcp_context *address6_allocate(struct dhcp_context *context, unsigned c har *clid, int clid_len, int temp_addr,
int iaid, int serial, struct dhcp_netid *n unsigned int iaid, int serial, struct dhcp
etids, int plain_range, struct in6_addr *ans); _netid *netids, int plain_range, struct in6_addr *ans);
int config_valid(struct dhcp_config *config, struct dhcp_context *context, struc
t in6_addr *addr);
struct dhcp_context *address6_available(struct dhcp_context *context, struct dhcp_context *address6_available(struct dhcp_context *context,
struct in6_addr *taddr, struct in6_addr *taddr,
struct dhcp_netid *netids, struct dhcp_netid *netids,
int plain_range); int plain_range);
struct dhcp_context *address6_valid(struct dhcp_context *context, struct dhcp_context *address6_valid(struct dhcp_context *context,
struct in6_addr *taddr, struct in6_addr *taddr,
struct dhcp_netid *netids, struct dhcp_netid *netids,
int plain_range); int plain_range);
struct dhcp_config *config_find_by_address6(struct dhcp_config *configs, struct in6_addr *net, struct dhcp_config *config_find_by_address6(struct dhcp_config *configs, struct in6_addr *net,
int prefix, u64 addr); int prefix, struct in6_addr *addr);
void make_duid(time_t now); void make_duid(time_t now);
void dhcp_construct_contexts(time_t now); void dhcp_construct_contexts(time_t now);
void get_client_mac(struct in6_addr *client, int iface, unsigned char *mac, void get_client_mac(struct in6_addr *client, int iface, unsigned char *mac,
unsigned int *maclenp, unsigned int *mactypep, time_t now); unsigned int *maclenp, unsigned int *mactypep, time_t now);
#endif #endif
/* rfc3315.c */ /* rfc3315.c */
#ifdef HAVE_DHCP6 #ifdef HAVE_DHCP6
unsigned short dhcp6_reply(struct dhcp_context *context, int interface, char *if ace_name, unsigned short dhcp6_reply(struct dhcp_context *context, int interface, char *if ace_name,
struct in6_addr *fallback, struct in6_addr *ll_addr, s truct in6_addr *ula_addr, struct in6_addr *fallback, struct in6_addr *ll_addr, s truct in6_addr *ula_addr,
skipping to change at line 1554 skipping to change at line 1563
struct dhcp_netid *option_filter(struct dhcp_netid *tags, struct dhcp_netid *con text_tags, struct dhcp_netid *option_filter(struct dhcp_netid *tags, struct dhcp_netid *con text_tags,
struct dhcp_opt *opts); struct dhcp_opt *opts);
int match_netid(struct dhcp_netid *check, struct dhcp_netid *pool, int tagnotnee ded); int match_netid(struct dhcp_netid *check, struct dhcp_netid *pool, int tagnotnee ded);
char *strip_hostname(char *hostname); char *strip_hostname(char *hostname);
void log_tags(struct dhcp_netid *netid, u32 xid); void log_tags(struct dhcp_netid *netid, u32 xid);
int match_bytes(struct dhcp_opt *o, unsigned char *p, int len); int match_bytes(struct dhcp_opt *o, unsigned char *p, int len);
void dhcp_update_configs(struct dhcp_config *configs); void dhcp_update_configs(struct dhcp_config *configs);
void display_opts(void); void display_opts(void);
int lookup_dhcp_opt(int prot, char *name); int lookup_dhcp_opt(int prot, char *name);
int lookup_dhcp_len(int prot, int val); int lookup_dhcp_len(int prot, int val);
char *option_string(int prot, unsigned int opt, unsigned char *val,
int opt_len, char *buf, int buf_len);
struct dhcp_config *find_config(struct dhcp_config *configs, struct dhcp_config *find_config(struct dhcp_config *configs,
struct dhcp_context *context, struct dhcp_context *context,
unsigned char *clid, int clid_len, unsigned char *clid, int clid_len,
unsigned char *hwaddr, int hw_len, unsigned char *hwaddr, int hw_len,
int hw_type, char *hostname); int hw_type, char *hostname,
struct dhcp_netid *filter);
int config_has_mac(struct dhcp_config *config, unsigned char *hwaddr, int len, i nt type); int config_has_mac(struct dhcp_config *config, unsigned char *hwaddr, int len, i nt type);
#ifdef HAVE_LINUX_NETWORK #ifdef HAVE_LINUX_NETWORK
char *whichdevice(void); char *whichdevice(void);
void bindtodevice(char *device, int fd); void bindtodevice(char *device, int fd);
#endif #endif
# ifdef HAVE_DHCP6 # ifdef HAVE_DHCP6
void display_opts6(void); void display_opts6(void);
# endif # endif
void log_context(int family, struct dhcp_context *context); void log_context(int family, struct dhcp_context *context);
void log_relay(int family, struct dhcp_relay *relay); void log_relay(int family, struct dhcp_relay *relay);
 End of changes. 80 change blocks. 
135 lines changed or deleted 142 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)