aboutsummaryrefslogtreecommitdiff
path: root/src/util/common_logging.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/common_logging.c')
-rw-r--r--src/util/common_logging.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/util/common_logging.c b/src/util/common_logging.c
index 60f0b2e8b..de30cab3a 100644
--- a/src/util/common_logging.c
+++ b/src/util/common_logging.c
@@ -1462,11 +1462,17 @@ GNUNET_a2s (const struct sockaddr *addr,
1462 if (addrlen != sizeof (struct sockaddr_in)) 1462 if (addrlen != sizeof (struct sockaddr_in))
1463 return "<invalid v4 address>"; 1463 return "<invalid v4 address>";
1464 v4 = (const struct sockaddr_in *) addr; 1464 v4 = (const struct sockaddr_in *) addr;
1465 inet_ntop (AF_INET, &v4->sin_addr, buf, INET_ADDRSTRLEN); 1465 inet_ntop (AF_INET,
1466 &v4->sin_addr,
1467 buf,
1468 INET_ADDRSTRLEN);
1466 if (0 == ntohs (v4->sin_port)) 1469 if (0 == ntohs (v4->sin_port))
1467 return buf; 1470 return buf;
1468 strcat (buf, ":"); 1471 strcat (buf, ":");
1469 GNUNET_snprintf (b2, sizeof (b2), "%u", ntohs (v4->sin_port)); 1472 GNUNET_snprintf (b2,
1473 sizeof (b2),
1474 "%u",
1475 ntohs (v4->sin_port));
1470 strcat (buf, b2); 1476 strcat (buf, b2);
1471 return buf; 1477 return buf;
1472 case AF_INET6: 1478 case AF_INET6:
@@ -1474,12 +1480,19 @@ GNUNET_a2s (const struct sockaddr *addr,
1474 return "<invalid v4 address>"; 1480 return "<invalid v4 address>";
1475 v6 = (const struct sockaddr_in6 *) addr; 1481 v6 = (const struct sockaddr_in6 *) addr;
1476 buf[0] = '['; 1482 buf[0] = '[';
1477 inet_ntop (AF_INET6, &v6->sin6_addr, &buf[1], INET6_ADDRSTRLEN); 1483 inet_ntop (AF_INET6,
1484 &v6->sin6_addr,
1485 &buf[1],
1486 INET6_ADDRSTRLEN);
1478 if (0 == ntohs (v6->sin6_port)) 1487 if (0 == ntohs (v6->sin6_port))
1479 return &buf[1]; 1488 return &buf[1];
1480 strcat (buf, "]:"); 1489 strcat (buf, "]:");
1481 GNUNET_snprintf (b2, sizeof (b2), "%u", ntohs (v6->sin6_port)); 1490 GNUNET_snprintf (b2,
1482 strcat (buf, b2); 1491 sizeof (b2),
1492 "%u",
1493 ntohs (v6->sin6_port));
1494 strcat (buf,
1495 b2);
1483 return buf; 1496 return buf;
1484 case AF_UNIX: 1497 case AF_UNIX:
1485 if (addrlen <= sizeof (sa_family_t)) 1498 if (addrlen <= sizeof (sa_family_t))