* @author Christian Grothoff
*
* TODO:
- * - need some logging
* - need some statistics
* - test
*
{
struct TunnelState *state;
+ {
+ char sbuf[INET6_ADDRSTRLEN];
+ char dbuf[INET6_ADDRSTRLEN];
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Received UDP packet going from %s:%u to %s:%u\n",
+ inet_ntop (af,
+ source_ip,
+ sbuf, sizeof (sbuf)),
+ (unsigned int) ntohs (udp->spt),
+ inet_ntop (af,
+ source_ip,
+ dbuf, sizeof (dbuf)),
+ (unsigned int) ntohs (udp->dpt));
+ }
if (pktlen < sizeof (struct udp_packet))
{
/* blame kernel */
char buf[pktlen];
struct tcp_packet *mtcp;
+ {
+ char sbuf[INET6_ADDRSTRLEN];
+ char dbuf[INET6_ADDRSTRLEN];
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Received TCP packet going from %s:%u to %s:%u\n",
+ inet_ntop (af,
+ source_ip,
+ sbuf, sizeof (sbuf)),
+ (unsigned int) ntohs (tcp->spt),
+ inet_ntop (af,
+ source_ip,
+ dbuf, sizeof (dbuf)),
+ (unsigned int) ntohs (tcp->dpt));
+ }
if (pktlen < sizeof (struct tcp_packet))
{
/* blame kernel */
state->serv->address.proto,
&state->ri.local_address);
} while (NULL != get_redirect_state (state->ri.remote_address.af,
- IPPROTO_UDP,
+ state->ri.remote_address.proto,
&state->ri.remote_address.address,
state->ri.remote_address.port,
&state->ri.local_address.address,
state->ri.local_address.port,
&key));
+ {
+ char buf[INET6_ADDRSTRLEN];
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Picked local address %s:%u for new connection\n",
+ inet_ntop (state->ri.local_address.af,
+ &state->ri.local_address.address,
+ buf, sizeof (buf)),
+ (unsigned int) state->ri.local_address.port);
+ }
GNUNET_assert (GNUNET_OK ==
GNUNET_CONTAINER_multihashmap_put (connections_map,
&key, state,
{
size_t len;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Sending packet with %u bytes TCP payload via TUN\n",
+ (unsigned int) payload_length);
len = sizeof (struct GNUNET_MessageHeader) + sizeof (struct tun_header);
switch (source_address->af)
{
}
GNUNET_break_op (ntohl (start->reserved) == 0);
/* setup fresh connection */
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Received data from %s for forwarding to TCP service %s on port %u\n",
+ GNUNET_i2s (sender),
+ GNUNET_h2s (&start->service_descriptor),
+ (unsigned int) ntohs (start->tcp_header.dpt));
if (NULL == (state->serv = find_service (tcp_services, &start->service_descriptor,
ntohs (start->tcp_header.dpt))))
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
+ {
+ char buf[INET6_ADDRSTRLEN];
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Received data from %s for starting TCP stream to %s:%u\n",
+ GNUNET_i2s (sender),
+ inet_ntop (af,
+ &state->ri.remote_address.address,
+ buf, sizeof (buf)),
+ (unsigned int) ntohs (start->tcp_header.dpt));
+ }
+
state->ri.remote_address.proto = IPPROTO_TCP;
state->ri.remote_address.port = ntohs (start->tcp_header.dpt);
setup_state_record (state);
return GNUNET_SYSERR;
}
GNUNET_break_op (ntohl (data->reserved) == 0);
+ {
+ char buf[INET6_ADDRSTRLEN];
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Received additional data from %s for TCP stream to %s:%u\n",
+ GNUNET_i2s (sender),
+ inet_ntop (state->ri.remote_address.af,
+ &state->ri.remote_address.address,
+ buf, sizeof (buf)),
+ (unsigned int) state->ri.remote_address.port);
+ }
+
send_tcp_packet_via_tun (&state->ri.remote_address,
&state->ri.local_address,
&data->tcp_header,
{
size_t len;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Sending packet with %u bytes UDP payload via TUN\n",
+ (unsigned int) payload_length);
len = sizeof (struct GNUNET_MessageHeader) + sizeof (struct tun_header);
switch (source_address->af)
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
+ {
+ char buf[INET6_ADDRSTRLEN];
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Received data from %s for forwarding to UDP %s:%u\n",
+ GNUNET_i2s (sender),
+ inet_ntop (af,
+ &state->ri.remote_address.address,
+ buf, sizeof (buf)),
+ (unsigned int) ntohs (msg->destination_port));
+ }
state->ri.remote_address.proto = IPPROTO_UDP;
state->ri.remote_address.port = msg->destination_port;
if (NULL == state->heap_node)
}
msg = (const struct GNUNET_EXIT_UdpServiceMessage*) message;
pkt_len -= sizeof (struct GNUNET_EXIT_UdpServiceMessage);
-
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Received data from %s for forwarding to UDP service %s on port %u\n",
+ GNUNET_i2s (sender),
+ GNUNET_h2s (&msg->service_descriptor),
+ (unsigned int) ntohs (msg->destination_port));
if (NULL == (state->serv = find_service (udp_services, &msg->service_descriptor,
ntohs (msg->destination_port))))
{
const struct GNUNET_ATS_Information *ats GNUNET_UNUSED)
{
struct TunnelState *s = GNUNET_malloc (sizeof (struct TunnelState));
-
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Received inbound tunnel from `%s'\n",
+ GNUNET_i2s (initiator));
s->tunnel = tunnel;
return s;
}
struct TunnelState *s = tunnel_ctx;
struct TunnelMessageQueue *tnq;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Tunnel destroyed\n");
while (NULL != (tnq = s->head))
{
GNUNET_CONTAINER_DLL_remove (s->head,
{
unsigned int i;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Exit service is shutting down now\n");
if (helper_handle != NULL)
{
GNUNET_HELPER_stop (helper_handle);