1 From f6bea86c78ba9efbd01da3dd2fb18764ec806290 Mon Sep 17 00:00:00 2001
2 From: Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk>
3 Date: Wed, 7 Sep 2016 09:35:07 +0100
4 Subject: [PATCH] dnsmasq: compile time option NO_ID
6 Some consider it good practice to obscure software version numbers to
7 clients. Compiling with -DNO_ID removes the *.bind info structure.
8 This includes: version, author, copyright, cachesize, cache insertions,
9 evictions, misses & hits, auth & servers.
11 Signed-off-by: Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk>
14 src/config.h | 5 +++++
15 src/dnsmasq.h | 4 ++++
16 src/option.c | 8 ++++++--
18 5 files changed, 19 insertions(+), 3 deletions(-)
22 @@ -1290,6 +1290,7 @@ void cache_add_dhcp_entry(char *host_nam
27 int cache_make_stat(struct txt_record *t)
29 static char *buff = NULL;
30 @@ -1385,6 +1386,7 @@ int cache_make_stat(struct txt_record *t
36 /* There can be names in the cache containing control chars, don't
37 mess up logging or open security holes. */
40 @@ -120,6 +120,8 @@ HAVE_LOOP
42 use the Linux inotify facility to efficiently re-read configuration files.
45 + Don't report *.bind CHAOS info to clients.
49 @@ -434,6 +436,9 @@ static char *compile_opts =
61 @@ -286,6 +286,7 @@ struct naptr {
66 #define TXT_STAT_CACHESIZE 1
67 #define TXT_STAT_INSERTS 2
68 #define TXT_STAT_EVICTIONS 3
69 @@ -293,6 +294,7 @@ struct naptr {
70 #define TXT_STAT_HITS 5
71 #define TXT_STAT_AUTH 6
72 #define TXT_STAT_SERVERS 7
77 @@ -1078,7 +1080,9 @@ void cache_add_dhcp_entry(char *host_nam
78 struct in_addr a_record_from_hosts(char *name, time_t now);
79 void cache_unhash_dhcp(void);
80 void dump_cache(time_t now);
82 int cache_make_stat(struct txt_record *t);
84 char *cache_get_name(struct crec *crecp);
85 char *cache_get_cname_target(struct crec *crecp);
86 struct crec *cache_enumerate(int init);
89 @@ -657,7 +657,8 @@ static int atoi_check8(char *a, int *res
96 static void add_txt(char *name, char *txt, int stat)
98 struct txt_record *r = opt_malloc(sizeof(struct txt_record));
99 @@ -670,13 +671,14 @@ static void add_txt(char *name, char *tx
101 memcpy((r->txt)+1, txt, len);
106 r->name = opt_string_alloc(name);
107 r->next = daemon->txt;
113 static void do_usage(void)
115 @@ -4515,6 +4517,7 @@ void read_opts(int argc, char **argv, ch
116 daemon->soa_expiry = SOA_EXPIRY;
117 daemon->max_port = MAX_PORT;
120 add_txt("version.bind", "dnsmasq-" VERSION, 0 );
121 add_txt("authors.bind", "Simon Kelley", 0);
122 add_txt("copyright.bind", COPYRIGHT, 0);
123 @@ -4527,6 +4530,7 @@ void read_opts(int argc, char **argv, ch
124 add_txt("auth.bind", NULL, TXT_STAT_AUTH);
126 add_txt("servers.bind", NULL, TXT_STAT_SERVERS);
133 @@ -1264,6 +1264,7 @@ size_t answer_request(struct dns_header
134 unsigned long ttl = daemon->local_ttl;
136 log_query(F_CONFIG | F_RRNAME, name, NULL, "<TXT>");
138 /* Dynamically generate stat record */
141 @@ -1271,7 +1272,7 @@ size_t answer_request(struct dns_header
142 if (!cache_make_stat(t))
147 if (ok && add_resource_record(header, limit, &trunc, nameoffset, &ansp,
149 T_TXT, t->class, "t", t->len, t->txt))