[strongSwan-dev] [PATCH] Reduce noise in log file
Volker Rümelin
vr_strongswan at t-online.de
Sun Apr 21 15:10:39 CEST 2013
Hi,
once again. This time with tabs instead of spaces.
I find a lot of unnecessary error entries in my log file if I connect
over IPV6 to a strongswan 5 server which also accepts connections over
IPv4. There is one entry for each IPv4 connection in ipsec.conf. The
following patch adds the missing test for IPv4 addresses.
Apr 20 21:12:25 proxy charon: 18[LIB] resolving 'x.x.x.x' failed:
Address family for hostname not supported
Apr 20 21:12:25 proxy charon: last message repeated 8 times
Suppress 'Address family for hostname not supported' errors if a IPv6
client connects in a mixed IPv4/IPv6 environment.
---
src/libstrongswan/networking/host_resolver.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/src/libstrongswan/networking/host_resolver.c b/src/libstrongswan/networking/host_resolver.c
index 5e244f1..99a17d1 100644
--- a/src/libstrongswan/networking/host_resolver.c
+++ b/src/libstrongswan/networking/host_resolver.c
@@ -233,10 +233,24 @@ METHOD(host_resolver_t, resolve, host_t*,
.family = family,
};
host_t *result;
+ struct in_addr addr;
- if (family == AF_INET && strchr(name, ':'))
- { /* do not try to convert v6 addresses for v4 family */
- return NULL;
+ switch (family)
+ {
+ case AF_INET:
+ /* do not try to convert v6 addresses for v4 family */
+ if (strchr(name, ':'))
+ {
+ return NULL;
+ }
+ break;
+ case AF_INET6:
+ /* do not try to convert v4 addresses for v6 family */
+ if (inet_pton(AF_INET, name, &addr) == 1)
+ {
+ return NULL;
+ }
+ break;
}
this->mutex->lock(this->mutex);
if (this->disabled)
--
1.7.10.4
More information about the Dev
mailing list