aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sunrpc/clnt.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/sunrpc/clnt.h')
-rw-r--r--include/linux/sunrpc/clnt.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 044f531aee70..3d025588e56e 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -286,5 +286,20 @@ static inline bool rpc_copy_addr(struct sockaddr *dst,
286 return false; 286 return false;
287} 287}
288 288
289/**
290 * rpc_get_scope_id - return scopeid for a given sockaddr
291 * @sa: sockaddr to get scopeid from
292 *
293 * Returns the value of the sin6_scope_id for AF_INET6 addrs, or 0 if
294 * not an AF_INET6 address.
295 */
296static inline u32 rpc_get_scope_id(const struct sockaddr *sa)
297{
298 if (sa->sa_family != AF_INET6)
299 return 0;
300
301 return ((struct sockaddr_in6 *) sa)->sin6_scope_id;
302}
303
289#endif /* __KERNEL__ */ 304#endif /* __KERNEL__ */
290#endif /* _LINUX_SUNRPC_CLNT_H */ 305#endif /* _LINUX_SUNRPC_CLNT_H */