aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/lockd/clntlock.c2
-rw-r--r--fs/lockd/host.c1
-rw-r--r--fs/lockd/mon.c1
-rw-r--r--fs/lockd/svcsubs.c2
-rw-r--r--fs/nfs/dns_resolve.c2
-rw-r--r--fs/nfs/nfs4client.c1
-rw-r--r--fs/nfs/nfs4filelayoutdev.c1
-rw-r--r--fs/nfs/nfs4namespace.c1
-rw-r--r--fs/nfs/super.c1
-rw-r--r--fs/nfsd/fault_inject.c2
-rw-r--r--fs/nfsd/nfs4state.c2
-rw-r--r--fs/nfsd/nfscache.c2
-rw-r--r--fs/nfsd/nfsctl.c2
-rw-r--r--include/linux/sunrpc/addr.h170
-rw-r--r--include/linux/sunrpc/clnt.h155
-rw-r--r--net/sunrpc/addr.c3
-rw-r--r--net/sunrpc/clnt.c1
-rw-r--r--net/sunrpc/rpcb_clnt.c1
-rw-r--r--net/sunrpc/svcauth_unix.c2
-rw-r--r--net/sunrpc/xprtrdma/transport.c1
-rw-r--r--net/sunrpc/xprtsock.c1
21 files changed, 191 insertions, 163 deletions
diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c
index ca0a08001449..4885b53e56bd 100644
--- a/fs/lockd/clntlock.c
+++ b/fs/lockd/clntlock.c
@@ -11,7 +11,7 @@
11#include <linux/slab.h> 11#include <linux/slab.h>
12#include <linux/time.h> 12#include <linux/time.h>
13#include <linux/nfs_fs.h> 13#include <linux/nfs_fs.h>
14#include <linux/sunrpc/clnt.h> 14#include <linux/sunrpc/addr.h>
15#include <linux/sunrpc/svc.h> 15#include <linux/sunrpc/svc.h>
16#include <linux/lockd/lockd.h> 16#include <linux/lockd/lockd.h>
17#include <linux/kthread.h> 17#include <linux/kthread.h>
diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index 0e17090c310f..764c4d2ed804 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -13,6 +13,7 @@
13#include <linux/in.h> 13#include <linux/in.h>
14#include <linux/in6.h> 14#include <linux/in6.h>
15#include <linux/sunrpc/clnt.h> 15#include <linux/sunrpc/clnt.h>
16#include <linux/sunrpc/addr.h>
16#include <linux/sunrpc/svc.h> 17#include <linux/sunrpc/svc.h>
17#include <linux/lockd/lockd.h> 18#include <linux/lockd/lockd.h>
18#include <linux/mutex.h> 19#include <linux/mutex.h>
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c
index 3c2cfc683631..1812f026960c 100644
--- a/fs/lockd/mon.c
+++ b/fs/lockd/mon.c
@@ -12,6 +12,7 @@
12#include <linux/slab.h> 12#include <linux/slab.h>
13 13
14#include <linux/sunrpc/clnt.h> 14#include <linux/sunrpc/clnt.h>
15#include <linux/sunrpc/addr.h>
15#include <linux/sunrpc/xprtsock.h> 16#include <linux/sunrpc/xprtsock.h>
16#include <linux/sunrpc/svc.h> 17#include <linux/sunrpc/svc.h>
17#include <linux/lockd/lockd.h> 18#include <linux/lockd/lockd.h>
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c
index 0deb5f6c9dd4..8064435e8bef 100644
--- a/fs/lockd/svcsubs.c
+++ b/fs/lockd/svcsubs.c
@@ -13,7 +13,7 @@
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/mutex.h> 14#include <linux/mutex.h>
15#include <linux/sunrpc/svc.h> 15#include <linux/sunrpc/svc.h>
16#include <linux/sunrpc/clnt.h> 16#include <linux/sunrpc/addr.h>
17#include <linux/nfsd/nfsfh.h> 17#include <linux/nfsd/nfsfh.h>
18#include <linux/nfsd/export.h> 18#include <linux/nfsd/export.h>
19#include <linux/lockd/lockd.h> 19#include <linux/lockd/lockd.h>
diff --git a/fs/nfs/dns_resolve.c b/fs/nfs/dns_resolve.c
index ca4b11ec87a2..62c8c4127219 100644
--- a/fs/nfs/dns_resolve.c
+++ b/fs/nfs/dns_resolve.c
@@ -10,6 +10,7 @@
10 10
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/sunrpc/clnt.h> 12#include <linux/sunrpc/clnt.h>
13#include <linux/sunrpc/addr.h>
13#include <linux/dns_resolver.h> 14#include <linux/dns_resolver.h>
14#include "dns_resolve.h" 15#include "dns_resolve.h"
15 16
@@ -42,6 +43,7 @@ EXPORT_SYMBOL_GPL(nfs_dns_resolve_name);
42#include <linux/seq_file.h> 43#include <linux/seq_file.h>
43#include <linux/inet.h> 44#include <linux/inet.h>
44#include <linux/sunrpc/clnt.h> 45#include <linux/sunrpc/clnt.h>
46#include <linux/sunrpc/addr.h>
45#include <linux/sunrpc/cache.h> 47#include <linux/sunrpc/cache.h>
46#include <linux/sunrpc/svcauth.h> 48#include <linux/sunrpc/svcauth.h>
47#include <linux/sunrpc/rpc_pipe_fs.h> 49#include <linux/sunrpc/rpc_pipe_fs.h>
diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
index acc347268124..e5f2fad14ff8 100644
--- a/fs/nfs/nfs4client.c
+++ b/fs/nfs/nfs4client.c
@@ -6,6 +6,7 @@
6#include <linux/nfs_fs.h> 6#include <linux/nfs_fs.h>
7#include <linux/nfs_idmap.h> 7#include <linux/nfs_idmap.h>
8#include <linux/nfs_mount.h> 8#include <linux/nfs_mount.h>
9#include <linux/sunrpc/addr.h>
9#include <linux/sunrpc/auth.h> 10#include <linux/sunrpc/auth.h>
10#include <linux/sunrpc/xprt.h> 11#include <linux/sunrpc/xprt.h>
11#include <linux/sunrpc/bc_xprt.h> 12#include <linux/sunrpc/bc_xprt.h>
diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c
index b720064bcd7f..1fe284f01f8b 100644
--- a/fs/nfs/nfs4filelayoutdev.c
+++ b/fs/nfs/nfs4filelayoutdev.c
@@ -31,6 +31,7 @@
31#include <linux/nfs_fs.h> 31#include <linux/nfs_fs.h>
32#include <linux/vmalloc.h> 32#include <linux/vmalloc.h>
33#include <linux/module.h> 33#include <linux/module.h>
34#include <linux/sunrpc/addr.h>
34 35
35#include "internal.h" 36#include "internal.h"
36#include "nfs4session.h" 37#include "nfs4session.h"
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c
index 1e09eb78543b..0dd766079e1c 100644
--- a/fs/nfs/nfs4namespace.c
+++ b/fs/nfs/nfs4namespace.c
@@ -14,6 +14,7 @@
14#include <linux/slab.h> 14#include <linux/slab.h>
15#include <linux/string.h> 15#include <linux/string.h>
16#include <linux/sunrpc/clnt.h> 16#include <linux/sunrpc/clnt.h>
17#include <linux/sunrpc/addr.h>
17#include <linux/vfs.h> 18#include <linux/vfs.h>
18#include <linux/inet.h> 19#include <linux/inet.h>
19#include "internal.h" 20#include "internal.h"
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index c25cadf8f8c4..3250b41eb562 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -31,6 +31,7 @@
31#include <linux/errno.h> 31#include <linux/errno.h>
32#include <linux/unistd.h> 32#include <linux/unistd.h>
33#include <linux/sunrpc/clnt.h> 33#include <linux/sunrpc/clnt.h>
34#include <linux/sunrpc/addr.h>
34#include <linux/sunrpc/stats.h> 35#include <linux/sunrpc/stats.h>
35#include <linux/sunrpc/metrics.h> 36#include <linux/sunrpc/metrics.h>
36#include <linux/sunrpc/xprtsock.h> 37#include <linux/sunrpc/xprtsock.h>
diff --git a/fs/nfsd/fault_inject.c b/fs/nfsd/fault_inject.c
index e761ee95617f..247c00ccdb0f 100644
--- a/fs/nfsd/fault_inject.c
+++ b/fs/nfsd/fault_inject.c
@@ -9,7 +9,7 @@
9#include <linux/debugfs.h> 9#include <linux/debugfs.h>
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/nsproxy.h> 11#include <linux/nsproxy.h>
12#include <linux/sunrpc/clnt.h> 12#include <linux/sunrpc/addr.h>
13#include <asm/uaccess.h> 13#include <asm/uaccess.h>
14 14
15#include "state.h" 15#include "state.h"
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 27c77a0b423f..60a2282905e0 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -40,7 +40,7 @@
40#include <linux/pagemap.h> 40#include <linux/pagemap.h>
41#include <linux/ratelimit.h> 41#include <linux/ratelimit.h>
42#include <linux/sunrpc/svcauth_gss.h> 42#include <linux/sunrpc/svcauth_gss.h>
43#include <linux/sunrpc/clnt.h> 43#include <linux/sunrpc/addr.h>
44#include "xdr4.h" 44#include "xdr4.h"
45#include "vfs.h" 45#include "vfs.h"
46#include "current_stateid.h" 46#include "current_stateid.h"
diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c
index d16a5d6435f2..f7544698e6e6 100644
--- a/fs/nfsd/nfscache.c
+++ b/fs/nfsd/nfscache.c
@@ -9,7 +9,7 @@
9 */ 9 */
10 10
11#include <linux/slab.h> 11#include <linux/slab.h>
12#include <linux/sunrpc/clnt.h> 12#include <linux/sunrpc/addr.h>
13#include <linux/highmem.h> 13#include <linux/highmem.h>
14 14
15#include "nfsd.h" 15#include "nfsd.h"
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 65889ec1d28e..29c3f0d25469 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -10,7 +10,7 @@
10 10
11#include <linux/sunrpc/svcsock.h> 11#include <linux/sunrpc/svcsock.h>
12#include <linux/lockd/lockd.h> 12#include <linux/lockd/lockd.h>
13#include <linux/sunrpc/clnt.h> 13#include <linux/sunrpc/addr.h>
14#include <linux/sunrpc/gss_api.h> 14#include <linux/sunrpc/gss_api.h>
15#include <linux/sunrpc/gss_krb5_enctypes.h> 15#include <linux/sunrpc/gss_krb5_enctypes.h>
16#include <linux/sunrpc/rpc_pipe_fs.h> 16#include <linux/sunrpc/rpc_pipe_fs.h>
diff --git a/include/linux/sunrpc/addr.h b/include/linux/sunrpc/addr.h
new file mode 100644
index 000000000000..07d8e53bedfc
--- /dev/null
+++ b/include/linux/sunrpc/addr.h
@@ -0,0 +1,170 @@
1/*
2 * linux/include/linux/sunrpc/addr.h
3 *
4 * Various routines for copying and comparing sockaddrs and for
5 * converting them to and from presentation format.
6 */
7#ifndef _LINUX_SUNRPC_ADDR_H
8#define _LINUX_SUNRPC_ADDR_H
9
10#include <linux/socket.h>
11#include <linux/in.h>
12#include <linux/in6.h>
13#include <net/ipv6.h>
14
15size_t rpc_ntop(const struct sockaddr *, char *, const size_t);
16size_t rpc_pton(struct net *, const char *, const size_t,
17 struct sockaddr *, const size_t);
18char * rpc_sockaddr2uaddr(const struct sockaddr *, gfp_t);
19size_t rpc_uaddr2sockaddr(struct net *, const char *, const size_t,
20 struct sockaddr *, const size_t);
21
22static inline unsigned short rpc_get_port(const struct sockaddr *sap)
23{
24 switch (sap->sa_family) {
25 case AF_INET:
26 return ntohs(((struct sockaddr_in *)sap)->sin_port);
27 case AF_INET6:
28 return ntohs(((struct sockaddr_in6 *)sap)->sin6_port);
29 }
30 return 0;
31}
32
33static inline void rpc_set_port(struct sockaddr *sap,
34 const unsigned short port)
35{
36 switch (sap->sa_family) {
37 case AF_INET:
38 ((struct sockaddr_in *)sap)->sin_port = htons(port);
39 break;
40 case AF_INET6:
41 ((struct sockaddr_in6 *)sap)->sin6_port = htons(port);
42 break;
43 }
44}
45
46#define IPV6_SCOPE_DELIMITER '%'
47#define IPV6_SCOPE_ID_LEN sizeof("%nnnnnnnnnn")
48
49static inline bool __rpc_cmp_addr4(const struct sockaddr *sap1,
50 const struct sockaddr *sap2)
51{
52 const struct sockaddr_in *sin1 = (const struct sockaddr_in *)sap1;
53 const struct sockaddr_in *sin2 = (const struct sockaddr_in *)sap2;
54
55 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr;
56}
57
58static inline bool __rpc_copy_addr4(struct sockaddr *dst,
59 const struct sockaddr *src)
60{
61 const struct sockaddr_in *ssin = (struct sockaddr_in *) src;
62 struct sockaddr_in *dsin = (struct sockaddr_in *) dst;
63
64 dsin->sin_family = ssin->sin_family;
65 dsin->sin_addr.s_addr = ssin->sin_addr.s_addr;
66 return true;
67}
68
69#if IS_ENABLED(CONFIG_IPV6)
70static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
71 const struct sockaddr *sap2)
72{
73 const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sap1;
74 const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2;
75
76 if (!ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr))
77 return false;
78 else if (ipv6_addr_type(&sin1->sin6_addr) & IPV6_ADDR_LINKLOCAL)
79 return sin1->sin6_scope_id == sin2->sin6_scope_id;
80
81 return true;
82}
83
84static inline bool __rpc_copy_addr6(struct sockaddr *dst,
85 const struct sockaddr *src)
86{
87 const struct sockaddr_in6 *ssin6 = (const struct sockaddr_in6 *) src;
88 struct sockaddr_in6 *dsin6 = (struct sockaddr_in6 *) dst;
89
90 dsin6->sin6_family = ssin6->sin6_family;
91 dsin6->sin6_addr = ssin6->sin6_addr;
92 dsin6->sin6_scope_id = ssin6->sin6_scope_id;
93 return true;
94}
95#else /* !(IS_ENABLED(CONFIG_IPV6) */
96static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
97 const struct sockaddr *sap2)
98{
99 return false;
100}
101
102static inline bool __rpc_copy_addr6(struct sockaddr *dst,
103 const struct sockaddr *src)
104{
105 return false;
106}
107#endif /* !(IS_ENABLED(CONFIG_IPV6) */
108
109/**
110 * rpc_cmp_addr - compare the address portion of two sockaddrs.
111 * @sap1: first sockaddr
112 * @sap2: second sockaddr
113 *
114 * Just compares the family and address portion. Ignores port, but
115 * compares the scope if it's a link-local address.
116 *
117 * Returns true if the addrs are equal, false if they aren't.
118 */
119static inline bool rpc_cmp_addr(const struct sockaddr *sap1,
120 const struct sockaddr *sap2)
121{
122 if (sap1->sa_family == sap2->sa_family) {
123 switch (sap1->sa_family) {
124 case AF_INET:
125 return __rpc_cmp_addr4(sap1, sap2);
126 case AF_INET6:
127 return __rpc_cmp_addr6(sap1, sap2);
128 }
129 }
130 return false;
131}
132
133/**
134 * rpc_copy_addr - copy the address portion of one sockaddr to another
135 * @dst: destination sockaddr
136 * @src: source sockaddr
137 *
138 * Just copies the address portion and family. Ignores port, scope, etc.
139 * Caller is responsible for making certain that dst is large enough to hold
140 * the address in src. Returns true if address family is supported. Returns
141 * false otherwise.
142 */
143static inline bool rpc_copy_addr(struct sockaddr *dst,
144 const struct sockaddr *src)
145{
146 switch (src->sa_family) {
147 case AF_INET:
148 return __rpc_copy_addr4(dst, src);
149 case AF_INET6:
150 return __rpc_copy_addr6(dst, src);
151 }
152 return false;
153}
154
155/**
156 * rpc_get_scope_id - return scopeid for a given sockaddr
157 * @sa: sockaddr to get scopeid from
158 *
159 * Returns the value of the sin6_scope_id for AF_INET6 addrs, or 0 if
160 * not an AF_INET6 address.
161 */
162static inline u32 rpc_get_scope_id(const struct sockaddr *sa)
163{
164 if (sa->sa_family != AF_INET6)
165 return 0;
166
167 return ((struct sockaddr_in6 *) sa)->sin6_scope_id;
168}
169
170#endif /* _LINUX_SUNRPC_ADDR_H */
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 6a7c2619a355..4a4abde000cb 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -165,160 +165,5 @@ size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t);
165const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t); 165const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t);
166int rpc_localaddr(struct rpc_clnt *, struct sockaddr *, size_t); 166int rpc_localaddr(struct rpc_clnt *, struct sockaddr *, size_t);
167 167
168size_t rpc_ntop(const struct sockaddr *, char *, const size_t);
169size_t rpc_pton(struct net *, const char *, const size_t,
170 struct sockaddr *, const size_t);
171char * rpc_sockaddr2uaddr(const struct sockaddr *, gfp_t);
172size_t rpc_uaddr2sockaddr(struct net *, const char *, const size_t,
173 struct sockaddr *, const size_t);
174
175static inline unsigned short rpc_get_port(const struct sockaddr *sap)
176{
177 switch (sap->sa_family) {
178 case AF_INET:
179 return ntohs(((struct sockaddr_in *)sap)->sin_port);
180 case AF_INET6:
181 return ntohs(((struct sockaddr_in6 *)sap)->sin6_port);
182 }
183 return 0;
184}
185
186static inline void rpc_set_port(struct sockaddr *sap,
187 const unsigned short port)
188{
189 switch (sap->sa_family) {
190 case AF_INET:
191 ((struct sockaddr_in *)sap)->sin_port = htons(port);
192 break;
193 case AF_INET6:
194 ((struct sockaddr_in6 *)sap)->sin6_port = htons(port);
195 break;
196 }
197}
198
199#define IPV6_SCOPE_DELIMITER '%'
200#define IPV6_SCOPE_ID_LEN sizeof("%nnnnnnnnnn")
201
202static inline bool __rpc_cmp_addr4(const struct sockaddr *sap1,
203 const struct sockaddr *sap2)
204{
205 const struct sockaddr_in *sin1 = (const struct sockaddr_in *)sap1;
206 const struct sockaddr_in *sin2 = (const struct sockaddr_in *)sap2;
207
208 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr;
209}
210
211static inline bool __rpc_copy_addr4(struct sockaddr *dst,
212 const struct sockaddr *src)
213{
214 const struct sockaddr_in *ssin = (struct sockaddr_in *) src;
215 struct sockaddr_in *dsin = (struct sockaddr_in *) dst;
216
217 dsin->sin_family = ssin->sin_family;
218 dsin->sin_addr.s_addr = ssin->sin_addr.s_addr;
219 return true;
220}
221
222#if IS_ENABLED(CONFIG_IPV6)
223static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
224 const struct sockaddr *sap2)
225{
226 const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sap1;
227 const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2;
228
229 if (!ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr))
230 return false;
231 else if (ipv6_addr_type(&sin1->sin6_addr) & IPV6_ADDR_LINKLOCAL)
232 return sin1->sin6_scope_id == sin2->sin6_scope_id;
233
234 return true;
235}
236
237static inline bool __rpc_copy_addr6(struct sockaddr *dst,
238 const struct sockaddr *src)
239{
240 const struct sockaddr_in6 *ssin6 = (const struct sockaddr_in6 *) src;
241 struct sockaddr_in6 *dsin6 = (struct sockaddr_in6 *) dst;
242
243 dsin6->sin6_family = ssin6->sin6_family;
244 dsin6->sin6_addr = ssin6->sin6_addr;
245 dsin6->sin6_scope_id = ssin6->sin6_scope_id;
246 return true;
247}
248#else /* !(IS_ENABLED(CONFIG_IPV6) */
249static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
250 const struct sockaddr *sap2)
251{
252 return false;
253}
254
255static inline bool __rpc_copy_addr6(struct sockaddr *dst,
256 const struct sockaddr *src)
257{
258 return false;
259}
260#endif /* !(IS_ENABLED(CONFIG_IPV6) */
261
262/**
263 * rpc_cmp_addr - compare the address portion of two sockaddrs.
264 * @sap1: first sockaddr
265 * @sap2: second sockaddr
266 *
267 * Just compares the family and address portion. Ignores port, but
268 * compares the scope if it's a link-local address.
269 *
270 * Returns true if the addrs are equal, false if they aren't.
271 */
272static inline bool rpc_cmp_addr(const struct sockaddr *sap1,
273 const struct sockaddr *sap2)
274{
275 if (sap1->sa_family == sap2->sa_family) {
276 switch (sap1->sa_family) {
277 case AF_INET:
278 return __rpc_cmp_addr4(sap1, sap2);
279 case AF_INET6:
280 return __rpc_cmp_addr6(sap1, sap2);
281 }
282 }
283 return false;
284}
285
286/**
287 * rpc_copy_addr - copy the address portion of one sockaddr to another
288 * @dst: destination sockaddr
289 * @src: source sockaddr
290 *
291 * Just copies the address portion and family. Ignores port, scope, etc.
292 * Caller is responsible for making certain that dst is large enough to hold
293 * the address in src. Returns true if address family is supported. Returns
294 * false otherwise.
295 */
296static inline bool rpc_copy_addr(struct sockaddr *dst,
297 const struct sockaddr *src)
298{
299 switch (src->sa_family) {
300 case AF_INET:
301 return __rpc_copy_addr4(dst, src);
302 case AF_INET6:
303 return __rpc_copy_addr6(dst, src);
304 }
305 return false;
306}
307
308/**
309 * rpc_get_scope_id - return scopeid for a given sockaddr
310 * @sa: sockaddr to get scopeid from
311 *
312 * Returns the value of the sin6_scope_id for AF_INET6 addrs, or 0 if
313 * not an AF_INET6 address.
314 */
315static inline u32 rpc_get_scope_id(const struct sockaddr *sa)
316{
317 if (sa->sa_family != AF_INET6)
318 return 0;
319
320 return ((struct sockaddr_in6 *) sa)->sin6_scope_id;
321}
322
323#endif /* __KERNEL__ */ 168#endif /* __KERNEL__ */
324#endif /* _LINUX_SUNRPC_CLNT_H */ 169#endif /* _LINUX_SUNRPC_CLNT_H */
diff --git a/net/sunrpc/addr.c b/net/sunrpc/addr.c
index d11418f97f1f..a622ad64acd8 100644
--- a/net/sunrpc/addr.c
+++ b/net/sunrpc/addr.c
@@ -17,7 +17,8 @@
17 */ 17 */
18 18
19#include <net/ipv6.h> 19#include <net/ipv6.h>
20#include <linux/sunrpc/clnt.h> 20#include <linux/sunrpc/addr.h>
21#include <linux/sunrpc/msg_prot.h>
21#include <linux/slab.h> 22#include <linux/slab.h>
22#include <linux/export.h> 23#include <linux/export.h>
23 24
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 822f020fa7f4..c8193ce67b23 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -33,6 +33,7 @@
33#include <linux/rcupdate.h> 33#include <linux/rcupdate.h>
34 34
35#include <linux/sunrpc/clnt.h> 35#include <linux/sunrpc/clnt.h>
36#include <linux/sunrpc/addr.h>
36#include <linux/sunrpc/rpc_pipe_fs.h> 37#include <linux/sunrpc/rpc_pipe_fs.h>
37#include <linux/sunrpc/metrics.h> 38#include <linux/sunrpc/metrics.h>
38#include <linux/sunrpc/bc_xprt.h> 39#include <linux/sunrpc/bc_xprt.h>
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c
index 795a0f4e920b..3df764dc330c 100644
--- a/net/sunrpc/rpcb_clnt.c
+++ b/net/sunrpc/rpcb_clnt.c
@@ -26,6 +26,7 @@
26#include <net/ipv6.h> 26#include <net/ipv6.h>
27 27
28#include <linux/sunrpc/clnt.h> 28#include <linux/sunrpc/clnt.h>
29#include <linux/sunrpc/addr.h>
29#include <linux/sunrpc/sched.h> 30#include <linux/sunrpc/sched.h>
30#include <linux/sunrpc/xprtsock.h> 31#include <linux/sunrpc/xprtsock.h>
31 32
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
index 4d0129203733..ce34c8e5b8eb 100644
--- a/net/sunrpc/svcauth_unix.c
+++ b/net/sunrpc/svcauth_unix.c
@@ -6,6 +6,7 @@
6#include <linux/sunrpc/svcsock.h> 6#include <linux/sunrpc/svcsock.h>
7#include <linux/sunrpc/svcauth.h> 7#include <linux/sunrpc/svcauth.h>
8#include <linux/sunrpc/gss_api.h> 8#include <linux/sunrpc/gss_api.h>
9#include <linux/sunrpc/addr.h>
9#include <linux/err.h> 10#include <linux/err.h>
10#include <linux/seq_file.h> 11#include <linux/seq_file.h>
11#include <linux/hash.h> 12#include <linux/hash.h>
@@ -17,7 +18,6 @@
17#include <linux/user_namespace.h> 18#include <linux/user_namespace.h>
18#define RPCDBG_FACILITY RPCDBG_AUTH 19#define RPCDBG_FACILITY RPCDBG_AUTH
19 20
20#include <linux/sunrpc/clnt.h>
21 21
22#include "netns.h" 22#include "netns.h"
23 23
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c
index c9aa7a35f3bf..66591dcd7e6b 100644
--- a/net/sunrpc/xprtrdma/transport.c
+++ b/net/sunrpc/xprtrdma/transport.c
@@ -51,6 +51,7 @@
51#include <linux/init.h> 51#include <linux/init.h>
52#include <linux/slab.h> 52#include <linux/slab.h>
53#include <linux/seq_file.h> 53#include <linux/seq_file.h>
54#include <linux/sunrpc/addr.h>
54 55
55#include "xprt_rdma.h" 56#include "xprt_rdma.h"
56 57
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 68b0a81c31d5..bbc09154df8d 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -33,6 +33,7 @@
33#include <linux/udp.h> 33#include <linux/udp.h>
34#include <linux/tcp.h> 34#include <linux/tcp.h>
35#include <linux/sunrpc/clnt.h> 35#include <linux/sunrpc/clnt.h>
36#include <linux/sunrpc/addr.h>
36#include <linux/sunrpc/sched.h> 37#include <linux/sunrpc/sched.h>
37#include <linux/sunrpc/svcsock.h> 38#include <linux/sunrpc/svcsock.h>
38#include <linux/sunrpc/xprtsock.h> 39#include <linux/sunrpc/xprtsock.h>