diff mbox

[07/15] rpc.fedfsd: Squelch compiler warnings

Message ID 20111025164916.18584.14463.stgit@seurat.1015granger.net
State Accepted
Headers show

Commit Message

Chuck Lever Oct. 25, 2011, 4:49 p.m. UTC
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(-)
diff mbox

Patch

diff --git a/src/fedfsd/listen.c b/src/fedfsd/listen.c
index fce09d7..1f0abf2 100644
--- a/src/fedfsd/listen.c
+++ b/src/fedfsd/listen.c
@@ -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);
 }
 
 /**
diff --git a/src/fedfsd/svc.c b/src/fedfsd/svc.c
index bbe1fa1..6504973 100644
--- a/src/fedfsd/svc.c
+++ b/src/fedfsd/svc.c
@@ -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) {