]> git.baikalelectronics.ru Git - kernel.git/commitdiff
SUNRPC query transport's source port
authorOlga Kornievskaia <kolga@netapp.com>
Thu, 24 Jun 2021 03:28:48 +0000 (23:28 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Thu, 8 Jul 2021 18:03:24 +0000 (14:03 -0400)
Provide ability to query transport's source port.

Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
include/linux/sunrpc/xprtsock.h
net/sunrpc/xprtsock.c

index 3c1423ee74b4eb18733d171a703ba6cef3e40984..8c2a712cb24202824aa188dfb3283c42890bfeb4 100644 (file)
@@ -10,6 +10,7 @@
 
 int            init_socket_xprt(void);
 void           cleanup_socket_xprt(void);
+unsigned short get_srcport(struct rpc_xprt *);
 
 #define RPC_MIN_RESVPORT       (1U)
 #define RPC_MAX_RESVPORT       (65535U)
index 2ad4d0df45fe2639556b8173ed9c936a31b3f7c6..4611845ec1eb10a3f8f789d65177ee2077200eb8 100644 (file)
@@ -1653,6 +1653,13 @@ static int xs_get_srcport(struct sock_xprt *transport)
        return port;
 }
 
+unsigned short get_srcport(struct rpc_xprt *xprt)
+{
+       struct sock_xprt *sock = container_of(xprt, struct sock_xprt, xprt);
+       return sock->srcport;
+}
+EXPORT_SYMBOL(get_srcport);
+
 static unsigned short xs_next_srcport(struct sock_xprt *transport, unsigned short port)
 {
        if (transport->srcport != 0)