[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r3734 - GNUnet/src/transports
From: |
grothoff |
Subject: |
[GNUnet-SVN] r3734 - GNUnet/src/transports |
Date: |
Sun, 12 Nov 2006 13:02:46 -0800 (PST) |
Author: grothoff
Date: 2006-11-12 13:02:44 -0800 (Sun, 12 Nov 2006)
New Revision: 3734
Modified:
GNUnet/src/transports/ip.c
GNUnet/src/transports/ip6.c
Log:
fixing IP resolution code
Modified: GNUnet/src/transports/ip.c
===================================================================
--- GNUnet/src/transports/ip.c 2006-11-12 20:53:48 UTC (rev 3733)
+++ GNUnet/src/transports/ip.c 2006-11-12 21:02:44 UTC (rev 3734)
@@ -305,28 +305,33 @@
char * ipString;
int retval;
- ipString = NULL;
- if ( (1 != GC_get_configuration_value_string(cfg,
- "NETWORK",
- "IP",
- "",
- &ipString)) ||
- (strlen(ipString) > 0) ) {
+ retval = SYSERR;
+ if (GC_have_configuration_value(cfg,
+ "NETWORK",
+ "IP")) {
+ ipString = NULL;
+ GC_get_configuration_value_string(cfg,
+ "NETWORK",
+ "IP",
+ "",
+ &ipString);
+ if (strlen(ipString) > 0) {
+ retval = get_host_by_name(ectx,
+ ipString,
+ address);
+ }
+ FREE(ipString);
+ }
#if LINUX || SOMEBSD || MINGW
+ if (retval == SYSERR)
if (OK == getAddressFromIOCTL(cfg,
ectx,
address))
retval = OK;
- else
#endif
- retval = getAddressFromHostname(ectx,
- address);
- } else {
- retval = get_host_by_name(ectx,
- ipString,
- address);
- }
- FREE(ipString);
+ if (retval == SYSERR)
+ retval = getAddressFromHostname(ectx,
+ address);
return retval;
}
Modified: GNUnet/src/transports/ip6.c
===================================================================
--- GNUnet/src/transports/ip6.c 2006-11-12 20:53:48 UTC (rev 3733)
+++ GNUnet/src/transports/ip6.c 2006-11-12 21:02:44 UTC (rev 3734)
@@ -92,27 +92,25 @@
struct hostent * ip; /* for the lookup of the IP in gnunet.conf */
retval = SYSERR;
- ipString = NULL;
- if ( (1 != GC_get_configuration_value_string(cfg,
- "NETWORK",
- "IP6",
- "",
- &ipString)) ||
- (strlen(ipString) > 0) ) {
- retval = getAddress6FromHostname(ectx,
- address);
- } else {
- ip = gethostbyname2(ipString,
- AF_INET6);
- if (ip == NULL) {
- GE_LOG(ectx,
- GE_ERROR | GE_USER | GE_BULK,
- _("Could not resolve `%s': %s\n"),
- ipString,
- hstrerror(h_errno));
- retval = SYSERR;
- } else {
- if (ip->h_addrtype != AF_INET6) {
+ if (GC_have_configuration_value(cfg,
+ "NETWORK",
+ "IP6")) {
+ ipString = NULL;
+ GC_get_configuration_value_string(cfg,
+ "NETWORK",
+ "IP6",
+ "",
+ &ipString);
+ if (strlen(ipString) > 0) {
+ ip = gethostbyname2(ipString,
+ AF_INET6);
+ if (ip == NULL) {
+ GE_LOG(ectx,
+ GE_ERROR | GE_USER | GE_BULK,
+ _("Could not resolve `%s': %s\n"),
+ ipString,
+ hstrerror(h_errno));
+ } else if (ip->h_addrtype != AF_INET6) {
GE_ASSERT(ectx,
0);
retval = SYSERR;
@@ -125,8 +123,11 @@
retval = OK;
}
}
+ FREE(ipString);
}
- FREE(ipString);
+ if (retval == SYSERR)
+ retval = getAddress6FromHostname(ectx,
+ address);
return retval;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r3734 - GNUnet/src/transports,
grothoff <=