diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-01-20 17:21:21 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-01-20 17:21:21 +0000 |
commit | 8154c9edf0d39e8fec6f199115b02e84e49bba0b (patch) | |
tree | b923f8eb47c192f697f3292e6cbcf84e4f2504e0 | |
parent | cebfadaaefc873a8eae0d5db22173f616892ee52 (diff) | |
download | gnunet-8154c9edf0d39e8fec6f199115b02e84e49bba0b.tar.gz gnunet-8154c9edf0d39e8fec6f199115b02e84e49bba0b.zip |
-use different message types for different directions for TCP DATA
-rw-r--r-- | src/exit/gnunet-daemon-exit.c | 5 | ||||
-rw-r--r-- | src/include/gnunet_protocols.h | 15 | ||||
-rw-r--r-- | src/vpn/gnunet-service-vpn.c | 4 |
3 files changed, 15 insertions, 9 deletions
diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c index 316133a75..9bdfba7da 100644 --- a/src/exit/gnunet-daemon-exit.c +++ b/src/exit/gnunet-daemon-exit.c | |||
@@ -721,7 +721,7 @@ tcp_from_helper (const struct GNUNET_TUN_TcpHeader *tcp, | |||
721 | tnq->len = mlen; | 721 | tnq->len = mlen; |
722 | tdm = (struct GNUNET_EXIT_TcpDataMessage *) &tnq[1]; | 722 | tdm = (struct GNUNET_EXIT_TcpDataMessage *) &tnq[1]; |
723 | tdm->header.size = htons ((uint16_t) mlen); | 723 | tdm->header.size = htons ((uint16_t) mlen); |
724 | tdm->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_TCP_DATA); | 724 | tdm->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_TCP_DATA_TO_VPN); |
725 | tdm->reserved = htonl (0); | 725 | tdm->reserved = htonl (0); |
726 | memcpy (&tdm->tcp_header, | 726 | memcpy (&tdm->tcp_header, |
727 | buf, | 727 | buf, |
@@ -789,6 +789,7 @@ message_token (void *cls GNUNET_UNUSED, void *client GNUNET_UNUSED, | |||
789 | _("IPv4 packet options received. Ignored.\n")); | 789 | _("IPv4 packet options received. Ignored.\n")); |
790 | return; | 790 | return; |
791 | } | 791 | } |
792 | |||
792 | size -= sizeof (struct GNUNET_TUN_IPv4Header); | 793 | size -= sizeof (struct GNUNET_TUN_IPv4Header); |
793 | switch (pkt4->protocol) | 794 | switch (pkt4->protocol) |
794 | { | 795 | { |
@@ -2143,7 +2144,7 @@ run (void *cls, char *const *args GNUNET_UNUSED, | |||
2143 | {&receive_udp_remote, GNUNET_MESSAGE_TYPE_VPN_UDP_TO_INTERNET, 0}, | 2144 | {&receive_udp_remote, GNUNET_MESSAGE_TYPE_VPN_UDP_TO_INTERNET, 0}, |
2144 | {&receive_tcp_service, GNUNET_MESSAGE_TYPE_VPN_TCP_TO_SERVICE_START, 0}, | 2145 | {&receive_tcp_service, GNUNET_MESSAGE_TYPE_VPN_TCP_TO_SERVICE_START, 0}, |
2145 | {&receive_tcp_remote, GNUNET_MESSAGE_TYPE_VPN_TCP_TO_INTERNET_START, 0}, | 2146 | {&receive_tcp_remote, GNUNET_MESSAGE_TYPE_VPN_TCP_TO_INTERNET_START, 0}, |
2146 | {&receive_tcp_data, GNUNET_MESSAGE_TYPE_VPN_TCP_DATA, 0}, | 2147 | {&receive_tcp_data, GNUNET_MESSAGE_TYPE_VPN_TCP_DATA_TO_EXIT, 0}, |
2147 | {NULL, 0, 0} | 2148 | {NULL, 0, 0} |
2148 | }; | 2149 | }; |
2149 | 2150 | ||
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h index bda20e37d..1bd590d5e 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h | |||
@@ -597,27 +597,32 @@ extern "C" | |||
597 | /** | 597 | /** |
598 | * Type of messages containing an DNS request for a DNS exit service. | 598 | * Type of messages containing an DNS request for a DNS exit service. |
599 | */ | 599 | */ |
600 | #define GNUNET_MESSAGE_TYPE_VPN_DNS_TO_INTERNET 194 | 600 | #define GNUNET_MESSAGE_TYPE_VPN_DNS_TO_INTERNET 193 |
601 | 601 | ||
602 | /** | 602 | /** |
603 | * Type of messages containing an DNS reply from a DNS exit service. | 603 | * Type of messages containing an DNS reply from a DNS exit service. |
604 | */ | 604 | */ |
605 | #define GNUNET_MESSAGE_TYPE_VPN_DNS_FROM_INTERNET 195 | 605 | #define GNUNET_MESSAGE_TYPE_VPN_DNS_FROM_INTERNET 194 |
606 | 606 | ||
607 | /** | 607 | /** |
608 | * Type of messages containing an TCP packet for a service. | 608 | * Type of messages containing an TCP packet for a service. |
609 | */ | 609 | */ |
610 | #define GNUNET_MESSAGE_TYPE_VPN_TCP_TO_SERVICE_START 196 | 610 | #define GNUNET_MESSAGE_TYPE_VPN_TCP_TO_SERVICE_START 195 |
611 | 611 | ||
612 | /** | 612 | /** |
613 | * Type of messages containing an TCP packet for the Internet. | 613 | * Type of messages containing an TCP packet for the Internet. |
614 | */ | 614 | */ |
615 | #define GNUNET_MESSAGE_TYPE_VPN_TCP_TO_INTERNET_START 197 | 615 | #define GNUNET_MESSAGE_TYPE_VPN_TCP_TO_INTERNET_START 196 |
616 | 616 | ||
617 | /** | 617 | /** |
618 | * Type of messages containing an TCP packet of an established connection. | 618 | * Type of messages containing an TCP packet of an established connection. |
619 | */ | 619 | */ |
620 | #define GNUNET_MESSAGE_TYPE_VPN_TCP_DATA 198 | 620 | #define GNUNET_MESSAGE_TYPE_VPN_TCP_DATA_TO_EXIT 197 |
621 | |||
622 | /** | ||
623 | * Type of messages containing an TCP packet of an established connection. | ||
624 | */ | ||
625 | #define GNUNET_MESSAGE_TYPE_VPN_TCP_DATA_TO_VPN 198 | ||
621 | 626 | ||
622 | /** | 627 | /** |
623 | * Type of messages containing an UDP packet for a service. | 628 | * Type of messages containing an UDP packet for a service. |
diff --git a/src/vpn/gnunet-service-vpn.c b/src/vpn/gnunet-service-vpn.c index fe431b994..6b89c46ae 100644 --- a/src/vpn/gnunet-service-vpn.c +++ b/src/vpn/gnunet-service-vpn.c | |||
@@ -1196,7 +1196,7 @@ route_packet (struct DestinationEntry *destination, | |||
1196 | tnq->msg = &tnq[1]; | 1196 | tnq->msg = &tnq[1]; |
1197 | tdm = (struct GNUNET_EXIT_TcpDataMessage *) &tnq[1]; | 1197 | tdm = (struct GNUNET_EXIT_TcpDataMessage *) &tnq[1]; |
1198 | tdm->header.size = htons ((uint16_t) mlen); | 1198 | tdm->header.size = htons ((uint16_t) mlen); |
1199 | tdm->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_TCP_DATA); | 1199 | tdm->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_TCP_DATA_TO_EXIT); |
1200 | tdm->reserved = htonl (0); | 1200 | tdm->reserved = htonl (0); |
1201 | tdm->tcp_header = *tcp; | 1201 | tdm->tcp_header = *tcp; |
1202 | memcpy (&tdm[1], | 1202 | memcpy (&tdm[1], |
@@ -2322,7 +2322,7 @@ run (void *cls, | |||
2322 | }; | 2322 | }; |
2323 | static const struct GNUNET_MESH_MessageHandler mesh_handlers[] = { | 2323 | static const struct GNUNET_MESH_MessageHandler mesh_handlers[] = { |
2324 | { &receive_udp_back, GNUNET_MESSAGE_TYPE_VPN_UDP_REPLY, 0}, | 2324 | { &receive_udp_back, GNUNET_MESSAGE_TYPE_VPN_UDP_REPLY, 0}, |
2325 | { &receive_tcp_back, GNUNET_MESSAGE_TYPE_VPN_TCP_DATA, 0}, | 2325 | { &receive_tcp_back, GNUNET_MESSAGE_TYPE_VPN_TCP_DATA_TO_VPN, 0}, |
2326 | {NULL, 0, 0} | 2326 | {NULL, 0, 0} |
2327 | }; | 2327 | }; |
2328 | static const GNUNET_MESH_ApplicationType types[] = { | 2328 | static const GNUNET_MESH_ApplicationType types[] = { |