diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-01-02 04:37:59 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-01-02 04:37:59 +0000 |
commit | 86a020dbabef7e047706f462840bfe66b036093c (patch) | |
tree | e19123a84f515ad810ed892811a5c6492b6b971f | |
parent | 1fd2ff9b321277b55444c2a074e6476cc10099c2 (diff) | |
download | gnunet-86a020dbabef7e047706f462840bfe66b036093c.tar.gz gnunet-86a020dbabef7e047706f462840bfe66b036093c.zip |
-small steps towards saner DNS API
-rw-r--r-- | src/dns/Makefile.am | 5 | ||||
-rw-r--r-- | src/dns/dns.conf | 11 | ||||
-rw-r--r-- | src/dns/dns.h | 54 | ||||
-rw-r--r-- | src/dns/dns_api.c | 89 | ||||
-rw-r--r-- | src/dns/gnunet-service-dns.c | 2 | ||||
-rw-r--r-- | src/include/gnunet_dns_service.h | 69 | ||||
-rw-r--r-- | src/vpn/gnunet-daemon-exit.c | 18 | ||||
-rw-r--r-- | src/vpn/gnunet-daemon-vpn-helper.c | 65 | ||||
-rw-r--r-- | src/vpn/gnunet-daemon-vpn.c | 51 | ||||
-rw-r--r-- | src/vpn/gnunet-daemon-vpn.h | 2 | ||||
-rw-r--r-- | src/vpn/gnunet-vpn-packet.h | 8 |
11 files changed, 254 insertions, 120 deletions
diff --git a/src/dns/Makefile.am b/src/dns/Makefile.am index 4e2637204..a7aafa4fc 100644 --- a/src/dns/Makefile.am +++ b/src/dns/Makefile.am | |||
@@ -12,6 +12,9 @@ pkgcfgdir= $(pkgdatadir)/config.d/ | |||
12 | 12 | ||
13 | plugindir = $(libdir)/gnunet | 13 | plugindir = $(libdir)/gnunet |
14 | 14 | ||
15 | dist_pkgcfg_DATA = \ | ||
16 | dns.conf | ||
17 | |||
15 | if LINUX | 18 | if LINUX |
16 | HIJACKBIN = gnunet-helper-hijack-dns | 19 | HIJACKBIN = gnunet-helper-hijack-dns |
17 | install-exec-hook: | 20 | install-exec-hook: |
@@ -52,7 +55,7 @@ libgnunetdnsparser_la_LDFLAGS = \ | |||
52 | 55 | ||
53 | 56 | ||
54 | libgnunetdns_la_SOURCES = \ | 57 | libgnunetdns_la_SOURCES = \ |
55 | dns_api.c | 58 | dns_api.c dns.h |
56 | libgnunetdns_la_LIBADD = \ | 59 | libgnunetdns_la_LIBADD = \ |
57 | $(top_builddir)/src/util/libgnunetutil.la $(XLIB) | 60 | $(top_builddir)/src/util/libgnunetutil.la $(XLIB) |
58 | libgnunetdns_la_LDFLAGS = \ | 61 | libgnunetdns_la_LDFLAGS = \ |
diff --git a/src/dns/dns.conf b/src/dns/dns.conf new file mode 100644 index 000000000..59d827692 --- /dev/null +++ b/src/dns/dns.conf | |||
@@ -0,0 +1,11 @@ | |||
1 | [dns] | ||
2 | AUTOSTART = YES | ||
3 | PORT = 0 | ||
4 | HOSTNAME = localhost | ||
5 | HOME = $SERVICEHOME | ||
6 | CONFIG = $DEFAULTCONFIG | ||
7 | BINARY = gnunet-service-dns | ||
8 | ACCEPT_FROM = 127.0.0.1; | ||
9 | ACCEPT_FROM6 = ::1; | ||
10 | UNIXPATH = /tmp/gnunet-service-dns.sock | ||
11 | PROVIDE_EXIT = NO | ||
diff --git a/src/dns/dns.h b/src/dns/dns.h new file mode 100644 index 000000000..dd0f55e16 --- /dev/null +++ b/src/dns/dns.h | |||
@@ -0,0 +1,54 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | (C) 2010, 2011, 2012 Christian Grothoff (and other contributing authors) | ||
4 | |||
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 | ||
7 | by the Free Software Foundation; either version 2, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file dns/dns.h | ||
23 | * @brief IPC messages between DNS API and DNS service | ||
24 | * @author Philipp Toelke | ||
25 | * @author Christian Grothoff | ||
26 | */ | ||
27 | #ifndef DNS_H | ||
28 | #define DNS_H | ||
29 | |||
30 | GNUNET_NETWORK_STRUCT_BEGIN | ||
31 | |||
32 | struct query_packet | ||
33 | { | ||
34 | struct GNUNET_MessageHeader hdr; | ||
35 | |||
36 | /** | ||
37 | * The IP-Address this query was originally sent to | ||
38 | */ | ||
39 | char orig_to[16]; | ||
40 | /** | ||
41 | * The IP-Address this query was originally sent from | ||
42 | */ | ||
43 | char orig_from[16]; | ||
44 | char addrlen; | ||
45 | /** | ||
46 | * The UDP-Port this query was originally sent from | ||
47 | */ | ||
48 | uint16_t src_port GNUNET_PACKED; | ||
49 | |||
50 | unsigned char data[1]; /* The DNS-Packet */ | ||
51 | }; | ||
52 | GNUNET_NETWORK_STRUCT_END | ||
53 | |||
54 | #endif | ||
diff --git a/src/dns/dns_api.c b/src/dns/dns_api.c index 90b4a8f42..68b703eba 100644 --- a/src/dns/dns_api.c +++ b/src/dns/dns_api.c | |||
@@ -34,6 +34,15 @@ | |||
34 | #include <block_dns.h> | 34 | #include <block_dns.h> |
35 | 35 | ||
36 | #include "gnunet_dns_service.h" | 36 | #include "gnunet_dns_service.h" |
37 | #include "dns.h" | ||
38 | |||
39 | struct query_packet_list | ||
40 | { | ||
41 | struct query_packet_list *next GNUNET_PACKED; | ||
42 | struct query_packet_list *prev GNUNET_PACKED; | ||
43 | struct query_packet pkt; | ||
44 | }; | ||
45 | |||
37 | 46 | ||
38 | 47 | ||
39 | struct GNUNET_DNS_Handle | 48 | struct GNUNET_DNS_Handle |
@@ -237,9 +246,9 @@ GNUNET_DNS_restart_hijack (struct GNUNET_DNS_Handle *h) | |||
237 | * FIXME: we should not expost our internal structures like this. | 246 | * FIXME: we should not expost our internal structures like this. |
238 | * Just a quick initial hack. | 247 | * Just a quick initial hack. |
239 | */ | 248 | */ |
240 | void | 249 | static void |
241 | GNUNET_DNS_queue_request (struct GNUNET_DNS_Handle *h, | 250 | queue_request (struct GNUNET_DNS_Handle *h, |
242 | struct query_packet_list *q) | 251 | struct query_packet_list *q) |
243 | { | 252 | { |
244 | GNUNET_CONTAINER_DLL_insert_tail (h->head, h->tail, q); | 253 | GNUNET_CONTAINER_DLL_insert_tail (h->head, h->tail, q); |
245 | if (h->dns_connection != NULL && h->dns_transmit_handle == NULL) | 254 | if (h->dns_connection != NULL && h->dns_transmit_handle == NULL) |
@@ -251,6 +260,78 @@ GNUNET_DNS_queue_request (struct GNUNET_DNS_Handle *h, | |||
251 | } | 260 | } |
252 | 261 | ||
253 | 262 | ||
263 | |||
264 | /** | ||
265 | * Process a DNS request sent to an IPv4 resolver. Pass it | ||
266 | * to the DNS service for resolution. | ||
267 | * | ||
268 | * @param h DNS handle | ||
269 | * @param dst_ip destination IPv4 address | ||
270 | * @param src_ip source IPv4 address (usually local machine) | ||
271 | * @param src_port source port (to be used for reply) | ||
272 | * @param udp_packet_len length of the UDP payload in bytes | ||
273 | * @param udp_packet UDP payload | ||
274 | */ | ||
275 | void | ||
276 | GNUNET_DNS_queue_request_v4 (struct GNUNET_DNS_Handle *h, | ||
277 | const struct in_addr *dst_ip, | ||
278 | const struct in_addr *src_ip, | ||
279 | uint16_t src_port, | ||
280 | size_t udp_packet_len, | ||
281 | const char *udp_packet) | ||
282 | { | ||
283 | size_t len = sizeof (struct query_packet) + udp_packet_len - 1; | ||
284 | struct query_packet_list *query = | ||
285 | GNUNET_malloc (len + sizeof (struct answer_packet_list) - | ||
286 | sizeof (struct answer_packet)); | ||
287 | query->pkt.hdr.type = htons (GNUNET_MESSAGE_TYPE_VPN_DNS_LOCAL_QUERY_DNS); | ||
288 | query->pkt.hdr.size = htons (len); | ||
289 | memcpy (query->pkt.orig_to, dst_ip, 4); | ||
290 | memcpy (query->pkt.orig_from, src_ip, 4); | ||
291 | query->pkt.addrlen = 4; | ||
292 | query->pkt.src_port = htons (src_port); | ||
293 | memcpy (query->pkt.data, udp_packet, udp_packet_len); | ||
294 | queue_request (h, query); | ||
295 | } | ||
296 | |||
297 | |||
298 | /** | ||
299 | * Process a DNS request sent to an IPv6 resolver. Pass it | ||
300 | * to the DNS service for resolution. | ||
301 | * | ||
302 | * @param h DNS handle | ||
303 | * @param dst_ip destination IPv6 address | ||
304 | * @param src_ip source IPv6 address (usually local machine) | ||
305 | * @param src_port source port (to be used for reply) | ||
306 | * @param udp_packet_len length of the UDP payload in bytes | ||
307 | * @param udp_packet UDP payload | ||
308 | */ | ||
309 | void | ||
310 | GNUNET_DNS_queue_request_v6 (struct GNUNET_DNS_Handle *h, | ||
311 | const struct in6_addr *dst_ip, | ||
312 | const struct in6_addr *src_ip, | ||
313 | uint16_t src_port, | ||
314 | size_t udp_packet_len, | ||
315 | const char *udp_packet) | ||
316 | { | ||
317 | size_t len = | ||
318 | sizeof (struct query_packet) + udp_packet_len - 1; | ||
319 | struct query_packet_list *query = | ||
320 | GNUNET_malloc (len + sizeof (struct answer_packet_list) - | ||
321 | sizeof (struct answer_packet)); | ||
322 | query->pkt.hdr.type = | ||
323 | htons (GNUNET_MESSAGE_TYPE_VPN_DNS_LOCAL_QUERY_DNS); | ||
324 | query->pkt.hdr.size = htons (len); | ||
325 | memcpy (query->pkt.orig_to, dst_ip, 16); | ||
326 | memcpy (query->pkt.orig_from, src_ip, 16); | ||
327 | query->pkt.addrlen = 16; | ||
328 | query->pkt.src_port = htons (src_port); | ||
329 | memcpy (query->pkt.data, udp_packet, | ||
330 | udp_packet_len); | ||
331 | queue_request (h, query); | ||
332 | } | ||
333 | |||
334 | |||
254 | void | 335 | void |
255 | GNUNET_DNS_disconnect (struct GNUNET_DNS_Handle *h) | 336 | GNUNET_DNS_disconnect (struct GNUNET_DNS_Handle *h) |
256 | { | 337 | { |
@@ -261,3 +342,5 @@ GNUNET_DNS_disconnect (struct GNUNET_DNS_Handle *h) | |||
261 | } | 342 | } |
262 | GNUNET_free (h); | 343 | GNUNET_free (h); |
263 | } | 344 | } |
345 | |||
346 | /* end of dns_api.c */ | ||
diff --git a/src/dns/gnunet-service-dns.c b/src/dns/gnunet-service-dns.c index 065c085c7..a8c3254ef 100644 --- a/src/dns/gnunet-service-dns.c +++ b/src/dns/gnunet-service-dns.c | |||
@@ -41,7 +41,7 @@ | |||
41 | #include "gnunet_mesh_service.h" | 41 | #include "gnunet_mesh_service.h" |
42 | #include "gnunet_signatures.h" | 42 | #include "gnunet_signatures.h" |
43 | 43 | ||
44 | 44 | #include "dns.h" | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | ||
diff --git a/src/include/gnunet_dns_service.h b/src/include/gnunet_dns_service.h index a6471d6e9..c42f7787f 100644 --- a/src/include/gnunet_dns_service.h +++ b/src/include/gnunet_dns_service.h | |||
@@ -36,35 +36,6 @@ | |||
36 | #include "gnunet_common.h" | 36 | #include "gnunet_common.h" |
37 | #include "gnunet_util_lib.h" | 37 | #include "gnunet_util_lib.h" |
38 | 38 | ||
39 | GNUNET_NETWORK_STRUCT_BEGIN | ||
40 | |||
41 | struct query_packet | ||
42 | { | ||
43 | struct GNUNET_MessageHeader hdr; | ||
44 | |||
45 | /** | ||
46 | * The IP-Address this query was originally sent to | ||
47 | */ | ||
48 | char orig_to[16]; | ||
49 | /** | ||
50 | * The IP-Address this query was originally sent from | ||
51 | */ | ||
52 | char orig_from[16]; | ||
53 | /** | ||
54 | * The UDP-Portthis query was originally sent from | ||
55 | */ | ||
56 | char addrlen; | ||
57 | uint16_t src_port GNUNET_PACKED; | ||
58 | |||
59 | unsigned char data[1]; /* The DNS-Packet */ | ||
60 | }; | ||
61 | |||
62 | struct query_packet_list | ||
63 | { | ||
64 | struct query_packet_list *next GNUNET_PACKED; | ||
65 | struct query_packet_list *prev GNUNET_PACKED; | ||
66 | struct query_packet pkt; | ||
67 | }; | ||
68 | 39 | ||
69 | enum GNUNET_DNS_ANSWER_Subtype | 40 | enum GNUNET_DNS_ANSWER_Subtype |
70 | { | 41 | { |
@@ -106,6 +77,7 @@ struct GNUNET_vpn_service_descriptor | |||
106 | uint32_t service_type GNUNET_PACKED; | 77 | uint32_t service_type GNUNET_PACKED; |
107 | }; | 78 | }; |
108 | 79 | ||
80 | GNUNET_NETWORK_STRUCT_BEGIN | ||
109 | struct answer_packet | 81 | struct answer_packet |
110 | { | 82 | { |
111 | /* General data */ | 83 | /* General data */ |
@@ -161,12 +133,43 @@ GNUNET_DNS_restart_hijack (struct GNUNET_DNS_Handle *h); | |||
161 | 133 | ||
162 | 134 | ||
163 | /** | 135 | /** |
164 | * FIXME: we should not expost our internal structures like this. | 136 | * Process a DNS request sent to an IPv4 resolver. Pass it |
165 | * Just a quick initial hack. | 137 | * to the DNS service for resolution. |
138 | * | ||
139 | * @param h DNS handle | ||
140 | * @param dst_ip destination IPv4 address | ||
141 | * @param src_ip source IPv4 address (usually local machine) | ||
142 | * @param src_port source port (to be used for reply) | ||
143 | * @param udp_packet_len length of the UDP payload in bytes | ||
144 | * @param udp_packet UDP payload | ||
145 | */ | ||
146 | void | ||
147 | GNUNET_DNS_queue_request_v4 (struct GNUNET_DNS_Handle *h, | ||
148 | const struct in_addr *dst_ip, | ||
149 | const struct in_addr *src_ip, | ||
150 | uint16_t src_port, | ||
151 | size_t udp_packet_len, | ||
152 | const char *udp_packet); | ||
153 | |||
154 | /** | ||
155 | * Process a DNS request sent to an IPv6 resolver. Pass it | ||
156 | * to the DNS service for resolution. | ||
157 | * | ||
158 | * @param h DNS handle | ||
159 | * @param dst_ip destination IPv6 address | ||
160 | * @param src_ip source IPv6 address (usually local machine) | ||
161 | * @param src_port source port (to be used for reply) | ||
162 | * @param udp_packet_len length of the UDP payload in bytes | ||
163 | * @param udp_packet UDP payload | ||
166 | */ | 164 | */ |
167 | void | 165 | void |
168 | GNUNET_DNS_queue_request (struct GNUNET_DNS_Handle *h, | 166 | GNUNET_DNS_queue_request_v6 (struct GNUNET_DNS_Handle *h, |
169 | struct query_packet_list *q); | 167 | const struct in6_addr *dst_ip, |
168 | const struct in6_addr *src_ip, | ||
169 | uint16_t src_port, | ||
170 | size_t udp_packet_len, | ||
171 | const char *udp_packet); | ||
172 | |||
170 | 173 | ||
171 | void | 174 | void |
172 | GNUNET_DNS_disconnect (struct GNUNET_DNS_Handle *h); | 175 | GNUNET_DNS_disconnect (struct GNUNET_DNS_Handle *h); |
diff --git a/src/vpn/gnunet-daemon-exit.c b/src/vpn/gnunet-daemon-exit.c index 2e8061024..5c450ecc6 100644 --- a/src/vpn/gnunet-daemon-exit.c +++ b/src/vpn/gnunet-daemon-exit.c | |||
@@ -550,11 +550,10 @@ message_token (void *cls GNUNET_UNUSED, void *client GNUNET_UNUSED, | |||
550 | else if (ntohs (pkt_tun->tun.type) == 0x0800) | 550 | else if (ntohs (pkt_tun->tun.type) == 0x0800) |
551 | { | 551 | { |
552 | struct ip_pkt *pkt4 = (struct ip_pkt *) pkt_tun; | 552 | struct ip_pkt *pkt4 = (struct ip_pkt *) pkt_tun; |
553 | uint32_t tmp = pkt4->ip_hdr.dadr; | ||
554 | 553 | ||
555 | if (IPPROTO_UDP == pkt4->ip_hdr.proto) | 554 | if (IPPROTO_UDP == pkt4->ip_hdr.proto) |
556 | udp_from_helper (&((struct ip_udp *) pkt4)->udp_hdr, | 555 | udp_from_helper (&((struct ip_udp *) pkt4)->udp_hdr, |
557 | (unsigned char *) &tmp, 4); | 556 | (unsigned char *) &pkt4->ip_hdr.dadr, 4); |
558 | else if (IPPROTO_TCP == pkt4->ip_hdr.proto) | 557 | else if (IPPROTO_TCP == pkt4->ip_hdr.proto) |
559 | { | 558 | { |
560 | size_t pktlen = ntohs (pkt4->ip_hdr.tot_lngth); | 559 | size_t pktlen = ntohs (pkt4->ip_hdr.tot_lngth); |
@@ -563,7 +562,7 @@ message_token (void *cls GNUNET_UNUSED, void *client GNUNET_UNUSED, | |||
563 | pktlen -= 4 * pkt4->ip_hdr.hdr_lngth; | 562 | pktlen -= 4 * pkt4->ip_hdr.hdr_lngth; |
564 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "-hdr: %d\n", pktlen); | 563 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "-hdr: %d\n", pktlen); |
565 | tcp_from_helper (&((struct ip_tcp *) pkt4)->tcp_hdr, | 564 | tcp_from_helper (&((struct ip_tcp *) pkt4)->tcp_hdr, |
566 | (unsigned char *) &tmp, 4, pktlen); | 565 | (unsigned char *) &pkt4->ip_hdr.dadr, 4, pktlen); |
567 | } | 566 | } |
568 | } | 567 | } |
569 | else | 568 | else |
@@ -860,8 +859,7 @@ prepare_ipv4_packet (size_t len, uint16_t pktlen, void *payload, | |||
860 | pkt4->ip_hdr.proto = protocol; | 859 | pkt4->ip_hdr.proto = protocol; |
861 | pkt4->ip_hdr.chks = 0; /* Will be calculated later */ | 860 | pkt4->ip_hdr.chks = 0; /* Will be calculated later */ |
862 | 861 | ||
863 | memcpy (&tmp, ipaddress, 4); | 862 | memcpy (&pkt4->ip_hdr.dadr, ipaddress, sizeof (struct in_addr)); |
864 | pkt4->ip_hdr.dadr = tmp; | ||
865 | 863 | ||
866 | /* Generate a new src-address */ | 864 | /* Generate a new src-address */ |
867 | char *ipv4addr; | 865 | char *ipv4addr; |
@@ -883,7 +881,7 @@ prepare_ipv4_packet (size_t len, uint16_t pktlen, void *payload, | |||
883 | 881 | ||
884 | tmp |= ntohl (*((uint32_t *) tunnel)) & (~tmp2); | 882 | tmp |= ntohl (*((uint32_t *) tunnel)) & (~tmp2); |
885 | 883 | ||
886 | pkt4->ip_hdr.sadr = tmp; | 884 | pkt4->ip_hdr.sadr.s_addr = tmp; |
887 | 885 | ||
888 | memcpy (&state->redirect_info.addr, &tmp, 4); | 886 | memcpy (&state->redirect_info.addr, &tmp, 4); |
889 | if (IPPROTO_UDP == protocol) | 887 | if (IPPROTO_UDP == protocol) |
@@ -903,10 +901,8 @@ prepare_ipv4_packet (size_t len, uint16_t pktlen, void *payload, | |||
903 | pkt4_tcp->tcp_hdr.crc = 0; | 901 | pkt4_tcp->tcp_hdr.crc = 0; |
904 | uint32_t sum = 0; | 902 | uint32_t sum = 0; |
905 | 903 | ||
906 | tmp = pkt4->ip_hdr.sadr; | 904 | sum = calculate_checksum_update (sum, (uint16_t *) &pkt4->ip_hdr.sadr, sizeof (struct in_addr)); |
907 | sum = calculate_checksum_update (sum, (uint16_t *) & tmp, 4); | 905 | sum = calculate_checksum_update (sum, (uint16_t *) &pkt4->ip_hdr.dadr, sizeof (struct in_addr)); |
908 | tmp = pkt4->ip_hdr.dadr; | ||
909 | sum = calculate_checksum_update (sum, (uint16_t *) & tmp, 4); | ||
910 | 906 | ||
911 | tmp = (protocol << 16) | (0xffff & pktlen); | 907 | tmp = (protocol << 16) | (0xffff & pktlen); |
912 | 908 | ||
@@ -947,7 +943,7 @@ prepare_ipv6_packet (size_t len, uint16_t pktlen, void *payload, | |||
947 | pkt6->ip6_hdr.paylgth = htons (pktlen); | 943 | pkt6->ip6_hdr.paylgth = htons (pktlen); |
948 | pkt6->ip6_hdr.hoplmt = 64; | 944 | pkt6->ip6_hdr.hoplmt = 64; |
949 | 945 | ||
950 | memcpy (pkt6->ip6_hdr.dadr, ipaddress, 16); | 946 | memcpy (&pkt6->ip6_hdr.dadr, ipaddress, sizeof (struct in6_addr)); |
951 | 947 | ||
952 | /* Generate a new src-address | 948 | /* Generate a new src-address |
953 | * This takes as much from the address of the tunnel as fits into | 949 | * This takes as much from the address of the tunnel as fits into |
diff --git a/src/vpn/gnunet-daemon-vpn-helper.c b/src/vpn/gnunet-daemon-vpn-helper.c index 984b126e7..3bb3aa262 100644 --- a/src/vpn/gnunet-daemon-vpn-helper.c +++ b/src/vpn/gnunet-daemon-vpn-helper.c | |||
@@ -338,29 +338,20 @@ message_token (void *cls GNUNET_UNUSED, void *client GNUNET_UNUSED, | |||
338 | if (ntohs (pkt6_udp->udp_hdr.dpt) == 53) | 338 | if (ntohs (pkt6_udp->udp_hdr.dpt) == 53) |
339 | { | 339 | { |
340 | /* 9 = 8 for the udp-header + 1 for the unsigned char data[1]; */ | 340 | /* 9 = 8 for the udp-header + 1 for the unsigned char data[1]; */ |
341 | size_t len = | 341 | GNUNET_DNS_queue_request_v6 (dns_handle, |
342 | sizeof (struct query_packet) + ntohs (pkt6_udp->udp_hdr.len) - 9; | 342 | &pkt6->ip6_hdr.dadr, |
343 | 343 | &pkt6->ip6_hdr.sadr, | |
344 | struct query_packet_list *query = | 344 | ntohs (pkt6_udp->udp_hdr.spt), |
345 | GNUNET_malloc (len + sizeof (struct answer_packet_list) - | 345 | ntohs (pkt6_udp->udp_hdr.len) - 8, |
346 | sizeof (struct answer_packet)); | 346 | (const void*) pkt6_udp->data); |
347 | query->pkt.hdr.type = | 347 | |
348 | htons (GNUNET_MESSAGE_TYPE_VPN_DNS_LOCAL_QUERY_DNS); | ||
349 | query->pkt.hdr.size = htons (len); | ||
350 | memcpy (query->pkt.orig_to, &pkt6->ip6_hdr.dadr, 16); | ||
351 | memcpy (query->pkt.orig_from, &pkt6->ip6_hdr.sadr, 16); | ||
352 | query->pkt.addrlen = 16; | ||
353 | query->pkt.src_port = pkt6_udp->udp_hdr.spt; | ||
354 | memcpy (query->pkt.data, pkt6_udp->data, | ||
355 | ntohs (pkt6_udp->udp_hdr.len) - 8); | ||
356 | GNUNET_DNS_queue_request (dns_handle, query); | ||
357 | break; | 348 | break; |
358 | } | 349 | } |
359 | /* fall through */ | 350 | /* fall through */ |
360 | case IPPROTO_TCP: | 351 | case IPPROTO_TCP: |
361 | pkt6_tcp = (struct ip6_tcp *) pkt6; | 352 | pkt6_tcp = (struct ip6_tcp *) pkt6; |
362 | 353 | ||
363 | if ((key = address6_mapping_exists (pkt6->ip6_hdr.dadr)) != NULL) | 354 | if ((key = address6_mapping_exists (&pkt6->ip6_hdr.dadr)) != NULL) |
364 | { | 355 | { |
365 | struct map_entry *me = GNUNET_CONTAINER_multihashmap_get (hashmap, key); | 356 | struct map_entry *me = GNUNET_CONTAINER_multihashmap_get (hashmap, key); |
366 | 357 | ||
@@ -487,16 +478,13 @@ message_token (void *cls GNUNET_UNUSED, void *client GNUNET_UNUSED, | |||
487 | } | 478 | } |
488 | else | 479 | else |
489 | { | 480 | { |
481 | char pbuf[INET6_ADDRSTRLEN]; | ||
490 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 482 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
491 | "Packet to %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x, which has no mapping\n", | 483 | "Packet to %s, which has no mapping\n", |
492 | pkt6->ip6_hdr.dadr[0], pkt6->ip6_hdr.dadr[1], | 484 | inet_ntop (AF_INET6, |
493 | pkt6->ip6_hdr.dadr[2], pkt6->ip6_hdr.dadr[3], | 485 | &pkt6->ip6_hdr.dadr, |
494 | pkt6->ip6_hdr.dadr[4], pkt6->ip6_hdr.dadr[5], | 486 | pbuf, |
495 | pkt6->ip6_hdr.dadr[6], pkt6->ip6_hdr.dadr[7], | 487 | sizeof (pbuf))); |
496 | pkt6->ip6_hdr.dadr[8], pkt6->ip6_hdr.dadr[9], | ||
497 | pkt6->ip6_hdr.dadr[10], pkt6->ip6_hdr.dadr[11], | ||
498 | pkt6->ip6_hdr.dadr[12], pkt6->ip6_hdr.dadr[13], | ||
499 | pkt6->ip6_hdr.dadr[14], pkt6->ip6_hdr.dadr[15]); | ||
500 | } | 488 | } |
501 | break; | 489 | break; |
502 | case 0x3a: | 490 | case 0x3a: |
@@ -504,7 +492,7 @@ message_token (void *cls GNUNET_UNUSED, void *client GNUNET_UNUSED, | |||
504 | pkt6_icmp = (struct ip6_icmp *) pkt6; | 492 | pkt6_icmp = (struct ip6_icmp *) pkt6; |
505 | /* If this packet is an icmp-echo-request and a mapping exists, answer */ | 493 | /* If this packet is an icmp-echo-request and a mapping exists, answer */ |
506 | if (pkt6_icmp->icmp_hdr.type == 0x80 && | 494 | if (pkt6_icmp->icmp_hdr.type == 0x80 && |
507 | (key = address6_mapping_exists (pkt6->ip6_hdr.dadr)) != NULL) | 495 | (key = address6_mapping_exists (&pkt6->ip6_hdr.dadr)) != NULL) |
508 | { | 496 | { |
509 | GNUNET_free (key); | 497 | GNUNET_free (key); |
510 | pkt6_icmp = GNUNET_malloc (ntohs (pkt6->shdr.size)); | 498 | pkt6_icmp = GNUNET_malloc (ntohs (pkt6->shdr.size)); |
@@ -528,25 +516,16 @@ message_token (void *cls GNUNET_UNUSED, void *client GNUNET_UNUSED, | |||
528 | /* Send dns-packets to the service-dns */ | 516 | /* Send dns-packets to the service-dns */ |
529 | if (pkt->ip_hdr.proto == IPPROTO_UDP && ntohs (udp->udp_hdr.dpt) == 53) | 517 | if (pkt->ip_hdr.proto == IPPROTO_UDP && ntohs (udp->udp_hdr.dpt) == 53) |
530 | { | 518 | { |
531 | /* 9 = 8 for the udp-header + 1 for the unsigned char data[1]; */ | 519 | GNUNET_DNS_queue_request_v4 (dns_handle, |
532 | size_t len = sizeof (struct query_packet) + ntohs (udp->udp_hdr.len) - 9; | 520 | &pkt->ip_hdr.dadr, |
533 | 521 | &pkt->ip_hdr.sadr, | |
534 | struct query_packet_list *query = | 522 | ntohs (udp->udp_hdr.spt), |
535 | GNUNET_malloc (len + sizeof (struct answer_packet_list) - | 523 | ntohs (udp->udp_hdr.len) - 8, |
536 | sizeof (struct answer_packet)); | 524 | (const void*) udp->data); |
537 | query->pkt.hdr.type = htons (GNUNET_MESSAGE_TYPE_VPN_DNS_LOCAL_QUERY_DNS); | ||
538 | query->pkt.hdr.size = htons (len); | ||
539 | memcpy (query->pkt.orig_to, &pkt->ip_hdr.dadr, 4); | ||
540 | memcpy (query->pkt.orig_from, &pkt->ip_hdr.sadr, 4); | ||
541 | query->pkt.addrlen = 4; | ||
542 | query->pkt.src_port = udp->udp_hdr.spt; | ||
543 | memcpy (query->pkt.data, udp->data, ntohs (udp->udp_hdr.len) - 8); | ||
544 | |||
545 | GNUNET_DNS_queue_request (dns_handle, query); | ||
546 | } | 525 | } |
547 | else | 526 | else |
548 | { | 527 | { |
549 | uint32_t dadr = pkt->ip_hdr.dadr; | 528 | uint32_t dadr = pkt->ip_hdr.dadr.s_addr; |
550 | unsigned char *c = (unsigned char *) &dadr; | 529 | unsigned char *c = (unsigned char *) &dadr; |
551 | 530 | ||
552 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Packet to %d.%d.%d.%d, proto %x\n", | 531 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Packet to %d.%d.%d.%d, proto %x\n", |
diff --git a/src/vpn/gnunet-daemon-vpn.c b/src/vpn/gnunet-daemon-vpn.c index 86f08d19c..cd587d7b1 100644 --- a/src/vpn/gnunet-daemon-vpn.c +++ b/src/vpn/gnunet-daemon-vpn.c | |||
@@ -118,8 +118,9 @@ cleanup (void *cls GNUNET_UNUSED, | |||
118 | * @return the hash of the IP-Address if a mapping exists, NULL otherwise | 118 | * @return the hash of the IP-Address if a mapping exists, NULL otherwise |
119 | */ | 119 | */ |
120 | GNUNET_HashCode * | 120 | GNUNET_HashCode * |
121 | address6_mapping_exists (unsigned char addr[]) | 121 | address6_mapping_exists (struct in6_addr *v6addr) |
122 | { | 122 | { |
123 | unsigned char *addr = (unsigned char*) v6addr; | ||
123 | GNUNET_HashCode *key = GNUNET_malloc (sizeof (GNUNET_HashCode)); | 124 | GNUNET_HashCode *key = GNUNET_malloc (sizeof (GNUNET_HashCode)); |
124 | unsigned char *k = (unsigned char *) key; | 125 | unsigned char *k = (unsigned char *) key; |
125 | 126 | ||
@@ -375,9 +376,11 @@ send_pkt_to_peer (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
375 | * Create a new Address from an answer-packet | 376 | * Create a new Address from an answer-packet |
376 | */ | 377 | */ |
377 | void | 378 | void |
378 | new_ip6addr (unsigned char *buf, const GNUNET_HashCode * peer, | 379 | new_ip6addr (struct in6_addr *v6addr, |
380 | const GNUNET_HashCode * peer, | ||
379 | const GNUNET_HashCode * service_desc) | 381 | const GNUNET_HashCode * service_desc) |
380 | { /* {{{ */ | 382 | { /* {{{ */ |
383 | unsigned char *buf = (unsigned char*) v6addr; | ||
381 | char *ipv6addr; | 384 | char *ipv6addr; |
382 | unsigned long long ipv6prefix; | 385 | unsigned long long ipv6prefix; |
383 | 386 | ||
@@ -415,8 +418,10 @@ new_ip6addr (unsigned char *buf, const GNUNET_HashCode * peer, | |||
415 | * Create a new Address from an answer-packet | 418 | * Create a new Address from an answer-packet |
416 | */ | 419 | */ |
417 | void | 420 | void |
418 | new_ip6addr_remote (unsigned char *buf, unsigned char *addr, char addrlen) | 421 | new_ip6addr_remote (struct in6_addr *v6addr, |
422 | unsigned char *addr, char addrlen) | ||
419 | { /* {{{ */ | 423 | { /* {{{ */ |
424 | unsigned char *buf = (unsigned char*) v6addr; | ||
420 | char *ipv6addr; | 425 | char *ipv6addr; |
421 | unsigned long long ipv6prefix; | 426 | unsigned long long ipv6prefix; |
422 | 427 | ||
@@ -529,7 +534,8 @@ process_answer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
529 | unsigned char *c = ((unsigned char *) pkt) + ntohs (pkt->addroffset); | 534 | unsigned char *c = ((unsigned char *) pkt) + ntohs (pkt->addroffset); |
530 | unsigned char *k = (unsigned char *) &key; | 535 | unsigned char *k = (unsigned char *) &key; |
531 | 536 | ||
532 | new_ip6addr (c, &pkt->service_descr.peer, | 537 | new_ip6addr ((struct in6_addr*) c, |
538 | &pkt->service_descr.peer, | ||
533 | &pkt->service_descr.service_descriptor); | 539 | &pkt->service_descr.service_descriptor); |
534 | /* | 540 | /* |
535 | * Copy the newly generated ip-address to the key backwarts (as only the first part is hashed) | 541 | * Copy the newly generated ip-address to the key backwarts (as only the first part is hashed) |
@@ -655,7 +661,8 @@ process_answer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
655 | 661 | ||
656 | unsigned char *c = ((unsigned char *) pkt) + ntohs (pkt->addroffset); | 662 | unsigned char *c = ((unsigned char *) pkt) + ntohs (pkt->addroffset); |
657 | 663 | ||
658 | new_ip6addr_remote (c, pkt->addr, pkt->addrsize); | 664 | new_ip6addr_remote ((struct in6_addr*) c, |
665 | pkt->addr, pkt->addrsize); | ||
659 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 666 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
660 | "New mapping to %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x\n", | 667 | "New mapping to %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x\n", |
661 | c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], | 668 | c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], |
@@ -877,9 +884,9 @@ receive_udp_back (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, | |||
877 | GNUNET_assert (pkt6 != NULL); | 884 | GNUNET_assert (pkt6 != NULL); |
878 | 885 | ||
879 | if (ntohs (message->type) == GNUNET_MESSAGE_TYPE_VPN_SERVICE_UDP_BACK) | 886 | if (ntohs (message->type) == GNUNET_MESSAGE_TYPE_VPN_SERVICE_UDP_BACK) |
880 | new_ip6addr (pkt6->ip6_hdr.sadr, &other->hashPubKey, desc); | 887 | new_ip6addr (&pkt6->ip6_hdr.sadr, &other->hashPubKey, desc); |
881 | else | 888 | else |
882 | new_ip6addr_remote (pkt6->ip6_hdr.sadr, s->addr, s->addrlen); | 889 | new_ip6addr_remote (&pkt6->ip6_hdr.sadr, s->addr, s->addrlen); |
883 | 890 | ||
884 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 891 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
885 | "Relaying calc:%d gnu:%d udp:%d bytes!\n", size, | 892 | "Relaying calc:%d gnu:%d udp:%d bytes!\n", size, |
@@ -906,12 +913,12 @@ receive_udp_back (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, | |||
906 | GNUNET_CONFIGURATION_get_value_string (cfg, "vpn", | 913 | GNUNET_CONFIGURATION_get_value_string (cfg, "vpn", |
907 | "IPV6ADDR", | 914 | "IPV6ADDR", |
908 | &ipv6addr)); | 915 | &ipv6addr)); |
909 | inet_pton (AF_INET6, ipv6addr, pkt6->ip6_hdr.dadr); | 916 | inet_pton (AF_INET6, ipv6addr, &pkt6->ip6_hdr.dadr); |
910 | GNUNET_free (ipv6addr); | 917 | GNUNET_free (ipv6addr); |
911 | } | 918 | } |
912 | memcpy (&pkt6->udp_hdr, pkt, ntohs (pkt->len)); | 919 | memcpy (&pkt6->udp_hdr, pkt, ntohs (pkt->len)); |
913 | 920 | ||
914 | GNUNET_HashCode *key = address6_mapping_exists (pkt6->ip6_hdr.sadr); | 921 | GNUNET_HashCode *key = address6_mapping_exists (&pkt6->ip6_hdr.sadr); |
915 | 922 | ||
916 | GNUNET_assert (key != NULL); | 923 | GNUNET_assert (key != NULL); |
917 | 924 | ||
@@ -968,7 +975,7 @@ receive_udp_back (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, | |||
968 | uint32_t sadr; | 975 | uint32_t sadr; |
969 | 976 | ||
970 | new_ip4addr_remote ((unsigned char *) &sadr, s->addr, s->addrlen); | 977 | new_ip4addr_remote ((unsigned char *) &sadr, s->addr, s->addrlen); |
971 | pkt4->ip_hdr.sadr = sadr; | 978 | pkt4->ip_hdr.sadr.s_addr = sadr; |
972 | 979 | ||
973 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 980 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
974 | "Relaying calc:%d gnu:%d udp:%d bytes!\n", size, | 981 | "Relaying calc:%d gnu:%d udp:%d bytes!\n", size, |
@@ -1001,11 +1008,11 @@ receive_udp_back (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, | |||
1001 | &ipv4addr)); | 1008 | &ipv4addr)); |
1002 | inet_pton (AF_INET, ipv4addr, &dadr); | 1009 | inet_pton (AF_INET, ipv4addr, &dadr); |
1003 | GNUNET_free (ipv4addr); | 1010 | GNUNET_free (ipv4addr); |
1004 | pkt4->ip_hdr.dadr = dadr; | 1011 | pkt4->ip_hdr.dadr.s_addr = dadr; |
1005 | } | 1012 | } |
1006 | memcpy (&pkt4->udp_hdr, pkt, ntohs (pkt->len)); | 1013 | memcpy (&pkt4->udp_hdr, pkt, ntohs (pkt->len)); |
1007 | 1014 | ||
1008 | GNUNET_HashCode *key = address4_mapping_exists (pkt4->ip_hdr.sadr); | 1015 | GNUNET_HashCode *key = address4_mapping_exists (pkt4->ip_hdr.sadr.s_addr); |
1009 | 1016 | ||
1010 | GNUNET_assert (key != NULL); | 1017 | GNUNET_assert (key != NULL); |
1011 | 1018 | ||
@@ -1061,9 +1068,9 @@ receive_tcp_back (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, | |||
1061 | GNUNET_assert (pkt6 != NULL); | 1068 | GNUNET_assert (pkt6 != NULL); |
1062 | 1069 | ||
1063 | if (ntohs (message->type) == GNUNET_MESSAGE_TYPE_VPN_SERVICE_TCP_BACK) | 1070 | if (ntohs (message->type) == GNUNET_MESSAGE_TYPE_VPN_SERVICE_TCP_BACK) |
1064 | new_ip6addr (pkt6->ip6_hdr.sadr, &other->hashPubKey, desc); | 1071 | new_ip6addr (&pkt6->ip6_hdr.sadr, &other->hashPubKey, desc); |
1065 | else | 1072 | else |
1066 | new_ip6addr_remote (pkt6->ip6_hdr.sadr, s->addr, s->addrlen); | 1073 | new_ip6addr_remote (&pkt6->ip6_hdr.sadr, s->addr, s->addrlen); |
1067 | 1074 | ||
1068 | pkt6->shdr.type = htons (GNUNET_MESSAGE_TYPE_VPN_HELPER); | 1075 | pkt6->shdr.type = htons (GNUNET_MESSAGE_TYPE_VPN_HELPER); |
1069 | pkt6->shdr.size = htons (size); | 1076 | pkt6->shdr.size = htons (size); |
@@ -1086,12 +1093,12 @@ receive_tcp_back (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, | |||
1086 | GNUNET_CONFIGURATION_get_value_string (cfg, "vpn", | 1093 | GNUNET_CONFIGURATION_get_value_string (cfg, "vpn", |
1087 | "IPV6ADDR", | 1094 | "IPV6ADDR", |
1088 | &ipv6addr)); | 1095 | &ipv6addr)); |
1089 | inet_pton (AF_INET6, ipv6addr, pkt6->ip6_hdr.dadr); | 1096 | inet_pton (AF_INET6, ipv6addr, &pkt6->ip6_hdr.dadr); |
1090 | GNUNET_free (ipv6addr); | 1097 | GNUNET_free (ipv6addr); |
1091 | } | 1098 | } |
1092 | memcpy (&pkt6->tcp_hdr, pkt, pktlen); | 1099 | memcpy (&pkt6->tcp_hdr, pkt, pktlen); |
1093 | 1100 | ||
1094 | GNUNET_HashCode *key = address6_mapping_exists (pkt6->ip6_hdr.sadr); | 1101 | GNUNET_HashCode *key = address6_mapping_exists (&pkt6->ip6_hdr.sadr); |
1095 | 1102 | ||
1096 | GNUNET_assert (key != NULL); | 1103 | GNUNET_assert (key != NULL); |
1097 | 1104 | ||
@@ -1141,7 +1148,7 @@ receive_tcp_back (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, | |||
1141 | uint32_t sadr; | 1148 | uint32_t sadr; |
1142 | 1149 | ||
1143 | new_ip4addr_remote ((unsigned char *) &sadr, s->addr, s->addrlen); | 1150 | new_ip4addr_remote ((unsigned char *) &sadr, s->addr, s->addrlen); |
1144 | pkt4->ip_hdr.sadr = sadr; | 1151 | pkt4->ip_hdr.sadr.s_addr = sadr; |
1145 | 1152 | ||
1146 | pkt4->shdr.type = htons (GNUNET_MESSAGE_TYPE_VPN_HELPER); | 1153 | pkt4->shdr.type = htons (GNUNET_MESSAGE_TYPE_VPN_HELPER); |
1147 | pkt4->shdr.size = htons (size); | 1154 | pkt4->shdr.size = htons (size); |
@@ -1170,12 +1177,12 @@ receive_tcp_back (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, | |||
1170 | &ipv4addr)); | 1177 | &ipv4addr)); |
1171 | inet_pton (AF_INET, ipv4addr, &dadr); | 1178 | inet_pton (AF_INET, ipv4addr, &dadr); |
1172 | GNUNET_free (ipv4addr); | 1179 | GNUNET_free (ipv4addr); |
1173 | pkt4->ip_hdr.dadr = dadr; | 1180 | pkt4->ip_hdr.dadr.s_addr = dadr; |
1174 | } | 1181 | } |
1175 | 1182 | ||
1176 | memcpy (&pkt4->tcp_hdr, pkt, pktlen); | 1183 | memcpy (&pkt4->tcp_hdr, pkt, pktlen); |
1177 | 1184 | ||
1178 | GNUNET_HashCode *key = address4_mapping_exists (pkt4->ip_hdr.sadr); | 1185 | GNUNET_HashCode *key = address4_mapping_exists (pkt4->ip_hdr.sadr.s_addr); |
1179 | 1186 | ||
1180 | GNUNET_assert (key != NULL); | 1187 | GNUNET_assert (key != NULL); |
1181 | 1188 | ||
@@ -1191,10 +1198,8 @@ receive_tcp_back (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, | |||
1191 | uint32_t sum = 0; | 1198 | uint32_t sum = 0; |
1192 | uint32_t tmp; | 1199 | uint32_t tmp; |
1193 | 1200 | ||
1194 | tmp = pkt4->ip_hdr.sadr; | 1201 | sum = calculate_checksum_update (sum, (uint16_t *) &pkt4->ip_hdr.sadr, 4); |
1195 | sum = calculate_checksum_update (sum, (uint16_t *) & tmp, 4); | 1202 | sum = calculate_checksum_update (sum, (uint16_t *) &pkt4->ip_hdr.dadr, 4); |
1196 | tmp = pkt4->ip_hdr.dadr; | ||
1197 | sum = calculate_checksum_update (sum, (uint16_t *) & tmp, 4); | ||
1198 | 1203 | ||
1199 | tmp = (0x06 << 16) | (0xffff & pktlen); // 0x06 for TCP? | 1204 | tmp = (0x06 << 16) | (0xffff & pktlen); // 0x06 for TCP? |
1200 | 1205 | ||
diff --git a/src/vpn/gnunet-daemon-vpn.h b/src/vpn/gnunet-daemon-vpn.h index 35520a277..91280368a 100644 --- a/src/vpn/gnunet-daemon-vpn.h +++ b/src/vpn/gnunet-daemon-vpn.h | |||
@@ -53,7 +53,7 @@ size_t | |||
53 | send_udp_service (void *cls, size_t size, void *buf); | 53 | send_udp_service (void *cls, size_t size, void *buf); |
54 | 54 | ||
55 | GNUNET_HashCode * | 55 | GNUNET_HashCode * |
56 | address6_mapping_exists (unsigned char addr[]); | 56 | address6_mapping_exists (struct in6_addr *v6addr); |
57 | GNUNET_HashCode * | 57 | GNUNET_HashCode * |
58 | address4_mapping_exists (uint32_t addr); | 58 | address4_mapping_exists (uint32_t addr); |
59 | 59 | ||
diff --git a/src/vpn/gnunet-vpn-packet.h b/src/vpn/gnunet-vpn-packet.h index ddbfba730..835ffb8a3 100644 --- a/src/vpn/gnunet-vpn-packet.h +++ b/src/vpn/gnunet-vpn-packet.h | |||
@@ -23,8 +23,8 @@ struct ip6_hdr | |||
23 | unsigned paylgth:16 GNUNET_PACKED; | 23 | unsigned paylgth:16 GNUNET_PACKED; |
24 | unsigned nxthdr:8 GNUNET_PACKED; | 24 | unsigned nxthdr:8 GNUNET_PACKED; |
25 | unsigned hoplmt:8 GNUNET_PACKED; | 25 | unsigned hoplmt:8 GNUNET_PACKED; |
26 | unsigned char sadr[16]; | 26 | struct in6_addr sadr; |
27 | unsigned char dadr[16]; | 27 | struct in6_addr dadr; |
28 | }; | 28 | }; |
29 | 29 | ||
30 | struct ip_hdr | 30 | struct ip_hdr |
@@ -43,8 +43,8 @@ struct ip_hdr | |||
43 | unsigned proto:8 GNUNET_PACKED; | 43 | unsigned proto:8 GNUNET_PACKED; |
44 | unsigned chks:16 GNUNET_PACKED; | 44 | unsigned chks:16 GNUNET_PACKED; |
45 | 45 | ||
46 | uint32_t sadr GNUNET_PACKED; | 46 | struct in_addr sadr GNUNET_PACKED; |
47 | uint32_t dadr GNUNET_PACKED; | 47 | struct in_addr dadr GNUNET_PACKED; |
48 | }; | 48 | }; |
49 | 49 | ||
50 | #define TCP_FLAG_SYN 2 | 50 | #define TCP_FLAG_SYN 2 |