aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-11-24 12:00:30 +0000
committerChristian Grothoff <christian@grothoff.org>2010-11-24 12:00:30 +0000
commit364b7d59c77677d3b18478118f3636515ad4d0ed (patch)
treef2cfe5335add1d58e70fd3269bd002e8762dd97b
parenta83c0b0a14ce303375e0304034de165d8709457d (diff)
downloadgnunet-364b7d59c77677d3b18478118f3636515ad4d0ed.tar.gz
gnunet-364b7d59c77677d3b18478118f3636515ad4d0ed.zip
style
-rw-r--r--src/transport/plugin_transport_tcp.c484
1 files changed, 278 insertions, 206 deletions
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index c77963e32..94f1eb329 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -880,8 +880,7 @@ disconnect_session (struct Session *session)
880 "tcp", 880 "tcp",
881 pm->transmit_cont != NULL 881 pm->transmit_cont != NULL
882 ? "Could not deliver message to `%4s'.\n" 882 ? "Could not deliver message to `%4s'.\n"
883 : 883 : "Could not deliver message to `%4s', notifying.\n",
884 "Could not deliver message to `%4s', notifying.\n",
885 GNUNET_i2s (&session->target)); 884 GNUNET_i2s (&session->target));
886#endif 885#endif
887 GNUNET_STATISTICS_update (session->plugin->env->stats, 886 GNUNET_STATISTICS_update (session->plugin->env->stats,
@@ -1190,7 +1189,8 @@ tcp_plugin_send (void *cls,
1190#endif 1189#endif
1191 session = create_session (plugin, 1190 session = create_session (plugin,
1192 target, 1191 target,
1193 NULL, is_natd); 1192 NULL,
1193 is_natd);
1194 1194
1195 /* create new message entry */ 1195 /* create new message entry */
1196 pm = GNUNET_malloc (sizeof (struct PendingMessage) + msgbuf_size); 1196 pm = GNUNET_malloc (sizeof (struct PendingMessage) + msgbuf_size);
@@ -1210,7 +1210,10 @@ tcp_plugin_send (void *cls,
1210 session->pending_messages_tail, 1210 session->pending_messages_tail,
1211 pm); 1211 pm);
1212 1212
1213 GNUNET_assert(GNUNET_CONTAINER_multihashmap_put(plugin->nat_wait_conns, &target->hashPubKey, session, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY) == GNUNET_OK); 1213 GNUNET_assert(GNUNET_CONTAINER_multihashmap_put(plugin->nat_wait_conns,
1214 &target->hashPubKey,
1215 session,
1216 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY) == GNUNET_OK);
1214#if DEBUG_TCP_NAT 1217#if DEBUG_TCP_NAT
1215 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, 1218 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
1216 "tcp", 1219 "tcp",
@@ -1221,7 +1224,9 @@ tcp_plugin_send (void *cls,
1221 run_gnunet_nat_client (plugin, &a4); 1224 run_gnunet_nat_client (plugin, &a4);
1222 return 0; 1225 return 0;
1223 } 1226 }
1224 else if ((plugin->allow_nat == GNUNET_YES) && (is_natd == GNUNET_YES) && (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains(plugin->nat_wait_conns, &target->hashPubKey))) 1227 if ( (plugin->allow_nat == GNUNET_YES) &&
1228 (is_natd == GNUNET_YES) &&
1229 (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains(plugin->nat_wait_conns, &target->hashPubKey)) )
1225 { 1230 {
1226 /* Only do one NAT punch attempt per peer identity */ 1231 /* Only do one NAT punch attempt per peer identity */
1227 return -1; 1232 return -1;
@@ -1252,7 +1257,8 @@ tcp_plugin_send (void *cls,
1252 session = create_session (plugin, 1257 session = create_session (plugin,
1253 target, 1258 target,
1254 GNUNET_SERVER_connect_socket (plugin->server, 1259 GNUNET_SERVER_connect_socket (plugin->server,
1255 sa), is_natd); 1260 sa),
1261 is_natd);
1256 session->connect_addr = GNUNET_malloc (addrlen); 1262 session->connect_addr = GNUNET_malloc (addrlen);
1257 memcpy (session->connect_addr, 1263 memcpy (session->connect_addr,
1258 addr, 1264 addr,
@@ -1480,9 +1486,7 @@ check_port (struct Plugin *plugin, uint16_t in_port)
1480 return GNUNET_OK; 1486 return GNUNET_OK;
1481 if ( (plugin->only_nat_addresses == GNUNET_YES) && 1487 if ( (plugin->only_nat_addresses == GNUNET_YES) &&
1482 (plugin->behind_nat == GNUNET_YES) ) 1488 (plugin->behind_nat == GNUNET_YES) )
1483 { 1489 return GNUNET_SYSERR; /* odd case... */
1484 return GNUNET_SYSERR; /* odd case... */
1485 }
1486 if ((in_port == plugin->adv_port) || (in_port == plugin->open_port)) 1490 if ((in_port == plugin->adv_port) || (in_port == plugin->open_port))
1487 return GNUNET_OK; 1491 return GNUNET_OK;
1488 return GNUNET_SYSERR; 1492 return GNUNET_SYSERR;
@@ -1527,9 +1531,7 @@ tcp_plugin_check_address (void *cls,
1527 return GNUNET_SYSERR; 1531 return GNUNET_SYSERR;
1528 if (GNUNET_OK != 1532 if (GNUNET_OK !=
1529 check_local_addr (plugin, &v4->ipv4_addr, sizeof (uint32_t))) 1533 check_local_addr (plugin, &v4->ipv4_addr, sizeof (uint32_t)))
1530 { 1534 return GNUNET_SYSERR;
1531 return GNUNET_SYSERR;
1532 }
1533 } 1535 }
1534 else 1536 else
1535 { 1537 {
@@ -1544,13 +1546,12 @@ tcp_plugin_check_address (void *cls,
1544 return GNUNET_SYSERR; 1546 return GNUNET_SYSERR;
1545 if (GNUNET_OK != 1547 if (GNUNET_OK !=
1546 check_local_addr (plugin, &v6->ipv6_addr, sizeof (struct in6_addr))) 1548 check_local_addr (plugin, &v6->ipv6_addr, sizeof (struct in6_addr)))
1547 { 1549 return GNUNET_SYSERR;
1548 return GNUNET_SYSERR;
1549 }
1550 } 1550 }
1551 return GNUNET_OK; 1551 return GNUNET_OK;
1552} 1552}
1553 1553
1554
1554/** 1555/**
1555 * We've received a nat probe from this peer via TCP. Finish 1556 * We've received a nat probe from this peer via TCP. Finish
1556 * creating the client session and resume sending of queued 1557 * creating the client session and resume sending of queued
@@ -1562,12 +1563,12 @@ tcp_plugin_check_address (void *cls,
1562 */ 1563 */
1563static void 1564static void
1564handle_tcp_nat_probe (void *cls, 1565handle_tcp_nat_probe (void *cls,
1565 struct GNUNET_SERVER_Client *client, 1566 struct GNUNET_SERVER_Client *client,
1566 const struct GNUNET_MessageHeader *message) 1567 const struct GNUNET_MessageHeader *message)
1567{ 1568{
1568 struct Plugin *plugin = cls; 1569 struct Plugin *plugin = cls;
1569 struct Session *session; 1570 struct Session *session;
1570 struct TCP_NAT_ProbeMessage *tcp_nat_probe; 1571 const struct TCP_NAT_ProbeMessage *tcp_nat_probe;
1571 size_t alen; 1572 size_t alen;
1572 void *vaddr; 1573 void *vaddr;
1573 struct IPv4TcpAddress *t4; 1574 struct IPv4TcpAddress *t4;
@@ -1591,84 +1592,94 @@ handle_tcp_nat_probe (void *cls,
1591 GNUNET_break_op(0); 1592 GNUNET_break_op(0);
1592 return; 1593 return;
1593 } 1594 }
1594 tcp_nat_probe = (struct TCP_NAT_ProbeMessage *)message; 1595 tcp_nat_probe = (const struct TCP_NAT_ProbeMessage *)message;
1595 1596 session = GNUNET_CONTAINER_multihashmap_get(plugin->nat_wait_conns,
1596 if (GNUNET_CONTAINER_multihashmap_contains(plugin->nat_wait_conns, &tcp_nat_probe->clientIdentity.hashPubKey) == GNUNET_YES) 1597 &tcp_nat_probe->clientIdentity.hashPubKey);
1598 if (session == NULL)
1597 { 1599 {
1598#if DEBUG_TCP_NAT 1600#if DEBUG_TCP_NAT
1599 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, 1601 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
1600 "tcp", 1602 "tcp",
1601 "Found session for NAT probe!\n"); 1603 "Did NOT find session for NAT probe!\n");
1602#endif 1604#endif
1603 session = GNUNET_CONTAINER_multihashmap_get(plugin->nat_wait_conns, &tcp_nat_probe->clientIdentity.hashPubKey); 1605 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1604 GNUNET_assert(session != NULL); 1606 return;
1605 GNUNET_assert(GNUNET_CONTAINER_multihashmap_remove(plugin->nat_wait_conns, &tcp_nat_probe->clientIdentity.hashPubKey, session) == GNUNET_YES); 1607 }
1606 GNUNET_SERVER_client_keep (client);
1607 session->client = client;
1608 session->last_activity = GNUNET_TIME_absolute_get ();
1609 session->inbound = GNUNET_NO;
1610
1611 if (GNUNET_OK ==
1612 GNUNET_SERVER_client_get_address (client, &vaddr, &alen))
1613 {
1614#if DEBUG_TCP_NAT 1608#if DEBUG_TCP_NAT
1615 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, 1609 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
1616 "tcp", 1610 "tcp",
1617 "handle_tcp_nat_probe Found address `%s' for incoming connection %p\n", 1611 "Found session for NAT probe!\n");
1618 GNUNET_a2s (vaddr, alen),
1619 client);
1620#endif 1612#endif
1621 if (((const struct sockaddr *)vaddr)->sa_family == AF_INET) 1613 GNUNET_assert(GNUNET_CONTAINER_multihashmap_remove(plugin->nat_wait_conns,
1622 { 1614 &tcp_nat_probe->clientIdentity.hashPubKey,
1623 s4 = vaddr; 1615 session) == GNUNET_YES);
1624 t4 = GNUNET_malloc (sizeof (struct IPv4TcpAddress)); 1616 if (GNUNET_OK !=
1625 t4->t_port = s4->sin_port; 1617 GNUNET_SERVER_client_get_address (client, &vaddr, &alen))
1626 t4->ipv4_addr = s4->sin_addr.s_addr; 1618 {
1627 session->connect_addr = t4; 1619 GNUNET_break (0);
1628 session->connect_alen = sizeof (struct IPv4TcpAddress); 1620 GNUNET_free (session);
1629 } 1621 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1630 else if (((const struct sockaddr *)vaddr)->sa_family == AF_INET6) 1622 return;
1631 { 1623 }
1632 s6 = vaddr; 1624
1633 t6 = GNUNET_malloc (sizeof (struct IPv6TcpAddress)); 1625 GNUNET_SERVER_client_keep (client);
1634 t6->t6_port = s6->sin6_port; 1626 session->client = client;
1635 memcpy (&t6->ipv6_addr, 1627 session->last_activity = GNUNET_TIME_absolute_get ();
1636 &s6->sin6_addr, 1628 session->inbound = GNUNET_NO;
1637 sizeof (struct in6_addr)); 1629
1638 session->connect_addr = t6;
1639 session->connect_alen = sizeof (struct IPv6TcpAddress);
1640 }
1641 else
1642 {
1643#if DEBUG_TCP_NAT 1630#if DEBUG_TCP_NAT
1644 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, 1631 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
1645 "tcp", 1632 "tcp",
1646 "Bad address for incoming connection!\n"); 1633 "handle_tcp_nat_probe Found address `%s' for incoming connection %p\n",
1634 GNUNET_a2s (vaddr, alen),
1635 client);
1647#endif 1636#endif
1648 } 1637 switch (((const struct sockaddr *)vaddr)->sa_family)
1649 GNUNET_free (vaddr); 1638 {
1650 } 1639 case AF_INET:
1651 1640 s4 = vaddr;
1652 session->next = plugin->sessions; 1641 t4 = GNUNET_malloc (sizeof (struct IPv4TcpAddress));
1653 plugin->sessions = session; 1642 t4->t_port = s4->sin_port;
1654 GNUNET_STATISTICS_update (plugin->env->stats, 1643 t4->ipv4_addr = s4->sin_addr.s_addr;
1655 gettext_noop ("# TCP sessions active"), 1644 session->connect_addr = t4;
1656 1, 1645 session->connect_alen = sizeof (struct IPv4TcpAddress);
1657 GNUNET_NO); 1646 break;
1658 process_pending_messages (session); 1647 case AF_INET6:
1659 } 1648 s6 = vaddr;
1660 else 1649 t6 = GNUNET_malloc (sizeof (struct IPv6TcpAddress));
1661 { 1650 t6->t6_port = s6->sin6_port;
1651 memcpy (&t6->ipv6_addr,
1652 &s6->sin6_addr,
1653 sizeof (struct in6_addr));
1654 session->connect_addr = t6;
1655 session->connect_alen = sizeof (struct IPv6TcpAddress);
1656 break;
1657 default:
1658 GNUNET_break_op (0);
1662#if DEBUG_TCP_NAT 1659#if DEBUG_TCP_NAT
1663 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, 1660 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
1664 "tcp", 1661 "tcp",
1665 "Did NOT find session for NAT probe!\n"); 1662 "Bad address for incoming connection!\n");
1666#endif 1663#endif
1664 GNUNET_free (vaddr);
1665 GNUNET_SERVER_client_drop (client);
1666 GNUNET_free (session);
1667 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
1668 return;
1667 } 1669 }
1668 1670 GNUNET_free (vaddr);
1671
1672 session->next = plugin->sessions;
1673 plugin->sessions = session;
1674 GNUNET_STATISTICS_update (plugin->env->stats,
1675 gettext_noop ("# TCP sessions active"),
1676 1,
1677 GNUNET_NO);
1678 process_pending_messages (session);
1669 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1679 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1670} 1680}
1671 1681
1682
1672/** 1683/**
1673 * We've received a welcome from this peer via TCP. Possibly create a 1684 * We've received a welcome from this peer via TCP. Possibly create a
1674 * fresh client record and send back our welcome. 1685 * fresh client record and send back our welcome.
@@ -1707,7 +1718,6 @@ handle_tcp_welcome (void *cls,
1707 1718
1708 if (session == NULL) 1719 if (session == NULL)
1709 { 1720 {
1710 GNUNET_SERVER_client_keep (client);
1711#if DEBUG_TCP_NAT 1721#if DEBUG_TCP_NAT
1712 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, 1722 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
1713 "tcp", 1723 "tcp",
@@ -1715,8 +1725,11 @@ handle_tcp_welcome (void *cls,
1715 "WELCOME", 1725 "WELCOME",
1716 GNUNET_i2s (&wm->clientIdentity), client); 1726 GNUNET_i2s (&wm->clientIdentity), client);
1717#endif 1727#endif
1728 GNUNET_SERVER_client_keep (client);
1718 session = create_session (plugin, 1729 session = create_session (plugin,
1719 &wm->clientIdentity, client, GNUNET_NO); 1730 &wm->clientIdentity,
1731 client,
1732 GNUNET_NO);
1720 session->inbound = GNUNET_YES; 1733 session->inbound = GNUNET_YES;
1721 if (GNUNET_OK == 1734 if (GNUNET_OK ==
1722 GNUNET_SERVER_client_get_address (client, &vaddr, &alen)) 1735 GNUNET_SERVER_client_get_address (client, &vaddr, &alen))
@@ -1802,7 +1815,8 @@ handle_tcp_welcome (void *cls,
1802 * @param tc task context (unused) 1815 * @param tc task context (unused)
1803 */ 1816 */
1804static void 1817static void
1805delayed_done (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 1818delayed_done (void *cls,
1819 const struct GNUNET_SCHEDULER_TaskContext *tc)
1806{ 1820{
1807 struct Session *session = cls; 1821 struct Session *session = cls;
1808 struct GNUNET_TIME_Relative delay; 1822 struct GNUNET_TIME_Relative delay;
@@ -1837,15 +1851,18 @@ handle_tcp_data (void *cls,
1837 struct Plugin *plugin = cls; 1851 struct Plugin *plugin = cls;
1838 struct Session *session; 1852 struct Session *session;
1839 struct GNUNET_TIME_Relative delay; 1853 struct GNUNET_TIME_Relative delay;
1854 uint16_t type;
1840 1855
1841 if ((GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_WELCOME == ntohs(message->type)) || (ntohs(message->type) == GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_NAT_PROBE)) 1856 type = ntohs (message->type);
1857 if ( (GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_WELCOME == type) ||
1858 (GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_NAT_PROBE == type) )
1842 { 1859 {
1843 /* We don't want to propagate WELCOME and NAT Probe messages up! */ 1860 /* We don't want to propagate WELCOME and NAT Probe messages up! */
1844 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1861 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1845 return; 1862 return;
1846 } 1863 }
1847 session = find_session_by_client (plugin, client); 1864 session = find_session_by_client (plugin, client);
1848 if ( (NULL == session) || (GNUNET_YES == session->expecting_welcome)) 1865 if ( (NULL == session) || (GNUNET_YES == session->expecting_welcome) )
1849 { 1866 {
1850 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 1867 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
1851 return; 1868 return;
@@ -1939,8 +1956,9 @@ process_interfaces (void *cls,
1939 1956
1940 af = addr->sa_family; 1957 af = addr->sa_family;
1941 arg_nat = NULL; 1958 arg_nat = NULL;
1942 if (af == AF_INET) 1959 switch (af)
1943 { 1960 {
1961 case AF_INET:
1944 t4.ipv4_addr = ((struct sockaddr_in *) addr)->sin_addr.s_addr; 1962 t4.ipv4_addr = ((struct sockaddr_in *) addr)->sin_addr.s_addr;
1945 GNUNET_assert(NULL != inet_ntop(AF_INET, &t4.ipv4_addr, &buf[0], INET_ADDRSTRLEN)); 1963 GNUNET_assert(NULL != inet_ntop(AF_INET, &t4.ipv4_addr, &buf[0], INET_ADDRSTRLEN));
1946 if ((plugin->bind_address != NULL) && (0 != strcmp(buf, plugin->bind_address))) 1964 if ((plugin->bind_address != NULL) && (0 != strcmp(buf, plugin->bind_address)))
@@ -1964,9 +1982,8 @@ process_interfaces (void *cls,
1964 t4.t_port = htons (plugin->adv_port); 1982 t4.t_port = htons (plugin->adv_port);
1965 arg = &t4; 1983 arg = &t4;
1966 args = sizeof (t4); 1984 args = sizeof (t4);
1967 } 1985 break;
1968 else if (af == AF_INET6) 1986 case AF_INET6:
1969 {
1970 if ( (IN6_IS_ADDR_LINKLOCAL (&((struct sockaddr_in6 *) addr)->sin6_addr)) || 1987 if ( (IN6_IS_ADDR_LINKLOCAL (&((struct sockaddr_in6 *) addr)->sin6_addr)) ||
1971 (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno(plugin->env->cfg, "transport-tcp", "DISABLEV6")) ) 1988 (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno(plugin->env->cfg, "transport-tcp", "DISABLEV6")) )
1972 { 1989 {
@@ -1991,16 +2008,17 @@ process_interfaces (void *cls,
1991 t6.t6_port = htons (plugin->adv_port); 2008 t6.t6_port = htons (plugin->adv_port);
1992 arg = &t6; 2009 arg = &t6;
1993 args = sizeof (t6); 2010 args = sizeof (t6);
1994 } 2011 break;
1995 else 2012 default:
1996 {
1997 GNUNET_break (0); 2013 GNUNET_break (0);
1998 return GNUNET_OK; 2014 return GNUNET_OK;
1999 } 2015 }
2016#if DEBUG_TCP
2000 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, 2017 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
2001 "tcp", 2018 "tcp",
2002 _("Found address `%s' (%s) len %d\n"), 2019 "Found address `%s' (%s) len %d\n",
2003 GNUNET_a2s (addr, addrlen), name, args); 2020 GNUNET_a2s (addr, addrlen), name, args);
2021#endif
2004 plugin->env->notify_address (plugin->env->cls, 2022 plugin->env->notify_address (plugin->env->cls,
2005 "tcp", 2023 "tcp",
2006 arg, args, GNUNET_TIME_UNIT_FOREVER_REL); 2024 arg, args, GNUNET_TIME_UNIT_FOREVER_REL);
@@ -2044,30 +2062,33 @@ process_hostname_ips (void *cls,
2044 process_interfaces (plugin, "<hostname>", GNUNET_YES, addr, addrlen); 2062 process_interfaces (plugin, "<hostname>", GNUNET_YES, addr, addrlen);
2045} 2063}
2046 2064
2065
2047/** 2066/**
2048 * We can now send a probe message, copy into buffer to really send. 2067 * We can now send a probe message, copy into buffer to really send.
2049 * 2068 *
2050 * @param cls closure, a struct TCPProbeContext 2069 * @param cls closure, a struct TCPProbeContext
2051 * @param size max size to copy 2070 * @param size max size to copy
2052 * @param buf buffer to copy message to 2071 * @param buf buffer to copy message to
2072 * @return number of bytes copied into buf
2053 */ 2073 */
2054static size_t notify_send_probe (void *cls, 2074static size_t
2055 size_t size, void *buf) 2075notify_send_probe (void *cls,
2076 size_t size,
2077 void *buf)
2056{ 2078{
2057 struct TCPProbeContext *tcp_probe_ctx = cls; 2079 struct TCPProbeContext *tcp_probe_ctx = cls;
2080 size_t ret;
2058 2081
2082 tcp_probe_ctx->transmit_handle = NULL;
2059 if (buf == NULL) 2083 if (buf == NULL)
2060 { 2084 return 0;
2061 return 0;
2062 }
2063
2064 GNUNET_assert(size >= sizeof(tcp_probe_ctx->message)); 2085 GNUNET_assert(size >= sizeof(tcp_probe_ctx->message));
2065 memcpy(buf, &tcp_probe_ctx->message, sizeof(tcp_probe_ctx->message)); 2086 memcpy(buf, &tcp_probe_ctx->message, sizeof(tcp_probe_ctx->message));
2066 GNUNET_SERVER_connect_socket (tcp_probe_ctx->plugin->server, 2087 GNUNET_SERVER_connect_socket (tcp_probe_ctx->plugin->server,
2067 tcp_probe_ctx->sock); 2088 tcp_probe_ctx->sock);
2068 2089 ret = sizeof(tcp_probe_ctx->message);
2069 GNUNET_free(tcp_probe_ctx); 2090 GNUNET_free(tcp_probe_ctx);
2070 return sizeof(tcp_probe_ctx->message); 2091 return ret;
2071} 2092}
2072 2093
2073 2094
@@ -2114,9 +2135,11 @@ tcp_plugin_server_read (void *cls,
2114 for (i = 0; i < sizeof(mybuf); i++) 2135 for (i = 0; i < sizeof(mybuf); i++)
2115 { 2136 {
2116 if (mybuf[i] == '\n') 2137 if (mybuf[i] == '\n')
2117 mybuf[i] = '\0'; 2138 {
2118 2139 mybuf[i] = '\0';
2119 if ((mybuf[i] == ':') && (i + 1 < sizeof(mybuf))) 2140 break;
2141 }
2142 if ( (mybuf[i] == ':') && (i + 1 < sizeof(mybuf)) )
2120 { 2143 {
2121 mybuf[i] = '\0'; 2144 mybuf[i] = '\0';
2122 port_start = &mybuf[i + 1]; 2145 port_start = &mybuf[i + 1];
@@ -2218,29 +2241,41 @@ tcp_transport_start_nat_server(struct Plugin *plugin)
2218 GNUNET_YES); 2241 GNUNET_YES);
2219 if (plugin->server_stdout == NULL) 2242 if (plugin->server_stdout == NULL)
2220 return GNUNET_SYSERR; 2243 return GNUNET_SYSERR;
2221
2222#if DEBUG_TCP_NAT 2244#if DEBUG_TCP_NAT
2223 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, 2245 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
2224 "tcp" 2246 "tcp"
2225 "Starting gnunet-nat-server process cmd: %s %s\n", "gnunet-nat-server", plugin->internal_address); 2247 "Starting %s %s\n",
2248 "gnunet-nat-server",
2249 plugin->internal_address);
2226#endif 2250#endif
2227 /* Start the server process */ 2251 /* Start the server process */
2228 plugin->server_proc = GNUNET_OS_start_process(NULL, plugin->server_stdout, "gnunet-nat-server", "gnunet-nat-server", plugin->internal_address, NULL); 2252 plugin->server_proc = GNUNET_OS_start_process (NULL,
2253 plugin->server_stdout,
2254 "gnunet-nat-server",
2255 "gnunet-nat-server",
2256 plugin->internal_address,
2257 NULL);
2229 if (plugin->server_proc == NULL) 2258 if (plugin->server_proc == NULL)
2230 { 2259 {
2231#if DEBUG_TCP_NAT 2260 GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING,
2232 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2261 "tcp",
2233 "Failed to start gnunet-nat-server process\n"); 2262 _("Failed to start %s\n"),
2234#endif 2263 "gnunet-nat-server");
2264 GNUNET_DISK_pipe_close (plugin->server_stdout);
2265 plugin->server_stdout = NULL;
2235 return GNUNET_SYSERR; 2266 return GNUNET_SYSERR;
2236 } 2267 }
2237 /* Close the write end of the read pipe */ 2268 /* Close the write end of the read pipe */
2238 GNUNET_DISK_pipe_close_end(plugin->server_stdout, GNUNET_DISK_PIPE_END_WRITE); 2269 GNUNET_DISK_pipe_close_end(plugin->server_stdout,
2239 2270 GNUNET_DISK_PIPE_END_WRITE);
2240 plugin->server_stdout_handle = GNUNET_DISK_pipe_handle(plugin->server_stdout, GNUNET_DISK_PIPE_END_READ); 2271 plugin->server_stdout_handle
2241 plugin->server_read_task = 2272 = GNUNET_DISK_pipe_handle (plugin->server_stdout,
2242 GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, 2273 GNUNET_DISK_PIPE_END_READ);
2243 plugin->server_stdout_handle, &tcp_plugin_server_read, plugin); 2274 plugin->server_read_task
2275 = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
2276 plugin->server_stdout_handle,
2277 &tcp_plugin_server_read,
2278 plugin);
2244 return GNUNET_YES; 2279 return GNUNET_YES;
2245} 2280}
2246 2281
@@ -2250,9 +2285,10 @@ tcp_transport_start_nat_server(struct Plugin *plugin)
2250 * PATH environment variable. 2285 * PATH environment variable.
2251 * 2286 *
2252 * @param binary the name of the file to find 2287 * @param binary the name of the file to find
2288 * @return path to binary, NULL if not found
2253 */ 2289 */
2254static char * 2290static char *
2255get_path_from_PATH (char *binary) 2291get_path_from_PATH (const char *binary)
2256{ 2292{
2257 char *path; 2293 char *path;
2258 char *pos; 2294 char *pos;
@@ -2263,8 +2299,9 @@ get_path_from_PATH (char *binary)
2263 p = getenv ("PATH"); 2299 p = getenv ("PATH");
2264 if (p == NULL) 2300 if (p == NULL)
2265 { 2301 {
2266 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 2302 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
2267 _("PATH environment variable is unset.\n")); 2303 "tcp",
2304 _("PATH environment variable is unset.\n"));
2268 return NULL; 2305 return NULL;
2269 } 2306 }
2270 path = GNUNET_strdup (p); /* because we write on it */ 2307 path = GNUNET_strdup (p); /* because we write on it */
@@ -2293,24 +2330,26 @@ get_path_from_PATH (char *binary)
2293 return NULL; 2330 return NULL;
2294} 2331}
2295 2332
2333
2296/** 2334/**
2297 * Check whether the suid bit is set on a file. 2335 * Check whether the suid bit is set on a file.
2298 * Attempts to find the file using the current 2336 * Attempts to find the file using the current
2299 * PATH environment variable as a search path. 2337 * PATH environment variable as a search path.
2300 * 2338 *
2301 * @param binary the name of the file to check 2339 * @param binary the name of the file to check
2340 * @return GNUNET_YES if the file is SUID,
2341 * GNUNET_NO if not,
2342 * GNUNET_SYSERR on error
2302 */ 2343 */
2303static int 2344static int
2304check_gnunet_nat_binary(char *binary) 2345check_gnunet_nat_binary(const char *binary)
2305{ 2346{
2306 struct stat statbuf; 2347 struct stat statbuf;
2307 char *p; 2348 char *p;
2308#ifdef MINGW 2349#ifdef MINGW
2309 SOCKET rawsock; 2350 SOCKET rawsock;
2310#endif
2311
2312#ifdef MINGW
2313 char *binaryexe; 2351 char *binaryexe;
2352
2314 GNUNET_asprintf (&binaryexe, "%s.exe", binary); 2353 GNUNET_asprintf (&binaryexe, "%s.exe", binary);
2315 p = get_path_from_PATH (binaryexe); 2354 p = get_path_from_PATH (binaryexe);
2316 free (binaryexe); 2355 free (binaryexe);
@@ -2319,9 +2358,10 @@ check_gnunet_nat_binary(char *binary)
2319#endif 2358#endif
2320 if (p == NULL) 2359 if (p == NULL)
2321 { 2360 {
2322 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 2361 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
2323 _("Could not find binary `%s' in PATH!\n"), 2362 "tcp",
2324 binary); 2363 _("Could not find binary `%s' in PATH!\n"),
2364 binary);
2325 return GNUNET_NO; 2365 return GNUNET_NO;
2326 } 2366 }
2327 if (0 != STAT (p, &statbuf)) 2367 if (0 != STAT (p, &statbuf))
@@ -2344,8 +2384,9 @@ check_gnunet_nat_binary(char *binary)
2344 if (INVALID_SOCKET == rawsock) 2384 if (INVALID_SOCKET == rawsock)
2345 { 2385 {
2346 DWORD err = GetLastError (); 2386 DWORD err = GetLastError ();
2347 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 2387 GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING,
2348 "socket (AF_INET, SOCK_RAW, IPPROTO_ICMP) have failed! GLE = %d\n", err); 2388 "tcp",
2389 "socket (AF_INET, SOCK_RAW, IPPROTO_ICMP) failed! GLE = %d\n", err);
2349 return GNUNET_NO; /* not running as administrator */ 2390 return GNUNET_NO; /* not running as administrator */
2350 } 2391 }
2351 closesocket (rawsock); 2392 closesocket (rawsock);
@@ -2387,15 +2428,16 @@ libgnunet_plugin_transport_tcp_init (void *cls)
2387 service = GNUNET_SERVICE_start ("transport-tcp", env->cfg); 2428 service = GNUNET_SERVICE_start ("transport-tcp", env->cfg);
2388 if (service == NULL) 2429 if (service == NULL)
2389 { 2430 {
2390 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 2431 GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING,
2391 _("Failed to start service for `%s' transport plugin.\n"), 2432 "tcp",
2392 "tcp"); 2433 _("Failed to start service.\n"));
2393 return NULL; 2434 return NULL;
2394 } 2435 }
2395 2436
2396 if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (env->cfg, 2437 behind_nat = GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
2397 "transport-tcp", 2438 "transport-tcp",
2398 "BEHIND_NAT")) 2439 "BEHIND_NAT");
2440 if (GNUNET_YES == behind_nat)
2399 { 2441 {
2400 /* We are behind nat (according to the user) */ 2442 /* We are behind nat (according to the user) */
2401 if (check_gnunet_nat_binary("gnunet-nat-server") == GNUNET_YES) 2443 if (check_gnunet_nat_binary("gnunet-nat-server") == GNUNET_YES)
@@ -2405,91 +2447,102 @@ libgnunet_plugin_transport_tcp_init (void *cls)
2405 else 2447 else
2406 { 2448 {
2407 behind_nat = GNUNET_NO; 2449 behind_nat = GNUNET_NO;
2408 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Configuration specified you are behind a NAT, but gnunet-nat-server is not installed properly (suid bit not set)!\n"); 2450 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
2451 _("Configuration specified you are behind a NAT, but %s is not installed properly (SUID bit not set)!\n"),
2452 "gnunet-nat-server");
2409 } 2453 }
2410 } 2454 }
2411 else 2455 allow_nat = GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
2412 behind_nat = GNUNET_NO; /* We are not behind nat! */ 2456 "transport-tcp",
2413 2457 "ALLOW_NAT");
2414 if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (env->cfg, 2458 if (GNUNET_YES == allow_nat)
2415 "transport-tcp",
2416 "ALLOW_NAT"))
2417 { 2459 {
2418 if (check_gnunet_nat_binary("gnunet-nat-client") == GNUNET_YES) 2460 if (check_gnunet_nat_binary("gnunet-nat-client") == GNUNET_YES)
2419 allow_nat = GNUNET_YES; /* We will try to connect to NAT'd peers */ 2461 {
2462 allow_nat = GNUNET_YES; /* We will try to connect to NAT'd peers */
2463 }
2420 else 2464 else
2421 { 2465 {
2422 allow_nat = GNUNET_NO; 2466 allow_nat = GNUNET_NO;
2423 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Configuration specified you want to connect to NAT'd peers, but gnunet-nat-client is not installed properly (suid bit not set)!\n"); 2467 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
2424 } 2468 _("Configuration specified you want to connect to NATed peers, but %s is not installed properly (SUID bit not set)!\n"),
2469 "gnunet-nat-client");
2470 }
2425 } 2471 }
2426 else
2427 allow_nat = GNUNET_NO; /* We don't want to try to help NAT'd peers */
2428 2472
2429 2473 only_nat_addresses = GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
2430 if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (env->cfg, 2474 "transport-tcp",
2431 "transport-tcp", 2475 "ONLY_NAT_ADDRESSES");
2432 "ONLY_NAT_ADDRESSES"))
2433 only_nat_addresses = GNUNET_YES; /* We will only report our addresses as NAT'd */
2434 else
2435 only_nat_addresses = GNUNET_NO; /* We will report our addresses as NAT'd and non-NAT'd */
2436 2476
2437 external_address = NULL; 2477 external_address = NULL;
2438 if (((GNUNET_YES == behind_nat) || (GNUNET_YES == allow_nat)) && (GNUNET_OK != 2478 if ( ( (GNUNET_YES == behind_nat) ||
2439 GNUNET_CONFIGURATION_get_value_string (env->cfg, 2479 (GNUNET_YES == allow_nat) ) &&
2440 "transport-tcp", 2480 (GNUNET_OK !=
2441 "EXTERNAL_ADDRESS", 2481 GNUNET_CONFIGURATION_get_value_string (env->cfg,
2442 &external_address))) 2482 "transport-tcp",
2443 { 2483 "EXTERNAL_ADDRESS",
2444 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 2484 &external_address)) )
2445 _ 2485 {
2446 ("Require EXTERNAL_ADDRESS for service `%s' in configuration (either BEHIND_NAT or ALLOW_NAT set to YES)!\n"), 2486 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
2447 "transport-tcp"); 2487 "tcp",
2488 _("EXTERNAL_ADDRESS option required in configuration (either BEHIND_NAT or ALLOW_NAT set to YES)!\n"));
2448 GNUNET_SERVICE_stop (service); 2489 GNUNET_SERVICE_stop (service);
2449 return NULL; 2490 return NULL;
2450 } 2491 }
2451 2492
2452 if ((external_address != NULL) && (inet_pton(AF_INET, external_address, &in_addr.sin_addr) != 1)) 2493 if ( (external_address != NULL) &&
2494 (inet_pton(AF_INET, external_address, &in_addr.sin_addr) != 1) )
2453 { 2495 {
2454 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Malformed EXTERNAL_ADDRESS %s given in configuration!\n", external_address); 2496 GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING,
2497 "tcp",
2498 _("Malformed %s `%s' given in configuration!\n"),
2499 "EXTERNAL_ADDRESS",
2500 external_address);
2455 } 2501 }
2456 2502
2457 internal_address = NULL; 2503 internal_address = NULL;
2458 if ((GNUNET_YES == behind_nat) && (GNUNET_OK != 2504 if ( (GNUNET_YES == behind_nat) &&
2459 GNUNET_CONFIGURATION_get_value_string (env->cfg, 2505 (GNUNET_OK !=
2460 "transport-tcp", 2506 GNUNET_CONFIGURATION_get_value_string (env->cfg,
2461 "INTERNAL_ADDRESS", 2507 "transport-tcp",
2462 &internal_address))) 2508 "INTERNAL_ADDRESS",
2463 { 2509 &internal_address)) )
2464 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 2510 {
2465 _("Require INTERNAL_ADDRESS for service `%s' in configuration!\n"), 2511 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
2466 "transport-tcp"); 2512 "tcp",
2513 _("Require INTERNAL_ADDRESS in configuration!\n"));
2467 GNUNET_SERVICE_stop (service); 2514 GNUNET_SERVICE_stop (service);
2468 GNUNET_free_non_null(external_address); 2515 GNUNET_free_non_null(external_address);
2469 return NULL; 2516 return NULL;
2470 } 2517 }
2471 2518
2472 if ((internal_address != NULL) && (inet_pton(AF_INET, internal_address, &in_addr.sin_addr) != 1)) 2519 if ( (internal_address != NULL) &&
2520 (inet_pton(AF_INET, internal_address, &in_addr.sin_addr) != 1) )
2473 { 2521 {
2474 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Malformed INTERNAL_ADDRESS %s given in configuration!\n", internal_address); 2522 GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING,
2523 "tcp",
2524 _("Malformed %s `%s' given in configuration!\n"),
2525 "INTERNAL_ADDRESS",
2526 internal_address);
2475 } 2527 }
2476 2528
2477 aport = 0; 2529 aport = 0;
2478 if ((GNUNET_OK != 2530 if ( (GNUNET_OK !=
2479 GNUNET_CONFIGURATION_get_value_number (env->cfg, 2531 GNUNET_CONFIGURATION_get_value_number (env->cfg,
2480 "transport-tcp", 2532 "transport-tcp",
2481 "PORT", 2533 "PORT",
2482 &bport)) || 2534 &bport)) ||
2483 (bport > 65535) || 2535 (bport > 65535) ||
2484 ((GNUNET_OK == 2536 ((GNUNET_OK ==
2485 GNUNET_CONFIGURATION_get_value_number (env->cfg, 2537 GNUNET_CONFIGURATION_get_value_number (env->cfg,
2486 "transport-tcp", 2538 "transport-tcp",
2487 "ADVERTISED-PORT", 2539 "ADVERTISED-PORT",
2488 &aport)) && (aport > 65535))) 2540 &aport)) &&
2489 { 2541 (aport > 65535)) )
2490 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 2542 {
2491 _ 2543 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
2492 ("Require valid port number for service `%s' in configuration!\n"), 2544 "tcp",
2545 _("Require valid port number for service `%s' in configuration!\n"),
2493 "transport-tcp"); 2546 "transport-tcp");
2494 GNUNET_free_non_null(external_address); 2547 GNUNET_free_non_null(external_address);
2495 GNUNET_free_non_null(internal_address); 2548 GNUNET_free_non_null(internal_address);
@@ -2531,10 +2584,9 @@ libgnunet_plugin_transport_tcp_init (void *cls)
2531 { 2584 {
2532 if (GNUNET_YES != tcp_transport_start_nat_server(plugin)) 2585 if (GNUNET_YES != tcp_transport_start_nat_server(plugin))
2533 { 2586 {
2534 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 2587 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
2535 2588 "tcp",
2536 _ 2589 _("Failed to start %s required for NAT in %s!\n"),
2537 ("Failed to start %s required for NAT in %s!\n"),
2538 "gnunet-nat-server" 2590 "gnunet-nat-server"
2539 "transport-tcp"); 2591 "transport-tcp");
2540 GNUNET_free_non_null(external_address); 2592 GNUNET_free_non_null(external_address);
@@ -2551,17 +2603,28 @@ libgnunet_plugin_transport_tcp_init (void *cls)
2551 GNUNET_assert(plugin->nat_wait_conns != NULL); 2603 GNUNET_assert(plugin->nat_wait_conns != NULL);
2552 } 2604 }
2553 2605
2554 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("TCP transport listening on port %llu\n"), bport); 2606 GNUNET_log_from (GNUNET_ERROR_TYPE_INFO,
2607 "tcp",
2608 _("TCP transport listening on port %llu\n"),
2609 bport);
2555 if (aport != bport) 2610 if (aport != bport)
2556 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 2611 GNUNET_log_from (GNUNET_ERROR_TYPE_INFO,
2612 "tcp",
2557 _("TCP transport advertises itself as being on port %llu\n"), 2613 _("TCP transport advertises itself as being on port %llu\n"),
2558 aport); 2614 aport);
2559 GNUNET_SERVER_disconnect_notify (plugin->server, 2615 GNUNET_SERVER_disconnect_notify (plugin->server,
2560 &disconnect_notify, 2616 &disconnect_notify,
2561 plugin); 2617 plugin);
2562 2618
2563 if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_string (env->cfg, "transport-tcp", "BINDTO", &plugin->bind_address)) 2619 if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_string (env->cfg,
2564 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Binding tcp plugin to specific address: `%s'\n", plugin->bind_address); 2620 "transport-tcp",
2621 "BINDTO",
2622 &plugin->bind_address))
2623 {
2624 GNUNET_log(GNUNET_ERROR_TYPE_INFO,
2625 _("Binding TCP plugin to specific address: `%s'\n"),
2626 plugin->bind_address);
2627 }
2565 2628
2566 if (plugin->behind_nat == GNUNET_NO) 2629 if (plugin->behind_nat == GNUNET_NO)
2567 { 2630 {
@@ -2574,19 +2637,28 @@ libgnunet_plugin_transport_tcp_init (void *cls)
2574 &process_hostname_ips, 2637 &process_hostname_ips,
2575 plugin); 2638 plugin);
2576 2639
2577 if ((plugin->behind_nat == GNUNET_YES) && (inet_pton(AF_INET, plugin->external_address, &t4.ipv4_addr) == 1)) 2640 if ( (plugin->behind_nat == GNUNET_YES) &&
2641 (inet_pton(AF_INET, plugin->external_address, &t4.ipv4_addr) == 1) )
2578 { 2642 {
2579 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Notifying transport of address %s:0\n", plugin->external_address); 2643 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
2644 "tcp",
2645 "Notifying transport of address %s:0\n",
2646 plugin->external_address);
2580 t4.t_port = htons(0); 2647 t4.t_port = htons(0);
2581 add_to_address_list (plugin, &t4.ipv4_addr, sizeof (uint32_t)); 2648 add_to_address_list (plugin, &t4.ipv4_addr, sizeof (uint32_t));
2582 plugin->env->notify_address (plugin->env->cls, 2649 plugin->env->notify_address (plugin->env->cls,
2583 "tcp", 2650 "tcp",
2584 &t4, sizeof(t4), GNUNET_TIME_UNIT_FOREVER_REL); 2651 &t4, sizeof(t4), GNUNET_TIME_UNIT_FOREVER_REL);
2585 } 2652 }
2586 else if ((plugin->external_address != NULL) && (inet_pton(AF_INET, plugin->external_address, &t4.ipv4_addr) == 1)) 2653 else if ((plugin->external_address != NULL) &&
2654 (inet_pton(AF_INET, plugin->external_address, &t4.ipv4_addr) == 1) )
2587 { 2655 {
2588 t4.t_port = htons(plugin->adv_port); 2656 t4.t_port = htons(plugin->adv_port);
2589 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Notifying transport of address %s:%d\n", plugin->external_address, plugin->adv_port); 2657 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
2658 "tcp",
2659 "Notifying transport of address %s:%d\n",
2660 plugin->external_address,
2661 plugin->adv_port);
2590 add_to_address_list (plugin, &t4.ipv4_addr, sizeof (uint32_t)); 2662 add_to_address_list (plugin, &t4.ipv4_addr, sizeof (uint32_t));
2591 plugin->env->notify_address (plugin->env->cls, 2663 plugin->env->notify_address (plugin->env->cls,
2592 "tcp", 2664 "tcp",