"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/dnsmasq.h" between
dnsmasq-2.84.tar.xz and dnsmasq-2.85.tar.xz

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

dnsmasq.h  (dnsmasq-2.84.tar.xz):dnsmasq.h  (dnsmasq-2.85.tar.xz)
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
#if defined(HAVE_POLL_H) #include <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 276 skipping to change at line 272
#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_IGNORE_CLID 59 #define OPT_IGNORE_CLID 59
#define OPT_SINGLE_PORT 60 #define OPT_SINGLE_PORT 60
#define OPT_LEASE_RENEW 61 #define OPT_LEASE_RENEW 61
#define OPT_LAST 62 #define OPT_LOG_DEBUG 62
#define OPT_LAST 63
#define OPTION_BITS (sizeof(unsigned int)*8) #define OPTION_BITS (sizeof(unsigned int)*8)
#define OPTION_SIZE ( (OPT_LAST/OPTION_BITS)+((OPT_LAST%OPTION_BITS)!=0) ) #define OPTION_SIZE ( (OPT_LAST/OPTION_BITS)+((OPT_LAST%OPTION_BITS)!=0) )
#define option_var(x) (daemon->options[(x) / OPTION_BITS]) #define option_var(x) (daemon->options[(x) / OPTION_BITS])
#define option_val(x) ((1u) << ((x) % OPTION_BITS)) #define option_val(x) ((1u) << ((x) % OPTION_BITS))
#define option_bool(x) (option_var(x) & option_val(x)) #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 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.
*/ MS_DEBUG messages are suppressed unless --log-debug is set. */
#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
#define MS_DEBUG LOG_NEWS
/* Note that this is used widely as a container for IPv4/IPv6 addresses, /* Note that this is used widely as a container for IPv4/IPv6 addresses,
so for that reason, was well as to avoid wasting memory in almost every so for that reason, was well as to avoid wasting memory in almost every
cache entry, the other variants should not be larger than cache entry, the other variants should not be larger than
sizeof(struct in6_addr) - 16 bytes. sizeof(struct in6_addr) - 16 bytes.
*/ */
union all_addr { union all_addr {
struct in_addr addr4; struct in_addr addr4;
struct in6_addr addr6; struct in6_addr addr6;
struct { struct {
skipping to change at line 328 skipping to change at line 327
struct blockdata *target; struct blockdata *target;
unsigned short targetlen, srvport, priority, weight; unsigned short targetlen, srvport, priority, weight;
} srv; } srv;
/* for log_query */ /* for log_query */
struct { struct {
unsigned short keytag, algo, digest, rcode; unsigned short keytag, algo, digest, rcode;
} log; } log;
}; };
struct bogus_addr { struct bogus_addr {
struct in_addr addr; struct in_addr addr, mask;
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;
struct doctor *next; struct doctor *next;
}; };
struct mx_srv_record { struct mx_srv_record {
skipping to change at line 429 skipping to change at line 428
int ttl, flags; 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;
struct in6_addr addr6; struct in6_addr addr6;
struct host_record *next; struct host_record *next;
}; };
#define IN4 1
#define IN6 2
#define INP4 4
#define INP6 8
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 flags;
struct in_addr proto4;
struct in6_addr proto6;
struct addrlist *addr; struct addrlist *addr;
struct interface_name *next; struct interface_name *next;
}; };
union bigname { union bigname {
char name[MAXDNAME]; char name[MAXDNAME];
union bigname *next; /* freelist */ union bigname *next; /* freelist */
}; };
struct blockdata { struct blockdata {
skipping to change at line 543 skipping to change at line 549
struct serverfd { struct serverfd {
int fd; int fd;
union mysockaddr source_addr; union mysockaddr source_addr;
char interface[IF_NAMESIZE+1]; char interface[IF_NAMESIZE+1];
unsigned int ifindex, used, preallocated; unsigned int ifindex, used, preallocated;
struct serverfd *next; struct serverfd *next;
}; };
struct randfd { struct randfd {
struct server *serv;
int fd; int fd;
unsigned short refcount, family; unsigned short refcount; /* refcount == 0xffff means overflow record. */
};
struct randfd_list {
struct randfd *rfd;
struct randfd_list *next;
}; };
struct server { struct server {
union mysockaddr addr, source_addr; union mysockaddr addr, source_addr;
char interface[IF_NAMESIZE+1]; char interface[IF_NAMESIZE+1];
unsigned int ifindex; /* corresponding to interface, above */
struct serverfd *sfd; struct serverfd *sfd;
char *domain; /* set if this server only handles a domain. */ char *domain; /* set if this server only handles a domain. */
int flags, tcpfd, edns_pktsz; int flags, tcpfd, edns_pktsz;
time_t pktsz_reduced; time_t pktsz_reduced;
unsigned int queries, failed_queries; unsigned int queries, failed_queries;
#ifdef HAVE_LOOP #ifdef HAVE_LOOP
u32 uid; u32 uid;
#endif #endif
struct server *next; struct server *next;
}; };
skipping to change at line 672 skipping to change at line 685
struct frec { struct frec {
struct frec_src { struct frec_src {
union mysockaddr source; union mysockaddr source;
union all_addr dest; union all_addr dest;
unsigned int iface, log_id; unsigned int iface, log_id;
int fd; int fd;
unsigned short orig_id; unsigned short orig_id;
struct frec_src *next; struct frec_src *next;
} frec_src; } frec_src;
struct server *sentto; /* NULL means free */ struct server *sentto; /* NULL means free */
struct randfd *rfd4; struct randfd_list *rfds;
struct randfd *rfd6;
unsigned short new_id; unsigned short new_id;
int forwardall, flags; int 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 */
struct frec *blocking_query; /* Query which is blocking us. */ struct frec *blocking_query; /* Query which is blocking us. */
skipping to change at line 1113 skipping to change at line 1125
struct frec_src *free_frec_src; struct frec_src *free_frec_src;
int frec_src_count; int frec_src_count;
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; /* " " */ int fd_save; /* " " */
pid_t tcp_pids[MAX_PROCS]; pid_t tcp_pids[MAX_PROCS];
int tcp_pipes[MAX_PROCS]; int tcp_pipes[MAX_PROCS];
int pipe_to_parent; int pipe_to_parent;
struct randfd randomsocks[RANDOM_SOCKS]; int numrrand;
struct randfd *randomsocks;
struct randfd_list *rfl_spare, *rfl_poll;
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
skipping to change at line 1234 skipping to change at line 1248
size_t setup_reply(struct dns_header *header, size_t qlen, size_t setup_reply(struct dns_header *header, size_t qlen,
union 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); time_t now);
int check_for_ignored_address(struct dns_header *header, size_t qlen, struct bog int check_for_ignored_address(struct dns_header *header, size_t qlen);
us_addr *baddr);
int check_for_local_domain(char *name, time_t now); int check_for_local_domain(char *name, time_t now);
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, ...);
int in_arpa_name_2_addr(char *namein, union all_addr *addrp); int in_arpa_name_2_addr(char *namein, union 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 */
skipping to change at line 1289 skipping to change at line 1303
u32 rand32(void); u32 rand32(void);
u64 rand64(void); u64 rand64(void);
int legal_hostname(char *name); int legal_hostname(char *name);
char *canonicalise(char *in, int *nomem); char *canonicalise(char *in, int *nomem);
unsigned char *do_rfc1035_name(unsigned char *p, char *sval, char *limit); unsigned char *do_rfc1035_name(unsigned char *p, char *sval, char *limit);
void *safe_malloc(size_t size); void *safe_malloc(size_t size);
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(const union mysockaddr *s1, const 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);
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);
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);
skipping to change at line 1340 skipping to change at line 1354
void reread_dhcp(void); void reread_dhcp(void);
void read_servers_file(void); void read_servers_file(void);
void set_option_bool(unsigned int opt); void set_option_bool(unsigned int opt);
void reset_option_bool(unsigned int opt); void reset_option_bool(unsigned int opt);
struct hostsfile *expand_filelist(struct hostsfile *list); struct hostsfile *expand_filelist(struct hostsfile *list);
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, 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, struct frec *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, union 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); int allocate_rfd(struct randfd_list **fdlp, struct server *serv);
void free_rfd(struct randfd *rfd); void free_rfds(struct randfd_list **fdlp);
/* 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);
void pre_allocate_sfds(void); void pre_allocate_sfds(void);
int reload_servers(char *fname); int reload_servers(char *fname);
void mark_servers(int flag); void mark_servers(int flag);
void cleanup_servers(void); void cleanup_servers(void);
void add_update_server(int flags, void add_update_server(int flags,
union mysockaddr *addr, union mysockaddr *addr,
union mysockaddr *source_addr, union mysockaddr *source_addr,
const char *interface, const char *interface,
const char *domain); const char *domain);
void check_servers(void); void check_servers(void);
 End of changes. 18 change blocks. 
24 lines changed or deleted 35 lines changed or added

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