plugindir = $(libdir)/gnunet
+dist_pkgcfg_DATA = \
+ dns.conf
+
if LINUX
HIJACKBIN = gnunet-helper-hijack-dns
install-exec-hook:
libgnunetdns_la_SOURCES = \
- dns_api.c
+ dns_api.c dns.h
libgnunetdns_la_LIBADD = \
$(top_builddir)/src/util/libgnunetutil.la $(XLIB)
libgnunetdns_la_LDFLAGS = \
--- /dev/null
+[dns]
+AUTOSTART = YES
+PORT = 0
+HOSTNAME = localhost
+HOME = $SERVICEHOME
+CONFIG = $DEFAULTCONFIG
+BINARY = gnunet-service-dns
+ACCEPT_FROM = 127.0.0.1;
+ACCEPT_FROM6 = ::1;
+UNIXPATH = /tmp/gnunet-service-dns.sock
+PROVIDE_EXIT = NO
--- /dev/null
+/*
+ This file is part of GNUnet
+ (C) 2010, 2011, 2012 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * @file dns/dns.h
+ * @brief IPC messages between DNS API and DNS service
+ * @author Philipp Toelke
+ * @author Christian Grothoff
+ */
+#ifndef DNS_H
+#define DNS_H
+
+GNUNET_NETWORK_STRUCT_BEGIN
+
+struct query_packet
+{
+ struct GNUNET_MessageHeader hdr;
+
+ /**
+ * The IP-Address this query was originally sent to
+ */
+ char orig_to[16];
+ /**
+ * The IP-Address this query was originally sent from
+ */
+ char orig_from[16];
+ char addrlen;
+ /**
+ * The UDP-Port this query was originally sent from
+ */
+ uint16_t src_port GNUNET_PACKED;
+
+ unsigned char data[1]; /* The DNS-Packet */
+};
+GNUNET_NETWORK_STRUCT_END
+
+#endif
#include <block_dns.h>
#include "gnunet_dns_service.h"
+#include "dns.h"
+
+struct query_packet_list
+{
+ struct query_packet_list *next GNUNET_PACKED;
+ struct query_packet_list *prev GNUNET_PACKED;
+ struct query_packet pkt;
+};
+
struct GNUNET_DNS_Handle
* FIXME: we should not expost our internal structures like this.
* Just a quick initial hack.
*/
-void
-GNUNET_DNS_queue_request (struct GNUNET_DNS_Handle *h,
- struct query_packet_list *q)
+static void
+queue_request (struct GNUNET_DNS_Handle *h,
+ struct query_packet_list *q)
{
GNUNET_CONTAINER_DLL_insert_tail (h->head, h->tail, q);
if (h->dns_connection != NULL && h->dns_transmit_handle == NULL)
}
+
+/**
+ * Process a DNS request sent to an IPv4 resolver. Pass it
+ * to the DNS service for resolution.
+ *
+ * @param h DNS handle
+ * @param dst_ip destination IPv4 address
+ * @param src_ip source IPv4 address (usually local machine)
+ * @param src_port source port (to be used for reply)
+ * @param udp_packet_len length of the UDP payload in bytes
+ * @param udp_packet UDP payload
+ */
+void
+GNUNET_DNS_queue_request_v4 (struct GNUNET_DNS_Handle *h,
+ const struct in_addr *dst_ip,
+ const struct in_addr *src_ip,
+ uint16_t src_port,
+ size_t udp_packet_len,
+ const char *udp_packet)
+{
+ size_t len = sizeof (struct query_packet) + udp_packet_len - 1;
+ struct query_packet_list *query =
+ GNUNET_malloc (len + sizeof (struct answer_packet_list) -
+ sizeof (struct answer_packet));
+ query->pkt.hdr.type = htons (GNUNET_MESSAGE_TYPE_VPN_DNS_LOCAL_QUERY_DNS);
+ query->pkt.hdr.size = htons (len);
+ memcpy (query->pkt.orig_to, dst_ip, 4);
+ memcpy (query->pkt.orig_from, src_ip, 4);
+ query->pkt.addrlen = 4;
+ query->pkt.src_port = htons (src_port);
+ memcpy (query->pkt.data, udp_packet, udp_packet_len);
+ queue_request (h, query);
+}
+
+
+/**
+ * Process a DNS request sent to an IPv6 resolver. Pass it
+ * to the DNS service for resolution.
+ *
+ * @param h DNS handle
+ * @param dst_ip destination IPv6 address
+ * @param src_ip source IPv6 address (usually local machine)
+ * @param src_port source port (to be used for reply)
+ * @param udp_packet_len length of the UDP payload in bytes
+ * @param udp_packet UDP payload
+ */
+void
+GNUNET_DNS_queue_request_v6 (struct GNUNET_DNS_Handle *h,
+ const struct in6_addr *dst_ip,
+ const struct in6_addr *src_ip,
+ uint16_t src_port,
+ size_t udp_packet_len,
+ const char *udp_packet)
+{
+ size_t len =
+ sizeof (struct query_packet) + udp_packet_len - 1;
+ struct query_packet_list *query =
+ GNUNET_malloc (len + sizeof (struct answer_packet_list) -
+ sizeof (struct answer_packet));
+ query->pkt.hdr.type =
+ htons (GNUNET_MESSAGE_TYPE_VPN_DNS_LOCAL_QUERY_DNS);
+ query->pkt.hdr.size = htons (len);
+ memcpy (query->pkt.orig_to, dst_ip, 16);
+ memcpy (query->pkt.orig_from, src_ip, 16);
+ query->pkt.addrlen = 16;
+ query->pkt.src_port = htons (src_port);
+ memcpy (query->pkt.data, udp_packet,
+ udp_packet_len);
+ queue_request (h, query);
+}
+
+
void
GNUNET_DNS_disconnect (struct GNUNET_DNS_Handle *h)
{
}
GNUNET_free (h);
}
+
+/* end of dns_api.c */
#include "gnunet_mesh_service.h"
#include "gnunet_signatures.h"
-
+#include "dns.h"
#include "gnunet_common.h"
#include "gnunet_util_lib.h"
-GNUNET_NETWORK_STRUCT_BEGIN
-
-struct query_packet
-{
- struct GNUNET_MessageHeader hdr;
-
- /**
- * The IP-Address this query was originally sent to
- */
- char orig_to[16];
- /**
- * The IP-Address this query was originally sent from
- */
- char orig_from[16];
- /**
- * The UDP-Portthis query was originally sent from
- */
- char addrlen;
- uint16_t src_port GNUNET_PACKED;
-
- unsigned char data[1]; /* The DNS-Packet */
-};
-
-struct query_packet_list
-{
- struct query_packet_list *next GNUNET_PACKED;
- struct query_packet_list *prev GNUNET_PACKED;
- struct query_packet pkt;
-};
enum GNUNET_DNS_ANSWER_Subtype
{
uint32_t service_type GNUNET_PACKED;
};
+GNUNET_NETWORK_STRUCT_BEGIN
struct answer_packet
{
/* General data */
/**
- * FIXME: we should not expost our internal structures like this.
- * Just a quick initial hack.
+ * Process a DNS request sent to an IPv4 resolver. Pass it
+ * to the DNS service for resolution.
+ *
+ * @param h DNS handle
+ * @param dst_ip destination IPv4 address
+ * @param src_ip source IPv4 address (usually local machine)
+ * @param src_port source port (to be used for reply)
+ * @param udp_packet_len length of the UDP payload in bytes
+ * @param udp_packet UDP payload
+ */
+void
+GNUNET_DNS_queue_request_v4 (struct GNUNET_DNS_Handle *h,
+ const struct in_addr *dst_ip,
+ const struct in_addr *src_ip,
+ uint16_t src_port,
+ size_t udp_packet_len,
+ const char *udp_packet);
+
+/**
+ * Process a DNS request sent to an IPv6 resolver. Pass it
+ * to the DNS service for resolution.
+ *
+ * @param h DNS handle
+ * @param dst_ip destination IPv6 address
+ * @param src_ip source IPv6 address (usually local machine)
+ * @param src_port source port (to be used for reply)
+ * @param udp_packet_len length of the UDP payload in bytes
+ * @param udp_packet UDP payload
*/
void
-GNUNET_DNS_queue_request (struct GNUNET_DNS_Handle *h,
- struct query_packet_list *q);
+GNUNET_DNS_queue_request_v6 (struct GNUNET_DNS_Handle *h,
+ const struct in6_addr *dst_ip,
+ const struct in6_addr *src_ip,
+ uint16_t src_port,
+ size_t udp_packet_len,
+ const char *udp_packet);
+
void
GNUNET_DNS_disconnect (struct GNUNET_DNS_Handle *h);
else if (ntohs (pkt_tun->tun.type) == 0x0800)
{
struct ip_pkt *pkt4 = (struct ip_pkt *) pkt_tun;
- uint32_t tmp = pkt4->ip_hdr.dadr;
if (IPPROTO_UDP == pkt4->ip_hdr.proto)
udp_from_helper (&((struct ip_udp *) pkt4)->udp_hdr,
- (unsigned char *) &tmp, 4);
+ (unsigned char *) &pkt4->ip_hdr.dadr, 4);
else if (IPPROTO_TCP == pkt4->ip_hdr.proto)
{
size_t pktlen = ntohs (pkt4->ip_hdr.tot_lngth);
pktlen -= 4 * pkt4->ip_hdr.hdr_lngth;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "-hdr: %d\n", pktlen);
tcp_from_helper (&((struct ip_tcp *) pkt4)->tcp_hdr,
- (unsigned char *) &tmp, 4, pktlen);
+ (unsigned char *) &pkt4->ip_hdr.dadr, 4, pktlen);
}
}
else
pkt4->ip_hdr.proto = protocol;
pkt4->ip_hdr.chks = 0; /* Will be calculated later */
- memcpy (&tmp, ipaddress, 4);
- pkt4->ip_hdr.dadr = tmp;
+ memcpy (&pkt4->ip_hdr.dadr, ipaddress, sizeof (struct in_addr));
/* Generate a new src-address */
char *ipv4addr;
tmp |= ntohl (*((uint32_t *) tunnel)) & (~tmp2);
- pkt4->ip_hdr.sadr = tmp;
+ pkt4->ip_hdr.sadr.s_addr = tmp;
memcpy (&state->redirect_info.addr, &tmp, 4);
if (IPPROTO_UDP == protocol)
pkt4_tcp->tcp_hdr.crc = 0;
uint32_t sum = 0;
- tmp = pkt4->ip_hdr.sadr;
- sum = calculate_checksum_update (sum, (uint16_t *) & tmp, 4);
- tmp = pkt4->ip_hdr.dadr;
- sum = calculate_checksum_update (sum, (uint16_t *) & tmp, 4);
+ sum = calculate_checksum_update (sum, (uint16_t *) &pkt4->ip_hdr.sadr, sizeof (struct in_addr));
+ sum = calculate_checksum_update (sum, (uint16_t *) &pkt4->ip_hdr.dadr, sizeof (struct in_addr));
tmp = (protocol << 16) | (0xffff & pktlen);
pkt6->ip6_hdr.paylgth = htons (pktlen);
pkt6->ip6_hdr.hoplmt = 64;
- memcpy (pkt6->ip6_hdr.dadr, ipaddress, 16);
+ memcpy (&pkt6->ip6_hdr.dadr, ipaddress, sizeof (struct in6_addr));
/* Generate a new src-address
* This takes as much from the address of the tunnel as fits into
if (ntohs (pkt6_udp->udp_hdr.dpt) == 53)
{
/* 9 = 8 for the udp-header + 1 for the unsigned char data[1]; */
- size_t len =
- sizeof (struct query_packet) + ntohs (pkt6_udp->udp_hdr.len) - 9;
-
- struct query_packet_list *query =
- GNUNET_malloc (len + sizeof (struct answer_packet_list) -
- sizeof (struct answer_packet));
- query->pkt.hdr.type =
- htons (GNUNET_MESSAGE_TYPE_VPN_DNS_LOCAL_QUERY_DNS);
- query->pkt.hdr.size = htons (len);
- memcpy (query->pkt.orig_to, &pkt6->ip6_hdr.dadr, 16);
- memcpy (query->pkt.orig_from, &pkt6->ip6_hdr.sadr, 16);
- query->pkt.addrlen = 16;
- query->pkt.src_port = pkt6_udp->udp_hdr.spt;
- memcpy (query->pkt.data, pkt6_udp->data,
- ntohs (pkt6_udp->udp_hdr.len) - 8);
- GNUNET_DNS_queue_request (dns_handle, query);
+ GNUNET_DNS_queue_request_v6 (dns_handle,
+ &pkt6->ip6_hdr.dadr,
+ &pkt6->ip6_hdr.sadr,
+ ntohs (pkt6_udp->udp_hdr.spt),
+ ntohs (pkt6_udp->udp_hdr.len) - 8,
+ (const void*) pkt6_udp->data);
+
break;
}
/* fall through */
case IPPROTO_TCP:
pkt6_tcp = (struct ip6_tcp *) pkt6;
- if ((key = address6_mapping_exists (pkt6->ip6_hdr.dadr)) != NULL)
+ if ((key = address6_mapping_exists (&pkt6->ip6_hdr.dadr)) != NULL)
{
struct map_entry *me = GNUNET_CONTAINER_multihashmap_get (hashmap, key);
}
else
{
+ char pbuf[INET6_ADDRSTRLEN];
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Packet to %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x, which has no mapping\n",
- pkt6->ip6_hdr.dadr[0], pkt6->ip6_hdr.dadr[1],
- pkt6->ip6_hdr.dadr[2], pkt6->ip6_hdr.dadr[3],
- pkt6->ip6_hdr.dadr[4], pkt6->ip6_hdr.dadr[5],
- pkt6->ip6_hdr.dadr[6], pkt6->ip6_hdr.dadr[7],
- pkt6->ip6_hdr.dadr[8], pkt6->ip6_hdr.dadr[9],
- pkt6->ip6_hdr.dadr[10], pkt6->ip6_hdr.dadr[11],
- pkt6->ip6_hdr.dadr[12], pkt6->ip6_hdr.dadr[13],
- pkt6->ip6_hdr.dadr[14], pkt6->ip6_hdr.dadr[15]);
+ "Packet to %s, which has no mapping\n",
+ inet_ntop (AF_INET6,
+ &pkt6->ip6_hdr.dadr,
+ pbuf,
+ sizeof (pbuf)));
}
break;
case 0x3a:
pkt6_icmp = (struct ip6_icmp *) pkt6;
/* If this packet is an icmp-echo-request and a mapping exists, answer */
if (pkt6_icmp->icmp_hdr.type == 0x80 &&
- (key = address6_mapping_exists (pkt6->ip6_hdr.dadr)) != NULL)
+ (key = address6_mapping_exists (&pkt6->ip6_hdr.dadr)) != NULL)
{
GNUNET_free (key);
pkt6_icmp = GNUNET_malloc (ntohs (pkt6->shdr.size));
/* Send dns-packets to the service-dns */
if (pkt->ip_hdr.proto == IPPROTO_UDP && ntohs (udp->udp_hdr.dpt) == 53)
{
- /* 9 = 8 for the udp-header + 1 for the unsigned char data[1]; */
- size_t len = sizeof (struct query_packet) + ntohs (udp->udp_hdr.len) - 9;
-
- struct query_packet_list *query =
- GNUNET_malloc (len + sizeof (struct answer_packet_list) -
- sizeof (struct answer_packet));
- query->pkt.hdr.type = htons (GNUNET_MESSAGE_TYPE_VPN_DNS_LOCAL_QUERY_DNS);
- query->pkt.hdr.size = htons (len);
- memcpy (query->pkt.orig_to, &pkt->ip_hdr.dadr, 4);
- memcpy (query->pkt.orig_from, &pkt->ip_hdr.sadr, 4);
- query->pkt.addrlen = 4;
- query->pkt.src_port = udp->udp_hdr.spt;
- memcpy (query->pkt.data, udp->data, ntohs (udp->udp_hdr.len) - 8);
-
- GNUNET_DNS_queue_request (dns_handle, query);
+ GNUNET_DNS_queue_request_v4 (dns_handle,
+ &pkt->ip_hdr.dadr,
+ &pkt->ip_hdr.sadr,
+ ntohs (udp->udp_hdr.spt),
+ ntohs (udp->udp_hdr.len) - 8,
+ (const void*) udp->data);
}
else
{
- uint32_t dadr = pkt->ip_hdr.dadr;
+ uint32_t dadr = pkt->ip_hdr.dadr.s_addr;
unsigned char *c = (unsigned char *) &dadr;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Packet to %d.%d.%d.%d, proto %x\n",
* @return the hash of the IP-Address if a mapping exists, NULL otherwise
*/
GNUNET_HashCode *
-address6_mapping_exists (unsigned char addr[])
+address6_mapping_exists (struct in6_addr *v6addr)
{
+ unsigned char *addr = (unsigned char*) v6addr;
GNUNET_HashCode *key = GNUNET_malloc (sizeof (GNUNET_HashCode));
unsigned char *k = (unsigned char *) key;
* Create a new Address from an answer-packet
*/
void
-new_ip6addr (unsigned char *buf, const GNUNET_HashCode * peer,
+new_ip6addr (struct in6_addr *v6addr,
+ const GNUNET_HashCode * peer,
const GNUNET_HashCode * service_desc)
{ /* {{{ */
+ unsigned char *buf = (unsigned char*) v6addr;
char *ipv6addr;
unsigned long long ipv6prefix;
* Create a new Address from an answer-packet
*/
void
-new_ip6addr_remote (unsigned char *buf, unsigned char *addr, char addrlen)
+new_ip6addr_remote (struct in6_addr *v6addr,
+ unsigned char *addr, char addrlen)
{ /* {{{ */
+ unsigned char *buf = (unsigned char*) v6addr;
char *ipv6addr;
unsigned long long ipv6prefix;
unsigned char *c = ((unsigned char *) pkt) + ntohs (pkt->addroffset);
unsigned char *k = (unsigned char *) &key;
- new_ip6addr (c, &pkt->service_descr.peer,
+ new_ip6addr ((struct in6_addr*) c,
+ &pkt->service_descr.peer,
&pkt->service_descr.service_descriptor);
/*
* Copy the newly generated ip-address to the key backwarts (as only the first part is hashed)
unsigned char *c = ((unsigned char *) pkt) + ntohs (pkt->addroffset);
- new_ip6addr_remote (c, pkt->addr, pkt->addrsize);
+ new_ip6addr_remote ((struct in6_addr*) c,
+ pkt->addr, pkt->addrsize);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"New mapping to %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x\n",
c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9],
GNUNET_assert (pkt6 != NULL);
if (ntohs (message->type) == GNUNET_MESSAGE_TYPE_VPN_SERVICE_UDP_BACK)
- new_ip6addr (pkt6->ip6_hdr.sadr, &other->hashPubKey, desc);
+ new_ip6addr (&pkt6->ip6_hdr.sadr, &other->hashPubKey, desc);
else
- new_ip6addr_remote (pkt6->ip6_hdr.sadr, s->addr, s->addrlen);
+ new_ip6addr_remote (&pkt6->ip6_hdr.sadr, s->addr, s->addrlen);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Relaying calc:%d gnu:%d udp:%d bytes!\n", size,
GNUNET_CONFIGURATION_get_value_string (cfg, "vpn",
"IPV6ADDR",
&ipv6addr));
- inet_pton (AF_INET6, ipv6addr, pkt6->ip6_hdr.dadr);
+ inet_pton (AF_INET6, ipv6addr, &pkt6->ip6_hdr.dadr);
GNUNET_free (ipv6addr);
}
memcpy (&pkt6->udp_hdr, pkt, ntohs (pkt->len));
- GNUNET_HashCode *key = address6_mapping_exists (pkt6->ip6_hdr.sadr);
+ GNUNET_HashCode *key = address6_mapping_exists (&pkt6->ip6_hdr.sadr);
GNUNET_assert (key != NULL);
uint32_t sadr;
new_ip4addr_remote ((unsigned char *) &sadr, s->addr, s->addrlen);
- pkt4->ip_hdr.sadr = sadr;
+ pkt4->ip_hdr.sadr.s_addr = sadr;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Relaying calc:%d gnu:%d udp:%d bytes!\n", size,
&ipv4addr));
inet_pton (AF_INET, ipv4addr, &dadr);
GNUNET_free (ipv4addr);
- pkt4->ip_hdr.dadr = dadr;
+ pkt4->ip_hdr.dadr.s_addr = dadr;
}
memcpy (&pkt4->udp_hdr, pkt, ntohs (pkt->len));
- GNUNET_HashCode *key = address4_mapping_exists (pkt4->ip_hdr.sadr);
+ GNUNET_HashCode *key = address4_mapping_exists (pkt4->ip_hdr.sadr.s_addr);
GNUNET_assert (key != NULL);
GNUNET_assert (pkt6 != NULL);
if (ntohs (message->type) == GNUNET_MESSAGE_TYPE_VPN_SERVICE_TCP_BACK)
- new_ip6addr (pkt6->ip6_hdr.sadr, &other->hashPubKey, desc);
+ new_ip6addr (&pkt6->ip6_hdr.sadr, &other->hashPubKey, desc);
else
- new_ip6addr_remote (pkt6->ip6_hdr.sadr, s->addr, s->addrlen);
+ new_ip6addr_remote (&pkt6->ip6_hdr.sadr, s->addr, s->addrlen);
pkt6->shdr.type = htons (GNUNET_MESSAGE_TYPE_VPN_HELPER);
pkt6->shdr.size = htons (size);
GNUNET_CONFIGURATION_get_value_string (cfg, "vpn",
"IPV6ADDR",
&ipv6addr));
- inet_pton (AF_INET6, ipv6addr, pkt6->ip6_hdr.dadr);
+ inet_pton (AF_INET6, ipv6addr, &pkt6->ip6_hdr.dadr);
GNUNET_free (ipv6addr);
}
memcpy (&pkt6->tcp_hdr, pkt, pktlen);
- GNUNET_HashCode *key = address6_mapping_exists (pkt6->ip6_hdr.sadr);
+ GNUNET_HashCode *key = address6_mapping_exists (&pkt6->ip6_hdr.sadr);
GNUNET_assert (key != NULL);
uint32_t sadr;
new_ip4addr_remote ((unsigned char *) &sadr, s->addr, s->addrlen);
- pkt4->ip_hdr.sadr = sadr;
+ pkt4->ip_hdr.sadr.s_addr = sadr;
pkt4->shdr.type = htons (GNUNET_MESSAGE_TYPE_VPN_HELPER);
pkt4->shdr.size = htons (size);
&ipv4addr));
inet_pton (AF_INET, ipv4addr, &dadr);
GNUNET_free (ipv4addr);
- pkt4->ip_hdr.dadr = dadr;
+ pkt4->ip_hdr.dadr.s_addr = dadr;
}
memcpy (&pkt4->tcp_hdr, pkt, pktlen);
- GNUNET_HashCode *key = address4_mapping_exists (pkt4->ip_hdr.sadr);
+ GNUNET_HashCode *key = address4_mapping_exists (pkt4->ip_hdr.sadr.s_addr);
GNUNET_assert (key != NULL);
uint32_t sum = 0;
uint32_t tmp;
- tmp = pkt4->ip_hdr.sadr;
- sum = calculate_checksum_update (sum, (uint16_t *) & tmp, 4);
- tmp = pkt4->ip_hdr.dadr;
- sum = calculate_checksum_update (sum, (uint16_t *) & tmp, 4);
+ sum = calculate_checksum_update (sum, (uint16_t *) &pkt4->ip_hdr.sadr, 4);
+ sum = calculate_checksum_update (sum, (uint16_t *) &pkt4->ip_hdr.dadr, 4);
tmp = (0x06 << 16) | (0xffff & pktlen); // 0x06 for TCP?
send_udp_service (void *cls, size_t size, void *buf);
GNUNET_HashCode *
-address6_mapping_exists (unsigned char addr[]);
+address6_mapping_exists (struct in6_addr *v6addr);
GNUNET_HashCode *
address4_mapping_exists (uint32_t addr);
unsigned paylgth:16 GNUNET_PACKED;
unsigned nxthdr:8 GNUNET_PACKED;
unsigned hoplmt:8 GNUNET_PACKED;
- unsigned char sadr[16];
- unsigned char dadr[16];
+ struct in6_addr sadr;
+ struct in6_addr dadr;
};
struct ip_hdr
unsigned proto:8 GNUNET_PACKED;
unsigned chks:16 GNUNET_PACKED;
- uint32_t sadr GNUNET_PACKED;
- uint32_t dadr GNUNET_PACKED;
+ struct in_addr sadr GNUNET_PACKED;
+ struct in_addr dadr GNUNET_PACKED;
};
#define TCP_FLAG_SYN 2