diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-05-22 09:58:51 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-05-22 09:58:51 +0000 |
commit | 94f9c245e43e1291bf4b3e800e6becdeb5f71e97 (patch) | |
tree | f95fa4062d2a9d63fe38267110b454f692865887 /src/vpn/gnunet-service-vpn.c | |
parent | a3896e7faa0e09dd2f92b40246e500a78d15b4a7 (diff) | |
download | gnunet-94f9c245e43e1291bf4b3e800e6becdeb5f71e97.tar.gz gnunet-94f9c245e43e1291bf4b3e800e6becdeb5f71e97.zip |
-diagnose tunnel issues
Diffstat (limited to 'src/vpn/gnunet-service-vpn.c')
-rw-r--r-- | src/vpn/gnunet-service-vpn.c | 63 |
1 files changed, 49 insertions, 14 deletions
diff --git a/src/vpn/gnunet-service-vpn.c b/src/vpn/gnunet-service-vpn.c index 33ffa913a..d9395cf48 100644 --- a/src/vpn/gnunet-service-vpn.c +++ b/src/vpn/gnunet-service-vpn.c | |||
@@ -324,7 +324,7 @@ struct ChannelState | |||
324 | 324 | ||
325 | 325 | ||
326 | /** | 326 | /** |
327 | * Return value from 'main'. | 327 | * Return value from #main(). |
328 | */ | 328 | */ |
329 | static int global_ret; | 329 | static int global_ret; |
330 | 330 | ||
@@ -445,12 +445,12 @@ get_destination_key_from_ip (int af, | |||
445 | */ | 445 | */ |
446 | static void | 446 | static void |
447 | get_channel_key_from_ips (int af, | 447 | get_channel_key_from_ips (int af, |
448 | uint8_t protocol, | 448 | uint8_t protocol, |
449 | const void *source_ip, | 449 | const void *source_ip, |
450 | uint16_t source_port, | 450 | uint16_t source_port, |
451 | const void *destination_ip, | 451 | const void *destination_ip, |
452 | uint16_t destination_port, | 452 | uint16_t destination_port, |
453 | struct GNUNET_HashCode *key) | 453 | struct GNUNET_HashCode *key) |
454 | { | 454 | { |
455 | char *off; | 455 | char *off; |
456 | 456 | ||
@@ -744,7 +744,7 @@ handle_regex_result (void *cls, | |||
744 | */ | 744 | */ |
745 | static struct ChannelState * | 745 | static struct ChannelState * |
746 | create_channel_to_destination (struct DestinationChannel *dt, | 746 | create_channel_to_destination (struct DestinationChannel *dt, |
747 | int client_af) | 747 | int client_af) |
748 | { | 748 | { |
749 | struct ChannelState *ts; | 749 | struct ChannelState *ts; |
750 | unsigned int apptype; | 750 | unsigned int apptype; |
@@ -774,10 +774,10 @@ create_channel_to_destination (struct DestinationChannel *dt, | |||
774 | if (dt->destination->is_service) | 774 | if (dt->destination->is_service) |
775 | { | 775 | { |
776 | ts->channel = GNUNET_CADET_channel_create (cadet_handle, | 776 | ts->channel = GNUNET_CADET_channel_create (cadet_handle, |
777 | ts, | 777 | ts, |
778 | &dt->destination->details.service_destination.target, | 778 | &dt->destination->details.service_destination.target, |
779 | apptype, | 779 | apptype, |
780 | GNUNET_CADET_OPTION_DEFAULT); | 780 | GNUNET_CADET_OPTION_DEFAULT); |
781 | if (NULL == ts->channel) | 781 | if (NULL == ts->channel) |
782 | { | 782 | { |
783 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 783 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
@@ -803,7 +803,8 @@ create_channel_to_destination (struct DestinationChannel *dt, | |||
803 | GNUNET_TUN_ipv4toregexsearch (&dt->destination->details.exit_destination.ip.v4, | 803 | GNUNET_TUN_ipv4toregexsearch (&dt->destination->details.exit_destination.ip.v4, |
804 | dt->destination_port, | 804 | dt->destination_port, |
805 | address); | 805 | address); |
806 | GNUNET_asprintf (&policy, "%s%s", | 806 | GNUNET_asprintf (&policy, |
807 | "%s%s", | ||
807 | GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX, | 808 | GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX, |
808 | address); | 809 | address); |
809 | break; | 810 | break; |
@@ -857,6 +858,36 @@ expire_channel (struct ChannelState *except) | |||
857 | 858 | ||
858 | 859 | ||
859 | /** | 860 | /** |
861 | * Output destination of a channel for diagnostics. | ||
862 | * | ||
863 | * @param de destination to process | ||
864 | * @return diagnostic string describing destination | ||
865 | */ | ||
866 | static const char * | ||
867 | print_channel_destination (const struct DestinationEntry *de) | ||
868 | { | ||
869 | static char dest[256]; | ||
870 | |||
871 | if (de->is_service) | ||
872 | { | ||
873 | GNUNET_snprintf (dest, | ||
874 | sizeof (dest), | ||
875 | "HS: %s-%s\n", | ||
876 | GNUNET_i2s (&de->details.service_destination.target), | ||
877 | GNUNET_h2s (&de->details.service_destination.service_descriptor)); | ||
878 | } | ||
879 | else | ||
880 | { | ||
881 | inet_ntop (de->details.exit_destination.af, | ||
882 | &de->details.exit_destination.ip, | ||
883 | dest, | ||
884 | sizeof (dest)); | ||
885 | } | ||
886 | return dest; | ||
887 | } | ||
888 | |||
889 | |||
890 | /** | ||
860 | * Route a packet via cadet to the given destination. | 891 | * Route a packet via cadet to the given destination. |
861 | * | 892 | * |
862 | * @param destination description of the destination | 893 | * @param destination description of the destination |
@@ -1098,7 +1129,11 @@ route_packet (struct DestinationEntry *destination, | |||
1098 | if (NULL == ts->channel) | 1129 | if (NULL == ts->channel) |
1099 | { | 1130 | { |
1100 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1131 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1101 | "Packet dropped, channel not yet ready\n"); | 1132 | "Packet dropped, channel to %s not yet ready (%s)\n", |
1133 | print_channel_destination (&ts->destination), | ||
1134 | (NULL == ts->search) | ||
1135 | ? "EXIT search failed" | ||
1136 | : "EXIT search active"); | ||
1102 | GNUNET_STATISTICS_update (stats, | 1137 | GNUNET_STATISTICS_update (stats, |
1103 | gettext_noop ("# Packets dropped (channel not yet online)"), | 1138 | gettext_noop ("# Packets dropped (channel not yet online)"), |
1104 | 1, | 1139 | 1, |