@@ -105,16 +105,14 @@ fedfsd_compare_sockaddr6(const struct sockaddr *sa1, const struct sockaddr *sa2)
{
const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sa1;
const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sa2;
+ const struct in6_addr *in1 = &sin1->sin6_addr;
+ const struct in6_addr *in2 = &sin2->sin6_addr;
- if ((IN6_IS_ADDR_LINKLOCAL((char *)&sin1->sin6_addr) &&
- IN6_IS_ADDR_LINKLOCAL((char *)&sin2->sin6_addr)) ||
- (IN6_IS_ADDR_SITELOCAL((char *)&sin1->sin6_addr) &&
- IN6_IS_ADDR_SITELOCAL((char *)&sin2->sin6_addr)))
+ if (IN6_IS_ADDR_LINKLOCAL(in1) && IN6_IS_ADDR_LINKLOCAL(in2))
if (sin1->sin6_scope_id != sin2->sin6_scope_id)
return false;
- return IN6_ARE_ADDR_EQUAL((char *)&sin1->sin6_addr,
- (char *)&sin2->sin6_addr);
+ return IN6_ARE_ADDR_EQUAL(in1, in2);
}
/**
@@ -62,8 +62,8 @@
static void
fedfsd_caller(struct svc_req *rqstp, char *buf, const size_t buflen)
{
- const struct sockaddr *sap = (struct sockaddr *)(char *)
- svc_getcaller(rqstp->rq_xprt);
+ const struct sockaddr_in6 *sin6 = svc_getcaller(rqstp->rq_xprt);
+ const struct sockaddr *sap = (struct sockaddr *)sin6;
socklen_t salen;
switch (sap->sa_family) {
We get twelve of these: listen.c:109:2: warning: dereferencing type-punned pointer might break strict-aliasing rules [-Wstrict-aliasing] And one in svc.c. Add an extra two pointer variables to squelch the warnings. Also, site-local IPv6 addresses are deprecated, so remove the test for those. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- src/fedfsd/listen.c | 10 ++++------ src/fedfsd/svc.c | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-)