aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprtsock.c
diff options
context:
space:
mode:
authorChuck Lever <cel@netapp.com>2006-01-03 03:55:51 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-01-06 14:58:56 -0500
commit922004120b10dcb0ce04b55014168e8a7a8c1a0e (patch)
tree4209bbd1043d9ddf09f2f277a65af758aa3631da /net/sunrpc/xprtsock.c
parent35f5a422ce1af836007f811b613c440d0e348e06 (diff)
SUNRPC: transport switch API for setting port number
At some point, transport endpoint addresses will no longer be IPv4. To hide the structure of the rpc_xprt's address field from ULPs and port mappers, add an API for setting the port number during an RPC bind operation. Test-plan: Destructive testing (unplugging the network temporarily). Connectathon with UDP and TCP. NFSv2/3 and NFSv4 mounting should be carefully checked. Probably need to rig a server where certain services aren't running, or that returns an error for some typical operation. Signed-off-by: Chuck Lever <cel@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r--net/sunrpc/xprtsock.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 51f07c9a751b..3e8893001479 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -921,6 +921,18 @@ static void xs_udp_timer(struct rpc_task *task)
921 xprt_adjust_cwnd(task, -ETIMEDOUT); 921 xprt_adjust_cwnd(task, -ETIMEDOUT);
922} 922}
923 923
924/**
925 * xs_set_port - reset the port number in the remote endpoint address
926 * @xprt: generic transport
927 * @port: new port number
928 *
929 */
930static void xs_set_port(struct rpc_xprt *xprt, unsigned short port)
931{
932 dprintk("RPC: setting port for xprt %p to %u\n", xprt, port);
933 xprt->addr.sin_port = htons(port);
934}
935
924static int xs_bindresvport(struct rpc_xprt *xprt, struct socket *sock) 936static int xs_bindresvport(struct rpc_xprt *xprt, struct socket *sock)
925{ 937{
926 struct sockaddr_in myaddr = { 938 struct sockaddr_in myaddr = {
@@ -1161,6 +1173,7 @@ static struct rpc_xprt_ops xs_udp_ops = {
1161 .set_buffer_size = xs_udp_set_buffer_size, 1173 .set_buffer_size = xs_udp_set_buffer_size,
1162 .reserve_xprt = xprt_reserve_xprt_cong, 1174 .reserve_xprt = xprt_reserve_xprt_cong,
1163 .release_xprt = xprt_release_xprt_cong, 1175 .release_xprt = xprt_release_xprt_cong,
1176 .set_port = xs_set_port,
1164 .connect = xs_connect, 1177 .connect = xs_connect,
1165 .buf_alloc = rpc_malloc, 1178 .buf_alloc = rpc_malloc,
1166 .buf_free = rpc_free, 1179 .buf_free = rpc_free,
@@ -1175,6 +1188,7 @@ static struct rpc_xprt_ops xs_udp_ops = {
1175static struct rpc_xprt_ops xs_tcp_ops = { 1188static struct rpc_xprt_ops xs_tcp_ops = {
1176 .reserve_xprt = xprt_reserve_xprt, 1189 .reserve_xprt = xprt_reserve_xprt,
1177 .release_xprt = xprt_release_xprt, 1190 .release_xprt = xprt_release_xprt,
1191 .set_port = xs_set_port,
1178 .connect = xs_connect, 1192 .connect = xs_connect,
1179 .buf_alloc = rpc_malloc, 1193 .buf_alloc = rpc_malloc,
1180 .buf_free = rpc_free, 1194 .buf_free = rpc_free,