[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r4997 - GNUnet/src/transports
From: |
gnunet |
Subject: |
[GNUnet-SVN] r4997 - GNUnet/src/transports |
Date: |
Sat, 9 Jun 2007 18:16:16 -0600 (MDT) |
Author: grothoff
Date: 2007-06-09 18:16:16 -0600 (Sat, 09 Jun 2007)
New Revision: 4997
Modified:
GNUnet/src/transports/Makefile.am
GNUnet/src/transports/http.c
GNUnet/src/transports/ip.c
GNUnet/src/transports/ip.h
GNUnet/src/transports/tcp.c
GNUnet/src/transports/tcp6.c
GNUnet/src/transports/udp.c
GNUnet/src/transports/udp6.c
Log:
cache IP resolution
Modified: GNUnet/src/transports/Makefile.am
===================================================================
--- GNUnet/src/transports/Makefile.am 2007-06-09 23:37:14 UTC (rev 4996)
+++ GNUnet/src/transports/Makefile.am 2007-06-10 00:16:16 UTC (rev 4997)
@@ -80,6 +80,7 @@
libgnunettransport_tcp6_la_SOURCES = tcp6.c
libgnunettransport_tcp6_la_LIBADD = \
$(top_builddir)/src/util/libgnunetutil.la \
+ libip.la \
libip6.la
libgnunettransport_tcp6_la_LDFLAGS = \
-export-dynamic -avoid-version -module
@@ -87,6 +88,7 @@
libgnunettransport_udp6_la_SOURCES = udp6.c
libgnunettransport_udp6_la_LIBADD = \
$(top_builddir)/src/util/libgnunetutil.la \
+ libip.la \
libip6.la
libgnunettransport_udp6_la_LDFLAGS = \
-export-dynamic -avoid-version -module
Modified: GNUnet/src/transports/http.c
===================================================================
--- GNUnet/src/transports/http.c 2007-06-09 23:37:14 UTC (rev 4996)
+++ GNUnet/src/transports/http.c 2007-06-10 00:16:16 UTC (rev 4997)
@@ -1151,11 +1151,9 @@
char * ret;
const HostAddress * haddr = (const HostAddress*) &hello[1];
size_t n;
- const char * hn = "";
-#if HAVE_GETNAMEINFO
- char hostname[256];
+ char * hn;
struct sockaddr_in serverAddr;
-
+
if (do_resolve) {
memset((char *) &serverAddr,
0,
@@ -1165,29 +1163,13 @@
haddr,
sizeof(IPaddr));
serverAddr.sin_port = haddr->port;
- if (0 == getnameinfo((const struct sockaddr*) &serverAddr,
- sizeof(struct sockaddr_in),
- hostname,
- 255,
- NULL, 0,
- NI_NAMEREQD))
- hn = hostname;
- }
-#else
-#if HAVE_GETHOSTBYADDR
- struct hostent * ent;
- if (do_resolve) {
- ent = gethostbyaddr(haddr,
- sizeof(IPaddr),
- AF_INET);
- if (ent != NULL)
- hn = ent->h_name;
- }
-#endif
-#endif
- n = 4*4+7+6 + strlen(hn) + 10;
+ hn = getIPaddressAsString((const struct sockaddr*) &serverAddr,
+ sizeof(struct sockaddr_in));
+ } else
+ hn = NULL;
+ n = 4*4+6+6 + (hn == NULL ? 0 : strlen(hn)) + 10;
ret = MALLOC(n);
- if (strlen(hn) > 0) {
+ if (hn != NULL) {
SNPRINTF(ret,
n,
"%s (%u.%u.%u.%u) HTTP (%u)",
@@ -1201,6 +1183,7 @@
PRIP(ntohl(*(int*)&haddr->ip.addr)),
ntohs(haddr->port));
}
+ FREENONNULL(hn);
return ret;
}
Modified: GNUnet/src/transports/ip.c
===================================================================
--- GNUnet/src/transports/ip.c 2007-06-09 23:37:14 UTC (rev 4996)
+++ GNUnet/src/transports/ip.c 2007-06-10 00:16:16 UTC (rev 4997)
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- (C) 2001, 2002, 2004, 2005, 2006 Christian Grothoff (and other
contributing authors)
+ (C) 2001, 2002, 2004, 2005, 2006, 2007 Christian Grothoff (and other
contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
@@ -21,6 +21,7 @@
/**
* @file transports/ip.c
* @brief code to determine the IP of the local machine
+ * and to do DNS resolution (with caching)
*
* @author Christian Grothoff
* @author Tzvetan Horozov
@@ -69,4 +70,134 @@
return OK;
}
+struct IPCache {
+ struct IPCache * next;
+ char * addr;
+ struct sockaddr * sa;
+ cron_t last_refresh;
+ cron_t last_request;
+ unsigned int salen;
+};
+
+static struct IPCache * head;
+
+static struct MUTEX * lock;
+
+static void cache_resolve(struct IPCache * cache) {
+#if HAVE_GETNAMEINFO
+ char hostname[256];
+
+ if (0 == getnameinfo(cache->sa,
+ cache->salen,
+ hostname,
+ 255,
+ NULL, 0,
+ NI_NAMEREQD))
+ cache->addr = STRDUP(hostname);
+#else
+#if HAVE_GETHOSTBYADDR
+ struct hostent * ent;
+
+ switch (cache->sa->sa_family) {
+ case AF_INET:
+ ent = gethostbyaddr(&((struct sockaddr_in*) cache->sa)->sin_addr,
+ sizeof(IPaddr),
+ AF_INET);
+ break;
+ case AF_INET6:
+ ent = gethostbyaddr(&((struct sockaddr_in6*) cache->sa)->sin6_addr,
+ sizeof(IPaddr6),
+ AF_INET6);
+ break;
+ default:
+ ent = NULL;
+ }
+ if (ent != NULL)
+ cache->addr = STRDUP(ent->h_name);
+#endif
+#endif
+}
+
+static struct IPCache * resolve(const struct sockaddr * sa,
+ unsigned int salen) {
+ struct IPCache * ret;
+
+ ret = MALLOC(sizeof(struct IPCache));
+ ret->next = head;
+ ret->salen = salen;
+ ret->sa = salen == 0 ? NULL : MALLOC(salen);
+ memcpy(ret->sa,
+ sa,
+ salen);
+ ret->last_request = get_time();
+ ret->last_refresh = get_time();
+ cache_resolve(ret);
+ head = ret;
+ return ret;
+}
+
+
+/**
+ * Get an IP address as a string
+ * (works for both IPv4 and IPv6).
+ */
+char * getIPaddressAsString(const void * sav,
+ unsigned int salen) {
+ const struct sockaddr * sa = sav;
+ char * ret;
+ struct IPCache * cache;
+ struct IPCache * prev;
+ cron_t now;
+
+ now = get_time();
+ MUTEX_LOCK(lock);
+ cache = head;
+ prev = NULL;
+ while ( (cache != NULL) &&
+ ( (cache->salen != salen) ||
+ (0 != memcmp(cache->sa,
+ sa,
+ salen) ) ) ) {
+ if (cache->last_request + 60 * cronMINUTES < now) {
+ prev->next = cache->next;
+ FREENONNULL(cache->addr);
+ FREE(cache->sa);
+ FREE(cache);
+ cache = prev;
+ }
+ prev = cache;
+ cache = cache->next;
+ }
+ if (cache != NULL) {
+ cache->last_request = now;
+ if (cache->last_refresh + 12 * cronHOURS < now) {
+ FREENONNULL(cache->addr);
+ cache->addr = NULL;
+ cache_resolve(cache);
+ }
+ } else
+ cache = resolve(sa, salen);
+ ret = (cache->addr == NULL) ? NULL : STRDUP(cache->addr);
+ MUTEX_UNLOCK(lock);
+ return ret;
+}
+
+
+void __attribute__ ((constructor)) gnunet_ip_ltdl_init() {
+ lock = MUTEX_CREATE(YES);
+}
+
+void __attribute__ ((destructor)) gnunet_ip_ltdl_fini() {
+ struct IPCache * pos;
+ MUTEX_DESTROY(lock);
+ while (head != NULL) {
+ pos = head->next;
+ FREENONNULL(head->addr);
+ FREE(head->sa);
+ FREE(head);
+ head = pos;
+ }
+}
+
+
/* end of ip.c */
Modified: GNUnet/src/transports/ip.h
===================================================================
--- GNUnet/src/transports/ip.h 2007-06-09 23:37:14 UTC (rev 4996)
+++ GNUnet/src/transports/ip.h 2007-06-10 00:16:16 UTC (rev 4997)
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- (C) 2001, 2002, 2003, 2004, 2005 Christian Grothoff (and other
contributing authors)
+ (C) 2001, 2002, 2003, 2004, 2005, 2007 Christian Grothoff (and other
contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
@@ -20,7 +20,8 @@
/**
* @file transports/ip.h
- * @brief
+ * @brief code to determine the IP of the local machine
+ * and to do DNS resolution (with caching)
*
* @author Christian Grothoff
*/
@@ -28,6 +29,8 @@
#ifndef IP_H
#define IP_H
+#include "gnunet_util.h"
+
/**
* @brief Determine the (external) IP of the local machine.
*
@@ -46,4 +49,13 @@
struct GE_Context * ectx,
IPaddr * address);
+
+/**
+ * Get an IP address as a string
+ * (works for both IPv4 and IPv6).
+ * @param sa should be of type "struct sockaddr*"
+ */
+char * getIPaddressAsString(const void * sa,
+ unsigned int salen);
+
#endif
Modified: GNUnet/src/transports/tcp.c
===================================================================
--- GNUnet/src/transports/tcp.c 2007-06-09 23:37:14 UTC (rev 4996)
+++ GNUnet/src/transports/tcp.c 2007-06-10 00:16:16 UTC (rev 4997)
@@ -502,11 +502,9 @@
char * ret;
const HostAddress * haddr = (const HostAddress*) &hello[1];
size_t n;
- const char * hn = "";
-#if HAVE_GETNAMEINFO
- char hostname[256];
+ char * hn;
struct sockaddr_in serverAddr;
-
+
if (do_resolve) {
memset((char *) &serverAddr,
0,
@@ -516,29 +514,13 @@
haddr,
sizeof(IPaddr));
serverAddr.sin_port = haddr->port;
- if (0 == getnameinfo((const struct sockaddr*) &serverAddr,
- sizeof(struct sockaddr_in),
- hostname,
- 255,
- NULL, 0,
- NI_NAMEREQD))
- hn = hostname;
- }
-#else
-#if HAVE_GETHOSTBYADDR
- struct hostent * ent;
- if (do_resolve) {
- ent = gethostbyaddr(haddr,
- sizeof(IPaddr),
- AF_INET);
- if (ent != NULL)
- hn = ent->h_name;
- }
-#endif
-#endif
- n = 4*4+6+6 + strlen(hn) + 10;
+ hn = getIPaddressAsString((const struct sockaddr*) &serverAddr,
+ sizeof(struct sockaddr_in));
+ } else
+ hn = NULL;
+ n = 4*4+6+6 + (hn == NULL ? 0 : strlen(hn)) + 10;
ret = MALLOC(n);
- if (strlen(hn) > 0) {
+ if (hn != NULL) {
SNPRINTF(ret,
n,
"%s (%u.%u.%u.%u) TCP (%u)",
@@ -552,6 +534,7 @@
PRIP(ntohl(*(int*)&haddr->ip.addr)),
ntohs(haddr->port));
}
+ FREENONNULL(hn);
return ret;
}
Modified: GNUnet/src/transports/tcp6.c
===================================================================
--- GNUnet/src/transports/tcp6.c 2007-06-09 23:37:14 UTC (rev 4996)
+++ GNUnet/src/transports/tcp6.c 2007-06-10 00:16:16 UTC (rev 4997)
@@ -29,6 +29,7 @@
#include "gnunet_transport.h"
#include "gnunet_stats_service.h"
#include "platform.h"
+#include "ip.h"
#include "ip6.h"
#define DEBUG_TCP6 NO
@@ -457,12 +458,9 @@
char * ret;
char inet6[INET6_ADDRSTRLEN];
const Host6Address * haddr = (const Host6Address*) &hello[1];
- const char * hn = "";
+ char * hn;
size_t n;
-
-#if HAVE_GETNAMEINFO
struct sockaddr_in6 serverAddr;
- char hostname[256];
if (do_resolve) {
memset((char *) &serverAddr,
@@ -472,31 +470,14 @@
memcpy(&serverAddr.sin6_addr,
haddr,
sizeof(IP6addr));
- serverAddr.sin6_port = haddr->port;
- if (0 == getnameinfo((const struct sockaddr* ) haddr,
- sizeof(struct sockaddr_in6),
- hostname,
- 255,
- NULL, 0,
- NI_NAMEREQD))
- hn = hostname;
- }
-#else
-#if HAVE_GETHOSTBYADDR
- struct hostent * ent;
-
- if (do_resolve) {
- ent = gethostbyaddr(haddr,
- sizeof(IP6addr),
- AF_INET6);
- if (ent != NULL)
- hn = ent->h_name;
- }
-#endif
-#endif
- n = INET6_ADDRSTRLEN + 16 + strlen(hn) + 10;
+ serverAddr.sin6_port = haddr->port;
+ hn = getIPaddressAsString((const struct sockaddr*) &serverAddr,
+ sizeof(struct sockaddr_in));
+ } else
+ hn = NULL;
+ n = INET6_ADDRSTRLEN + 16 + (hn == NULL ? 0 : strlen(hn)) + 10;
ret = MALLOC(n);
- if (strlen(hn) > 0) {
+ if (hn != NULL) {
SNPRINTF(ret,
n,
"%s (%s) TCP6 (%u)",
@@ -516,6 +497,7 @@
INET6_ADDRSTRLEN),
ntohs(haddr->port));
}
+ FREENONNULL(hn);
return ret;
}
Modified: GNUnet/src/transports/udp.c
===================================================================
--- GNUnet/src/transports/udp.c 2007-06-09 23:37:14 UTC (rev 4996)
+++ GNUnet/src/transports/udp.c 2007-06-10 00:16:16 UTC (rev 4997)
@@ -45,12 +45,12 @@
/**
* claimed IP of the sender, network byte order
*/
- IPaddr senderIP;
+ IPaddr ip;
/**
* claimed port of the sender, network byte order
*/
- unsigned short senderPort;
+ unsigned short port;
/**
* reserved (set to 0 for signature verification)
@@ -237,16 +237,16 @@
GE_BREAK(NULL, 0);
return SYSERR;
}
- if ( (YES == isBlacklisted(&haddr->senderIP,
+ if ( (YES == isBlacklisted(&haddr->ip,
sizeof(IPaddr))) ||
- (YES != isWhitelisted(&haddr->senderIP,
+ (YES != isWhitelisted(&haddr->ip,
sizeof(IPaddr))) ) {
#if DEBUG_UDP
GE_LOG(ectx,
GE_DEBUG | GE_USER | GE_BULK,
"Rejecting UDP HELLO from %u.%u.%u.%u:%u due to configuration.\n",
- PRIP(ntohl(*(int*)&haddr->senderIP.addr)),
- ntohs(haddr->senderPort));
+ PRIP(ntohl(*(int*)&haddr->ip.addr)),
+ ntohs(haddr->port));
#endif
return SYSERR; /* obviously invalid */
}
@@ -254,8 +254,8 @@
GE_LOG(ectx,
GE_DEBUG | GE_USER | GE_BULK,
"Verified UDP HELLO from %u.%u.%u.%u:%u.\n",
- PRIP(ntohl(*(int*)&haddr->senderIP.addr)),
- ntohs(haddr->senderPort));
+ PRIP(ntohl(*(int*)&haddr->ip.addr)),
+ ntohs(haddr->port));
#endif
return OK;
}
@@ -283,10 +283,10 @@
if (! ( ( (upnp != NULL) &&
(OK == upnp->get_ip(port,
"UDP",
- &haddr->senderIP)) ) ||
+ &haddr->ip)) ) ||
(SYSERR != getPublicIPAddress(cfg,
ectx,
- &haddr->senderIP)) ) ) {
+ &haddr->ip)) ) ) {
FREE(msg);
GE_LOG(ectx,
GE_WARNING | GE_ADMIN | GE_USER | GE_BULK,
@@ -296,8 +296,8 @@
GE_LOG(ectx,
GE_INFO | GE_USER | GE_BULK,
"UDP uses IP address %u.%u.%u.%u.\n",
- PRIP(ntohl(*(int*)&haddr->senderIP)));
- haddr->senderPort = htons(port);
+ PRIP(ntohl(*(int*)&haddr->ip)));
+ haddr->port = htons(port);
haddr->reserved = htons(0);
msg->senderAddressSize = htons(sizeof(HostAddress));
msg->protocol = htons(UDP_PROTOCOL_NUMBER);
@@ -351,11 +351,11 @@
ok = SYSERR;
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
- sin.sin_port = haddr->senderPort;
+ sin.sin_port = haddr->port;
GE_ASSERT(ectx, sizeof(struct in_addr) == sizeof(IPaddr));
memcpy(&sin.sin_addr,
- &haddr->senderIP,
+ &haddr->ip,
sizeof(IPaddr));
#if DEBUG_UDP
GE_LOG(ectx,
@@ -484,12 +484,9 @@
char * ret;
const HostAddress * haddr = (const HostAddress*) &hello[1];
size_t n;
- const char * hn = "";
-
-#if HAVE_GETNAMEINFO
- char hostname[256];
+ char * hn;
struct sockaddr_in serverAddr;
-
+
if (do_resolve) {
memset((char *) &serverAddr,
0,
@@ -498,43 +495,28 @@
memcpy(&serverAddr.sin_addr,
haddr,
sizeof(IPaddr));
- serverAddr.sin_port = haddr->senderPort;
- if (0 == getnameinfo((const struct sockaddr* ) &serverAddr,
- sizeof(struct sockaddr_in),
- hostname,
- 255,
- NULL, 0,
- NI_NAMEREQD))
- hn = hostname;
- }
-#else
-#if HAVE_GETHOSTBYADDR
- struct hostent * ent;
- if (do_resolve) {
- ent = gethostbyaddr(haddr,
- sizeof(IPaddr),
- AF_INET);
- if (ent != NULL)
- hn = ent->h_name;
- }
-#endif
-#endif
- n = 4*4+6+6 + strlen(hn) + 10;
+ serverAddr.sin_port = haddr->port;
+ hn = getIPaddressAsString((const struct sockaddr*) &serverAddr,
+ sizeof(struct sockaddr_in));
+ } else
+ hn = NULL;
+ n = 4*4+6+6 + (hn == NULL ? 0 : strlen(hn)) + 10;
ret = MALLOC(n);
- if (strlen(hn) > 0) {
+ if (hn != NULL) {
SNPRINTF(ret,
n,
"%s (%u.%u.%u.%u) UDP (%u)",
hn,
- PRIP(ntohl(*(int*)&haddr->senderIP.addr)),
- ntohs(haddr->senderPort));
+ PRIP(ntohl(*(int*)&haddr->ip.addr)),
+ ntohs(haddr->port));
} else {
SNPRINTF(ret,
n,
"%u.%u.%u.%u UDP (%u)",
- PRIP(ntohl(*(int*)&haddr->senderIP.addr)),
- ntohs(haddr->senderPort));
+ PRIP(ntohl(*(int*)&haddr->ip.addr)),
+ ntohs(haddr->port));
}
+ FREENONNULL(hn);
return ret;
}
Modified: GNUnet/src/transports/udp6.c
===================================================================
--- GNUnet/src/transports/udp6.c 2007-06-09 23:37:14 UTC (rev 4996)
+++ GNUnet/src/transports/udp6.c 2007-06-10 00:16:16 UTC (rev 4997)
@@ -29,6 +29,7 @@
#include "gnunet_transport.h"
#include "gnunet_stats_service.h"
#include "platform.h"
+#include "ip.h"
#include "ip6.h"
#define DEBUG_UDP6 NO
@@ -42,12 +43,12 @@
/**
* claimed IP of the sender, network byte order
*/
- IP6addr senderIP;
+ IP6addr ip;
/**
* claimed port of the sender, network byte order
*/
- unsigned short senderPort;
+ unsigned short port;
/**
* reserved (set to 0 for signature verification)
@@ -219,9 +220,9 @@
if ( (ntohs(hello->senderAddressSize) != sizeof(Host6Address)) ||
(ntohs(hello->header.size) != P2P_hello_MESSAGE_size(hello)) ||
(ntohs(hello->header.type) != p2p_PROTO_hello) ||
- (YES == isBlacklisted(&haddr->senderIP,
+ (YES == isBlacklisted(&haddr->ip,
sizeof(IP6addr))) ||
- (YES != isWhitelisted(&haddr->senderIP,
+ (YES != isWhitelisted(&haddr->ip,
sizeof(IP6addr))) )
return SYSERR; /* obviously invalid */
else {
@@ -230,10 +231,10 @@
GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
"Verified UDP6 hello from %u.%u.%u.%u:%u.\n",
inet_ntop(AF_INET6,
- &haddr->senderIP,
+ &haddr->ip,
inet6,
INET6_ADDRSTRLEN),
- ntohs(haddr->senderPort));
+ ntohs(haddr->port));
#endif
return OK;
}
@@ -260,14 +261,14 @@
if (SYSERR == getPublicIP6Address(cfg,
ectx,
- &haddr->senderIP)) {
+ &haddr->ip)) {
FREE(msg);
GE_LOG(ectx,
GE_WARNING,
_("UDP6: Could not determine my public IPv6 address.\n"));
return NULL;
}
- haddr->senderPort = htons(port);
+ haddr->port = htons(port);
haddr->reserved = htons(0);
msg->senderAddressSize = htons(sizeof(Host6Address));
msg->protocol = htons(UDP6_PROTOCOL_NUMBER);
@@ -323,9 +324,9 @@
ok = SYSERR;
memset(&sin, 0, sizeof(sin));
sin.sin6_family = AF_INET6;
- sin.sin6_port = haddr->senderPort;
+ sin.sin6_port = haddr->port;
memcpy(&sin.sin6_addr,
- &haddr->senderIP.addr,
+ &haddr->ip.addr,
sizeof(IP6addr));
#if DEBUG_UDP6
GE_LOG(ectx,
@@ -366,7 +367,7 @@
*
* @return OK on success, SYSERR if the operation failed
*/
-static int startTransportServer(void) {
+static int startTransportServer() {
int sock;
unsigned short port;
@@ -411,7 +412,7 @@
/**
* Reload the configuration. Should never fail.
*/
-static int reloadConfiguration(void) {
+static int reloadConfiguration() {
char * ch;
MUTEX_LOCK(configLock);
@@ -448,12 +449,9 @@
char * ret;
char inet6[INET6_ADDRSTRLEN];
const Host6Address * haddr = (const Host6Address*) &hello[1];
- const char * hn = "";
+ char * hn;
size_t n;
-
-#if HAVE_GETNAMEINFO
struct sockaddr_in6 serverAddr;
- char hostname[256];
if (do_resolve) {
memset((char *) &serverAddr,
@@ -463,49 +461,34 @@
memcpy(&serverAddr.sin6_addr,
haddr,
sizeof(IP6addr));
- serverAddr.sin6_port = haddr->senderPort;
- if (0 == getnameinfo((const struct sockaddr* ) haddr,
- sizeof(struct sockaddr_in6),
- hostname,
- 255,
- NULL, 0,
- NI_NAMEREQD))
- hn = hostname;
- }
-#else
-#if HAVE_GETHOSTBYADDR
- struct hostent * ent;
- if (do_resolve) {
- ent = gethostbyaddr(haddr,
- sizeof(IPaddr),
- AF_INET);
- if (ent != NULL)
- hn = ent->h_name;
- }
-#endif
-#endif
- n = INET6_ADDRSTRLEN + 16 + strlen(hn) + 10;
+ serverAddr.sin6_port = haddr->port;
+ hn = getIPaddressAsString((const struct sockaddr*) &serverAddr,
+ sizeof(struct sockaddr_in));
+ } else
+ hn = NULL;
+ n = INET6_ADDRSTRLEN + 16 + (hn == NULL ? 0 : strlen(hn)) + 10;
ret = MALLOC(n);
- if (strlen(hn) > 0) {
+ if (hn != NULL) {
SNPRINTF(ret,
n,
- "%s (%s) UDP6 (%u)",
+ "%s (%s) TCP6 (%u)",
hn,
inet_ntop(AF_INET6,
haddr,
inet6,
INET6_ADDRSTRLEN),
- ntohs(haddr->senderPort));
+ ntohs(haddr->port));
} else {
SNPRINTF(ret,
n,
- "%s UDP6 (%u)",
+ "%s TCP6 (%u)",
inet_ntop(AF_INET6,
haddr,
inet6,
INET6_ADDRSTRLEN),
- ntohs(haddr->senderPort));
+ ntohs(haddr->port));
}
+ FREENONNULL(hn);
return ret;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r4997 - GNUnet/src/transports,
gnunet <=