diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-09-27 22:25:05 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-09-27 22:25:05 +0000 |
commit | 64732cdb0d95320d9274b26fcac6e617d6473248 (patch) | |
tree | a21c273a37f4f210dd577a30e746d6269db75ccf /src/dns/gnunet-service-dns.c | |
parent | 94adb0e8c48d47e13e7319bb0fe228263b15abbf (diff) | |
download | gnunet-64732cdb0d95320d9274b26fcac6e617d6473248.tar.gz gnunet-64732cdb0d95320d9274b26fcac6e617d6473248.zip |
fixes relating to intercepting DNS queries over IPv6
Diffstat (limited to 'src/dns/gnunet-service-dns.c')
-rw-r--r-- | src/dns/gnunet-service-dns.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/dns/gnunet-service-dns.c b/src/dns/gnunet-service-dns.c index 50aa730e7..52f924cdf 100644 --- a/src/dns/gnunet-service-dns.c +++ b/src/dns/gnunet-service-dns.c | |||
@@ -410,7 +410,7 @@ request_done (struct RequestRecord *rr) | |||
410 | destination_port = src->sin6_port; | 410 | destination_port = src->sin6_port; |
411 | GNUNET_TUN_initialize_ipv6_header (&ip6, | 411 | GNUNET_TUN_initialize_ipv6_header (&ip6, |
412 | IPPROTO_UDP, | 412 | IPPROTO_UDP, |
413 | reply_len - sizeof (struct GNUNET_TUN_IPv6Header), | 413 | reply_len - off - sizeof (struct GNUNET_TUN_IPv6Header), |
414 | &dst->sin6_addr, | 414 | &dst->sin6_addr, |
415 | &src->sin6_addr); | 415 | &src->sin6_addr); |
416 | GNUNET_memcpy (&buf[off], &ip6, sizeof (ip6)); | 416 | GNUNET_memcpy (&buf[off], &ip6, sizeof (ip6)); |
@@ -916,7 +916,7 @@ process_helper_messages (void *cls GNUNET_UNUSED, void *client, | |||
916 | ip6 = (const struct GNUNET_TUN_IPv6Header *) &tun[1]; | 916 | ip6 = (const struct GNUNET_TUN_IPv6Header *) &tun[1]; |
917 | if ( (msize < sizeof (struct GNUNET_TUN_IPv6Header)) || | 917 | if ( (msize < sizeof (struct GNUNET_TUN_IPv6Header)) || |
918 | (ip6->version != 6) || | 918 | (ip6->version != 6) || |
919 | (ntohs (ip6->payload_length) != msize) || | 919 | (ntohs (ip6->payload_length) != msize - sizeof (struct GNUNET_TUN_IPv6Header)) || |
920 | (ip6->next_header != IPPROTO_UDP) ) | 920 | (ip6->next_header != IPPROTO_UDP) ) |
921 | { | 921 | { |
922 | /* non-IP/UDP packet received on TUN (or with extensions) */ | 922 | /* non-IP/UDP packet received on TUN (or with extensions) */ |
@@ -924,7 +924,7 @@ process_helper_messages (void *cls GNUNET_UNUSED, void *client, | |||
924 | _("Received malformed IPv6-UDP packet on TUN interface.\n")); | 924 | _("Received malformed IPv6-UDP packet on TUN interface.\n")); |
925 | return GNUNET_OK; | 925 | return GNUNET_OK; |
926 | } | 926 | } |
927 | udp = (const struct GNUNET_TUN_UdpHeader*) &ip6[1]; | 927 | udp = (const struct GNUNET_TUN_UdpHeader *) &ip6[1]; |
928 | msize -= sizeof (struct GNUNET_TUN_IPv6Header); | 928 | msize -= sizeof (struct GNUNET_TUN_IPv6Header); |
929 | break; | 929 | break; |
930 | default: | 930 | default: |
@@ -939,6 +939,8 @@ process_helper_messages (void *cls GNUNET_UNUSED, void *client, | |||
939 | (DNS_PORT != ntohs (udp->destination_port)) ) | 939 | (DNS_PORT != ntohs (udp->destination_port)) ) |
940 | { | 940 | { |
941 | /* non-DNS packet received on TUN, ignore */ | 941 | /* non-DNS packet received on TUN, ignore */ |
942 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
943 | _("DNS interceptor got non-DNS packet (dropped)\n")); | ||
942 | GNUNET_STATISTICS_update (stats, | 944 | GNUNET_STATISTICS_update (stats, |
943 | gettext_noop ("# Non-DNS UDP packet received via TUN interface"), | 945 | gettext_noop ("# Non-DNS UDP packet received via TUN interface"), |
944 | 1, GNUNET_NO); | 946 | 1, GNUNET_NO); |