aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2013-01-25 13:03:08 +0000
committergrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2013-01-25 13:03:08 +0000
commit7fa8708dd7484377a1cec4352b07e56d7659362e (patch)
tree3493677bc94c555bdb7d2e26b5b44351eac7ea10
parent041576494defd256ed7e9e8d52402167c1fce0c2 (diff)
-check that this is actually a DNS packet
git-svn-id: https://gnunet.org/svn/gnunet@25896 140774ce-b5e7-0310-ab8b-a85725594a96
-rw-r--r--src/dns/gnunet-service-dns.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/dns/gnunet-service-dns.c b/src/dns/gnunet-service-dns.c
index 5db14c56a3..19c9d8eeac 100644
--- a/src/dns/gnunet-service-dns.c
+++ b/src/dns/gnunet-service-dns.c
@@ -50,6 +50,11 @@
#include "gnunet_statistics_service.h"
#include "gnunet_tun_lib.h"
+/**
+ * Port number for DNS
+ */
+#define DNS_PORT 53
+
/**
* Generic logging shorthand
@@ -1066,7 +1071,8 @@ process_helper_messages (void *cls GNUNET_UNUSED, void *client,
ntohs (tun->proto));
return GNUNET_OK;
}
- if (msize <= sizeof (struct GNUNET_TUN_UdpHeader) + sizeof (struct GNUNET_TUN_DnsHeader))
+ if ( (msize <= sizeof (struct GNUNET_TUN_UdpHeader) + sizeof (struct GNUNET_TUN_DnsHeader)) ||
+ (DNS_PORT != ntohs (udp->destination_port)) )
{
/* non-DNS packet received on TUN, ignore */
GNUNET_STATISTICS_update (stats,