aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprtsock.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r--net/sunrpc/xprtsock.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index cb8e6c34e12f..17179aa4c207 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -341,7 +341,7 @@ static int xs_udp_send_request(struct rpc_task *task)
341 341
342 req->rq_xtime = jiffies; 342 req->rq_xtime = jiffies;
343 status = xs_sendpages(xprt->sock, (struct sockaddr *) &xprt->addr, 343 status = xs_sendpages(xprt->sock, (struct sockaddr *) &xprt->addr,
344 sizeof(xprt->addr), xdr, req->rq_bytes_sent); 344 xprt->addrlen, xdr, req->rq_bytes_sent);
345 345
346 dprintk("RPC: xs_udp_send_request(%u) = %d\n", 346 dprintk("RPC: xs_udp_send_request(%u) = %d\n",
347 xdr->len - req->rq_bytes_sent, status); 347 xdr->len - req->rq_bytes_sent, status);
@@ -1027,8 +1027,11 @@ static char *xs_print_peer_address(struct rpc_xprt *xprt, enum rpc_display_forma
1027 */ 1027 */
1028static void xs_set_port(struct rpc_xprt *xprt, unsigned short port) 1028static void xs_set_port(struct rpc_xprt *xprt, unsigned short port)
1029{ 1029{
1030 struct sockaddr_in *sap = (struct sockaddr_in *) &xprt->addr;
1031
1030 dprintk("RPC: setting port for xprt %p to %u\n", xprt, port); 1032 dprintk("RPC: setting port for xprt %p to %u\n", xprt, port);
1031 xprt->addr.sin_port = htons(port); 1033
1034 sap->sin_port = htons(port);
1032} 1035}
1033 1036
1034static int xs_bindresvport(struct rpc_xprt *xprt, struct socket *sock) 1037static int xs_bindresvport(struct rpc_xprt *xprt, struct socket *sock)
@@ -1209,7 +1212,7 @@ static void xs_tcp_connect_worker(void *args)
1209 xprt->stat.connect_count++; 1212 xprt->stat.connect_count++;
1210 xprt->stat.connect_start = jiffies; 1213 xprt->stat.connect_start = jiffies;
1211 status = sock->ops->connect(sock, (struct sockaddr *) &xprt->addr, 1214 status = sock->ops->connect(sock, (struct sockaddr *) &xprt->addr,
1212 sizeof(xprt->addr), O_NONBLOCK); 1215 xprt->addrlen, O_NONBLOCK);
1213 dprintk("RPC: %p connect status %d connected %d sock state %d\n", 1216 dprintk("RPC: %p connect status %d connected %d sock state %d\n",
1214 xprt, -status, xprt_connected(xprt), sock->sk->sk_state); 1217 xprt, -status, xprt_connected(xprt), sock->sk->sk_state);
1215 if (status < 0) { 1218 if (status < 0) {
@@ -1359,6 +1362,7 @@ static struct rpc_xprt_ops xs_tcp_ops = {
1359int xs_setup_udp(struct rpc_xprt *xprt, struct rpc_timeout *to) 1362int xs_setup_udp(struct rpc_xprt *xprt, struct rpc_timeout *to)
1360{ 1363{
1361 size_t slot_table_size; 1364 size_t slot_table_size;
1365 struct sockaddr_in *addr = (struct sockaddr_in *) &xprt->addr;
1362 1366
1363 xprt->max_reqs = xprt_udp_slot_table_entries; 1367 xprt->max_reqs = xprt_udp_slot_table_entries;
1364 slot_table_size = xprt->max_reqs * sizeof(xprt->slot[0]); 1368 slot_table_size = xprt->max_reqs * sizeof(xprt->slot[0]);
@@ -1366,7 +1370,7 @@ int xs_setup_udp(struct rpc_xprt *xprt, struct rpc_timeout *to)
1366 if (xprt->slot == NULL) 1370 if (xprt->slot == NULL)
1367 return -ENOMEM; 1371 return -ENOMEM;
1368 1372
1369 if (ntohs(xprt->addr.sin_port) != 0) 1373 if (ntohs(addr->sin_port != 0))
1370 xprt_set_bound(xprt); 1374 xprt_set_bound(xprt);
1371 xprt->port = xs_get_random_port(); 1375 xprt->port = xs_get_random_port();
1372 1376
@@ -1405,6 +1409,7 @@ int xs_setup_udp(struct rpc_xprt *xprt, struct rpc_timeout *to)
1405int xs_setup_tcp(struct rpc_xprt *xprt, struct rpc_timeout *to) 1409int xs_setup_tcp(struct rpc_xprt *xprt, struct rpc_timeout *to)
1406{ 1410{
1407 size_t slot_table_size; 1411 size_t slot_table_size;
1412 struct sockaddr_in *addr = (struct sockaddr_in *) &xprt->addr;
1408 1413
1409 xprt->max_reqs = xprt_tcp_slot_table_entries; 1414 xprt->max_reqs = xprt_tcp_slot_table_entries;
1410 slot_table_size = xprt->max_reqs * sizeof(xprt->slot[0]); 1415 slot_table_size = xprt->max_reqs * sizeof(xprt->slot[0]);
@@ -1412,7 +1417,7 @@ int xs_setup_tcp(struct rpc_xprt *xprt, struct rpc_timeout *to)
1412 if (xprt->slot == NULL) 1417 if (xprt->slot == NULL)
1413 return -ENOMEM; 1418 return -ENOMEM;
1414 1419
1415 if (ntohs(xprt->addr.sin_port) != 0) 1420 if (ntohs(addr->sin_port) != 0)
1416 xprt_set_bound(xprt); 1421 xprt_set_bound(xprt);
1417 xprt->port = xs_get_random_port(); 1422 xprt->port = xs_get_random_port();
1418 1423