Commit Diff
Diff:
bc461eeee092e53e10427deae0db3233aa75909c
0e7d94ac570129566a40f0d5c2138c844ef7c4c0
Commit:
0e7d94ac570129566a40f0d5c2138c844ef7c4c0
Tree:
767d72be948e8e1998a7c55627fedae69313df9d
Author:
pjp <pjp@delphinusdns.org>
Committer:
pjp <pjp@delphinusdns.org>
Date:
Sun May 18 17:14:05 2014 UTC
Message:
* make everything prettier (KNF) * OpenSMTPD is taken as an example here for prototypes * grooming these was a lot of hard work...
blob - 70cac757f5e2e2b4d87ff391ade774a30e61a696
blob + 72cc5c840ce23530feea66eb9a79b14c32418e8f
--- additional.c
+++ additional.c
@@ -32,12 +32,12 @@
int additional_a(char *, int, struct domain *, char *, int, int, int *);
int additional_aaaa(char *, int, struct domain *, char *, int, int, int *);
int additional_mx(char *, int, struct domain *, char *, int, int, int *);
-int additional_ptr(char *, int, struct domain *, char *, int, int, int *);
int additional_opt(struct question *, char *, int, int);
+int additional_ptr(char *, int, struct domain *, char *, int, int, int *);
extern int compress_label(u_char *, int, int);
-static const char rcsid[] = "$Id: additional.c,v 1.16 2014/05/10 15:11:21 pjp Exp $";
+static const char rcsid[] = "$Id: additional.c,v 1.17 2014/05/18 17:14:05 pjp Exp $";
/*
blob - 679ea70bdf37858ebc5336e736a961a3516adf0b
blob + 17ef599716a101e2c32fa29243369bf53e0d25cf
--- axfr.c
+++ axfr.c
@@ -29,35 +29,37 @@
#include "dns.h"
#include "db.h"
-int notify = 0;
-void init_axfr(void);
-int insert_axfr(char *, char *);
-void init_notifyslave(void);
-int insert_notifyslave(char *, char *);
-void axfrloop(int *, int, char **, DB *);
-void axfr_connection(int, char *, int, DB *);
-void reap(int);
-int build_header(DB *, char *, char *, struct question *, int);
-int build_soa(DB *, char *, int, struct domain *, struct question *);
-int checklabel(DB *, struct domain *, struct domain *, struct question *);
-void gather_notifydomains(DB *);
-void notifyslaves(int *);
-void notifypacket(int, void *, void *, int);
+void axfrloop(int *, int, char **, DB *);
+void axfr_connection(int, char *, int, DB *);
+int build_header(DB *, char *, char *, struct question *, int);
+int build_soa(DB *, char *, int, struct domain *, struct question *);
+int checklabel(DB *, struct domain *, struct domain *, struct question *);
+void gather_notifydomains(DB *);
+void init_axfr(void);
+void init_notifyslave(void);
+int insert_axfr(char *, char *);
+int insert_notifyslave(char *, char *);
+void notifypacket(int, void *, void *, int);
+void notifyslaves(int *);
+void reap(int);
-extern in_addr_t getmask(int);
-extern int getmask6(int, struct sockaddr_in6 *);
-extern void build_reply(struct sreply *, int, char *, int, struct question *, struct sockaddr *, socklen_t, struct domain *, struct domain *, u_int8_t, int, int, struct recurses *);
-extern void reply_fmterror(struct sreply *);
-extern void reply_nxdomain(struct sreply *);
-extern int get_soa(DB *, struct question *, struct domain *, int);
-extern int compress_label(u_char *, int, int);
-extern u_int16_t create_anyreply(struct sreply *, char *, int, int, int);
-extern struct question * build_fake_question(char *, int, u_int16_t);
-extern struct question * build_question(char *, int, int);
-extern int free_question(struct question *);
-extern void dolog(int, char *, ...);
+extern in_addr_t getmask(int);
+extern int getmask6(int, struct sockaddr_in6 *);
+extern void reply_fmterror(struct sreply *);
+extern void reply_nxdomain(struct sreply *);
+extern int get_soa(DB *, struct question *, struct domain *, int);
+extern int compress_label(u_char *, int, int);
+extern u_int16_t create_anyreply(struct sreply *, char *, int, int, int);
+extern struct question *build_fake_question(char *, int, u_int16_t);
+extern struct question *build_question(char *, int, int);
+extern int free_question(struct question *);
+extern void dolog(int, char *, ...);
+extern void build_reply(struct sreply *, int, char *, int, struct question *, struct sockaddr *, socklen_t, struct domain *, struct domain *, u_int8_t, int, int, struct recurses *);
+
+int notify = 0; /* do not notify when set to 0 */
+
extern int debug, verbose;
extern time_t time_changed;
@@ -96,7 +98,7 @@ static struct notifyentry {
} *notn2, *notnp;
-static const char rcsid[] = "$Id: axfr.c,v 1.9 2014/05/18 12:02:08 pjp Exp $";
+static const char rcsid[] = "$Id: axfr.c,v 1.10 2014/05/18 17:14:05 pjp Exp $";
/*
* INIT_AXFR - initialize the axfr singly linked list
blob - 4c2ed354306ae9f753e421a4dfb19a249416f018
blob + 2a6a41645827da149eac08a941f2859de58ba2ab
--- filter.c
+++ filter.c
@@ -29,13 +29,13 @@
#include "dns.h"
#include "db.h"
-void init_filter(void);
-int find_filter(struct sockaddr_storage *sst, int family);
-int insert_filter(char *address, char *prefixlen);
+int find_filter(struct sockaddr_storage *, int);
+void init_filter(void);
+int insert_filter(char *, char *);
-extern in_addr_t getmask(int prefixlen);
-extern int getmask6(int prefixlen, struct sockaddr_in6 *sin6);
-extern void dolog(int, char *, ...);
+extern void dolog(int, char *, ...);
+extern in_addr_t getmask(int);
+extern int getmask6(int, struct sockaddr_in6 *);
extern int debug, verbose;
@@ -51,7 +51,7 @@ static struct filterentry {
} *fn2, *fnp;
-static const char rcsid[] = "$Id: filter.c,v 1.2 2014/05/01 20:16:51 pjp Exp $";
+static const char rcsid[] = "$Id: filter.c,v 1.3 2014/05/18 17:14:05 pjp Exp $";
/*
* INIT_FILTER - initialize the filter singly linked list
blob - 3664072d7e6aaa4fc3a934d11e1563da02dde8f2
blob + 84c68f9e08e6567489c357485b15f20495328fba
--- log.c
+++ log.c
@@ -37,9 +37,9 @@ extern struct logging logging;
extern int debug;
extern int verbose;
-int remotelog(int fd, char *fmt, ...);
-void receivelog(char *buf, int len);
-void dolog(int pri, char *fmt, ...);
+void dolog(int pri, char *fmt, ...);
+void receivelog(char *buf, int len);
+int remotelog(int fd, char *fmt, ...);
/*
blob - 7cc269db93a4eb91597e8427708a649b82f7394f
blob + 493396456311a5bd13dcd30bcd9d031afcd4cd1a
--- main.c
+++ main.c
@@ -32,62 +32,61 @@
/* prototypes */
-struct question * build_question(char *, int, int);
-struct question * build_fake_question(char *, int, u_int16_t);
-void mainloop(struct cfg *);
-int free_question(struct question *);
-int lookup_zone(DB *, struct question *, struct domain *, int *, char *, int);
-u_int16_t check_qtype(struct domain *, u_int16_t, int, int *);
-int get_soa(DB *, struct question *, struct domain *, int);
-
-extern void reply_notimpl(struct sreply *);
-extern void reply_nxdomain(struct sreply *);
-extern void reply_noerror(struct sreply *);
-extern void reply_refused(struct sreply *);
-extern void reply_fmterror(struct sreply *);
-extern void reply_a(struct sreply *, DB *);
-extern void reply_aaaa(struct sreply *, DB *);
-extern void reply_soa(struct sreply *);
-extern void reply_ptr(struct sreply *);
-extern void reply_cname(struct sreply *);
-extern void reply_mx(struct sreply *, DB *);
-extern void reply_ns(struct sreply *, DB *);
-extern void reply_txt(struct sreply *);
-extern void reply_spf(struct sreply *);
-extern void reply_any(struct sreply *);
-extern void reply_srv(struct sreply *, DB *);
-extern void reply_naptr(struct sreply *, DB *);
-extern void reply_sshfp(struct sreply *);
+extern void add_rrlimit(int, u_int16_t *, int, char *);
+extern void axfrloop(int *, int, char **, DB *);
+extern int check_rrlimit(int, u_int16_t *, int, char *);
+extern void collects_init(void);
+extern void dolog(int, char *, ...);
+extern int find_filter(struct sockaddr_storage *, int);
+extern int find_recurse(struct sockaddr_storage *, int);
extern u_int8_t find_region(struct sockaddr_storage *, int);
-extern int find_wildcard(struct sockaddr_storage *, int);
-extern int find_filter(struct sockaddr_storage *, int);
-extern void init_wildcard(void);
-extern void init_recurse(void);
-extern void init_region(void);
-extern void init_filter(void);
-extern void init_notifyslave(void);
-extern void collects_init(void);
-extern void recurseloop(int sp, int *, DB *);
-extern int find_recurse(struct sockaddr_storage *, int);
-extern int remotelog(int, char *, ...);
-extern void receivelog(char *, int);
-extern void axfrloop(int *, int, char **, DB *);
-extern void dolog(int, char *, ...);
-extern char * rrlimit_setup(int);
-extern void add_rrlimit(int, u_int16_t *, int, char *);
-extern int check_rrlimit(int, u_int16_t *, int, char *);
+extern int find_wildcard(struct sockaddr_storage *, int);
+extern void init_wildcard(void);
+extern void init_recurse(void);
+extern void init_region(void);
+extern void init_filter(void);
+extern void init_notifyslave(void);
+extern void recurseloop(int sp, int *, DB *);
+extern void receivelog(char *, int);
+extern void reply_a(struct sreply *, DB *);
+extern void reply_aaaa(struct sreply *, DB *);
+extern void reply_any(struct sreply *);
+extern void reply_cname(struct sreply *);
+extern void reply_fmterror(struct sreply *);
+extern void reply_notimpl(struct sreply *);
+extern void reply_nxdomain(struct sreply *);
+extern void reply_noerror(struct sreply *);
+extern void reply_soa(struct sreply *);
+extern void reply_mx(struct sreply *, DB *);
+extern void reply_naptr(struct sreply *, DB *);
+extern void reply_ns(struct sreply *, DB *);
+extern void reply_ptr(struct sreply *);
+extern void reply_refused(struct sreply *);
+extern void reply_spf(struct sreply *);
+extern void reply_srv(struct sreply *, DB *);
+extern void reply_sshfp(struct sreply *);
+extern void reply_txt(struct sreply *);
+extern int remotelog(int, char *, ...);
+extern char *rrlimit_setup(int);
-char * dns_label(char *, int *);
-int compress_label(u_char *, u_int16_t, int);
-int memcasecmp(u_char *, u_char *, int);
-char * get_dns_type(int dnstype);
-void build_reply(struct sreply *, int, char *, int, struct question *, struct sockaddr *, socklen_t, struct domain *, struct domain *, u_int8_t, int, int, struct recurses *, char *);
-void recurseheader(struct srecurseheader *, int, struct sockaddr_storage *, struct sockaddr_storage *, int);
-void setup_master(DB *, DB_ENV *, int, char **);
-void master_shutdown(int);
-void master_reload(int);
-void slave_shutdown(void);
-void slave_signal(int);
+struct question *build_fake_question(char *, int, u_int16_t);
+struct question *build_question(char *, int, int);
+void build_reply(struct sreply *, int, char *, int, struct question *, struct sockaddr *, socklen_t, struct domain *, struct domain *, u_int8_t, int, int, struct recurses *, char *);
+int compress_label(u_char *, u_int16_t, int);
+u_int16_t check_qtype(struct domain *, u_int16_t, int, int *);
+char *dns_label(char *, int *);
+int free_question(struct question *);
+char *get_dns_type(int dnstype);
+int get_soa(DB *, struct question *, struct domain *, int);
+int lookup_zone(DB *, struct question *, struct domain *, int *, char *, int);
+void mainloop(struct cfg *);
+void master_reload(int);
+void master_shutdown(int);
+int memcasecmp(u_char *, u_char *, int);
+void recurseheader(struct srecurseheader *, int, struct sockaddr_storage *, struct sockaddr_storage *, int);
+void setup_master(DB *, DB_ENV *, int, char **);
+void slave_signal(int);
+void slave_shutdown(void);
/* aliases */
@@ -170,7 +169,7 @@ static struct tcps {
} *tn1, *tnp, *tntmp;
-static const char rcsid[] = "$Id: main.c,v 1.97 2014/05/18 11:54:02 pjp Exp $";
+static const char rcsid[] = "$Id: main.c,v 1.98 2014/05/18 17:14:05 pjp Exp $";
/*
* MAIN - set up arguments, set up database, set up sockets, call mainloop
blob - 401d2bbe6ffbf71515ce32f5a7bc44e688265ad0
blob + c77446c9451f7f317c860fd5eda89101db2bc927
--- parse.y
+++ parse.y
@@ -25,6 +25,38 @@
#include "dns.h"
#include "db.h"
+
+extern void dolog(int, char *, ...);
+extern char *dns_label(char *, int *);
+extern u_int8_t find_region(struct sockaddr_storage *, int);
+extern int insert_region(char *, char *, u_int8_t);
+extern int insert_axfr(char *, char *);
+extern int insert_notifyslave(char *, char *);
+extern int insert_filter(char *, char *);
+extern int insert_recurse(char *, char *);
+extern int insert_wildcard(char *, char *);
+extern void slave_shutdown(void);
+
+extern int notify;
+extern int errno;
+extern int debug;
+extern int verbose;
+extern int bflag;
+extern int iflag;
+extern int lflag;
+extern int nflag;
+extern int rflag;
+extern int bcount;
+extern int icount;
+extern int ratelimit;
+extern int ratelimit_packets_per_second;
+extern u_int16_t port;
+extern u_int32_t cachesize;
+extern char *bind_list[255];
+extern char *interface_list[255];
+
+
+
TAILQ_HEAD(files, file) files = TAILQ_HEAD_INITIALIZER(files);
static struct file {
TAILQ_ENTRY(file) entry;
@@ -58,7 +90,7 @@ typedef struct {
int lineno;
} YYSTYPE;
-static const char rcsid[] = "$Id: parse.y,v 1.21 2014/05/18 11:54:02 pjp Exp $";
+static const char rcsid[] = "$Id: parse.y,v 1.22 2014/05/18 17:14:05 pjp Exp $";
static int version = 0;
static int state = 0;
static uint8_t region = 0;
@@ -67,23 +99,6 @@ static DB *mydb;
YYSTYPE yylval;
-extern int notify;
-extern int errno;
-extern int debug;
-extern int verbose;
-extern int bflag;
-extern int iflag;
-extern int lflag;
-extern int nflag;
-extern int rflag;
-extern int bcount;
-extern int icount;
-extern int ratelimit;
-extern int ratelimit_packets_per_second;
-extern u_int16_t port;
-extern u_int32_t cachesize;
-extern char *bind_list[255];
-extern char *interface_list[255];
char *converted_name;
int converted_namelen;
@@ -92,89 +107,65 @@ struct logging logging;
int axfrport = 0;
time_t time_changed;
-extern char * dns_label(char *, int *);
-extern u_int8_t find_region(struct sockaddr_storage *sst, int family);
-extern int insert_region(char *address, char *prefixlen, u_int8_t region);
-extern int insert_axfr(char *, char *);
-extern int insert_notifyslave(char *, char *);
-extern int insert_filter(char *, char *);
-extern int insert_recurse(char *, char *);
-extern int insert_wildcard(char *, char *);
-extern void dolog(int, char *, ...);
-extern void slave_shutdown(void);
-int get_string(char *buf, int n);
-int get_quotedstring(char *buf, int n);
-int get_ip(char *buf, int n);
-struct rrtab * rrlookup(struct rrtab *, char *keyword);
-char * check_rr(char *, char *, int, int *);
-int fill_soa(char *, char *, int, char *, char *, int, int, int, int, int);
-int fill_ns(char *name, char *type, int myttl, char *nameserver);
-int fill_ptr(char *name, char *type, int myttl, char *hostname);
-int fill_cname(char *name, char *type, int myttl, char *hostname);
-int fill_aaaa(char *name, char *type, int myttl, char *aaaa);
-int fill_a(char *name, char *type, int myttl, char *a);
-int fill_balance(char *name, char *type, int myttl, char *a);
-int fill_mx(char *name, char *type, int myttl, int priority, char *mxhost);
-int fill_sshfp(char *name, char *type, int myttl, int alg, int fptype, char *fingerprint);
-int fill_srv(char *, char *, int, int, int, int, char *);
-int fill_txt(char *name, char *type, int myttl, char *msg);
-int fill_naptr(char *, char *, int, int, int, char *, char *, char *, char *);
-int fill_spf(char *name, char *type, int myttl, char *msg);
-int get_record(struct domain *sdomain, char *converted_name, int converted_namelen);
-void set_record(struct domain *sdomain, char *converted_name, int converted_namelen);
+char *check_rr(char *, char *, int, int *);
+int fill_a(char *, char *, int, char *);
+int fill_aaaa(char *, char *, int, char *);
+int fill_balance(char *, char *, int, char *);
+int fill_ptr(char *, char *, int, char *);
+int fill_cname(char *, char *, int, char *);
+int fill_mx(char *, char *, int, int, char *);
+int fill_naptr(char *, char *, int, int, int, char *, char *, char *, char *);
+int fill_ns(char *, char *, int, char *);
+int fill_soa(char *, char *, int, char *, char *, int, int, int, int, int);
+int fill_spf(char *, char *, int, char *);
+int fill_sshfp(char *, char *, int, int, int, char *);
+int fill_srv(char *, char *, int, int, int, int, char *);
+int fill_txt(char *, char *, int, char *);
+int findeol(void);
+int get_ip(char *, int);
+char *get_prefixlen(char *, char *, int);
+int get_quotedstring(char *, int);
+int get_record(struct domain *, char *, int);
+int get_string(char *, int);
+int lgetc(int);
+struct tab * lookup(struct tab *, char *);
+int lungetc(int);
+int parse_file(DB *, char *);
struct file *pushfile(const char *, int);
-int popfile(void);
-int lgetc(int);
-int lungetc(int);
-int findeol(void);
-int yyparse(void);
-int parse_file(DB *, char *);
-static int temp_inet_net_pton_ipv6(const char *src, void *dst, size_t size);
-char * get_prefixlen(char *input, char *prefixlength, int plsize);
+int popfile(void);
+struct rrtab *rrlookup(struct rrtab *, char *);
+void set_record(struct domain *, char *, int);
+static int temp_inet_net_pton_ipv6(const char *, void *, size_t);
+int yyparse(void);
-void yyerror(const char *str)
-{
- dolog(LOG_ERR, "%s file: %s line: %d\n", str, file->name, file->lineno);
- slave_shutdown();
- exit (1);
-}
-int yywrap()
-{
- return 1;
-}
+struct rrtab {
+ char *name;
+ u_int16_t type;
+} myrrtab[] = {
+ { "a", DNS_TYPE_A } ,
+ { "soa", DNS_TYPE_SOA },
+ { "cname", DNS_TYPE_CNAME },
+ { "ptr", DNS_TYPE_PTR },
+ { "mx", DNS_TYPE_MX },
+ { "aaaa", DNS_TYPE_AAAA },
+ { "ns", DNS_TYPE_NS },
+ { "txt", DNS_TYPE_TXT },
+ { "hint", DNS_TYPE_HINT },
+ { "delegate", DNS_TYPE_DELEGATE },
+ { "balance", DNS_TYPE_BALANCE },
+ { "srv", DNS_TYPE_SRV },
+ { "spf", DNS_TYPE_SPF },
+ { "sshfp", DNS_TYPE_SSHFP },
+ { "naptr", DNS_TYPE_NAPTR },
+ { NULL, 0 },
+};
-int
-parse_file(DB *db, char *filename)
-{
- int errors;
- mydb = db;
- memset(&logging, 0, sizeof(struct logging));
- logging.active = 0;
-
- if ((file = pushfile(filename, 0)) == NULL) {
- return (-1);
- }
-
- topfile = file;
-
- if (yyparse() < 0) {
- dolog(LOG_ERR, "error: %s line: %d\n", file->name, file->lineno);
- return (-1);
- }
- errors = file->errors;
- popfile();
-
- dolog(LOG_INFO, "configuration file read\n");
-
- return 0;
-}
-
%}
@@ -1100,37 +1091,12 @@ ipcidr:
%%
-struct rrtab {
- char *name;
- u_int16_t type;
-} myrrtab[] = {
- { "a", DNS_TYPE_A } ,
- { "soa", DNS_TYPE_SOA },
- { "cname", DNS_TYPE_CNAME },
- { "ptr", DNS_TYPE_PTR },
- { "mx", DNS_TYPE_MX },
- { "aaaa", DNS_TYPE_AAAA },
- { "ns", DNS_TYPE_NS },
- { "txt", DNS_TYPE_TXT },
- { "hint", DNS_TYPE_HINT },
- { "delegate", DNS_TYPE_DELEGATE },
- { "balance", DNS_TYPE_BALANCE },
- { "srv", DNS_TYPE_SRV },
- { "spf", DNS_TYPE_SPF },
- { "sshfp", DNS_TYPE_SSHFP },
- { "naptr", DNS_TYPE_NAPTR },
- { NULL, 0 },
-};
-
-
-
struct tab {
char *val;
int num;
int state;
};
-struct tab * lookup(struct tab *cmdtab, char *keyword);
struct tab cmdtab[] = {
{ "axfrport", AXFRPORT, 0},
@@ -1146,6 +1112,51 @@ struct tab cmdtab[] = {
{ "zone", ZONE, 0 },
{ "notify", NOTIFY, STATE_IP },
{ NULL, 0, 0}};
+
+
+
+void
+yyerror(const char *str)
+{
+ dolog(LOG_ERR, "%s file: %s line: %d\n", str, file->name, file->lineno);
+ slave_shutdown();
+ exit (1);
+}
+
+int
+yywrap()
+{
+ return 1;
+}
+
+int
+parse_file(DB *db, char *filename)
+{
+ int errors;
+
+ mydb = db;
+
+ memset(&logging, 0, sizeof(struct logging));
+ logging.active = 0;
+
+
+ if ((file = pushfile(filename, 0)) == NULL) {
+ return (-1);
+ }
+
+ topfile = file;
+
+ if (yyparse() < 0) {
+ dolog(LOG_ERR, "error: %s line: %d\n", file->name, file->lineno);
+ return (-1);
+ }
+ errors = file->errors;
+ popfile();
+
+ dolog(LOG_INFO, "configuration file read\n");
+
+ return 0;
+}
int
yylex()
blob - f366150f1143cc9d315a93e3e3e39b22c627638b
blob + d9d9c2ea0de84858118c3783e8beef7e4bcfa6c6
--- ratelimit.c
+++ ratelimit.c
@@ -29,11 +29,11 @@
#include "dns.h"
#include "db.h"
-extern void dolog(int, char *, ...);
-static u_int16_t hash_rrlimit(u_int16_t *, int);
-char * rrlimit_setup(int size);
-void add_rrlimit(int size, u_int16_t *ip, int sizeip, char *rrlimit_ptr);
-int check_rrlimit(int size, u_int16_t *ip, int sizeip, char *rrlimit_ptr);
+void add_rrlimit(int, u_int16_t *, int, char *);
+int check_rrlimit(int, u_int16_t *, int, char *);
+extern void dolog(int, char *, ...);
+static u_int16_t hash_rrlimit(u_int16_t *, int);
+char *rrlimit_setup(int);
struct rrlimit {
u_int8_t pointer;
blob - deb9d0872bd565cb631d7bb8f55d0b1b5dbc2e22
blob + 7aa77822ff08b15719e1b5e88fd642a2ebba3f2f
--- recurse.c
+++ recurse.c
@@ -29,52 +29,50 @@
#include "dns.h"
#include "db.h"
-extern void update_db(DB *, struct domain *);
-extern in_addr_t getmask(int prefixlen);
-extern int getmask6(int prefixlen, struct sockaddr_in6 *sin6);
-extern struct question * build_question(char *buf, int len);
-extern struct question * build_fake_question(char *, int, u_int16_t);
-extern int free_question(struct question *);
-extern int lookup_zone(DB *db, struct question *question, struct domain *sd, int *lzerrno, char *replystring, int wildcard);
-extern void slave_shutdown(void);
-extern void dolog(int, char *, ...);
+extern struct question *build_fake_question(char *, int, u_int16_t);
+extern struct question *build_question(char *, int);
+extern void build_reply(struct sreply *, int, char *, int, struct question *, struct sockaddr *, socklen_t, struct domain *, struct domain *, u_int8_t, int, int, struct recurses *);
+extern void dolog(int, char *, ...);
+extern int free_question(struct question *);
+extern int get_soa(DB *, struct question *, struct domain *, int);
+extern in_addr_t getmask(int);
+extern int getmask6(int, struct sockaddr_in6 *);
+extern int lookup_zone(DB *, struct question *, struct domain *, int *, char *, int);
+extern int memcasecmp(u_char *, u_char *, int);
+extern void reply_a(struct sreply *, DB *);
+extern void reply_aaaa(struct sreply *, DB *);
+extern void reply_cname(struct sreply *);
+extern void reply_mx(struct sreply *, DB *);
+extern void reply_ns(struct sreply *, DB *);
+extern void reply_noerror(struct sreply *);
+extern void reply_nxdomain(struct sreply *);
+extern void reply_ptr(struct sreply *);
+extern void reply_soa(struct sreply *);
+extern void reply_txt(struct sreply *sreply);
+extern unsigned int res_randomid(void);
+extern void slave_shutdown(void);
+extern void update_db(DB *, struct domain *);
-void init_recurse(void);
-int find_recurse(struct sockaddr_storage *sst, int family);
-int insert_recurse(char *address, char *prefixlen);
-void recurseloop(int sp, int *raw, DB *db);
-int lookup_ns(DB *, struct recurses *);
-int lookup_a(DB *, struct recurses *, struct ns *);
-int recurse_parse(DB *db, struct recurses *sr, u_char *buf, u_int16_t offset);
-int negative_cache(DB *db, struct recurses *sr);
-int netlookup(DB *db, struct recurses *sr);
-int fakerecurse(DB *db, struct recurses *sr, struct ns *ns, int);
-void reply_raw(DB *db, struct recurses *sr, struct domain *sd, int *raw);
-void reply_raw_cname(DB *db, struct recurses *sr, struct domain *sd, int *raw);
-void reply_raw_noerror(DB *, struct recurses *, struct domain *, int *);
-void reply_raw_nxdomain(DB *, struct recurses *, struct domain *, int *);
+int contains(u_char *, u_char *);
+void init_recurse(void);
+int insert_recurse(char *, char *);
+int fakerecurse(DB *, struct recurses *, struct ns *, int);
+int find_recurse(struct sockaddr_storage *, int);
+int level(u_char *);
+int lookup_a(DB *, struct recurses *, struct ns *);
+int lookup_aaaa(DB *, struct recurses *, struct ns *);
+int lookup_ns(DB *, struct recurses *);
+int negative_cache(DB *, struct recurses *);
+int netlookup(DB *, struct recurses *);
+int netlookup6(DB *, struct recurses *);
+void recurseloop(int, int *, DB *);
+int recurse_parse(DB *, struct recurses *, u_char *, u_int16_t);
+void reply_raw(DB *, struct recurses *, struct domain *, int *);
+void reply_raw_cname(DB *, struct recurses *, struct domain *, int *);
+void reply_raw_noerror(DB *, struct recurses *, struct domain *, int *);
+void reply_raw_nxdomain(DB *, struct recurses *, struct domain *, int *);
+void remove_zone(DB *, struct domain *);
-extern void build_reply(struct sreply *reply, int so, char *buf, int len, struct question *q, struct sockaddr *sa, socklen_t slen, struct domain *sd1, struct domain *sd2, u_int8_t region, int istcp, int wildcard, struct recurses *sr);
-extern void reply_a(struct sreply *, DB *);
-extern void reply_aaaa(struct sreply *, DB *);
-extern void reply_ns(struct sreply *, DB *);
-extern void reply_mx(struct sreply *, DB *);
-extern void reply_cname(struct sreply *);
-extern void reply_nxdomain(struct sreply *);
-extern void reply_ptr(struct sreply *);
-extern void reply_soa(struct sreply *);
-extern void reply_txt(struct sreply *sreply);
-extern int memcasecmp(u_char *, u_char *, int);
-extern int get_soa(DB *, struct question *, struct domain *, int);
-extern void reply_noerror(struct sreply *);
-extern unsigned int res_randomid(void);
-
-void remove_zone(DB *db, struct domain *sd);
-int contains(u_char *a, u_char *b);
-int level(u_char *p);
-int lookup_aaaa(DB *db, struct recurses *sr, struct ns *ns);
-int netlookup6(DB *db, struct recurses *sr);
-
extern int debug, verbose;
#ifndef MIN
@@ -93,7 +91,7 @@ static struct recurseentry {
} *rn2, *rnp;
-static const char rcsid[] = "$Id: recurse.c,v 1.43 2014/05/18 11:54:02 pjp Exp $";
+static const char rcsid[] = "$Id: recurse.c,v 1.44 2014/05/18 17:14:05 pjp Exp $";
/*
* INIT_RECURSE - initialize the recurse singly linked list
blob - 00b09ed92476c805ee03cd6ba93f961183824db7
blob + 4a86a50fd8b58afd15020b1e2d8f6210ca7fde47
--- region.c
+++ region.c
@@ -29,11 +29,11 @@
#include "dns.h"
#include "db.h"
-u_int8_t find_region(struct sockaddr_storage *sst, int family);
-void init_region(void);
-int insert_region(char *address, char *prefixlen, u_int8_t region);
-in_addr_t getmask(int prefixlen);
-int getmask6(int prefixlen, struct sockaddr_in6 *sin6);
+u_int8_t find_region(struct sockaddr_storage *, int);
+in_addr_t getmask(int);
+int getmask6(int, struct sockaddr_in6 *);
+void init_region(void);
+int insert_region(char *, char *, u_int8_t);
SLIST_HEAD(listhead, entry) head;
@@ -48,7 +48,7 @@ static struct entry {
} *n2, *np;
-static const char rcsid[] = "$Id: region.c,v 1.10 2014/05/01 15:26:24 pjp Exp $";
+static const char rcsid[] = "$Id: region.c,v 1.11 2014/05/18 17:14:05 pjp Exp $";
/*
* INIT_REGION - initialize the region singly linked list
blob - 39f5941ada10eded8ee4bea021e85d0d2e893056
blob + e66391521f464284b18d61e12b51317fc7db5300
--- reply.c
+++ reply.c
@@ -29,53 +29,53 @@
#include "dns.h"
#include "db.h"
-void reply_a(struct sreply *, DB *);
-void reply_aaaa(struct sreply *, DB *);
-void reply_mx(struct sreply *, DB *);
-void reply_ns(struct sreply *, DB *);
-void reply_notimpl(struct sreply *);
-void reply_nxdomain(struct sreply *);
-void reply_noerror(struct sreply *);
-void reply_soa(struct sreply *);
-void reply_ptr(struct sreply *);
-void reply_txt(struct sreply *sreply);
-void reply_spf(struct sreply *sreply);
-void reply_srv(struct sreply *sreply, DB *db);
-void reply_naptr(struct sreply *sreply, DB *db);
-void reply_sshfp(struct sreply *);
-void reply_cname(struct sreply *);
-void reply_any(struct sreply *);
-void reply_refused(struct sreply *);
-void reply_fmterror(struct sreply *);
-void reply_raw2(int so, char *reply, int outlen, struct recurses *sr);
-void reply_raw6(int so, char *reply, int outlen, struct recurses *sr);
+/* prototypes */
-extern int compress_label(u_char *, int, int);
-extern int additional_a(char *, int, struct domain *, char *, int, int, int *);
-extern int additional_aaaa(char *, int, struct domain *, char *, int, int, int *);
-extern int additional_mx(char *, int, struct domain *, char *, int, int, int *);
-extern int additional_ptr(char *, int, struct domain *, char *, int, int, int *);
-extern int additional_opt(struct question *, char *, int, int);
+extern int additional_a(char *, int, struct domain *, char *, int, int, int *);
+extern int additional_aaaa(char *, int, struct domain *, char *, int, int, int *);
+extern int additional_mx(char *, int, struct domain *, char *, int, int, int *);
+extern int additional_ptr(char *, int, struct domain *, char *, int, int, int *);
+extern int additional_opt(struct question *, char *, int, int);
+extern struct question *build_fake_question(char *, int, u_int16_t);
+extern int compress_label(u_char *, int, int);
+extern void dolog(int, char *, ...);
+extern int free_question(struct question *);
+extern int lookup_zone(DB *, struct question *, struct domain *, int *, char *, int);
+extern void slave_shutdown(void);
-extern struct question * build_fake_question(char *, int, u_int16_t);
-extern int free_question(struct question *);
-extern int lookup_zone(DB *, struct question *, struct domain *, int *, char *, int);
-extern void slave_shutdown(void);
-extern void dolog(int, char *, ...);
-void update_db(DB *, struct domain *);
-struct domain * Lookup_zone(DB *db, char *name, u_int16_t namelen, u_int16_t type, int);
-void collects_init(void);
-u_int16_t create_anyreply(struct sreply *sreply, char *reply, int rlen, int offset, int soa);
+struct domain *Lookup_zone(DB *, char *, u_int16_t, u_int16_t, int);
+void collects_init(void);
+u_int16_t create_anyreply(struct sreply *, char *, int, int, int);
+u_short in_cksum(const u_short *, register int, int);
+void reply_a(struct sreply *, DB *);
+void reply_aaaa(struct sreply *, DB *);
+void reply_mx(struct sreply *, DB *);
+void reply_ns(struct sreply *, DB *);
+void reply_notimpl(struct sreply *);
+void reply_nxdomain(struct sreply *);
+void reply_noerror(struct sreply *);
+void reply_soa(struct sreply *);
+void reply_ptr(struct sreply *);
+void reply_txt(struct sreply *);
+void reply_spf(struct sreply *);
+void reply_srv(struct sreply *, DB *);
+void reply_naptr(struct sreply *, DB *);
+void reply_sshfp(struct sreply *);
+void reply_cname(struct sreply *);
+void reply_any(struct sreply *);
+void reply_refused(struct sreply *);
+void reply_fmterror(struct sreply *);
+void reply_raw2(int, char *, int, struct recurses *);
+void reply_raw6(int, char *, int, struct recurses *);
+void update_db(DB *, struct domain *);
#ifdef __linux__
-static int udp_cksum(const struct iphdr *ip, const struct udphdr *up, int len);
+static int udp_cksum(const struct iphdr *, const struct udphdr *, int);
#else
-static int udp_cksum(const struct ip *ip, const struct udphdr *up, int len);
+static int udp_cksum(const struct ip *, const struct udphdr *, int);
#endif
-u_short in_cksum(const u_short *addr, register int len, int csum);
-
SLIST_HEAD(listhead, collects) collectshead;
struct collects {
@@ -89,7 +89,7 @@ struct collects {
extern int debug, verbose;
-static const char rcsid[] = "$Id: reply.c,v 1.58 2014/05/18 11:54:02 pjp Exp $";
+static const char rcsid[] = "$Id: reply.c,v 1.59 2014/05/18 17:14:05 pjp Exp $";
/*
* REPLY_A() - replies a DNS question (*q) on socket (so)
blob - ae7b74188f942674590bb0791a04157f5f689b3f
blob + 0bfa32f93a92a9c0388c939c528395dbe01cccef
--- wildcard.c
+++ wildcard.c
@@ -29,12 +29,13 @@
#include "dns.h"
#include "db.h"
-void init_wildcard(void);
-int find_wildcard(struct sockaddr_storage *sst, int family);
-int insert_wildcard(char *address, char *prefixlen);
-extern in_addr_t getmask(int prefixlen);
-extern int getmask6(int prefixlen, struct sockaddr_in6 *sin6);
+extern in_addr_t getmask(int);
+extern int getmask6(int, struct sockaddr_in6 *);
+int find_wildcard(struct sockaddr_storage *, int);
+void init_wildcard(void);
+int insert_wildcard(char *, char *);
+
SLIST_HEAD(listhead, wildentry) wildhead;
static struct wildentry {
@@ -47,7 +48,7 @@ static struct wildentry {
} *wn2, *wnp;
-static const char rcsid[] = "$Id: wildcard.c,v 1.6 2014/05/01 15:26:24 pjp Exp $";
+static const char rcsid[] = "$Id: wildcard.c,v 1.7 2014/05/18 17:14:05 pjp Exp $";
/*
* INIT_WILDCARD - initialize the wildcard singly linked list
repomaster@centroid.eu