From 8dd10256cb24ceade8b40bd1604f03ddac8589e2 Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Tue, 29 Jun 2010 21:14:40 +0200 Subject: ipset 5: Sparc related and compatibility fixes 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. --- lib/parse.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'lib/parse.c') 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++; \ } \ -- cgit v1.2.3