diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-07-11 14:54:27 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-07-11 14:54:27 +0000 |
commit | ec346597fba6b7fdec3939de40b3b7aba322049d (patch) | |
tree | e386f9ea31440a63f2c38c49705930d9ca99f289 | |
parent | 8dc32abbeff6b4b348253afed6c60543665a34c2 (diff) | |
download | gnunet-ec346597fba6b7fdec3939de40b3b7aba322049d.tar.gz gnunet-ec346597fba6b7fdec3939de40b3b7aba322049d.zip |
fixes
-rw-r--r-- | src/nat/gnunet-nat-server.c | 16 | ||||
-rw-r--r-- | src/nat/nat.c | 4 | ||||
-rw-r--r-- | src/nat/test_nat.c | 1 | ||||
-rw-r--r-- | src/nat/test_nat_mini.c | 1 | ||||
-rw-r--r-- | src/nat/test_nat_test_data.conf | 2 |
5 files changed, 18 insertions, 6 deletions
diff --git a/src/nat/gnunet-nat-server.c b/src/nat/gnunet-nat-server.c index 1c639596f..bf4318a91 100644 --- a/src/nat/gnunet-nat-server.c +++ b/src/nat/gnunet-nat-server.c | |||
@@ -29,6 +29,8 @@ | |||
29 | #include "gnunet_protocols.h" | 29 | #include "gnunet_protocols.h" |
30 | #include "nat.h" | 30 | #include "nat.h" |
31 | 31 | ||
32 | #define DEBUG_NAT GNUNET_NO | ||
33 | |||
32 | /** | 34 | /** |
33 | * Our server. | 35 | * Our server. |
34 | */ | 36 | */ |
@@ -56,10 +58,12 @@ try_anat (uint32_t dst_ipv4, | |||
56 | struct GNUNET_NAT_Handle *h; | 58 | struct GNUNET_NAT_Handle *h; |
57 | struct sockaddr_in sa; | 59 | struct sockaddr_in sa; |
58 | 60 | ||
61 | #if DEBUG_NAT | ||
59 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 62 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
60 | "Asking for connection reversal with %x and code %u\n", | 63 | "Asking for connection reversal with %x and code %u\n", |
61 | (unsigned int) dst_ipv4, | 64 | (unsigned int) dst_ipv4, |
62 | (unsigned int) dport); | 65 | (unsigned int) dport); |
66 | #endif | ||
63 | h = GNUNET_NAT_register (cfg, | 67 | h = GNUNET_NAT_register (cfg, |
64 | is_tcp, | 68 | is_tcp, |
65 | dport, | 69 | dport, |
@@ -111,7 +115,11 @@ tcp_send (void *cls, | |||
111 | ctx->s)) ) | 115 | ctx->s)) ) |
112 | { | 116 | { |
113 | if (-1 == GNUNET_NETWORK_socket_send (ctx->s, &ctx->data, sizeof (ctx->data))) | 117 | if (-1 == GNUNET_NETWORK_socket_send (ctx->s, &ctx->data, sizeof (ctx->data))) |
114 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_DEBUG, "send"); | 118 | { |
119 | #if DEBUG_NAT | ||
120 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_DEBUG, "send"); | ||
121 | #endif | ||
122 | } | ||
115 | GNUNET_NETWORK_socket_shutdown (ctx->s, SHUT_RDWR); | 123 | GNUNET_NETWORK_socket_shutdown (ctx->s, SHUT_RDWR); |
116 | } | 124 | } |
117 | GNUNET_NETWORK_socket_close (ctx->s); | 125 | GNUNET_NETWORK_socket_close (ctx->s); |
@@ -149,9 +157,11 @@ try_send_tcp (uint32_t dst_ipv4, | |||
149 | #endif | 157 | #endif |
150 | sa.sin_addr.s_addr = dst_ipv4; | 158 | sa.sin_addr.s_addr = dst_ipv4; |
151 | sa.sin_port = htons (dport); | 159 | sa.sin_port = htons (dport); |
160 | #if DEBUG_NAT | ||
152 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 161 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
153 | "Sending TCP message to `%s'\n", | 162 | "Sending TCP message to `%s'\n", |
154 | GNUNET_a2s ((struct sockaddr*) &sa, sizeof (sa))); | 163 | GNUNET_a2s ((struct sockaddr*) &sa, sizeof (sa))); |
164 | #endif | ||
155 | if ( (GNUNET_OK != | 165 | if ( (GNUNET_OK != |
156 | GNUNET_NETWORK_socket_connect (s, | 166 | GNUNET_NETWORK_socket_connect (s, |
157 | (const struct sockaddr*) &sa, sizeof (sa))) && | 167 | (const struct sockaddr*) &sa, sizeof (sa))) && |
@@ -199,9 +209,11 @@ try_send_udp (uint32_t dst_ipv4, | |||
199 | #endif | 209 | #endif |
200 | sa.sin_addr.s_addr = dst_ipv4; | 210 | sa.sin_addr.s_addr = dst_ipv4; |
201 | sa.sin_port = htons (dport); | 211 | sa.sin_port = htons (dport); |
212 | #if DEBUG_NAT | ||
202 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 213 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
203 | "Sending UDP packet to `%s'\n", | 214 | "Sending UDP packet to `%s'\n", |
204 | GNUNET_a2s ((struct sockaddr*) &sa, sizeof (sa))); | 215 | GNUNET_a2s ((struct sockaddr*) &sa, sizeof (sa))); |
216 | #endif | ||
205 | if (-1 == GNUNET_NETWORK_socket_sendto (s, | 217 | if (-1 == GNUNET_NETWORK_socket_sendto (s, |
206 | &data, sizeof(data), | 218 | &data, sizeof(data), |
207 | (const struct sockaddr*) &sa, sizeof (sa))) | 219 | (const struct sockaddr*) &sa, sizeof (sa))) |
@@ -226,8 +238,10 @@ test (void *cls, | |||
226 | const struct GNUNET_NAT_TestMessage *tm; | 238 | const struct GNUNET_NAT_TestMessage *tm; |
227 | uint16_t dport; | 239 | uint16_t dport; |
228 | 240 | ||
241 | #if DEBUG_NAT | ||
229 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 242 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
230 | "Received test request\n"); | 243 | "Received test request\n"); |
244 | #endif | ||
231 | tm = (const struct GNUNET_NAT_TestMessage*) msg; | 245 | tm = (const struct GNUNET_NAT_TestMessage*) msg; |
232 | dport = ntohs (tm->dport); | 246 | dport = ntohs (tm->dport); |
233 | if (0 == dport) | 247 | if (0 == dport) |
diff --git a/src/nat/nat.c b/src/nat/nat.c index d09fd79fc..5bcf970c1 100644 --- a/src/nat/nat.c +++ b/src/nat/nat.c | |||
@@ -423,11 +423,13 @@ add_to_address_list_as_is (struct GNUNET_NAT_Handle *h, | |||
423 | GNUNET_CONTAINER_DLL_insert (h->lal_head, | 423 | GNUNET_CONTAINER_DLL_insert (h->lal_head, |
424 | h->lal_tail, | 424 | h->lal_tail, |
425 | lal); | 425 | lal); |
426 | #if DEBUG_NAT | ||
426 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, | 427 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, |
427 | "nat", | 428 | "nat", |
428 | "Adding address `%s' from source %d\n", | 429 | "Adding address `%s' from source %d\n", |
429 | GNUNET_a2s (arg, arg_size), | 430 | GNUNET_a2s (arg, arg_size), |
430 | src); | 431 | src); |
432 | #endif | ||
431 | if (NULL != h->address_callback) | 433 | if (NULL != h->address_callback) |
432 | h->address_callback (h->callback_cls, | 434 | h->address_callback (h->callback_cls, |
433 | GNUNET_YES, | 435 | GNUNET_YES, |
@@ -1229,8 +1231,6 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1229 | h->use_hostname = GNUNET_CONFIGURATION_get_value_yesno (cfg, | 1231 | h->use_hostname = GNUNET_CONFIGURATION_get_value_yesno (cfg, |
1230 | "nat", | 1232 | "nat", |
1231 | "USE_HOSTNAME"); | 1233 | "USE_HOSTNAME"); |
1232 | if (h->use_localaddresses) | ||
1233 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "USE LOCALADDR enabled!\n"); | ||
1234 | h->disable_ipv6 = GNUNET_CONFIGURATION_get_value_yesno(cfg, | 1234 | h->disable_ipv6 = GNUNET_CONFIGURATION_get_value_yesno(cfg, |
1235 | "nat", | 1235 | "nat", |
1236 | "DISABLEV6"); | 1236 | "DISABLEV6"); |
diff --git a/src/nat/test_nat.c b/src/nat/test_nat.c index cb011c7af..c58d83224 100644 --- a/src/nat/test_nat.c +++ b/src/nat/test_nat.c | |||
@@ -129,7 +129,6 @@ run (void *cls, | |||
129 | struct addr_cls data; | 129 | struct addr_cls data; |
130 | struct sockaddr *addr; | 130 | struct sockaddr *addr; |
131 | 131 | ||
132 | GNUNET_log_setup ("test-nat", "DEBUG", NULL); | ||
133 | data.addr = NULL; | 132 | data.addr = NULL; |
134 | GNUNET_OS_network_interfaces_list (process_if, &data); | 133 | GNUNET_OS_network_interfaces_list (process_if, &data); |
135 | if (NULL == data.addr) | 134 | if (NULL == data.addr) |
diff --git a/src/nat/test_nat_mini.c b/src/nat/test_nat_mini.c index e7b8294c8..ee0115cb1 100644 --- a/src/nat/test_nat_mini.c +++ b/src/nat/test_nat_mini.c | |||
@@ -82,7 +82,6 @@ run (void *cls, | |||
82 | { | 82 | { |
83 | struct GNUNET_NAT_MiniHandle *mini; | 83 | struct GNUNET_NAT_MiniHandle *mini; |
84 | 84 | ||
85 | GNUNET_log_setup ("test-nat-mini", "DEBUG", NULL); | ||
86 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 85 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
87 | "Requesting NAT redirection for port %u...\n", | 86 | "Requesting NAT redirection for port %u...\n", |
88 | PORT); | 87 | PORT); |
diff --git a/src/nat/test_nat_test_data.conf b/src/nat/test_nat_test_data.conf index 41324bb0a..c5d9f161e 100644 --- a/src/nat/test_nat_test_data.conf +++ b/src/nat/test_nat_test_data.conf | |||
@@ -40,4 +40,4 @@ INTERNAL_ADDRESS = 127.0.0.1 | |||
40 | 40 | ||
41 | # Disable IPv6 support | 41 | # Disable IPv6 support |
42 | DISABLEV6 = YES | 42 | DISABLEV6 = YES |
43 | x | 43 | |