diff options
Diffstat (limited to 'src/transport/plugin_transport_tcp.c')
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index ba8b5895e..664dcbb7d 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -475,7 +475,9 @@ notify_session_monitor (struct Plugin *plugin, | |||
475 | return; | 475 | return; |
476 | memset (&info, 0, sizeof (info)); | 476 | memset (&info, 0, sizeof (info)); |
477 | info.state = state; | 477 | info.state = state; |
478 | info.is_inbound = GNUNET_SYSERR; /* hard to say */ | 478 | info.is_inbound = (0 != (GNUNET_HELLO_ADDRESS_INFO_INBOUND & session->address->local_info)) |
479 | ? GNUNET_YES | ||
480 | : GNUNET_NO; | ||
479 | info.num_msg_pending = session->msgs_in_queue; | 481 | info.num_msg_pending = session->msgs_in_queue; |
480 | info.num_bytes_pending = session->bytes_in_queue; | 482 | info.num_bytes_pending = session->bytes_in_queue; |
481 | if (GNUNET_SCHEDULER_NO_TASK != session->receive_delay_task) | 483 | if (GNUNET_SCHEDULER_NO_TASK != session->receive_delay_task) |
@@ -494,9 +496,9 @@ notify_session_monitor (struct Plugin *plugin, | |||
494 | * address and that the next call to this function is allowed | 496 | * address and that the next call to this function is allowed |
495 | * to override the address again. | 497 | * to override the address again. |
496 | * | 498 | * |
497 | * @param cls closure ('struct Plugin*') | 499 | * @param cls closure (`struct Plugin *`) |
498 | * @param addr binary address | 500 | * @param addr binary address |
499 | * @param addrlen length of the address | 501 | * @param addrlen length of @a addr |
500 | * @return string representing the same address | 502 | * @return string representing the same address |
501 | */ | 503 | */ |
502 | static const char * | 504 | static const char * |
@@ -513,7 +515,7 @@ tcp_plugin_address_to_string (void *cls, | |||
513 | * @param cls the `struct Plugin` | 515 | * @param cls the `struct Plugin` |
514 | * @param ucred credentials, if available, otherwise NULL | 516 | * @param ucred credentials, if available, otherwise NULL |
515 | * @param addr address | 517 | * @param addr address |
516 | * @param addrlen length of address | 518 | * @param addrlen length of @a addr |
517 | * @return #GNUNET_YES to allow, #GNUNET_NO to deny, #GNUNET_SYSERR | 519 | * @return #GNUNET_YES to allow, #GNUNET_NO to deny, #GNUNET_SYSERR |
518 | * for unknown address family (will be denied). | 520 | * for unknown address family (will be denied). |
519 | */ | 521 | */ |
@@ -2194,10 +2196,11 @@ handle_tcp_nat_probe (void *cls, | |||
2194 | t4->options = htonl (TCP_OPTIONS_NONE); | 2196 | t4->options = htonl (TCP_OPTIONS_NONE); |
2195 | t4->t4_port = s4->sin_port; | 2197 | t4->t4_port = s4->sin_port; |
2196 | t4->ipv4_addr = s4->sin_addr.s_addr; | 2198 | t4->ipv4_addr = s4->sin_addr.s_addr; |
2197 | session->address = GNUNET_HELLO_address_allocate ( | 2199 | session->address = GNUNET_HELLO_address_allocate (&tcp_nat_probe->clientIdentity, |
2198 | &tcp_nat_probe->clientIdentity, PLUGIN_NAME, &t4, | 2200 | PLUGIN_NAME, |
2199 | sizeof(struct IPv4TcpAddress), | 2201 | &t4, |
2200 | GNUNET_HELLO_ADDRESS_INFO_NONE); | 2202 | sizeof(struct IPv4TcpAddress), |
2203 | GNUNET_HELLO_ADDRESS_INFO_NONE); | ||
2201 | break; | 2204 | break; |
2202 | case AF_INET6: | 2205 | case AF_INET6: |
2203 | s6 = vaddr; | 2206 | s6 = vaddr; |
@@ -2205,10 +2208,11 @@ handle_tcp_nat_probe (void *cls, | |||
2205 | t6->options = htonl (TCP_OPTIONS_NONE); | 2208 | t6->options = htonl (TCP_OPTIONS_NONE); |
2206 | t6->t6_port = s6->sin6_port; | 2209 | t6->t6_port = s6->sin6_port; |
2207 | memcpy (&t6->ipv6_addr, &s6->sin6_addr, sizeof(struct in6_addr)); | 2210 | memcpy (&t6->ipv6_addr, &s6->sin6_addr, sizeof(struct in6_addr)); |
2208 | session->address = GNUNET_HELLO_address_allocate ( | 2211 | session->address = GNUNET_HELLO_address_allocate (&tcp_nat_probe->clientIdentity, |
2209 | &tcp_nat_probe->clientIdentity, | 2212 | PLUGIN_NAME, |
2210 | PLUGIN_NAME, &t6, sizeof(struct IPv6TcpAddress), | 2213 | &t6, |
2211 | GNUNET_HELLO_ADDRESS_INFO_NONE); | 2214 | sizeof(struct IPv6TcpAddress), |
2215 | GNUNET_HELLO_ADDRESS_INFO_NONE); | ||
2212 | break; | 2216 | break; |
2213 | default: | 2217 | default: |
2214 | GNUNET_break_op(0); | 2218 | GNUNET_break_op(0); |
@@ -2305,8 +2309,10 @@ handle_tcp_welcome (void *cls, | |||
2305 | t4.t4_port = s4->sin_port; | 2309 | t4.t4_port = s4->sin_port; |
2306 | t4.ipv4_addr = s4->sin_addr.s_addr; | 2310 | t4.ipv4_addr = s4->sin_addr.s_addr; |
2307 | address = GNUNET_HELLO_address_allocate (&wm->clientIdentity, | 2311 | address = GNUNET_HELLO_address_allocate (&wm->clientIdentity, |
2308 | PLUGIN_NAME, &t4, sizeof(t4), | 2312 | PLUGIN_NAME, |
2309 | GNUNET_HELLO_ADDRESS_INFO_INBOUND); | 2313 | &t4, |
2314 | sizeof(t4), | ||
2315 | GNUNET_HELLO_ADDRESS_INFO_INBOUND); | ||
2310 | } | 2316 | } |
2311 | else if (alen == sizeof(struct sockaddr_in6)) | 2317 | else if (alen == sizeof(struct sockaddr_in6)) |
2312 | { | 2318 | { |