summaryrefslogtreecommitdiff
path: root/src/transport/gnunet-communicator-tcp.c
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2019-12-27 04:48:12 +0900
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2019-12-27 04:48:12 +0900
commit852b6710fb70b3943e2b2f02252bfa58bca3ce45 (patch)
treed50fd98d94f2acbf487b792e6bff1b5ffce83d63 /src/transport/gnunet-communicator-tcp.c
parent705ef31579622b7ad033ae4a22ddc30fa7040148 (diff)
fix communicator IP parsing, debug udp communicator
Diffstat (limited to 'src/transport/gnunet-communicator-tcp.c')
-rw-r--r--src/transport/gnunet-communicator-tcp.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/transport/gnunet-communicator-tcp.c b/src/transport/gnunet-communicator-tcp.c
index e902e2316..107a37838 100644
--- a/src/transport/gnunet-communicator-tcp.c
+++ b/src/transport/gnunet-communicator-tcp.c
@@ -1183,10 +1183,13 @@ tcp_address_to_sockaddr (const char *bindto, socklen_t *sock_len)
/* try IPv4 */
struct sockaddr_in v4;
- if (1 == inet_pton (AF_INET, cp, &v4))
+ if (1 == inet_pton (AF_INET, cp, &v4.sin_addr))
{
v4.sin_family = AF_INET;
v4.sin_port = htons ((uint16_t) port);
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ v4.sin_len = sizeof(struct sockaddr_in);
+#endif
in = GNUNET_memdup (&v4, sizeof(v4));
*sock_len = sizeof(v4);
GNUNET_free (cp);
@@ -1204,10 +1207,13 @@ tcp_address_to_sockaddr (const char *bindto, socklen_t *sock_len)
start++; /* skip over '[' */
cp[strlen (cp) - 1] = '\0'; /* eat ']' */
}
- if (1 == inet_pton (AF_INET6, start, &v6))
+ if (1 == inet_pton (AF_INET6, start, &v6.sin6_addr))
{
v6.sin6_family = AF_INET6;
v6.sin6_port = htons ((uint16_t) port);
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ v6.sin6_len = sizeof(sizeof(struct sockaddr_in6));
+#endif
in = GNUNET_memdup (&v6, sizeof(v6));
*sock_len = sizeof(v6);
GNUNET_free (cp);