-use different message types for different directions for TCP DATA
authorChristian Grothoff <christian@grothoff.org>
Fri, 20 Jan 2012 17:21:21 +0000 (17:21 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 20 Jan 2012 17:21:21 +0000 (17:21 +0000)
src/exit/gnunet-daemon-exit.c
src/include/gnunet_protocols.h
src/vpn/gnunet-service-vpn.c

index 316133a759541bb9925b280bd277ba5498f0ab86..9bdfba7da425aec35d26a0de7558bc977cbc914d 100644 (file)
@@ -721,7 +721,7 @@ tcp_from_helper (const struct GNUNET_TUN_TcpHeader *tcp,
   tnq->len = mlen;
   tdm = (struct GNUNET_EXIT_TcpDataMessage *) &tnq[1];
   tdm->header.size = htons ((uint16_t) mlen);
-  tdm->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_TCP_DATA);
+  tdm->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_TCP_DATA_TO_VPN);
   tdm->reserved = htonl (0);
   memcpy (&tdm->tcp_header,
          buf, 
@@ -789,6 +789,7 @@ message_token (void *cls GNUNET_UNUSED, void *client GNUNET_UNUSED,
                    _("IPv4 packet options received.  Ignored.\n"));
        return;
       }
+      
       size -= sizeof (struct GNUNET_TUN_IPv4Header);
       switch (pkt4->protocol)
       {
@@ -2143,7 +2144,7 @@ run (void *cls, char *const *args GNUNET_UNUSED,
     {&receive_udp_remote, GNUNET_MESSAGE_TYPE_VPN_UDP_TO_INTERNET, 0},
     {&receive_tcp_service, GNUNET_MESSAGE_TYPE_VPN_TCP_TO_SERVICE_START, 0},
     {&receive_tcp_remote, GNUNET_MESSAGE_TYPE_VPN_TCP_TO_INTERNET_START, 0},
-    {&receive_tcp_data, GNUNET_MESSAGE_TYPE_VPN_TCP_DATA, 0},
+    {&receive_tcp_data, GNUNET_MESSAGE_TYPE_VPN_TCP_DATA_TO_EXIT, 0},
     {NULL, 0, 0}
   };
 
index bda20e37d7d60ff338593a37aaa6c0d19f10a5a9..1bd590d5ea0302c6aa86eb0ecf1aec627f596404 100644 (file)
@@ -597,27 +597,32 @@ extern "C"
 /**
  * Type of messages containing an DNS request for a DNS exit service.
  */
-#define GNUNET_MESSAGE_TYPE_VPN_DNS_TO_INTERNET 194
+#define GNUNET_MESSAGE_TYPE_VPN_DNS_TO_INTERNET 193
 
 /**
  * Type of messages containing an DNS reply from a DNS exit service.
  */
-#define GNUNET_MESSAGE_TYPE_VPN_DNS_FROM_INTERNET 195
+#define GNUNET_MESSAGE_TYPE_VPN_DNS_FROM_INTERNET 194
 
 /**
  * Type of messages containing an TCP packet for a service.
  */
-#define GNUNET_MESSAGE_TYPE_VPN_TCP_TO_SERVICE_START 196
+#define GNUNET_MESSAGE_TYPE_VPN_TCP_TO_SERVICE_START 195
 
 /**
  * Type of messages containing an TCP packet for the Internet.
  */
-#define GNUNET_MESSAGE_TYPE_VPN_TCP_TO_INTERNET_START 197
+#define GNUNET_MESSAGE_TYPE_VPN_TCP_TO_INTERNET_START 196
 
 /**
  * Type of messages containing an TCP packet of an established connection.
  */
-#define GNUNET_MESSAGE_TYPE_VPN_TCP_DATA 198
+#define GNUNET_MESSAGE_TYPE_VPN_TCP_DATA_TO_EXIT 197
+
+/**
+ * Type of messages containing an TCP packet of an established connection.
+ */
+#define GNUNET_MESSAGE_TYPE_VPN_TCP_DATA_TO_VPN 198
 
 /**
  * Type of messages containing an UDP packet for a service.
index fe431b994f9e05f845aba15233adf1652a8e1474..6b89c46ae2277a250b5bf560de4634ed08076c88 100644 (file)
@@ -1196,7 +1196,7 @@ route_packet (struct DestinationEntry *destination,
       tnq->msg = &tnq[1];
       tdm = (struct  GNUNET_EXIT_TcpDataMessage *) &tnq[1];
       tdm->header.size = htons ((uint16_t) mlen);
-      tdm->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_TCP_DATA);
+      tdm->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_TCP_DATA_TO_EXIT);
       tdm->reserved = htonl (0);
       tdm->tcp_header = *tcp;
       memcpy (&tdm[1],
@@ -2322,7 +2322,7 @@ run (void *cls,
   };
   static const struct GNUNET_MESH_MessageHandler mesh_handlers[] = {
     { &receive_udp_back, GNUNET_MESSAGE_TYPE_VPN_UDP_REPLY, 0},
-    { &receive_tcp_back, GNUNET_MESSAGE_TYPE_VPN_TCP_DATA, 0},
+    { &receive_tcp_back, GNUNET_MESSAGE_TYPE_VPN_TCP_DATA_TO_VPN, 0},
     {NULL, 0, 0}
   };
   static const GNUNET_MESH_ApplicationType types[] = {