Lines 1-345
Link Here
|
1 |
--- contrib/aaaa-filter-iterator.patch.orig 2016-01-04 12:57:42 UTC |
|
|
2 |
+++ contrib/aaaa-filter-iterator.patch |
3 |
@@ -1,8 +1,10 @@ |
4 |
---- unbound-1.4.17.orig/doc/unbound.conf.5.in |
5 |
-+++ unbound-1.4.17/doc/unbound.conf.5.in |
6 |
-@@ -519,6 +519,13 @@ authority servers and checks if the repl |
7 |
- Disabled by default. |
8 |
- This feature is an experimental implementation of draft dns\-0x20. |
9 |
+Index: trunk/doc/unbound.conf.5.in |
10 |
+=================================================================== |
11 |
+--- trunk/doc/unbound.conf.5.in (revision 3587) |
12 |
++++ trunk/doc/unbound.conf.5.in (working copy) |
13 |
+@@ -593,6 +593,13 @@ |
14 |
+ possible. Best effort approach, full QNAME and original QTYPE will be sent when |
15 |
+ upstream replies with a RCODE other than NOERROR. Default is off. |
16 |
.TP |
17 |
+.B aaaa\-filter: \fI<yes or no> |
18 |
+Activate behavior similar to BIND's AAAA-filter. |
19 |
@@ -13,20 +15,12 @@ |
20 |
+.TP |
21 |
.B private\-address: \fI<IP address or subnet> |
22 |
Give IPv4 of IPv6 addresses or classless subnets. These are addresses |
23 |
- on your private network, and are not allowed to be returned for public |
24 |
---- unbound-1.4.17.orig/util/config_file.c |
25 |
-+++ unbound-1.4.17/util/config_file.c |
26 |
-@@ -160,6 +160,7 @@ config_create(void) |
27 |
- cfg->harden_below_nxdomain = 0; |
28 |
- cfg->harden_referral_path = 0; |
29 |
- cfg->use_caps_bits_for_id = 0; |
30 |
-+ cfg->aaaa_filter = 0; /* ASN: default is disabled */ |
31 |
- cfg->private_address = NULL; |
32 |
- cfg->private_domain = NULL; |
33 |
- cfg->unwanted_threshold = 0; |
34 |
---- unbound-1.4.17.orig/iterator/iter_scrub.c |
35 |
-+++ unbound-1.4.17/iterator/iter_scrub.c |
36 |
-@@ -580,6 +580,32 @@ static int sanitize_nsec_is_overreach(st |
37 |
+ on your private network, and are not allowed to be returned for |
38 |
+Index: trunk/iterator/iter_scrub.c |
39 |
+=================================================================== |
40 |
+--- trunk/iterator/iter_scrub.c (revision 3587) |
41 |
++++ trunk/iterator/iter_scrub.c (working copy) |
42 |
+@@ -617,6 +617,32 @@ |
43 |
} |
44 |
|
45 |
/** |
46 |
@@ -38,7 +32,7 @@ |
47 |
+ */ |
48 |
+static int |
49 |
+asn_lookup_a_record_from_cache(struct query_info* qinfo, |
50 |
-+ struct module_env* env, struct iter_env* ie) |
51 |
++ struct module_env* env, struct iter_env* ATTR_UNUSED(ie)) |
52 |
+{ |
53 |
+ struct ub_packed_rrset_key* akey; |
54 |
+ |
55 |
@@ -59,7 +53,7 @@ |
56 |
* Given a response event, remove suspect RRsets from the response. |
57 |
* "Suspect" rrsets are potentially poison. Note that this routine expects |
58 |
* the response to be in a "normalized" state -- that is, all "irrelevant" |
59 |
-@@ -598,6 +625,7 @@ scrub_sanitize(ldns_buffer* pkt, struct |
60 |
+@@ -635,6 +661,7 @@ |
61 |
struct query_info* qinfo, uint8_t* zonename, struct module_env* env, |
62 |
struct iter_env* ie) |
63 |
{ |
64 |
@@ -67,7 +61,7 @@ |
65 |
int del_addi = 0; /* if additional-holding rrsets are deleted, we |
66 |
do not trust the normalized additional-A-AAAA any more */ |
67 |
struct rrset_parse* rrset, *prev; |
68 |
-@@ -633,6 +661,13 @@ scrub_sanitize(ldns_buffer* pkt, struct |
69 |
+@@ -670,6 +697,13 @@ |
70 |
rrset = rrset->rrset_all_next; |
71 |
} |
72 |
|
73 |
@@ -81,7 +75,7 @@ |
74 |
/* At this point, we brutally remove ALL rrsets that aren't |
75 |
* children of the originating zone. The idea here is that, |
76 |
* as far as we know, the server that we contacted is ONLY |
77 |
-@@ -644,6 +679,24 @@ scrub_sanitize(ldns_buffer* pkt, struct |
78 |
+@@ -681,6 +715,24 @@ |
79 |
rrset = msg->rrset_first; |
80 |
while(rrset) { |
81 |
|
82 |
@@ -105,10 +99,24 @@ |
83 |
+ |
84 |
/* remove private addresses */ |
85 |
if( (rrset->type == LDNS_RR_TYPE_A || |
86 |
- rrset->type == LDNS_RR_TYPE_AAAA) && |
87 |
---- unbound-1.4.17.orig/iterator/iterator.c |
88 |
-+++ unbound-1.4.17/iterator/iterator.c |
89 |
-@@ -1579,6 +1579,53 @@ processDSNSFind(struct module_qstate* qs |
90 |
+ rrset->type == LDNS_RR_TYPE_AAAA)) { |
91 |
+Index: trunk/iterator/iter_utils.c |
92 |
+=================================================================== |
93 |
+--- trunk/iterator/iter_utils.c (revision 3587) |
94 |
++++ trunk/iterator/iter_utils.c (working copy) |
95 |
+@@ -175,6 +175,7 @@ |
96 |
+ } |
97 |
+ iter_env->supports_ipv6 = cfg->do_ip6; |
98 |
+ iter_env->supports_ipv4 = cfg->do_ip4; |
99 |
++ iter_env->aaaa_filter = cfg->aaaa_filter; |
100 |
+ return 1; |
101 |
+ } |
102 |
+ |
103 |
+Index: trunk/iterator/iterator.c |
104 |
+=================================================================== |
105 |
+--- trunk/iterator/iterator.c (revision 3587) |
106 |
++++ trunk/iterator/iterator.c (working copy) |
107 |
+@@ -1776,6 +1776,53 @@ |
108 |
|
109 |
return 0; |
110 |
} |
111 |
@@ -128,7 +136,7 @@ |
112 |
+ */ |
113 |
+static int |
114 |
+asn_processQueryAAAA(struct module_qstate* qstate, struct iter_qstate* iq, |
115 |
-+ struct iter_env* ie, int id) |
116 |
++ struct iter_env* ATTR_UNUSED(ie), int id) |
117 |
+{ |
118 |
+ struct module_qstate* subq = NULL; |
119 |
+ |
120 |
@@ -162,7 +170,7 @@ |
121 |
|
122 |
/** |
123 |
* This is the request event state where the request will be sent to one of |
124 |
-@@ -1626,6 +1673,13 @@ processQueryTargets(struct module_qstate |
125 |
+@@ -1823,6 +1870,13 @@ |
126 |
return error_response(qstate, id, LDNS_RCODE_SERVFAIL); |
127 |
} |
128 |
|
129 |
@@ -176,7 +184,7 @@ |
130 |
/* Make sure we have a delegation point, otherwise priming failed |
131 |
* or another failure occurred */ |
132 |
if(!iq->dp) { |
133 |
-@@ -2568,6 +2622,62 @@ processFinished(struct module_qstate* qs |
134 |
+@@ -2922,6 +2976,61 @@ |
135 |
return 0; |
136 |
} |
137 |
|
138 |
@@ -195,9 +203,8 @@ |
139 |
+asn_processAAAAResponse(struct module_qstate* qstate, int id, |
140 |
+ struct module_qstate* super) |
141 |
+{ |
142 |
-+ struct iter_qstate* iq = (struct iter_qstate*)qstate->minfo[id]; |
143 |
++ /*struct iter_qstate* iq = (struct iter_qstate*)qstate->minfo[id];*/ |
144 |
+ struct iter_qstate* super_iq = (struct iter_qstate*)super->minfo[id]; |
145 |
-+ struct ub_packed_rrset_key* rrset; |
146 |
+ struct delegpt_ns* dpns = NULL; |
147 |
+ int error = (qstate->return_rcode != LDNS_RCODE_NOERROR); |
148 |
+ |
149 |
@@ -239,7 +246,7 @@ |
150 |
/* |
151 |
* Return priming query results to interestes super querystates. |
152 |
* |
153 |
-@@ -2587,6 +2697,9 @@ iter_inform_super(struct module_qstate* |
154 |
+@@ -2941,6 +3050,9 @@ |
155 |
else if(super->qinfo.qtype == LDNS_RR_TYPE_DS && ((struct iter_qstate*) |
156 |
super->minfo[id])->state == DSNS_FIND_STATE) |
157 |
processDSNSResponse(qstate, id, super); |
158 |
@@ -249,7 +256,7 @@ |
159 |
else if(qstate->return_rcode != LDNS_RCODE_NOERROR) |
160 |
error_supers(qstate, id, super); |
161 |
else if(qstate->is_priming) |
162 |
-@@ -2624,6 +2737,9 @@ iter_handle(struct module_qstate* qstate |
163 |
+@@ -2978,6 +3090,9 @@ |
164 |
case INIT_REQUEST_3_STATE: |
165 |
cont = processInitRequest3(qstate, iq, id); |
166 |
break; |
167 |
@@ -259,7 +266,7 @@ |
168 |
case QUERYTARGETS_STATE: |
169 |
cont = processQueryTargets(qstate, iq, ie, id); |
170 |
break; |
171 |
-@@ -2863,6 +2979,8 @@ iter_state_to_string(enum iter_state sta |
172 |
+@@ -3270,6 +3385,8 @@ |
173 |
return "INIT REQUEST STATE (stage 2)"; |
174 |
case INIT_REQUEST_3_STATE: |
175 |
return "INIT REQUEST STATE (stage 3)"; |
176 |
@@ -268,7 +275,7 @@ |
177 |
case QUERYTARGETS_STATE : |
178 |
return "QUERY TARGETS STATE"; |
179 |
case PRIME_RESP_STATE : |
180 |
-@@ -2887,6 +3005,7 @@ iter_state_is_responsestate(enum iter_st |
181 |
+@@ -3294,6 +3411,7 @@ |
182 |
case INIT_REQUEST_STATE : |
183 |
case INIT_REQUEST_2_STATE : |
184 |
case INIT_REQUEST_3_STATE : |
185 |
@@ -276,29 +283,21 @@ |
186 |
case QUERYTARGETS_STATE : |
187 |
case COLLECT_CLASS_STATE : |
188 |
return 0; |
189 |
---- unbound-1.4.17.orig/iterator/iter_utils.c |
190 |
-+++ unbound-1.4.17/iterator/iter_utils.c |
191 |
-@@ -128,6 +128,7 @@ iter_apply_cfg(struct iter_env* iter_env |
192 |
- } |
193 |
- iter_env->supports_ipv6 = cfg->do_ip6; |
194 |
- iter_env->supports_ipv4 = cfg->do_ip4; |
195 |
-+ iter_env->aaaa_filter = cfg->aaaa_filter; |
196 |
- return 1; |
197 |
- } |
198 |
- |
199 |
---- unbound-1.4.17.orig/iterator/iterator.h |
200 |
-+++ unbound-1.4.17/iterator/iterator.h |
201 |
-@@ -110,6 +110,9 @@ struct iter_env { |
202 |
- * array of max_dependency_depth+1 size. |
203 |
+Index: trunk/iterator/iterator.h |
204 |
+=================================================================== |
205 |
+--- trunk/iterator/iterator.h (revision 3587) |
206 |
++++ trunk/iterator/iterator.h (working copy) |
207 |
+@@ -113,6 +113,9 @@ |
208 |
*/ |
209 |
int* target_fetch_policy; |
210 |
-+ |
211 |
+ |
212 |
+ /** ASN: AAAA-filter flag */ |
213 |
+ int aaaa_filter; |
214 |
++ |
215 |
+ /** ip6.arpa dname in wireformat, used for qname-minimisation */ |
216 |
+ uint8_t* ip6arpa_dname; |
217 |
}; |
218 |
- |
219 |
- /** |
220 |
-@@ -135,6 +138,14 @@ enum iter_state { |
221 |
+@@ -163,6 +166,14 @@ |
222 |
INIT_REQUEST_3_STATE, |
223 |
|
224 |
/** |
225 |
@@ -312,8 +311,8 @@ |
226 |
+ /** |
227 |
* Each time a delegation point changes for a given query or a |
228 |
* query times out and/or wakes up, this state is (re)visited. |
229 |
- * This state is responsible for iterating through a list of |
230 |
-@@ -309,6 +320,13 @@ struct iter_qstate { |
231 |
+ * This state is reponsible for iterating through a list of |
232 |
+@@ -346,6 +357,13 @@ |
233 |
*/ |
234 |
int refetch_glue; |
235 |
|
236 |
@@ -326,31 +325,61 @@ |
237 |
+ |
238 |
/** list of pending queries to authoritative servers. */ |
239 |
struct outbound_list outlist; |
240 |
- }; |
241 |
---- unbound-1.4.17.orig/util/config_file.h |
242 |
-+++ unbound-1.4.17/util/config_file.h |
243 |
-@@ -169,6 +169,8 @@ struct config_file { |
244 |
- int harden_referral_path; |
245 |
+ |
246 |
+Index: trunk/pythonmod/interface.i |
247 |
+=================================================================== |
248 |
+--- trunk/pythonmod/interface.i (revision 3587) |
249 |
++++ trunk/pythonmod/interface.i (working copy) |
250 |
+@@ -632,6 +632,7 @@ |
251 |
+ int harden_dnssec_stripped; |
252 |
+ int harden_referral_path; |
253 |
+ int use_caps_bits_for_id; |
254 |
++ int aaaa_filter; /* ASN */ |
255 |
+ struct config_strlist* private_address; |
256 |
+ struct config_strlist* private_domain; |
257 |
+ size_t unwanted_threshold; |
258 |
+Index: trunk/util/config_file.c |
259 |
+=================================================================== |
260 |
+--- trunk/util/config_file.c (revision 3587) |
261 |
++++ trunk/util/config_file.c (working copy) |
262 |
+@@ -176,6 +176,7 @@ |
263 |
+ cfg->harden_referral_path = 0; |
264 |
+ cfg->harden_algo_downgrade = 0; |
265 |
+ cfg->use_caps_bits_for_id = 0; |
266 |
++ cfg->aaaa_filter = 0; /* ASN: default is disabled */ |
267 |
+ cfg->caps_whitelist = NULL; |
268 |
+ cfg->private_address = NULL; |
269 |
+ cfg->private_domain = NULL; |
270 |
+Index: trunk/util/config_file.h |
271 |
+=================================================================== |
272 |
+--- trunk/util/config_file.h (revision 3587) |
273 |
++++ trunk/util/config_file.h (working copy) |
274 |
+@@ -179,6 +179,8 @@ |
275 |
+ int harden_algo_downgrade; |
276 |
/** use 0x20 bits in query as random ID bits */ |
277 |
int use_caps_bits_for_id; |
278 |
+ /** ASN: enable AAAA filter? */ |
279 |
+ int aaaa_filter; |
280 |
+ /** 0x20 whitelist, domains that do not use capsforid */ |
281 |
+ struct config_strlist* caps_whitelist; |
282 |
/** strip away these private addrs from answers, no DNS Rebinding */ |
283 |
- struct config_strlist* private_address; |
284 |
- /** allow domain (and subdomains) to use private address space */ |
285 |
---- unbound-1.4.17.orig/util/configlexer.lex |
286 |
-+++ unbound-1.4.17/util/configlexer.lex |
287 |
-@@ -177,6 +177,7 @@ harden-below-nxdomain{COLON} { YDVAR(1, |
288 |
- harden-referral-path{COLON} { YDVAR(1, VAR_HARDEN_REFERRAL_PATH) } |
289 |
+Index: trunk/util/configlexer.lex |
290 |
+=================================================================== |
291 |
+--- trunk/util/configlexer.lex (revision 3587) |
292 |
++++ trunk/util/configlexer.lex (working copy) |
293 |
+@@ -267,6 +267,7 @@ |
294 |
use-caps-for-id{COLON} { YDVAR(1, VAR_USE_CAPS_FOR_ID) } |
295 |
+ caps-whitelist{COLON} { YDVAR(1, VAR_CAPS_WHITELIST) } |
296 |
unwanted-reply-threshold{COLON} { YDVAR(1, VAR_UNWANTED_REPLY_THRESHOLD) } |
297 |
+aaaa-filter{COLON} { YDVAR(1, VAR_AAAA_FILTER) } |
298 |
private-address{COLON} { YDVAR(1, VAR_PRIVATE_ADDRESS) } |
299 |
private-domain{COLON} { YDVAR(1, VAR_PRIVATE_DOMAIN) } |
300 |
prefetch-key{COLON} { YDVAR(1, VAR_PREFETCH_KEY) } |
301 |
---- unbound-1.4.17.orig/util/configparser.y |
302 |
-+++ unbound-1.4.17/util/configparser.y |
303 |
-@@ -92,6 +92,7 @@ extern struct config_parser_state* cfg_p |
304 |
+Index: trunk/util/configparser.y |
305 |
+=================================================================== |
306 |
+--- trunk/util/configparser.y (revision 3587) |
307 |
++++ trunk/util/configparser.y (working copy) |
308 |
+@@ -92,6 +92,7 @@ |
309 |
%token VAR_STATISTICS_CUMULATIVE VAR_OUTGOING_PORT_PERMIT |
310 |
%token VAR_OUTGOING_PORT_AVOID VAR_DLV_ANCHOR_FILE VAR_DLV_ANCHOR |
311 |
%token VAR_NEG_CACHE_SIZE VAR_HARDEN_REFERRAL_PATH VAR_PRIVATE_ADDRESS |
312 |
@@ -358,7 +387,7 @@ |
313 |
%token VAR_PRIVATE_DOMAIN VAR_REMOTE_CONTROL VAR_CONTROL_ENABLE |
314 |
%token VAR_CONTROL_INTERFACE VAR_CONTROL_PORT VAR_SERVER_KEY_FILE |
315 |
%token VAR_SERVER_CERT_FILE VAR_CONTROL_KEY_FILE VAR_CONTROL_CERT_FILE |
316 |
-@@ -151,6 +152,7 @@ content_server: server_num_threads | ser |
317 |
+@@ -169,6 +170,7 @@ |
318 |
server_dlv_anchor_file | server_dlv_anchor | server_neg_cache_size | |
319 |
server_harden_referral_path | server_private_address | |
320 |
server_private_domain | server_extended_statistics | |
321 |
@@ -366,8 +395,8 @@ |
322 |
server_local_data_ptr | server_jostle_timeout | |
323 |
server_unwanted_reply_threshold | server_log_time_ascii | |
324 |
server_domain_insecure | server_val_sig_skew_min | |
325 |
-@@ -802,6 +803,15 @@ server_use_caps_for_id: VAR_USE_CAPS_FOR |
326 |
- free($2); |
327 |
+@@ -893,6 +895,15 @@ |
328 |
+ yyerror("out of memory"); |
329 |
} |
330 |
; |
331 |
+server_aaaa_filter: VAR_AAAA_FILTER STRING_ARG |
332 |
@@ -382,13 +411,3 @@ |
333 |
server_private_address: VAR_PRIVATE_ADDRESS STRING_ARG |
334 |
{ |
335 |
OUTYY(("P(server_private_address:%s)\n", $2)); |
336 |
---- unbound-1.4.17.orig/pythonmod/interface.i |
337 |
-+++ unbound-1.4.17/pythonmod/interface.i |
338 |
-@@ -626,6 +626,7 @@ struct config_file { |
339 |
- int harden_dnssec_stripped; |
340 |
- int harden_referral_path; |
341 |
- int use_caps_bits_for_id; |
342 |
-+ int aaaa_filter; /* ASN */ |
343 |
- struct config_strlist* private_address; |
344 |
- struct config_strlist* private_domain; |
345 |
- size_t unwanted_threshold; |