diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-04-02 13:55:53 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-04-02 13:55:53 +0000 |
commit | 36acce256ce3d0a4dd85bb562b82895ed9f4017b (patch) | |
tree | 15a9b5256293adadacc07ab65648cbdaa7920316 /src/transport/plugin_transport_tcp.c | |
parent | f711ef398f4a4264b09b9a78a599bc863c2f28df (diff) | |
download | gnunet-36acce256ce3d0a4dd85bb562b82895ed9f4017b.tar.gz gnunet-36acce256ce3d0a4dd85bb562b82895ed9f4017b.zip |
- fix ipv6 address format for tcp pretty printer
Diffstat (limited to 'src/transport/plugin_transport_tcp.c')
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 95041d899..2fa96b464 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -1369,6 +1369,8 @@ struct PrettyPrinterContext | |||
1369 | * Port to add after the IP address. | 1369 | * Port to add after the IP address. |
1370 | */ | 1370 | */ |
1371 | uint16_t port; | 1371 | uint16_t port; |
1372 | |||
1373 | int ipv6; | ||
1372 | }; | 1374 | }; |
1373 | 1375 | ||
1374 | 1376 | ||
@@ -1390,7 +1392,10 @@ append_port (void *cls, const char *hostname) | |||
1390 | GNUNET_free (ppc); | 1392 | GNUNET_free (ppc); |
1391 | return; | 1393 | return; |
1392 | } | 1394 | } |
1393 | GNUNET_asprintf (&ret, "%s:%d", hostname, ppc->port); | 1395 | if (GNUNET_YES == ppc->ipv6) |
1396 | GNUNET_asprintf (&ret, "[%s]:%d", hostname, ppc->port); | ||
1397 | else | ||
1398 | GNUNET_asprintf (&ret, "%s:%d", hostname, ppc->port); | ||
1394 | ppc->asc (ppc->asc_cls, ret); | 1399 | ppc->asc (ppc->asc_cls, ret); |
1395 | GNUNET_free (ret); | 1400 | GNUNET_free (ret); |
1396 | } | 1401 | } |
@@ -1452,11 +1457,17 @@ tcp_plugin_address_pretty_printer (void *cls, const char *type, | |||
1452 | else | 1457 | else |
1453 | { | 1458 | { |
1454 | /* invalid address */ | 1459 | /* invalid address */ |
1460 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, "tcp", | ||
1461 | "Invalid address to string request: plugin `%s', address length: %u bytes\n"); | ||
1455 | GNUNET_break_op (0); | 1462 | GNUNET_break_op (0); |
1456 | asc (asc_cls, NULL); | 1463 | asc (asc_cls, NULL); |
1457 | return; | 1464 | return; |
1458 | } | 1465 | } |
1459 | ppc = GNUNET_malloc (sizeof (struct PrettyPrinterContext)); | 1466 | ppc = GNUNET_malloc (sizeof (struct PrettyPrinterContext)); |
1467 | if (addrlen == sizeof (struct IPv6TcpAddress)) | ||
1468 | ppc->ipv6 = GNUNET_YES; | ||
1469 | else | ||
1470 | ppc->ipv6 = GNUNET_NO; | ||
1460 | ppc->asc = asc; | 1471 | ppc->asc = asc; |
1461 | ppc->asc_cls = asc_cls; | 1472 | ppc->asc_cls = asc_cls; |
1462 | ppc->port = port; | 1473 | ppc->port = port; |