diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-10-18 09:42:34 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-10-18 09:42:34 +0000 |
commit | 50f76ab44c5cb28c0aa92a2a54f50d9ba10a46ee (patch) | |
tree | 43fd03278cc142372846018d43f0cb80ef37550c /src | |
parent | edbebab8a0ec393c3132edc78399c9951e123fdf (diff) | |
download | gnunet-50f76ab44c5cb28c0aa92a2a54f50d9ba10a46ee.tar.gz gnunet-50f76ab44c5cb28c0aa92a2a54f50d9ba10a46ee.zip |
-misc bugfixes
Diffstat (limited to 'src')
-rw-r--r-- | src/dns/dnsstub.c | 16 | ||||
-rwxr-xr-x | src/dns/test_gnunet_dns.sh | 10 |
2 files changed, 23 insertions, 3 deletions
diff --git a/src/dns/dnsstub.c b/src/dns/dnsstub.c index 687259feb..c755aff16 100644 --- a/src/dns/dnsstub.c +++ b/src/dns/dnsstub.c | |||
@@ -279,6 +279,10 @@ GNUNET_DNSSTUB_resolve (struct GNUNET_DNSSTUB_Context *ctx, | |||
279 | else | 279 | else |
280 | ret = rs->dnsout6; | 280 | ret = rs->dnsout6; |
281 | GNUNET_assert (NULL != ret); | 281 | GNUNET_assert (NULL != ret); |
282 | memcpy (&rs->addr, | ||
283 | sa, | ||
284 | sa_len); | ||
285 | rs->addrlen = sa_len; | ||
282 | rs->rc = rc; | 286 | rs->rc = rc; |
283 | rs->rc_cls = rc_cls; | 287 | rs->rc_cls = rc_cls; |
284 | if (GNUNET_SYSERR == | 288 | if (GNUNET_SYSERR == |
@@ -290,6 +294,10 @@ GNUNET_DNSSTUB_resolve (struct GNUNET_DNSSTUB_Context *ctx, | |||
290 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 294 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
291 | _("Failed to send DNS request to %s\n"), | 295 | _("Failed to send DNS request to %s\n"), |
292 | GNUNET_a2s (sa, sa_len)); | 296 | GNUNET_a2s (sa, sa_len)); |
297 | else | ||
298 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
299 | _("Sent DNS request to %s\n"), | ||
300 | GNUNET_a2s (sa, sa_len)); | ||
293 | return rs; | 301 | return rs; |
294 | } | 302 | } |
295 | 303 | ||
@@ -409,7 +417,9 @@ do_dns_read (struct GNUNET_DNSSTUB_RequestSocket *rs, | |||
409 | /* port the code above? */ | 417 | /* port the code above? */ |
410 | len = UINT16_MAX; | 418 | len = UINT16_MAX; |
411 | #endif | 419 | #endif |
412 | 420 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | |
421 | "Receiving %d byte DNS reply\n", | ||
422 | len); | ||
413 | { | 423 | { |
414 | unsigned char buf[len] GNUNET_ALIGN; | 424 | unsigned char buf[len] GNUNET_ALIGN; |
415 | 425 | ||
@@ -437,7 +447,11 @@ do_dns_read (struct GNUNET_DNSSTUB_RequestSocket *rs, | |||
437 | &addr, | 447 | &addr, |
438 | addrlen)) || | 448 | addrlen)) || |
439 | (0 == GNUNET_TIME_absolute_get_remaining (rs->timeout).rel_value) ) | 449 | (0 == GNUNET_TIME_absolute_get_remaining (rs->timeout).rel_value) ) |
450 | { | ||
451 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
452 | "Request timeout or invalid sender address; ignoring reply\n"); | ||
440 | return GNUNET_NO; | 453 | return GNUNET_NO; |
454 | } | ||
441 | if (NULL != rs->rc) | 455 | if (NULL != rs->rc) |
442 | rs->rc (rs->rc_cls, | 456 | rs->rc (rs->rc_cls, |
443 | rs, | 457 | rs, |
diff --git a/src/dns/test_gnunet_dns.sh b/src/dns/test_gnunet_dns.sh index 35585d46e..c60b94c19 100755 --- a/src/dns/test_gnunet_dns.sh +++ b/src/dns/test_gnunet_dns.sh | |||
@@ -10,9 +10,15 @@ export PATH=".:$PATH" | |||
10 | gnunet-service-dns -c dns.conf & | 10 | gnunet-service-dns -c dns.conf & |
11 | gnunet-dns-redirector -c dns.conf -4 127.0.0.1 & | 11 | gnunet-dns-redirector -c dns.conf -4 127.0.0.1 & |
12 | sleep 1 | 12 | sleep 1 |
13 | LO=`nslookup gnunet.org | grep Address | tail -n1` | 13 | # need to run 'nslookup' as 'nobody', as gnunet-service-dns runs as root |
14 | # and thus 'root' is excepted from DNS interception! | ||
15 | LO=`sudo -u nobody nslookup gnunet.org | grep Address | tail -n1` | ||
14 | if [ "$LO" != "Address: 127.0.0.1" ] | 16 | if [ "$LO" != "Address: 127.0.0.1" ] |
15 | then | 17 | then |
16 | echo "Fail: $LO" | 18 | echo "Fail: got address $LO, wanted 127.0.0.1" |
19 | ret=1 | ||
20 | else | ||
21 | ret=0 | ||
17 | fi | 22 | fi |
18 | kill `jobs -p` | 23 | kill `jobs -p` |
24 | exit $ret | ||