Author: grothoff Date: 2008-02-26 23:51:58 -0700 (Tue, 26 Feb 2008) New Revision: 6476
Modified: GNUnet/src/applications/fs/fsui/downloadtest.c GNUnet/src/applications/fs/fsui/search.c GNUnet/src/include/gnunet_util_network.h GNUnet/src/server/tcpserver.c GNUnet/src/setup/gnunet-win-tool.c GNUnet/src/transports/common.c GNUnet/src/transports/http.c GNUnet/src/transports/ip.c GNUnet/src/transports/ip.h GNUnet/src/transports/udp.c GNUnet/src/transports/upnp/init.c GNUnet/src/transports/upnp/ip.c GNUnet/src/transports/upnp/ip.h GNUnet/src/transports/upnp/upnp.c GNUnet/src/transports/upnp/upnptest.c GNUnet/src/util/network/dns.c GNUnet/src/util/network/ip.c GNUnet/src/util/network/ipcheck.c GNUnet/src/util/network/selecttest.c GNUnet/src/util/network_client/tcpio.c Log: reformat Modified: GNUnet/src/applications/fs/fsui/downloadtest.c =================================================================== --- GNUnet/src/applications/fs/fsui/downloadtest.c 2008-02-27 06:50:36 UTC (rev 6475) +++ GNUnet/src/applications/fs/fsui/downloadtest.c 2008-02-27 06:51:58 UTC (rev 6476) @@ -86,16 +86,14 @@ { char *u; - u = GNUNET_ECRS_uri_to_string(event->data.SearchResult.fi.uri); + u = GNUNET_ECRS_uri_to_string (event->data.SearchResult.fi.uri); if (!GNUNET_ECRS_uri_test_equal (upURI, event->data.SearchResult.fi.uri)) { #if DEBUG_VERBOSE - printf - ("Received result for different file: %s.\n", - u); + printf ("Received result for different file: %s.\n", u); #endif - GNUNET_free(u); + GNUNET_free (u); return NULL; /* ignore */ } #if DEBUG_VERBOSE @@ -141,7 +139,7 @@ search = NULL; break; case GNUNET_FSUI_download_progress: -#if DEBUG_VERBOSE > 1 +#if DEBUG_VERBOSE > 1 printf ("Download is progressing (%llu/%llu)...\n", event->data.DownloadProgress.completed, event->data.DownloadProgress.total); @@ -232,7 +230,7 @@ return -1; } #if START_DAEMON - GNUNET_disk_directory_remove(NULL, "/tmp/gnunet-fsui-test/content/"); + GNUNET_disk_directory_remove (NULL, "/tmp/gnunet-fsui-test/content/"); daemon = GNUNET_daemon_start (NULL, cfg, "peer.conf", GNUNET_NO); GNUNET_GE_ASSERT (NULL, daemon > 0); CHECK (GNUNET_OK == Modified: GNUnet/src/applications/fs/fsui/search.c =================================================================== --- GNUnet/src/applications/fs/fsui/search.c 2008-02-27 06:50:36 UTC (rev 6475) +++ GNUnet/src/applications/fs/fsui/search.c 2008-02-27 06:51:58 UTC (rev 6476) @@ -113,70 +113,64 @@ GNUNET_GE_BREAK (ectx, 0); #if DEBUG_SEARCH GNUNET_GE_LOG (ectx, - GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER, - "Received search result without key to decrypt.\n"); + GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER, + "Received search result without key to decrypt.\n"); #endif return GNUNET_SYSERR; } for (i = 0; i < pos->sizeUnmatchedResultsReceived; i++) { rp = &pos->unmatchedResultsReceived[i]; - if (! GNUNET_ECRS_uri_test_equal (fi->uri, rp->fi.uri)) - continue; + if (!GNUNET_ECRS_uri_test_equal (fi->uri, rp->fi.uri)) + continue; for (j = 0; j < rp->matchingKeyCount; j++) - if (0 == memcmp (key, - &rp->matchingKeys[j], - sizeof (GNUNET_HashCode))) - { + if (0 == memcmp (key, &rp->matchingKeys[j], sizeof (GNUNET_HashCode))) + { #if DEBUG_SEARCH - GNUNET_GE_LOG (ectx, - GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | - GNUNET_GE_USER, - "Received search result that I have seen before (missing keyword to show client).\n"); + GNUNET_GE_LOG (ectx, + GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | + GNUNET_GE_USER, + "Received search result that I have seen before (missing keyword to show client).\n"); #endif - return GNUNET_OK; - } + return GNUNET_OK; + } if (rp->matchingKeyCount + 1 == pos->numberOfURIKeys) - { + { #if DEBUG_SEARCH - GNUNET_GE_LOG (ectx, - GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | - GNUNET_GE_USER, - "Received search result (showing client)!\n"); + GNUNET_GE_LOG (ectx, + GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | + GNUNET_GE_USER, + "Received search result (showing client)!\n"); #endif - GNUNET_array_grow (rp->matchingKeys, rp->matchingKeyCount, - 0); - processResult (&rp->fi, pos); - GNUNET_ECRS_uri_destroy (rp->fi.uri); - GNUNET_ECRS_meta_data_destroy (rp->fi.meta); - pos->unmatchedResultsReceived[i] - = - pos->unmatchedResultsReceived[pos-> - sizeUnmatchedResultsReceived - - 1]; - GNUNET_array_grow (pos->unmatchedResultsReceived, - pos->sizeUnmatchedResultsReceived, - pos->sizeUnmatchedResultsReceived - 1); - return GNUNET_OK; - } + GNUNET_array_grow (rp->matchingKeys, rp->matchingKeyCount, 0); + processResult (&rp->fi, pos); + GNUNET_ECRS_uri_destroy (rp->fi.uri); + GNUNET_ECRS_meta_data_destroy (rp->fi.meta); + pos->unmatchedResultsReceived[i] + = + pos->unmatchedResultsReceived[pos-> + sizeUnmatchedResultsReceived - 1]; + GNUNET_array_grow (pos->unmatchedResultsReceived, + pos->sizeUnmatchedResultsReceived, + pos->sizeUnmatchedResultsReceived - 1); + return GNUNET_OK; + } GNUNET_array_grow (rp->matchingKeys, - rp->matchingKeyCount, - rp->matchingKeyCount + 1); + rp->matchingKeyCount, rp->matchingKeyCount + 1); rp->matchingKeys[rp->matchingKeyCount - 1] = *key; #if DEBUG_SEARCH GNUNET_GE_LOG (ectx, - GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | - GNUNET_GE_USER, - "Received search result (waiting for more %u keys before showing client).\n", - pos->numberOfURIKeys - rp->matchingKeyCount); + GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | + GNUNET_GE_USER, + "Received search result (waiting for more %u keys before showing client).\n", + pos->numberOfURIKeys - rp->matchingKeyCount); #endif return GNUNET_OK; } GNUNET_array_grow (pos->unmatchedResultsReceived, - pos->sizeUnmatchedResultsReceived, - pos->sizeUnmatchedResultsReceived + 1); - rp = - &pos->unmatchedResultsReceived[pos->sizeUnmatchedResultsReceived - 1]; + pos->sizeUnmatchedResultsReceived, + pos->sizeUnmatchedResultsReceived + 1); + rp = &pos->unmatchedResultsReceived[pos->sizeUnmatchedResultsReceived - 1]; rp->fi.meta = GNUNET_ECRS_meta_data_duplicate (fi->meta); rp->fi.uri = GNUNET_ECRS_uri_duplicate (fi->uri); rp->matchingKeys = NULL; @@ -185,9 +179,9 @@ rp->matchingKeys[0] = *key; #if DEBUG_SEARCH GNUNET_GE_LOG (ectx, - GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER, - "Received search result (waiting for %u more keys before showing client).\n", - pos->numberOfURIKeys - rp->matchingKeyCount); + GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER, + "Received search result (waiting for %u more keys before showing client).\n", + pos->numberOfURIKeys - rp->matchingKeyCount); #endif return GNUNET_OK; } Modified: GNUnet/src/include/gnunet_util_network.h =================================================================== --- GNUnet/src/include/gnunet_util_network.h 2008-02-27 06:50:36 UTC (rev 6475) +++ GNUnet/src/include/gnunet_util_network.h 2008-02-27 06:51:58 UTC (rev 6476) @@ -283,7 +283,7 @@ * @return GNUNET_NO if the IP is not in the list, GNUNET_YES if it it is */ int GNUNET_check_ipv4_listed (const struct GNUNET_IPv4NetworkSet *list, - const struct in_addr * ip); + const struct in_addr *ip); /** * Check if the given IP address is in the list of @@ -293,7 +293,7 @@ * @return GNUNET_NO if the IP is not in the list, GNUNET_YES if it it is */ int GNUNET_check_ipv6_listed (const struct GNUNET_IPv6NetworkSet *list, - const struct in6_addr * ip); + const struct in6_addr *ip); /* ********************* low-level socket operations **************** */ @@ -516,10 +516,9 @@ */ int GNUNET_get_ip_from_hostname (struct GNUNET_GE_Context *ectx, - const char * hostname, - int domain, - struct sockaddr ** sa, - socklen_t * socklen); + const char *hostname, + int domain, + struct sockaddr **sa, socklen_t * socklen); /** * Get an IP address as a string (works for both IPv4 and IPv6). Note @@ -538,7 +537,7 @@ */ char *GNUNET_get_local_ip (struct GNUNET_GC_Configuration *cfg, struct GNUNET_GE_Context *ectx, - struct in_addr * addr); + struct in_addr *addr); /** Modified: GNUnet/src/server/tcpserver.c =================================================================== --- GNUnet/src/server/tcpserver.c 2008-02-27 06:50:36 UTC (rev 6475) +++ GNUnet/src/server/tcpserver.c 2008-02-27 06:51:58 UTC (rev 6476) @@ -93,7 +93,7 @@ * Is this IP labeled as trusted for CS connections? */ static int -isWhitelisted4 (const struct in_addr * ip) +isWhitelisted4 (const struct in_addr *ip) { return GNUNET_check_ipv4_listed (trustedNetworksV4, ip); } @@ -102,7 +102,7 @@ * Is this IP labeled as trusted for CS connections? */ static int -isWhitelisted6 (const struct in6_addr * ip) +isWhitelisted6 (const struct in6_addr *ip) { return GNUNET_check_ipv6_listed (trustedNetworksV6, ip); } @@ -172,33 +172,35 @@ struct in6_addr ip6; struct sockaddr_in *a4; struct sockaddr_in6 *a6; - + if (addr_len == sizeof (struct sockaddr_in6)) { a6 = (struct sockaddr_in6 *) addr; - + memcpy (&ip6, &a6->sin6_addr, sizeof (struct in6_addr)); /* get embedded ipv4 address in case address embedding is used */ memcpy (&ip4, - &((char*) &ip6)[sizeof(struct in6_addr) - sizeof(struct in_addr)], - sizeof (struct in_addr)); - if ( (!isWhitelisted6 (&ip6)) && - (! ( ( (IN6_IS_ADDR_V4COMPAT(&a6->sin6_addr)) || - (IN6_IS_ADDR_V4MAPPED(&a6->sin6_addr)) ) && - (isWhitelisted4(&ip4) ) ) ) ) - return NULL; + &((char *) &ip6)[sizeof (struct in6_addr) - + sizeof (struct in_addr)], + sizeof (struct in_addr)); + if ((!isWhitelisted6 (&ip6)) + && + (!(((IN6_IS_ADDR_V4COMPAT (&a6->sin6_addr)) + || (IN6_IS_ADDR_V4MAPPED (&a6->sin6_addr))) + && (isWhitelisted4 (&ip4))))) + return NULL; } else if (addr_len == sizeof (struct sockaddr_in)) { a4 = (struct sockaddr_in *) addr; memcpy (&ip4, &a4->sin_addr, sizeof (struct in_addr)); if (!isWhitelisted4 (&ip4)) - return NULL; + return NULL; } else { - GNUNET_GE_BREAK(NULL, 0); - return NULL; + GNUNET_GE_BREAK (NULL, 0); + return NULL; } session = GNUNET_malloc (sizeof (ClientHandle)); session->sock = sock; @@ -335,7 +337,7 @@ int listenerPort; struct sockaddr_in6 serverAddr6; struct sockaddr_in serverAddr4; - struct sockaddr * serverAddr; + struct sockaddr *serverAddr; socklen_t socklen; const int on = 1; @@ -346,26 +348,27 @@ { listenerFD = SOCKET (PF_INET, SOCK_STREAM, 0); if (listenerFD < 0) - { - GNUNET_GE_LOG_STRERROR (ectx, - GNUNET_GE_FATAL | GNUNET_GE_ADMIN | - GNUNET_GE_USER | GNUNET_GE_IMMEDIATE, "socket"); - return GNUNET_SYSERR; - } + { + GNUNET_GE_LOG_STRERROR (ectx, + GNUNET_GE_FATAL | GNUNET_GE_ADMIN | + GNUNET_GE_USER | GNUNET_GE_IMMEDIATE, + "socket"); + return GNUNET_SYSERR; + } memset (&serverAddr4, 0, sizeof (serverAddr4)); serverAddr4.sin_family = AF_INET; serverAddr4.sin_addr.s_addr = htonl (INADDR_ANY); serverAddr4.sin_port = htons (listenerPort); - socklen = sizeof(serverAddr4); - serverAddr = (struct sockaddr*) &serverAddr4; + socklen = sizeof (serverAddr4); + serverAddr = (struct sockaddr *) &serverAddr4; } else { memset (&serverAddr6, 0, sizeof (serverAddr6)); serverAddr6.sin6_family = AF_INET6; serverAddr6.sin6_port = htons (listenerPort); - socklen = sizeof(serverAddr6); - serverAddr = (struct sockaddr*) &serverAddr6; + socklen = sizeof (serverAddr6); + serverAddr = (struct sockaddr *) &serverAddr6; } /* fill in the inet address structure */ if (SETSOCKOPT (listenerFD, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)) < 0) @@ -373,8 +376,7 @@ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_BULK, "setsockopt"); /* bind the socket */ - if (BIND (listenerFD, - serverAddr, socklen) < 0) + if (BIND (listenerFD, serverAddr, socklen) < 0) { GNUNET_GE_LOG_STRERROR (ectx, GNUNET_GE_ERROR | GNUNET_GE_ADMIN | @@ -388,7 +390,7 @@ CLOSE (listenerFD); return GNUNET_SYSERR; } - selector = GNUNET_select_create ("tcpserver", GNUNET_NO, ectx, NULL, listenerFD, socklen, 0, /* no timeout */ + selector = GNUNET_select_create ("tcpserver", GNUNET_NO, ectx, NULL, listenerFD, socklen, 0, /* no timeout */ &select_message_handler, NULL, &select_accept_handler, Modified: GNUnet/src/setup/gnunet-win-tool.c =================================================================== --- GNUnet/src/setup/gnunet-win-tool.c 2008-02-27 06:50:36 UTC (rev 6475) +++ GNUnet/src/setup/gnunet-win-tool.c 2008-02-27 06:51:58 UTC (rev 6476) @@ -103,7 +103,8 @@ if (pAddrTable->table[i].dwIndex == pTable->table[dwIfIdx].dwIndex) printf ("Address: %s\n", - inet_ntop(AF_INET, &pAddrTable->table[i].dwAddr, ntop_buf, INET_ADDRSTRLEN)); + inet_ntop (AF_INET, &pAddrTable->table[i].dwAddr, + ntop_buf, INET_ADDRSTRLEN)); } printf ("\n"); } Modified: GNUnet/src/transports/common.c =================================================================== --- GNUnet/src/transports/common.c 2008-02-27 06:50:36 UTC (rev 6475) +++ GNUnet/src/transports/common.c 2008-02-27 06:51:58 UTC (rev 6476) @@ -54,7 +54,7 @@ * Check if we are allowed to connect to the given IP. */ static int -is_blacklisted_ipv6 (const struct in6_addr * ip) +is_blacklisted_ipv6 (const struct in6_addr *ip) { int ret; @@ -83,21 +83,21 @@ static int is_rejected_ipv6 (const void *addr, unsigned int addr_len) { - const struct sockaddr_in6 * saddr; - const struct in6_addr * inaddr; + const struct sockaddr_in6 *saddr; + const struct in6_addr *inaddr; - if (addr_len == sizeof(struct in6_addr)) + if (addr_len == sizeof (struct in6_addr)) { inaddr = addr; } - else if (addr_len == sizeof(struct sockaddr_in6)) + else if (addr_len == sizeof (struct sockaddr_in6)) { saddr = addr; inaddr = &saddr->sin6_addr; } else { - GNUNET_GE_BREAK(NULL, 0); + GNUNET_GE_BREAK (NULL, 0); return GNUNET_SYSERR; } if ((GNUNET_YES == is_blacklisted_ipv6 (inaddr)) || @@ -143,21 +143,21 @@ static int is_rejected_ipv4 (const void *addr, unsigned int addr_len) { - const struct sockaddr_in * saddr; - const struct in_addr * inaddr; + const struct sockaddr_in *saddr; + const struct in_addr *inaddr; - if (addr_len == sizeof(struct in_addr)) + if (addr_len == sizeof (struct in_addr)) { inaddr = addr; } - else if (addr_len == sizeof(struct sockaddr_in)) + else if (addr_len == sizeof (struct sockaddr_in)) { saddr = addr; inaddr = &saddr->sin_addr; } else { - GNUNET_GE_BREAK(NULL, 0); + GNUNET_GE_BREAK (NULL, 0); return GNUNET_SYSERR; } if ((GNUNET_NO != is_blacklisted_ipv4 (inaddr)) || @@ -184,8 +184,8 @@ static int is_rejected_tester (const void *addr, unsigned int addr_len) { - if ( (addr_len == sizeof (struct in_addr)) || - (addr_len == sizeof (struct sockaddr_in)) ) + if ((addr_len == sizeof (struct in_addr)) || + (addr_len == sizeof (struct sockaddr_in))) return is_rejected_ipv4 (addr, addr_len); return is_rejected_ipv6 (addr, addr_len); } @@ -222,11 +222,10 @@ && ((GNUNET_YES == is_blacklisted_ipv6 (&haddr->ipv6)) - || (GNUNET_YES != - is_whitelisted_ipv6 (&haddr->ipv6))))) + || (GNUNET_YES != is_whitelisted_ipv6 (&haddr->ipv6))))) { - GNUNET_GE_BREAK_OP(NULL, 0); - return GNUNET_SYSERR; /* invalid */ + GNUNET_GE_BREAK_OP (NULL, 0); + return GNUNET_SYSERR; /* invalid */ } return GNUNET_OK; } @@ -372,8 +371,7 @@ GNUNET_IP_get_public_ipv4_address (cfg, coreAPI->ectx, &haddr->ipv4)))) { - if (0 != memcmp (&haddr->ipv4, - &last_addrv4, sizeof (struct in_addr))) + if (0 != memcmp (&haddr->ipv4, &last_addrv4, sizeof (struct in_addr))) { struct in_addr in4; char dst[INET_ADDRSTRLEN]; @@ -393,8 +391,7 @@ if (GNUNET_SYSERR != GNUNET_IP_get_public_ipv6_address (cfg, coreAPI->ectx, &haddr->ipv6)) { - if (0 != memcmp (&haddr->ipv6, - &last_addrv6, sizeof (struct in6_addr))) + if (0 != memcmp (&haddr->ipv6, &last_addrv6, sizeof (struct in6_addr))) { struct in6_addr in6; char dst[INET6_ADDRSTRLEN]; @@ -443,8 +440,7 @@ *sa = serverAddr4; memset (serverAddr4, 0, sizeof (struct sockaddr_in)); serverAddr4->sin_family = AF_INET; - memcpy (&serverAddr4->sin_addr, &haddr->ipv4, - sizeof (struct in_addr)); + memcpy (&serverAddr4->sin_addr, &haddr->ipv4, sizeof (struct in_addr)); serverAddr4->sin_port = haddr->port; } else if (0 != (available & VERSION_AVAILABLE_IPV6)) Modified: GNUnet/src/transports/http.c =================================================================== --- GNUnet/src/transports/http.c 2008-02-27 06:50:36 UTC (rev 6475) +++ GNUnet/src/transports/http.c 2008-02-27 06:51:58 UTC (rev 6476) @@ -1891,13 +1891,14 @@ STEP (); if (stats != NULL) stats->change (stat_select_calls, 1); - ret = SELECT (max + 1, &rs, &ws, &es, (have_tv == MHD_YES) ? &tv : NULL); + ret = + SELECT (max + 1, &rs, &ws, &es, (have_tv == MHD_YES) ? &tv : NULL); if (ret == -1) - { - GNUNET_GE_LOG_STRERROR(coreAPI->ectx, - GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_DEVELOPER, - "select"); - } + { + GNUNET_GE_LOG_STRERROR (coreAPI->ectx, + GNUNET_GE_ERROR | GNUNET_GE_ADMIN | + GNUNET_GE_DEVELOPER, "select"); + } STEP (); if (GNUNET_YES != http_running) break; Modified: GNUnet/src/transports/ip.c =================================================================== --- GNUnet/src/transports/ip.c 2008-02-27 06:50:36 UTC (rev 6475) +++ GNUnet/src/transports/ip.c 2008-02-27 06:51:58 UTC (rev 6476) @@ -49,7 +49,7 @@ int GNUNET_IP_get_public_ipv4_address (struct GNUNET_GC_Configuration *cfg, struct GNUNET_GE_Context *ectx, - struct in_addr * address) + struct in_addr *address) { static struct in_addr myAddress; static GNUNET_CronTime last; @@ -213,11 +213,11 @@ */ static int getAddress6FromHostname (struct GNUNET_GE_Context *ectx, - struct in6_addr * identity) + struct in6_addr *identity) { char hostname[MAX_HOSTNAME]; struct sockaddr_in6 addr; - struct sockaddr * sa; + struct sockaddr *sa; socklen_t salen; if (0 != gethostname (hostname, MAX_HOSTNAME)) @@ -230,14 +230,10 @@ /* GNUNET_GE_LOG(ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER, " looking up $HOSTNAME (%s) to obtain local IP\n", hostname); */ - salen = sizeof(struct sockaddr_in); - sa = (struct sockaddr*) &addr; + salen = sizeof (struct sockaddr_in); + sa = (struct sockaddr *) &addr; if (GNUNET_OK != - GNUNET_get_ip_from_hostname(ectx, - hostname, - AF_INET6, - &sa, - &salen)) + GNUNET_get_ip_from_hostname (ectx, hostname, AF_INET6, &sa, &salen)) return GNUNET_SYSERR; *identity = addr.sin6_addr; return GNUNET_OK; @@ -247,7 +243,7 @@ static int getAddress6FromGetIfAddrs (struct GNUNET_GC_Configuration *cfg, struct GNUNET_GE_Context *ectx, - struct in6_addr * identity) + struct in6_addr *identity) { char *interfaces; struct ifaddrs *ifa_first; @@ -305,13 +301,12 @@ */ static int getAddress6 (struct GNUNET_GC_Configuration *cfg, - struct GNUNET_GE_Context *ectx, - struct in6_addr * address) + struct GNUNET_GE_Context *ectx, struct in6_addr *address) { char *ipString; int retval; socklen_t sa_len; - struct sockaddr * sa; + struct sockaddr *sa; struct sockaddr_in6 sa6; retval = GNUNET_SYSERR; @@ -321,19 +316,16 @@ GNUNET_GC_get_configuration_value_string (cfg, "NETWORK", "IP6", "", &ipString); - sa_len = sizeof(struct sockaddr_in6); - sa = (struct sockaddr*) &sa6; - if ( (strlen (ipString) > 0) && - (GNUNET_OK == - GNUNET_get_ip_from_hostname(ectx, - ipString, - AF_INET6, - &sa, - &sa_len)) ) - { - *address = sa6.sin6_addr; - retval = GNUNET_OK; - } + sa_len = sizeof (struct sockaddr_in6); + sa = (struct sockaddr *) &sa6; + if ((strlen (ipString) > 0) && + (GNUNET_OK == + GNUNET_get_ip_from_hostname (ectx, + ipString, AF_INET6, &sa, &sa_len))) + { + *address = sa6.sin6_addr; + retval = GNUNET_OK; + } GNUNET_free (ipString); } #if HAVE_GETIFADDRS && HAVE_FREEIFADDRS @@ -353,7 +345,7 @@ int GNUNET_IP_get_public_ipv6_address (struct GNUNET_GC_Configuration *cfg, struct GNUNET_GE_Context *ectx, - struct in6_addr * address) + struct in6_addr *address) { static struct in6_addr myAddress; static GNUNET_CronTime last; Modified: GNUnet/src/transports/ip.h =================================================================== --- GNUnet/src/transports/ip.h 2008-02-27 06:50:36 UTC (rev 6475) +++ GNUnet/src/transports/ip.h 2008-02-27 06:51:58 UTC (rev 6476) @@ -47,7 +47,7 @@ */ int GNUNET_IP_get_public_ipv4_address (struct GNUNET_GC_Configuration *cfg, struct GNUNET_GE_Context *ectx, - struct in_addr * address); + struct in_addr *address); /** * @brief Get the IPv6 address for the local machine. @@ -56,7 +56,7 @@ */ int GNUNET_IP_get_public_ipv6_address (struct GNUNET_GC_Configuration *cfg, struct GNUNET_GE_Context *ectx, - struct in6_addr * address); + struct in6_addr *address); /** Modified: GNUnet/src/transports/udp.c =================================================================== --- GNUnet/src/transports/udp.c 2008-02-27 06:50:36 UTC (rev 6475) +++ GNUnet/src/transports/udp.c 2008-02-27 06:51:58 UTC (rev 6476) @@ -359,8 +359,7 @@ memset (&serverAddrv4, 0, sizeof (serverAddrv4)); serverAddrv4.sin_family = AF_INET; serverAddrv4.sin_port = haddr->port; - memcpy (&serverAddrv4.sin_addr, &haddr->ipv4, - sizeof (struct in_addr)); + memcpy (&serverAddrv4.sin_addr, &haddr->ipv4, sizeof (struct in_addr)); addrlen = sizeof (serverAddrv4); serverAddr = (struct sockaddr *) &serverAddrv4; } Modified: GNUnet/src/transports/upnp/init.c =================================================================== --- GNUnet/src/transports/upnp/init.c 2008-02-27 06:50:36 UTC (rev 6475) +++ GNUnet/src/transports/upnp/init.c 2008-02-27 06:51:58 UTC (rev 6476) @@ -58,24 +58,20 @@ * @return GNUNET_SYSERR on error, GNUNET_OK on success */ static int -gnunet_upnp_get_public_ip (struct in_addr * address) +gnunet_upnp_get_public_ip (struct in_addr *address) { const char *ip; socklen_t socklen; - struct sockaddr * sa; + struct sockaddr *sa; struct sockaddr_in s4; int ret; ip = gaim_upnp_get_public_ip (); if (ip == NULL) return GNUNET_SYSERR; - socklen = sizeof(struct sockaddr_in); - sa = (struct sockaddr*) &s4; - ret = GNUNET_get_ip_from_hostname (NULL, - ip, - AF_INET, - &sa, - &socklen); + socklen = sizeof (struct sockaddr_in); + sa = (struct sockaddr *) &s4; + ret = GNUNET_get_ip_from_hostname (NULL, ip, AF_INET, &sa, &socklen); if (ret == GNUNET_OK) *address = s4.sin_addr; return ret; @@ -139,7 +135,7 @@ */ static int gnunet_upnp_get_ip (unsigned short port, - const char *protocol, struct in_addr * address) + const char *protocol, struct in_addr *address) { unsigned int i; Modified: GNUnet/src/transports/upnp/ip.c =================================================================== --- GNUnet/src/transports/upnp/ip.c 2008-02-27 06:50:36 UTC (rev 6475) +++ GNUnet/src/transports/upnp/ip.c 2008-02-27 06:51:58 UTC (rev 6476) @@ -36,7 +36,7 @@ */ char * GNUNET_upnp_get_internal_ip (struct GNUNET_GC_Configuration *cfg, - struct GNUNET_GE_Context *ectx) + struct GNUNET_GE_Context *ectx) { struct in_addr address; Modified: GNUnet/src/transports/upnp/ip.h =================================================================== --- GNUnet/src/transports/upnp/ip.h 2008-02-27 06:50:36 UTC (rev 6475) +++ GNUnet/src/transports/upnp/ip.h 2008-02-27 06:51:58 UTC (rev 6476) @@ -34,7 +34,7 @@ * @return NULL on error */ char *GNUNET_upnp_get_internal_ip (struct GNUNET_GC_Configuration *cfg, - struct GNUNET_GE_Context *ectx); + struct GNUNET_GE_Context *ectx); #endif Modified: GNUnet/src/transports/upnp/upnp.c =================================================================== --- GNUnet/src/transports/upnp/upnp.c 2008-02-27 06:50:36 UTC (rev 6475) +++ GNUnet/src/transports/upnp/upnp.c 2008-02-27 06:51:58 UTC (rev 6476) @@ -565,7 +565,7 @@ const char *endDescURL; int ret; UPnPDiscoveryData dd; - struct sockaddr * sa; + struct sockaddr *sa; memset (&dd, 0, sizeof (UPnPDiscoveryData)); if (control_info.status == GAIM_UPNP_STATUS_DISCOVERING) @@ -573,14 +573,11 @@ dd.sock = sock; memset (&server, 0, sizeof (struct sockaddr_in)); server.sin_family = AF_INET; - avail = sizeof(struct sockaddr_in); - sa = (struct sockaddr*) &server; + avail = sizeof (struct sockaddr_in); + sa = (struct sockaddr *) &server; if (GNUNET_OK != - GNUNET_get_ip_from_hostname(ectx, - HTTPMU_HOST_ADDRESS, - AF_INET, - &sa, - &avail)) + GNUNET_get_ip_from_hostname (ectx, + HTTPMU_HOST_ADDRESS, AF_INET, &sa, &avail)) { CLOSE (dd.sock); return GNUNET_SYSERR; Modified: GNUnet/src/transports/upnp/upnptest.c =================================================================== --- GNUnet/src/transports/upnp/upnptest.c 2008-02-27 06:50:36 UTC (rev 6475) +++ GNUnet/src/transports/upnp/upnptest.c 2008-02-27 06:51:58 UTC (rev 6476) @@ -87,7 +87,7 @@ if (GNUNET_OK == upnp->get_ip (2086, "TCP", &addr)) { printf ("UPnP returned external IP %s\n", - inet_ntop(AF_INET, &addr, ntop_buf, INET_ADDRSTRLEN)); + inet_ntop (AF_INET, &addr, ntop_buf, INET_ADDRSTRLEN)); } else { Modified: GNUnet/src/util/network/dns.c =================================================================== --- GNUnet/src/util/network/dns.c 2008-02-27 06:50:36 UTC (rev 6475) +++ GNUnet/src/util/network/dns.c 2008-02-27 06:51:58 UTC (rev 6476) @@ -58,7 +58,8 @@ #endif #if HAVE_ADNS -static void adns_resolve(struct IPCache * cache) +static void +adns_resolve (struct IPCache *cache) { adns_answer *answer; adns_status ret; @@ -99,7 +100,8 @@ #endif #if HAVE_GETNAMEINFO -static void getnameinfo_resolve(struct IPCache * cache) +static void +getnameinfo_resolve (struct IPCache *cache) { char hostname[256]; @@ -109,7 +111,8 @@ #endif #if HAVE_GETHOSTBYADDR -static void gethostbyaddr_resolve(struct IPCache * cache) +static void +gethostbyaddr_resolve (struct IPCache *cache) { struct hostent *ent; @@ -137,17 +140,17 @@ #if HAVE_ADNS if (cache->sa->sa_family == AF_INET) { - adns_resolve(cache); + adns_resolve (cache); return; } #endif #if HAVE_GETNAMEINFO if (cache->addr == NULL) - getnameinfo_resolve(cache); + getnameinfo_resolve (cache); #endif #if HAVE_GETHOSTBYADDR if (cache->addr == NULL) - gethostbyaddr_resolve(cache); + gethostbyaddr_resolve (cache); #endif } @@ -295,14 +298,13 @@ #if HAVE_GETHOSTBYNAME static int -gethostbyname_resolve(struct GNUNET_GE_Context *ectx, - const char * hostname, - struct sockaddr ** sa, - socklen_t * socklen) +gethostbyname_resolve (struct GNUNET_GE_Context *ectx, + const char *hostname, + struct sockaddr **sa, socklen_t * socklen) { struct hostent *hp; - struct sockaddr_in * addr; - + struct sockaddr_in *addr; + hp = GETHOSTBYNAME (hostname); if (hp == NULL) { @@ -310,51 +312,47 @@ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_BULK, _("Could not find IP of host `%s': %s\n"), hostname, hstrerror (h_errno)); - return GNUNET_SYSERR; + return GNUNET_SYSERR; } if (hp->h_addrtype != AF_INET) { GNUNET_GE_BREAK (ectx, 0); return GNUNET_SYSERR; } - GNUNET_GE_ASSERT(NULL, hp->h_length == sizeof(struct in_addr)); + GNUNET_GE_ASSERT (NULL, hp->h_length == sizeof (struct in_addr)); if (NULL == *sa) { - *sa = GNUNET_malloc(sizeof(struct sockaddr_in)); - memset(*sa, 0, sizeof(struct sockaddr_in)); - *socklen = sizeof(struct sockaddr_in); + *sa = GNUNET_malloc (sizeof (struct sockaddr_in)); + memset (*sa, 0, sizeof (struct sockaddr_in)); + *socklen = sizeof (struct sockaddr_in); } else { - if (sizeof(struct sockaddr_in) > *socklen) - return GNUNET_SYSERR; - *socklen = sizeof(struct sockaddr_in); + if (sizeof (struct sockaddr_in) > *socklen) + return GNUNET_SYSERR; + *socklen = sizeof (struct sockaddr_in); } - addr = (struct sockaddr_in*) *sa; + addr = (struct sockaddr_in *) *sa; memset (addr, 0, sizeof (struct sockaddr_in)); addr->sin_family = AF_INET; - memcpy(&addr->sin_addr, - hp->h_addr_list[0], - hp->h_length); + memcpy (&addr->sin_addr, hp->h_addr_list[0], hp->h_length); return GNUNET_OK; } #endif #if HAVE_GETHOSTBYNAME2 static int -gethostbyname2_resolve(struct GNUNET_GE_Context *ectx, - const char * hostname, - int domain, - struct sockaddr ** sa, - socklen_t * socklen) +gethostbyname2_resolve (struct GNUNET_GE_Context *ectx, + const char *hostname, + int domain, struct sockaddr **sa, socklen_t * socklen) { struct hostent *hp; - + if (domain == AF_UNSPEC) { hp = gethostbyname2 (hostname, AF_INET); if (hp == NULL) - hp = gethostbyname2 (hostname, AF_INET6); + hp = gethostbyname2 (hostname, AF_INET6); } else { @@ -366,10 +364,9 @@ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_BULK, _("Could not find IP of host `%s': %s\n"), hostname, hstrerror (h_errno)); - return GNUNET_SYSERR; + return GNUNET_SYSERR; } - if ( (hp->h_addrtype != domain) && - (domain != 0) ) + if ((hp->h_addrtype != domain) && (domain != 0)) { GNUNET_GE_BREAK (ectx, 0); return GNUNET_SYSERR; @@ -377,45 +374,43 @@ domain = hp->haddrtype; if (domain == AF_INET) { - GNUNET_GE_ASSERT(NULL, hp->h_length == sizeof(struct in_addr)); + GNUNET_GE_ASSERT (NULL, hp->h_length == sizeof (struct in_addr)); if (NULL == *sa) - { - *sa = GNUNET_malloc(sizeof(struct sockaddr_in)); - memset(*sa, 0, sizeof(struct sockaddr_in)); - *socklen = sizeof(struct sockaddr_in); - } + { + *sa = GNUNET_malloc (sizeof (struct sockaddr_in)); + memset (*sa, 0, sizeof (struct sockaddr_in)); + *socklen = sizeof (struct sockaddr_in); + } else - { - if (sizeof(struct sockaddr_in) > *socklen) - return GNUNET_SYSERR; - *socklen = sizeof(struct sockaddr_in); - } + { + if (sizeof (struct sockaddr_in) > *socklen) + return GNUNET_SYSERR; + *socklen = sizeof (struct sockaddr_in); + } memset (*sa, 0, sizeof (struct sockaddr_in)); (*sa)->sa_family = AF_INET; - memcpy(&((struct sockaddr_in*)(*sa))->sin_addr, - hp->h_addr_list[0], - hp->h_length); + memcpy (&((struct sockaddr_in *) (*sa))->sin_addr, + hp->h_addr_list[0], hp->h_length); } else { - GNUNET_GE_ASSERT(NULL, hp->h_length == sizeof(struct in_addr6)); + GNUNET_GE_ASSERT (NULL, hp->h_length == sizeof (struct in_addr6)); if (NULL == *sa) - { - *sa = GNUNET_malloc(sizeof(struct sockaddr_in6)); - memset(*sa, 0, sizeof(struct sockaddr_in6)); - *socklen = sizeof(struct sockaddr_in6); - } + { + *sa = GNUNET_malloc (sizeof (struct sockaddr_in6)); + memset (*sa, 0, sizeof (struct sockaddr_in6)); + *socklen = sizeof (struct sockaddr_in6); + } else - { - if (sizeof(struct sockaddr_in6) > *socklen) - return GNUNET_SYSERR; - *socklen = sizeof(struct sockaddr_in6); - } + { + if (sizeof (struct sockaddr_in6) > *socklen) + return GNUNET_SYSERR; + *socklen = sizeof (struct sockaddr_in6); + } memset (*sa, 0, sizeof (struct sockaddr_in6)); (*sa)->sa_family = AF_INET6; - memcpy(&((struct sockaddr_in6*)(*sa))->sin6_addr, - hp->h_addr_list[0], - hp->h_length); + memcpy (&((struct sockaddr_in6 *) (*sa))->sin6_addr, + hp->h_addr_list[0], hp->h_length); } return GNUNET_OK; } @@ -424,41 +419,37 @@ #if HAVE_GETADDRINFO int getaddrinfo_resolve (struct GNUNET_GE_Context *ectx, - const char * hostname, - int domain, - struct sockaddr ** sa, - socklen_t * socklen) + const char *hostname, + int domain, struct sockaddr **sa, socklen_t * socklen) { int s; struct addrinfo hints; struct addrinfo *result; - + memset (&hints, 0, sizeof (struct addrinfo)); hints.ai_family = domain; hints.ai_socktype = 0; - hints.ai_protocol = 0; /* Any protocol */ + hints.ai_protocol = 0; /* Any protocol */ hints.ai_canonname = NULL; hints.ai_addr = NULL; hints.ai_next = NULL; - + if (0 != (s = getaddrinfo (hostname, NULL, &hints, &result))) { GNUNET_GE_LOG (ectx, - GNUNET_GE_ERROR | GNUNET_GE_USER | - GNUNET_GE_BULK, - _("Could not resolve `%s': %s\n"), hostname, - gai_strerror (s)); + GNUNET_GE_ERROR | GNUNET_GE_USER | + GNUNET_GE_BULK, + _("Could not resolve `%s': %s\n"), hostname, + gai_strerror (s)); return GNUNET_SYSERR; } if (result == NULL) return GNUNET_SYSERR; if (NULL == *sa) { - *sa = GNUNET_malloc(result->ai_addrlen); + *sa = GNUNET_malloc (result->ai_addrlen); *socklen = result->ai_addrlen; - memcpy(*sa, - result->ai_addr, - result->ai_addrlen); + memcpy (*sa, result->ai_addr, result->ai_addrlen); freeaddrinfo (result); return GNUNET_OK; } @@ -468,9 +459,7 @@ return GNUNET_SYSERR; } *socklen = result->ai_addrlen; - memcpy (*sa, - result->ai_addr, - result->ai_addrlen); + memcpy (*sa, result->ai_addr, result->ai_addrlen); freeaddrinfo (result); return GNUNET_OK; } @@ -495,43 +484,29 @@ */ int GNUNET_get_ip_from_hostname (struct GNUNET_GE_Context *ectx, - const char * hostname, - int domain, - struct sockaddr ** sa, - socklen_t * socklen) + const char *hostname, + int domain, + struct sockaddr **sa, socklen_t * socklen) { int ret; - ret = GNUNET_NO; /* NO: continue trying, OK: success, SYSERR: failure */ - GNUNET_mutex_lock(lock); + ret = GNUNET_NO; /* NO: continue trying, OK: success, SYSERR: failure */ + GNUNET_mutex_lock (lock); #if HAVE_GETADDRINFO if (ret == GNUNET_NO) - ret = getaddrinfo_resolve(ectx, - hostname, - domain, - sa, - socklen); + ret = getaddrinfo_resolve (ectx, hostname, domain, sa, socklen); #endif #if HAVE_GETHOSTBYNAME2 - if (ret == GNUNET_NO) - ret = gethostbyname2_resolve(ectx, - hostname, - domain, - sa, - socklen); + if (ret == GNUNET_NO) + ret = gethostbyname2_resolve (ectx, hostname, domain, sa, socklen); #endif #if HAVE_GETHOSTBYNAME - if ( (ret == GNUNET_NO) && - ( (domain == AF_UNSPEC) || - (domain == PF_INET) ) ) - ret = gethostbyname_resolve(ectx, - hostname, - sa, - socklen); + if ((ret == GNUNET_NO) && ((domain == AF_UNSPEC) || (domain == PF_INET))) + ret = gethostbyname_resolve (ectx, hostname, sa, socklen); #endif - GNUNET_mutex_unlock(lock); + GNUNET_mutex_unlock (lock); if (ret == GNUNET_NO) - ret = GNUNET_SYSERR; /* no further options */ + ret = GNUNET_SYSERR; /* no further options */ return ret; } Modified: GNUnet/src/util/network/ip.c =================================================================== --- GNUnet/src/util/network/ip.c 2008-02-27 06:50:36 UTC (rev 6475) +++ GNUnet/src/util/network/ip.c 2008-02-27 06:51:58 UTC (rev 6476) @@ -51,11 +51,11 @@ */ static int getAddressFromHostname (struct GNUNET_GE_Context *ectx, - struct in_addr * identity) + struct in_addr *identity) { char hostname[MAX_HOSTNAME]; int ret; - struct sockaddr * my_addr; + struct sockaddr *my_addr; struct sockaddr_in a4; socklen_t socklen; @@ -66,9 +66,10 @@ GNUNET_GE_USER | GNUNET_GE_BULK, "gethostname"); return GNUNET_SYSERR; } - socklen = sizeof(struct sockaddr_in); - my_addr = (struct sockaddr*) &a4; - ret = GNUNET_get_ip_from_hostname (ectx, hostname, AF_INET, &my_addr, &socklen); + socklen = sizeof (struct sockaddr_in); + my_addr = (struct sockaddr *) &a4; + ret = + GNUNET_get_ip_from_hostname (ectx, hostname, AF_INET, &my_addr, &socklen); if (ret == GNUNET_OK) *identity = a4.sin_addr; return ret; @@ -78,7 +79,7 @@ static int getAddressFromGetIfAddrs (struct GNUNET_GC_Configuration *cfg, struct GNUNET_GE_Context *ectx, - struct in_addr * identity) + struct in_addr *identity) { char *interfaces; struct ifaddrs *ifa_first; @@ -135,8 +136,7 @@ #define MAX_INTERFACES 16 static int getAddressFromIOCTL (struct GNUNET_GC_Configuration *cfg, - struct GNUNET_GE_Context *ectx, - struct in_addr * identity) + struct GNUNET_GE_Context *ectx, struct in_addr *identity) { char *interfaces; #ifndef MINGW @@ -300,14 +300,15 @@ return GNUNET_SYSERR; } else if (iAddrCount > 1) - { - GNUNET_GE_LOG (ectx, - GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER, - _("There is more than one IP address specified" - " for interface `%s'.\nGNUnet will " - "use %s.\n"), interfaces, - inet_ntop(AF_INET, &dwIP, ntop_buf, INET_ADDRSTRLEN)); - } + { + GNUNET_GE_LOG (ectx, + GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER, + _("There is more than one IP address specified" + " for interface `%s'.\nGNUnet will " + "use %s.\n"), interfaces, + inet_ntop (AF_INET, &dwIP, ntop_buf, + INET_ADDRSTRLEN)); + } identity->addr = dwIP; @@ -360,7 +361,8 @@ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER, _("GNUnet now uses the IP address %s.\n"), - inet_ntop(AF_INET, &identity->addr, ntop_buf, INET_ADDRSTRLEN)); + inet_ntop (AF_INET, &identity->addr, ntop_buf, + INET_ADDRSTRLEN)); return GNUNET_OK; #endif } @@ -373,11 +375,10 @@ */ char * GNUNET_get_local_ip (struct GNUNET_GC_Configuration *cfg, - struct GNUNET_GE_Context *ectx, - struct in_addr * addr) + struct GNUNET_GE_Context *ectx, struct in_addr *addr) { struct in_addr address; - struct sockaddr * my_addr; + struct sockaddr *my_addr; struct sockaddr_in a4; char *ipString; int retval; @@ -392,11 +393,13 @@ &ipString); if (strlen (ipString) > 0) { - socklen = sizeof(struct sockaddr_in); - my_addr = (struct sockaddr*) &a4; - retval = GNUNET_get_ip_from_hostname (ectx, ipString, AF_INET, &my_addr, &socklen); - if (retval == GNUNET_OK) - address = a4.sin_addr; + socklen = sizeof (struct sockaddr_in); + my_addr = (struct sockaddr *) &a4; + retval = + GNUNET_get_ip_from_hostname (ectx, ipString, AF_INET, &my_addr, + &socklen); + if (retval == GNUNET_OK) + address = a4.sin_addr; } GNUNET_free (ipString); } @@ -414,11 +417,7 @@ retval = getAddressFromHostname (ectx, &address); if (retval == GNUNET_SYSERR) return NULL; - if (NULL == - inet_ntop(AF_INET, - &address, - buf, - INET_ADDRSTRLEN)) + if (NULL == inet_ntop (AF_INET, &address, buf, INET_ADDRSTRLEN)) return NULL; if (addr != NULL) *addr = address; Modified: GNUnet/src/util/network/ipcheck.c =================================================================== --- GNUnet/src/util/network/ipcheck.c 2008-02-27 06:50:36 UTC (rev 6475) +++ GNUnet/src/util/network/ipcheck.c 2008-02-27 06:51:58 UTC (rev 6476) @@ -333,11 +333,10 @@ * @return GNUNET_NO if the IP is not in the list, GNUNET_YES if it it is */ int -GNUNET_check_ipv4_listed (const CIDRNetwork * list, - const struct in_addr * ip) +GNUNET_check_ipv4_listed (const CIDRNetwork * list, const struct in_addr *ip) { int i; - const struct in_addr * add; + const struct in_addr *add; add = ip; i = 0; @@ -362,8 +361,8 @@ * @return GNUNET_NO if the IP is not in the list, GNUNET_YES if it it is */ int -GNUNET_check_ipv6_listed (const CIDR6Network * list, - const struct in6_addr * ip) +GNUNET_check_ipv6_listed (const CIDR6Network * list, + const struct in6_addr *ip) { unsigned int i; unsigned int j; Modified: GNUnet/src/util/network/selecttest.c =================================================================== --- GNUnet/src/util/network/selecttest.c 2008-02-27 06:50:36 UTC (rev 6475) +++ GNUnet/src/util/network/selecttest.c 2008-02-27 06:51:58 UTC (rev 6476) @@ -197,7 +197,7 @@ sh = GNUNET_select_create ("Select Tester", GNUNET_NO, /* tcp */ NULL, /* ectx */ NULL, /* no load monitoring */ - listen_sock, sizeof (struct in_addr), 15 * GNUNET_CRON_SECONDS, /* inactive timeout */ + listen_sock, sizeof (struct in_addr), 15 * GNUNET_CRON_SECONDS, /* inactive timeout */ test_smh, NULL, test_sah, NULL, test_sch, NULL, 128 * 1024, /* memory quota */ 128 /* socket quota */ ); Modified: GNUnet/src/util/network_client/tcpio.c =================================================================== --- GNUnet/src/util/network_client/tcpio.c 2008-02-27 06:50:36 UTC (rev 6475) +++ GNUnet/src/util/network_client/tcpio.c 2008-02-27 06:51:58 UTC (rev 6476) @@ -236,7 +236,7 @@ GNUNET_ClientServerConnection *sock) { - struct sockaddr * soaddr; + struct sockaddr *soaddr; socklen_t socklen; fd_set rset; fd_set wset; @@ -260,7 +260,9 @@ return GNUNET_SYSERR; soaddr = NULL; socklen = 0; - if (GNUNET_SYSERR == GNUNET_get_ip_from_hostname (sock->ectx, host, AF_UNSPEC, &soaddr, &socklen)) + if (GNUNET_SYSERR == + GNUNET_get_ip_from_hostname (sock->ectx, host, AF_UNSPEC, &soaddr, + &socklen)) { GNUNET_free (host); return GNUNET_SYSERR; @@ -270,24 +272,24 @@ { GNUNET_free (host); GNUNET_mutex_unlock (sock->destroylock); - GNUNET_free(soaddr); + GNUNET_free (soaddr); return GNUNET_OK; } if (sock->dead == GNUNET_YES) { GNUNET_free (host); GNUNET_mutex_unlock (sock->destroylock); - GNUNET_free(soaddr); + GNUNET_free (soaddr); return GNUNET_SYSERR; } if (soaddr->sa_family == AF_INET) { - ((struct sockaddr_in*) soaddr)->sin_port = htons (port); + ((struct sockaddr_in *) soaddr)->sin_port = htons (port); osock = SOCKET (PF_INET, SOCK_STREAM, 0); - } + } else { - ((struct sockaddr_in6*) soaddr)->sin6_port = htons (port); + ((struct sockaddr_in6 *) soaddr)->sin6_port = htons (port); osock = SOCKET (PF_INET6, SOCK_STREAM, 0); } if (osock == -1) @@ -297,13 +299,13 @@ GNUNET_GE_ADMIN | GNUNET_GE_BULK, "socket"); GNUNET_free (host); GNUNET_mutex_unlock (sock->destroylock); - GNUNET_free(soaddr); + GNUNET_free (soaddr); return GNUNET_SYSERR; } sock->sock = GNUNET_socket_create (sock->ectx, NULL, osock); GNUNET_socket_set_blocking (sock->sock, GNUNET_NO); ret = CONNECT (osock, soaddr, socklen); - GNUNET_free(soaddr); + GNUNET_free (soaddr); if ((ret != 0) && (errno != EINPROGRESS) && (errno != EWOULDBLOCK)) { GNUNET_GE_LOG (sock->ectx, _______________________________________________ GNUnet-SVN mailing list GNUnet-SVN@gnu.org http://lists.gnu.org/mailman/listinfo/gnunet-svn