Skip to contentSkip to conversation

sunrpc: copy scope ID in __rpc_copy_addr6

PATCH In review Jeff Layton 2 participants 6 messages Feb 4, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sunrpc: copy scope ID in __rpc_copy_addr6

When copying an address, we should also copy the scopeid in the event that this is a link-local address and the scope matters.

---
 include/linux/sunrpc/clnt.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/sunrpc/clnt.h +1 -0
index 47354a2..6a7c261 100644
@@ -242,6 +242,7 @@ static inline bool __rpc_copy_addr6(struct sockaddr *dst,
 
 	dsin6->sin6_family = ssin6->sin6_family;
 	dsin6->sin6_addr = ssin6->sin6_addr;
+	dsin6->sin6_scope_id = ssin6->sin6_scope_id;
 	return true;
 }
 #else	/* !(IS_ENABLED(CONFIG_IPV6) */
Signature · 1 line
1.7.11.7
#1 lore raw
Quoted 28 lines

-----Original Message-----
From: [email protected] [mailto:linux-nfs- [email protected]] On Behalf Of Jeff Layton
Sent: Monday, February 04, 2013 8:10 AM
To: [email protected]
Cc: [email protected]; [email protected]
Subject: [PATCH] sunrpc: copy scope ID in __rpc_copy_addr6

When copying an address, we should also copy the scopeid in the event that this is a link-local address and the scope matters.

---
 include/linux/sunrpc/clnt.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/sunrpc/clnt.h index renamed from include/linux/sunrpc/clnt.h +0 -0

47354a2..6a7c261 100644

include/linux/sunrpc/clnt.h +1 -0
@@ -242,6 +242,7 @@ static inline bool __rpc_copy_addr6(struct sockaddr
 *dst,
 
 	dsin6->sin6_family = ssin6->sin6_family;
 	dsin6->sin6_addr = ssin6->sin6_addr;
+	dsin6->sin6_scope_id = ssin6->sin6_scope_id;
 	return true;
 }
Quoted 2 lines

#else /* !(IS_ENABLED(CONFIG_IPV6) */
--

Can we please move these helpers into a separate header, say include/Linux/sunrpc/inet.h?

Trond

#2 lore raw
In reply to Jeff Layton
Quoted 28 lines

-----Original Message-----
From: [email protected] [mailto:linux-nfs- [email protected]] On Behalf Of Jeff Layton
Sent: Monday, February 04, 2013 8:10 AM
To: [email protected]
Cc: [email protected]; [email protected]
Subject: [PATCH] sunrpc: copy scope ID in __rpc_copy_addr6

When copying an address, we should also copy the scopeid in the event that this is a link-local address and the scope matters.

---
 include/linux/sunrpc/clnt.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/sunrpc/clnt.h index renamed from include/linux/sunrpc/clnt.h +0 -0

47354a2..6a7c261 100644

include/linux/sunrpc/clnt.h +1 -0
@@ -242,6 +242,7 @@ static inline bool __rpc_copy_addr6(struct sockaddr
 *dst,
 
 	dsin6->sin6_family = ssin6->sin6_family;
 	dsin6->sin6_addr = ssin6->sin6_addr;
+	dsin6->sin6_scope_id = ssin6->sin6_scope_id;
 	return true;
 }
Quoted 2 lines

#else /* !(IS_ENABLED(CONFIG_IPV6) */
--

Oh... Also note that you probably want to apply the above scopeid to the NFSv4 callback address that is supplied by the client in the setclientid call.

Trond

#3 lore raw
Quoted 23 lines · Trond
Quoted 23 lines

-----Original Message-----
From: [email protected] [mailto:linux-nfs- [email protected]] On Behalf Of Jeff Layton
Sent: Monday, February 04, 2013 8:10 AM
To: [email protected]
Cc: [email protected]; [email protected]
Subject: [PATCH] sunrpc: copy scope ID in __rpc_copy_addr6

When copying an address, we should also copy the scopeid in the event that this is a link-local address and the scope matters.

---
 include/linux/sunrpc/clnt.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/sunrpc/clnt.h index renamed from include/linux/sunrpc/clnt.h +0 -0

47354a2..6a7c261 100644

include/linux/sunrpc/clnt.h +0 -0
@@ -242,6 +242,7 @@ static inline bool __rpc_copy_addr6(struct sockaddr
 *dst,
 
Quoted 11 lines
Quoted 7 lines
include/linux/sunrpc/clnt.h +1 -0
 	dsin6->sin6_family = ssin6->sin6_family;
 	dsin6->sin6_addr = ssin6->sin6_addr;
+	dsin6->sin6_scope_id = ssin6->sin6_scope_id;
 	return true;
 }

#else /* !(IS_ENABLED(CONFIG_IPV6) */
--

Can we please move these helpers into a separate header, say include/Linux/sunrpc/inet.h?

Yes, that's long overdue. I'll spin up a patch on top of this one to do that. I'd suggest that we call it "addr.h" to keep it in parity with the "addr.c" file that's in the sunrpc directory, since we'll need to move the prototypes for those functions as well.

Quoted 2 lines

Oh... Also note that you probably want to apply the above scopeid to the NFSv4 callback address that is supplied by the client in the setclientid call.

I'm not clear on what you mean here. This patch should make it so that the server keeps the correct scopeid along with the cb address that it tracks for a client (something that I don't think it does properly today).

Signature · 1 line
Jeff Layton <[email protected]>
#4 lore raw
Quoted 52 lines

-----Original Message-----
From: Jeff Layton [mailto:[email protected]]
Sent: Monday, February 04, 2013 9:42 AM
To: Myklebust, Trond
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] sunrpc: copy scope ID in __rpc_copy_addr6

Quoted 24 lines · Trond
Quoted 24 lines

-----Original Message-----
From: [email protected] [mailto:linux-nfs- [email protected]] On Behalf Of Jeff Layton
Sent: Monday, February 04, 2013 8:10 AM
To: [email protected]
Cc: [email protected]; [email protected]
Subject: [PATCH] sunrpc: copy scope ID in __rpc_copy_addr6

When copying an address, we should also copy the scopeid in the event that this is a link-local address and the scope matters.

---
 include/linux/sunrpc/clnt.h | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

b/include/linux/sunrpc/clnt.h index
47354a2..6a7c261 100644

include/linux/sunrpc/clnt.h +0 -0
@@ -242,6 +242,7 @@ static inline bool __rpc_copy_addr6(struct
 sockaddr *dst,
 
Quoted 10 lines
Quoted 7 lines
include/linux/sunrpc/clnt.h +1 -0
 	dsin6->sin6_family = ssin6->sin6_family;
 	dsin6->sin6_addr = ssin6->sin6_addr;
+	dsin6->sin6_scope_id = ssin6->sin6_scope_id;
 	return true;
 }

#else /* !(IS_ENABLED(CONFIG_IPV6) */
--

Can we please move these helpers into a separate header, say

include/Linux/sunrpc/inet.h?

Quoted 1 line

Yes, that's long overdue. I'll spin up a patch on top of this one to do that. I'd suggest that we call it "addr.h" to keep it in parity with the "addr.c" file that's in the sunrpc directory, since we'll need to move the prototypes for those functions as well.

Quoted 8 lines
Quoted 1 line

Oh... Also note that you probably want to apply the above scopeid to the

NFSv4 callback address that is supplied by the client in the setclientid call.

Quoted 1 line

I'm not clear on what you mean here. This patch should make it so that the server keeps the correct scopeid along with the cb address that it tracks for a client (something that I don't think it does properly today).

I mean that the NFSv4 client supplies an address in "universal address" format (i.e. a string) as part of the setclientid call. If that address is a link-local address, then it won't contain a scopeid ('cos the scopeid is an identifier that is local to the _server_). In that case the server should apply the scopeid from the nfs4_clientid in the gen_callback() helper.

Cheers
Trond

#5 lore raw
Quoted 56 lines · Trond
Quoted 56 lines

-----Original Message-----
From: Jeff Layton [mailto:[email protected]]
Sent: Monday, February 04, 2013 9:42 AM
To: Myklebust, Trond
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] sunrpc: copy scope ID in __rpc_copy_addr6

Quoted 24 lines · Trond
Quoted 24 lines

-----Original Message-----
From: [email protected] [mailto:linux-nfs- [email protected]] On Behalf Of Jeff Layton
Sent: Monday, February 04, 2013 8:10 AM
To: [email protected]
Cc: [email protected]; [email protected]
Subject: [PATCH] sunrpc: copy scope ID in __rpc_copy_addr6

When copying an address, we should also copy the scopeid in the event that this is a link-local address and the scope matters.

---
 include/linux/sunrpc/clnt.h | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

b/include/linux/sunrpc/clnt.h index
47354a2..6a7c261 100644

include/linux/sunrpc/clnt.h +0 -0
@@ -242,6 +242,7 @@ static inline bool __rpc_copy_addr6(struct
 sockaddr *dst,
 
Quoted 10 lines
Quoted 7 lines
include/linux/sunrpc/clnt.h +1 -0
 	dsin6->sin6_family = ssin6->sin6_family;
 	dsin6->sin6_addr = ssin6->sin6_addr;
+	dsin6->sin6_scope_id = ssin6->sin6_scope_id;
 	return true;
 }

#else /* !(IS_ENABLED(CONFIG_IPV6) */
--

Can we please move these helpers into a separate header, say

include/Linux/sunrpc/inet.h?

Quoted 1 line

Yes, that's long overdue. I'll spin up a patch on top of this one to do that. I'd suggest that we call it "addr.h" to keep it in parity with the "addr.c" file that's in the sunrpc directory, since we'll need to move the prototypes for those functions as well.

Quoted 1 line

Oh... Also note that you probably want to apply the above scopeid to the

NFSv4 callback address that is supplied by the client in the setclientid call.

Quoted 1 line
Quoted 9 lines
Quoted 4 lines

I'm not clear on what you mean here. This patch should make it so that the server keeps the correct scopeid along with the cb address that it tracks for a client (something that I don't think it does properly today).

I mean that the NFSv4 client supplies an address in "universal address" format (i.e. a string) as part of the setclientid call. If that address is a link-local address, then it won't contain a scopeid ('cos the scopeid is an identifier that is local to the _server_). In that case the server should apply the scopeid from the nfs4_clientid in the gen_callback() helper.

Cheers
Trond

I believe we already handle that correctly in gen_callback(), unless I'm missing something...

Signature · 1 line
Jeff Layton <[email protected]>