aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-05-25 13:17:43 +0000
committerChristian Grothoff <christian@grothoff.org>2015-05-25 13:17:43 +0000
commitff9dca51fb5bf1c513ee2241307f30a909bee9a1 (patch)
treee45a4cf98d9230c93e4af5d3d77109dd115c9e09
parent24dfcbf8adcfe9b2d7b03cb5510763780325e587 (diff)
downloadgnunet-ff9dca51fb5bf1c513ee2241307f30a909bee9a1.tar.gz
gnunet-ff9dca51fb5bf1c513ee2241307f30a909bee9a1.zip
-fix channel initialization with regex involvment
-rw-r--r--src/exit/gnunet-daemon-exit.c3
-rw-r--r--src/vpn/gnunet-service-vpn.c24
2 files changed, 17 insertions, 10 deletions
diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c
index 82242c78c..9479ef1ad 100644
--- a/src/exit/gnunet-daemon-exit.c
+++ b/src/exit/gnunet-daemon-exit.c
@@ -1936,7 +1936,8 @@ receive_tcp_service (void *cls,
1936 * #GNUNET_SYSERR to close it (signal serious error) 1936 * #GNUNET_SYSERR to close it (signal serious error)
1937 */ 1937 */
1938static int 1938static int
1939receive_tcp_remote (void *cls GNUNET_UNUSED, struct GNUNET_CADET_Channel *channel, 1939receive_tcp_remote (void *cls GNUNET_UNUSED,
1940 struct GNUNET_CADET_Channel *channel,
1940 void **channel_ctx GNUNET_UNUSED, 1941 void **channel_ctx GNUNET_UNUSED,
1941 const struct GNUNET_MessageHeader *message) 1942 const struct GNUNET_MessageHeader *message)
1942{ 1943{
diff --git a/src/vpn/gnunet-service-vpn.c b/src/vpn/gnunet-service-vpn.c
index 2ae81a65b..af70b8aae 100644
--- a/src/vpn/gnunet-service-vpn.c
+++ b/src/vpn/gnunet-service-vpn.c
@@ -266,6 +266,12 @@ struct ChannelState
266 int af; 266 int af;
267 267
268 /** 268 /**
269 * Is this channel new (#GNUNET_NO), or did we exchange messages with the
270 * other side already (#GNUNET_YES)?
271 */
272 int is_established;
273
274 /**
269 * Length of the doubly linked 'tmq_head/tmq_tail' list. 275 * Length of the doubly linked 'tmq_head/tmq_tail' list.
270 */ 276 */
271 unsigned int tmq_length; 277 unsigned int tmq_length;
@@ -924,7 +930,6 @@ route_packet (struct DestinationEntry *destination,
924 struct ChannelMessageQueueEntry *tnq; 930 struct ChannelMessageQueueEntry *tnq;
925 size_t alen; 931 size_t alen;
926 size_t mlen; 932 size_t mlen;
927 int is_new;
928 const struct GNUNET_TUN_UdpHeader *udp; 933 const struct GNUNET_TUN_UdpHeader *udp;
929 const struct GNUNET_TUN_TcpHeader *tcp; 934 const struct GNUNET_TUN_TcpHeader *tcp;
930 const struct GNUNET_TUN_IcmpHeader *icmp; 935 const struct GNUNET_TUN_IcmpHeader *icmp;
@@ -1093,7 +1098,6 @@ route_packet (struct DestinationEntry *destination,
1093 { 1098 {
1094 /* need to either use the existing channel from the destination (if still 1099 /* need to either use the existing channel from the destination (if still
1095 available) or create a fresh one */ 1100 available) or create a fresh one */
1096 is_new = GNUNET_YES;
1097 if (NULL == dt->ts) 1101 if (NULL == dt->ts)
1098 ts = create_channel_to_destination (dt, af); 1102 ts = create_channel_to_destination (dt, af);
1099 else 1103 else
@@ -1133,7 +1137,6 @@ route_packet (struct DestinationEntry *destination,
1133 } 1137 }
1134 else 1138 else
1135 { 1139 {
1136 is_new = GNUNET_NO;
1137 GNUNET_CONTAINER_heap_update_cost (channel_heap, 1140 GNUNET_CONTAINER_heap_update_cost (channel_heap,
1138 ts->heap_node, 1141 ts->heap_node,
1139 GNUNET_TIME_absolute_get ().abs_value_us); 1142 GNUNET_TIME_absolute_get ().abs_value_us);
@@ -1227,7 +1230,7 @@ route_packet (struct DestinationEntry *destination,
1227 } 1230 }
1228 break; 1231 break;
1229 case IPPROTO_TCP: 1232 case IPPROTO_TCP:
1230 if (is_new) 1233 if (GNUNET_NO == ts->is_established)
1231 { 1234 {
1232 if (destination->is_service) 1235 if (destination->is_service)
1233 { 1236 {
@@ -1559,6 +1562,7 @@ route_packet (struct DestinationEntry *destination,
1559 GNUNET_assert (0); 1562 GNUNET_assert (0);
1560 break; 1563 break;
1561 } 1564 }
1565 ts->is_established = GNUNET_YES;
1562 send_to_channel (tnq, ts); 1566 send_to_channel (tnq, ts);
1563} 1567}
1564 1568
@@ -3123,16 +3127,18 @@ run (void *cls,
3123 3127
3124 cadet_handle = 3128 cadet_handle =
3125 GNUNET_CADET_connect (cfg_, NULL, 3129 GNUNET_CADET_connect (cfg_, NULL,
3126 NULL, 3130 NULL,
3127 &channel_cleaner, 3131 &channel_cleaner,
3128 cadet_handlers, 3132 cadet_handlers,
3129 NULL); 3133 NULL);
3130 helper_handle = GNUNET_HELPER_start (GNUNET_NO, 3134 helper_handle = GNUNET_HELPER_start (GNUNET_NO,
3131 "gnunet-helper-vpn", vpn_argv, 3135 "gnunet-helper-vpn", vpn_argv,
3132 &message_token, NULL, NULL); 3136 &message_token, NULL, NULL);
3133 nc = GNUNET_SERVER_notification_context_create (server, 1); 3137 nc = GNUNET_SERVER_notification_context_create (server, 1);
3134 GNUNET_SERVER_add_handlers (server, service_handlers); 3138 GNUNET_SERVER_add_handlers (server, service_handlers);
3135 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &cleanup, cls); 3139 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
3140 &cleanup,
3141 NULL);
3136} 3142}
3137 3143
3138 3144