summaryrefslogtreecommitdiffstats
path: root/lib/parse.c
diff options
context:
space:
mode:
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2010-06-29 21:14:40 +0200
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2010-06-29 21:14:40 +0200
commit8dd10256cb24ceade8b40bd1604f03ddac8589e2 (patch)
tree9b6e5deae0b5d349122c82b63019d6bb36a66aeb /lib/parse.c
parent780f6384c5c6639da3f5a6ac8d30653e8a26d6c0 (diff)
ipset 5: Sparc related and compatibility fixesv5.0-pre5
ipset 5 is tested on Sparc, which revealed some compatibility issues and those are fixed. Kernels from 2.6.31 onward are supported. The testsuite checkings are completed to run match/target checks. The README file is updated to reflect the requirements to install and run ipset 5.
Diffstat (limited to 'lib/parse.c')
-rw-r--r--lib/parse.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/parse.c b/lib/parse.c
index b1fecc7..84b6a3f 100644
--- a/lib/parse.c
+++ b/lib/parse.c
@@ -437,7 +437,7 @@ get_addrinfo##f(struct ipset_session *session, \
struct in##n##_addr **inaddr) \
{ \
struct addrinfo *i; \
- struct sockaddr_in##n *saddr; \
+ struct sockaddr_in##n saddr; \
int found; \
\
if ((*info = get_addrinfo(session, str, family)) == NULL) { \
@@ -447,16 +447,18 @@ get_addrinfo##f(struct ipset_session *session, \
} \
\
for (i = *info, found = 0; i != NULL; i = i->ai_next) { \
- if (i->ai_family != family) \
+ if (i->ai_family != family \
+ || i->ai_addrlen != sizeof(saddr)) \
continue; \
if (found == 0) { \
- saddr = (struct sockaddr_in##n *)i->ai_addr; \
- *inaddr = &saddr->sin##n##_addr; \
- } else if (found == 1) { \
+ /* Workaround: can't cast on Sparc */ \
+ memcpy(&saddr, i->ai_addr, sizeof(saddr)); \
+ *inaddr = &saddr.sin##n##_addr; \
+ } else if (found == 1) { \
ipset_warn(session, \
"%s resolves to multiple addresses: " \
"using only the first one returned by the resolver", \
- str); \
+ str); \
} \
found++; \
} \