aboutsummaryrefslogtreecommitdiff
path: root/src/gns/gnunet-service-gns_interceptor.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-08-13 19:14:19 +0000
committerChristian Grothoff <christian@grothoff.org>2013-08-13 19:14:19 +0000
commit5f5f1974b15c646bde44583aede2433254138661 (patch)
tree6197cc994723c804e261ff15c9a04e800f3988ee /src/gns/gnunet-service-gns_interceptor.c
parentadc6e4a5804d4cb43516383ff1d97065df0d0fd9 (diff)
downloadgnunet-5f5f1974b15c646bde44583aede2433254138661.tar.gz
gnunet-5f5f1974b15c646bde44583aede2433254138661.zip
-more coding towards working new GNS service
Diffstat (limited to 'src/gns/gnunet-service-gns_interceptor.c')
-rw-r--r--src/gns/gnunet-service-gns_interceptor.c401
1 files changed, 172 insertions, 229 deletions
diff --git a/src/gns/gnunet-service-gns_interceptor.c b/src/gns/gnunet-service-gns_interceptor.c
index 8f1f1fb0b..ec6664454 100644
--- a/src/gns/gnunet-service-gns_interceptor.c
+++ b/src/gns/gnunet-service-gns_interceptor.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2009, 2010, 2011, 2012 Christian Grothoff (and other contributing authors) 3 (C) 2009-2013 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -24,18 +24,30 @@
24 */ 24 */
25#include "platform.h" 25#include "platform.h"
26#include "gnunet_util_lib.h" 26#include "gnunet_util_lib.h"
27#include "gnunet_transport_service.h"
28#include "gnunet_dns_service.h" 27#include "gnunet_dns_service.h"
29#include "gnunet_dnsparser_lib.h" 28#include "gnunet_dnsparser_lib.h"
30#include "gnunet-service-gns_resolver.h" 29#include "gnunet-service-gns_resolver.h"
30#include "gnunet-service-gns_interceptor.h"
31#include "gns.h" 31#include "gns.h"
32 32
33
33/** 34/**
34 * Handle to a DNS intercepted 35 * Handle to a DNS intercepted
35 * reslution request 36 * reslution request
36 */ 37 */
37struct InterceptLookupHandle 38struct InterceptLookupHandle
38{ 39{
40
41 /**
42 * We keep these in a DLL.
43 */
44 struct InterceptLookupHandle *next;
45
46 /**
47 * We keep these in a DLL.
48 */
49 struct InterceptLookupHandle *prev;
50
39 /** 51 /**
40 * the request handle to reply to 52 * the request handle to reply to
41 */ 53 */
@@ -45,11 +57,12 @@ struct InterceptLookupHandle
45 * the dns parser packet received 57 * the dns parser packet received
46 */ 58 */
47 struct GNUNET_DNSPARSER_Packet *packet; 59 struct GNUNET_DNSPARSER_Packet *packet;
48 60
49 /** 61 /**
50 * the query parsed from the packet 62 * Handle for the lookup operation.
51 */ 63 */
52 struct GNUNET_DNSPARSER_Query *query; 64 struct GNS_ResolverHandle *lookup;
65
53}; 66};
54 67
55 68
@@ -59,19 +72,19 @@ struct InterceptLookupHandle
59static struct GNUNET_DNS_Handle *dns_handle; 72static struct GNUNET_DNS_Handle *dns_handle;
60 73
61/** 74/**
62 * The root zone for this interceptor 75 * Key of the zone we start lookups in.
63 */ 76 */
64static struct GNUNET_CRYPTO_ShortHashCode our_zone; 77static struct GNUNET_CRYPTO_EccPublicKey zone;
65 78
66/** 79/**
67 * Our priv key 80 * Head of the DLL.
68 */ 81 */
69static struct GNUNET_CRYPTO_EccPrivateKey *our_key; 82static struct InterceptLookupHandle *ilh_head;
70 83
71/** 84/**
72 * Default timeout 85 * Tail of the DLL.
73 */ 86 */
74static struct GNUNET_TIME_Relative default_lookup_timeout; 87static struct InterceptLookupHandle *ilh_tail;
75 88
76 89
77/** 90/**
@@ -82,189 +95,132 @@ static struct GNUNET_TIME_Relative default_lookup_timeout;
82 * @param rd the record data 95 * @param rd the record data
83 */ 96 */
84static void 97static void
85reply_to_dns (void* cls, uint32_t rd_count, 98reply_to_dns (void *cls, uint32_t rd_count,
86 const struct GNUNET_NAMESTORE_RecordData *rd) 99 const struct GNUNET_NAMESTORE_RecordData *rd)
87{ 100{
101 struct InterceptLookupHandle *ilh = cls;
102 struct GNUNET_DNSPARSER_Packet *packet = ilh->packet;
103 struct GNUNET_DNSPARSER_Query *query = &packet->queries[0];
88 uint32_t i; 104 uint32_t i;
89 size_t len; 105 size_t len;
90 int ret; 106 int ret;
91 char *buf; 107 char *buf;
92 struct InterceptLookupHandle* ilh = (struct InterceptLookupHandle*)cls; 108 unsigned int num_answers;
93 struct GNUNET_DNSPARSER_Packet *packet = ilh->packet; 109
94 unsigned int num_answers = 0; 110 /* Put records in the DNS packet */
95 111 num_answers = 0;
96
97 /**
98 * Put records in the DNS packet and modify it
99 * to a response
100 */
101 for (i=0; i < rd_count; i++) 112 for (i=0; i < rd_count; i++)
102 { 113 if (rd[i].record_type == query->type)
103 if (rd[i].record_type == ilh->query->type)
104 num_answers++; 114 num_answers++;
105 }
106 115
107 struct GNUNET_DNSPARSER_Record answer_records[num_answers];
108 struct GNUNET_DNSPARSER_Record additional_records[rd_count-(num_answers)];
109 packet->answers = answer_records;
110 packet->additional_records = additional_records;
111
112 for (i=0; i < rd_count; i++)
113 { 116 {
114 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 117 struct GNUNET_DNSPARSER_Record answer_records[num_answers];
115 "Adding type %d to DNS response\n", rd[i].record_type); 118 struct GNUNET_DNSPARSER_Record additional_records[rd_count - num_answers];
116 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Name: %s\n", ilh->query->name); 119
117 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Record %d/%d\n", i+1, rd_count); 120 packet->answers = answer_records;
118 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Record len %d\n", rd[i].data_size); 121 packet->additional_records = additional_records;
119 122
120 if (rd[i].record_type == ilh->query->type) 123 for (i=0; i < rd_count; i++)
121 { 124 {
122 answer_records[i].name = ilh->query->name; 125 if (rd[i].record_type == query->type)
123 answer_records[i].type = rd[i].record_type;
124 switch(rd[i].record_type)
125 { 126 {
126 case GNUNET_DNSPARSER_TYPE_NS: 127 answer_records[i].name = query->name;
127 case GNUNET_DNSPARSER_TYPE_CNAME: 128 answer_records[i].type = rd[i].record_type;
128 case GNUNET_DNSPARSER_TYPE_PTR: 129 switch(rd[i].record_type)
129 answer_records[i].data.hostname = (char*)rd[i].data; 130 {
130 break; 131 case GNUNET_DNSPARSER_TYPE_NS:
131 case GNUNET_DNSPARSER_TYPE_SOA: 132 case GNUNET_DNSPARSER_TYPE_CNAME:
132 answer_records[i].data.soa = 133 case GNUNET_DNSPARSER_TYPE_PTR:
133 (struct GNUNET_DNSPARSER_SoaRecord *)rd[i].data; 134 answer_records[i].data.hostname = (char*)rd[i].data;
134 break; 135 break;
135 case GNUNET_DNSPARSER_TYPE_MX: 136 case GNUNET_DNSPARSER_TYPE_SOA:
136 answer_records[i].data.mx = 137 answer_records[i].data.soa =
137 (struct GNUNET_DNSPARSER_MxRecord *)rd[i].data; 138 (struct GNUNET_DNSPARSER_SoaRecord *)rd[i].data;
138 break; 139 break;
139 default: 140 case GNUNET_DNSPARSER_TYPE_MX:
140 answer_records[i].data.raw.data_len = rd[i].data_size; 141 answer_records[i].data.mx =
141 answer_records[i].data.raw.data = (char*)rd[i].data; 142 (struct GNUNET_DNSPARSER_MxRecord *)rd[i].data;
143 break;
144 default:
145 answer_records[i].data.raw.data_len = rd[i].data_size;
146 answer_records[i].data.raw.data = (char*)rd[i].data;
147 break;
148 }
149 GNUNET_break (0 == (rd[i].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION));
150 answer_records[i].expiration_time.abs_value_us = rd[i].expiration_time;
151 answer_records[i].class = GNUNET_DNSPARSER_CLASS_INTERNET;
142 } 152 }
143 GNUNET_break (0 == (rd[i].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)); 153 else
144 answer_records[i].expiration_time.abs_value_us = rd[i].expiration_time;
145 answer_records[i].class = GNUNET_DNSPARSER_CLASS_INTERNET;//hmmn
146 }
147 else
148 {
149 additional_records[i].name = ilh->query->name;
150 additional_records[i].type = rd[i].record_type;
151 switch(rd[i].record_type)
152 { 154 {
153 case GNUNET_DNSPARSER_TYPE_NS: 155 additional_records[i].name = query->name;
154 case GNUNET_DNSPARSER_TYPE_CNAME: 156 additional_records[i].type = rd[i].record_type;
155 case GNUNET_DNSPARSER_TYPE_PTR: 157 switch(rd[i].record_type)
156 additional_records[i].data.hostname = (char*)rd[i].data; 158 {
157 break; 159 case GNUNET_DNSPARSER_TYPE_NS:
158 case GNUNET_DNSPARSER_TYPE_SOA: 160 case GNUNET_DNSPARSER_TYPE_CNAME:
159 additional_records[i].data.soa = 161 case GNUNET_DNSPARSER_TYPE_PTR:
160 (struct GNUNET_DNSPARSER_SoaRecord *)rd[i].data; 162 additional_records[i].data.hostname = (char*)rd[i].data;
161 break; 163 break;
162 case GNUNET_DNSPARSER_TYPE_MX: 164 case GNUNET_DNSPARSER_TYPE_SOA:
163 additional_records[i].data.mx = 165 additional_records[i].data.soa =
164 (struct GNUNET_DNSPARSER_MxRecord *)rd[i].data; 166 (struct GNUNET_DNSPARSER_SoaRecord *)rd[i].data;
165 break; 167 break;
166 default: 168 case GNUNET_DNSPARSER_TYPE_MX:
167 additional_records[i].data.raw.data_len = rd[i].data_size; 169 additional_records[i].data.mx =
168 additional_records[i].data.raw.data = (char*)rd[i].data; 170 (struct GNUNET_DNSPARSER_MxRecord *)rd[i].data;
171 break;
172 default:
173 additional_records[i].data.raw.data_len = rd[i].data_size;
174 additional_records[i].data.raw.data = (char*)rd[i].data;
175 break;
176 }
177 GNUNET_break (0 == (rd[i].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION));
178 additional_records[i].expiration_time.abs_value_us = rd[i].expiration_time;
179 additional_records[i].class = GNUNET_DNSPARSER_CLASS_INTERNET;
169 } 180 }
170 GNUNET_break (0 == (rd[i].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION));
171 additional_records[i].expiration_time.abs_value_us = rd[i].expiration_time;
172 additional_records[i].class = GNUNET_DNSPARSER_CLASS_INTERNET;//hmmn
173 } 181 }
182 packet->num_answers = num_answers;
183 packet->num_additional_records = rd_count - num_answers;
184 packet->flags.authoritative_answer = 1;
185 if (NULL == rd)
186 packet->flags.return_code = GNUNET_DNSPARSER_RETURN_CODE_NAME_ERROR;
187 else
188 packet->flags.return_code = GNUNET_DNSPARSER_RETURN_CODE_NO_ERROR;
189 packet->flags.query_or_response = 1;
190 ret = GNUNET_DNSPARSER_pack (packet,
191 1024, /* maximum allowed size for DNS reply */
192 &buf,
193 &len);
194 if (GNUNET_OK != ret)
195 {
196 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
197 _("Error converting GNS response to DNS response!\n"));
198 }
199 else
200 {
201 GNUNET_DNS_request_answer (ilh->request_handle,
202 len,
203 buf);
204 GNUNET_free (buf);
205 }
206 packet->num_answers = 0;
207 packet->answers = NULL;
208 packet->num_additional_records = 0;
209 packet->additional_records = NULL;
210 GNUNET_DNSPARSER_free_packet (packet);
174 } 211 }
175 212 GNUNET_CONTAINER_DLL_remove (ilh_head, ilh_tail, ilh);
176 packet->num_answers = num_answers; 213 GNUNET_free (ilh);
177 packet->num_additional_records = rd_count-(num_answers);
178
179 packet->flags.authoritative_answer = 1;
180
181 if (rd == NULL)
182 packet->flags.return_code = GNUNET_DNSPARSER_RETURN_CODE_NAME_ERROR;
183 else
184 packet->flags.return_code = GNUNET_DNSPARSER_RETURN_CODE_NO_ERROR;
185
186 packet->flags.query_or_response = 1;
187
188
189 /**
190 * Reply to DNS
191 */
192 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
193 "Building DNS response\n");
194 ret = GNUNET_DNSPARSER_pack (packet,
195 1024, /* FIXME magic from dns redirector */
196 &buf,
197 &len);
198 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
199 "Built DNS response! (ret=%d,len=%d)\n",
200 ret, len);
201 if (ret == GNUNET_OK)
202 {
203 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
204 "Answering DNS request\n");
205 GNUNET_DNS_request_answer (ilh->request_handle,
206 len,
207 buf);
208
209 GNUNET_free (buf);
210 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
211 "Answered DNS request\n");
212 }
213 else
214 {
215 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
216 "Error building DNS response! (ret=%d)", ret);
217 }
218
219 packet->num_answers = 0;
220 packet->answers = NULL;
221 packet->num_additional_records = 0;
222 packet->additional_records = NULL;
223 GNUNET_DNSPARSER_free_packet(packet);
224 GNUNET_free(ilh);
225}
226
227
228/**
229 * Entry point for name resolution
230 * Setup a new query and try to resolve
231 *
232 * @param request the request handle of the DNS request from a client
233 * @param p the DNS query packet we received
234 * @param q the DNS query we received parsed from p
235 */
236static void
237start_resolution_for_dns (struct GNUNET_DNS_RequestHandle *request,
238 struct GNUNET_DNSPARSER_Packet *p,
239 struct GNUNET_DNSPARSER_Query *q)
240{
241 struct InterceptLookupHandle* ilh;
242
243 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
244 "Starting resolution for %s (type=%d)!\n",
245 q->name, q->type);
246 ilh = GNUNET_malloc(sizeof(struct InterceptLookupHandle));
247 ilh->packet = p;
248 ilh->query = q;
249 ilh->request_handle = request;
250
251 /* Start resolution in our zone */
252 gns_resolver_lookup_record(our_zone, our_zone, q->type, q->name,
253 our_key,
254 default_lookup_timeout,
255 GNUNET_NO,
256 &reply_to_dns, ilh);
257} 214}
258 215
259 216
260/** 217/**
261 * The DNS request handler 218 * The DNS request handler. Called for every incoming DNS request.
262 * Called for every incoming DNS request.
263 * 219 *
264 * @param cls closure 220 * @param cls closure, unused
265 * @param rh request handle to user for reply 221 * @param rh request handle to user for reply
266 * @param request_length number of bytes in request 222 * @param request_length number of bytes in @a request
267 * @param request udp payload of the DNS request 223 * @param request UDP payload of the DNS request
268 */ 224 */
269static void 225static void
270handle_dns_request (void *cls, 226handle_dns_request (void *cls,
@@ -273,61 +229,50 @@ handle_dns_request (void *cls,
273 const char *request) 229 const char *request)
274{ 230{
275 struct GNUNET_DNSPARSER_Packet *p; 231 struct GNUNET_DNSPARSER_Packet *p;
232 struct InterceptLookupHandle *ilh;
276 233
277 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 234 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
278 "Hijacked a DNS request...processing\n"); 235 "Hijacked a DNS request. Processing.\n");
279 if (NULL == (p = GNUNET_DNSPARSER_parse (request, request_length))) 236 if (NULL == (p = GNUNET_DNSPARSER_parse (request, request_length)))
280 { 237 {
281 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 238 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
282 "Received malformed DNS packet, leaving it untouched\n"); 239 "Received malformed DNS packet, leaving it untouched.\n");
283 GNUNET_DNS_request_forward (rh); 240 GNUNET_DNS_request_forward (rh);
284 GNUNET_DNSPARSER_free_packet (p); 241 GNUNET_DNSPARSER_free_packet (p);
285 return; 242 return;
286 } 243 }
287 244
288 /** 245 /* Check TLD and decide if we or legacy dns is responsible */
289 * Check tld and decide if we or 246 if (1 != p->num_queries)
290 * legacy dns is responsible
291 *
292 * FIXME now in theory there could be more than 1 query in the request
293 * but if this is case we get into trouble:
294 * either we query the GNS or the DNS. We cannot do both!
295 * So I suggest to either only allow a single query per request or
296 * only allow GNS or DNS requests.
297 * The way it is implemented here now is buggy and will lead to erratic
298 * behaviour (if multiple queries are present).
299 */
300 if (0 == p->num_queries)
301 { 247 {
302 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 248 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
303 "No Queries in DNS packet... forwarding\n"); 249 "Not exactly one query in DNS packet. Forwarding untouched.\n");
304 GNUNET_DNS_request_forward (rh); 250 GNUNET_DNS_request_forward (rh);
305 GNUNET_DNSPARSER_free_packet(p); 251 GNUNET_DNSPARSER_free_packet(p);
306 return; 252 return;
307 } 253 }
308 254
309 /** 255 /* Check for GNS TLDs. */
310 * Check for .gads/.zkey 256 if ( (GNUNET_YES == is_gads_tld (p->queries[0].name)) ||
311 */ 257 (GNUNET_YES == is_zkey_tld (p->queries[0].name)) ||
312 258 (0 == strcmp (p->queries[0].name, GNUNET_GNS_TLD)) )
313 if ((is_gads_tld(p->queries[0].name) == GNUNET_YES) ||
314 (is_zkey_tld(p->queries[0].name) == GNUNET_YES) ||
315 (strcmp(p->queries[0].name, GNUNET_GNS_TLD) == 0))
316 { 259 {
317 if (p->num_queries > 1) 260 /* Start resolution in GNS */
318 { 261 ilh = GNUNET_new (struct InterceptLookupHandle);
319 /* Note: We could also look for .gads */ 262 GNUNET_CONTAINER_DLL_insert (ilh_head, ilh_tail, ilh);
320 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 263 ilh->packet = p;
321 ">1 queriy in DNS packet... odd. We only process #1\n"); 264 ilh->request_handle = rh;
322 } 265 ilh->lookup = GNS_resolver_lookup (&zone,
323 start_resolution_for_dns (rh, p, p->queries); 266 p->queries[0].type,
267 p->queries[0].name,
268 NULL /* FIXME: enable shorten for DNS intercepts? */,
269 GNUNET_NO,
270 &reply_to_dns, ilh);
324 return; 271 return;
325 } 272 }
326 /** 273 /* This request does not concern us. Forward to real DNS. */
327 * This request does not concern us. Forward to real DNS.
328 */
329 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 274 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
330 "Request for %s is forwarded to DNS\n", 275 "Request for `%s' is forwarded to DNS untouched.\n",
331 p->queries[0].name); 276 p->queries[0].name);
332 GNUNET_DNS_request_forward (rh); 277 GNUNET_DNS_request_forward (rh);
333 GNUNET_DNSPARSER_free_packet (p); 278 GNUNET_DNSPARSER_free_packet (p);
@@ -337,37 +282,25 @@ handle_dns_request (void *cls,
337/** 282/**
338 * Initialized the interceptor 283 * Initialized the interceptor
339 * 284 *
340 * @param zone the zone to work in 285 * @param gnu_zone the zone to work in
341 * @param key the prov key of the zone (can be null, needed for caching)
342 * @param c the configuration 286 * @param c the configuration
343 * @return GNUNET_OK on success 287 * @return GNUNET_OK on success
344 */ 288 */
345int 289int
346gns_interceptor_init (struct GNUNET_CRYPTO_ShortHashCode zone, 290GNS_interceptor_init (const struct GNUNET_CRYPTO_EccPublicKey *gnu_zone,
347 struct GNUNET_CRYPTO_EccPrivateKey *key,
348 const struct GNUNET_CONFIGURATION_Handle *c) 291 const struct GNUNET_CONFIGURATION_Handle *c)
349{ 292{
350 GNUNET_log(GNUNET_ERROR_TYPE_INFO, 293 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
351 "DNS hijacking enabled... connecting to service.\n"); 294 "DNS hijacking enabled. Connecting to DNS service.\n");
352 our_zone = zone; 295 zone = *gnu_zone;
353 our_key = key;
354 /**
355 * Do gnunet dns init here
356 */
357 dns_handle = GNUNET_DNS_connect (c, 296 dns_handle = GNUNET_DNS_connect (c,
358 GNUNET_DNS_FLAG_PRE_RESOLUTION, 297 GNUNET_DNS_FLAG_PRE_RESOLUTION,
359 &handle_dns_request, /* rh */ 298 &handle_dns_request,
360 NULL); /* Closure */ 299 NULL);
361
362 if (GNUNET_OK !=
363 GNUNET_CONFIGURATION_get_value_time (c, "gns",
364 "DEFAULT_LOOKUP_TIMEOUT",
365 &default_lookup_timeout))
366 default_lookup_timeout = GNUNET_TIME_UNIT_ZERO;
367 if (NULL == dns_handle) 300 if (NULL == dns_handle)
368 { 301 {
369 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 302 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
370 "Failed to connect to the dnsservice!\n"); 303 _("Failed to connect to the DNS service!\n"));
371 return GNUNET_SYSERR; 304 return GNUNET_SYSERR;
372 } 305 }
373 return GNUNET_YES; 306 return GNUNET_YES;
@@ -378,13 +311,23 @@ gns_interceptor_init (struct GNUNET_CRYPTO_ShortHashCode zone,
378 * Disconnect from interceptor 311 * Disconnect from interceptor
379 */ 312 */
380void 313void
381gns_interceptor_stop () 314GNS_interceptor_done ()
382{ 315{
316 struct InterceptLookupHandle *ilh;
317
318 while (NULL != (ilh = ilh_head))
319 {
320 GNUNET_CONTAINER_DLL_remove (ilh_head, ilh_tail, ilh);
321 GNS_resolver_lookup_cancel (ilh->lookup);
322 GNUNET_DNS_request_drop (ilh->request_handle);
323 GNUNET_DNSPARSER_free_packet (ilh->packet);
324 GNUNET_free (ilh);
325 }
383 if (NULL != dns_handle) 326 if (NULL != dns_handle)
384 { 327 {
385 GNUNET_DNS_disconnect(dns_handle); 328 GNUNET_DNS_disconnect (dns_handle);
386 dns_handle = NULL; 329 dns_handle = NULL;
387 } 330 }
388} 331}
389 332
390/* end of gns_interceptor.c */ 333/* end of gnunet-service-gns_interceptor.c */