Re: [PATCH 01/14] NLM: Beef up NLM address display function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Oct 29, 2008, at 3:25 PM, J. Bruce Fields wrote:
On Fri, Oct 24, 2008 at 02:09:54PM -0400, Chuck Lever wrote:
Add support for IPv6 addresses with a scope ID,

I remain a bit confused about scope ID's.  If you tell me they're
needed, I'll believe you.

In this case we need to be able to send an IPv6 address to user space (in addition to the original use for this code, which was just to print debugging information).

To support locking and NSM with link-local addresses (which need an interface ID to work) we need to have scope ID support here.

and enable calls from outside of fs/lockd/host.c

Some day of course it'd be nice to collect all the basic "display an
ipv6 address" code together in one place!

There's a storm brewing on netdev to put address printing support into the kernel's implementation of vsnprintf (in preference to NIPQUAD and NIP6), so this may all go away at some point soon.

diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index 9fd8889..c7516ae 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -104,29 +104,54 @@ static void nlm_clear_port(struct sockaddr *sap)
	}
}

-static void nlm_display_address(const struct sockaddr *sap,
...
+int nlm_display_address(const struct sockaddr *sap, char *buf,

The return value is never used, even after your other patches.  Do you
have any plans to use it?

I thought it was used in the NSM code. I'll review that before submitting these again.

--b.

+			const size_t len)
+{
	switch (sap->sa_family) {
	case AF_UNSPEC:
-		snprintf(buf, len, "unspecified");
-		break;
+		snprintf(buf, len, "unspecified address");
+		return -EAFNOSUPPORT;
	case AF_INET:
-		snprintf(buf, len, NIPQUAD_FMT, NIPQUAD(sin->sin_addr.s_addr));
-		break;
+		return nlm_display_ipv4_address(sap, buf, len);
	case AF_INET6:
-		if (ipv6_addr_v4mapped(&sin6->sin6_addr))
-			snprintf(buf, len, NIPQUAD_FMT,
-				 NIPQUAD(sin6->sin6_addr.s6_addr32[3]));
-		else
-			snprintf(buf, len, NIP6_FMT, NIP6(sin6->sin6_addr));
-		break;
+		return nlm_display_ipv6_address(sap, buf, len);
	default:
		snprintf(buf, len, "unsupported address family");
-		break;
+		return -EAFNOSUPPORT;
	}
}

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux