diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/auth_gss/auth_gss.c | 6 | ||||
-rw-r--r-- | net/sunrpc/clnt.c | 5 | ||||
-rw-r--r-- | net/sunrpc/xprtsock.c | 24 |
3 files changed, 21 insertions, 14 deletions
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index 53a030acdf75..d2b08f16c257 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -844,10 +844,8 @@ gss_marshal(struct rpc_task *task, u32 *p) | |||
844 | 844 | ||
845 | /* We compute the checksum for the verifier over the xdr-encoded bytes | 845 | /* We compute the checksum for the verifier over the xdr-encoded bytes |
846 | * starting with the xid and ending at the end of the credential: */ | 846 | * starting with the xid and ending at the end of the credential: */ |
847 | iov.iov_base = req->rq_snd_buf.head[0].iov_base; | 847 | iov.iov_base = xprt_skip_transport_header(task->tk_xprt, |
848 | if (task->tk_client->cl_xprt->stream) | 848 | req->rq_snd_buf.head[0].iov_base); |
849 | /* See clnt.c:call_header() */ | ||
850 | iov.iov_base += 4; | ||
851 | iov.iov_len = (u8 *)p - (u8 *)iov.iov_base; | 849 | iov.iov_len = (u8 *)p - (u8 *)iov.iov_base; |
852 | xdr_buf_from_iov(&iov, &verf_buf); | 850 | xdr_buf_from_iov(&iov, &verf_buf); |
853 | 851 | ||
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 4677959d2834..cc1b773a79d3 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -1075,13 +1075,12 @@ static u32 * | |||
1075 | call_header(struct rpc_task *task) | 1075 | call_header(struct rpc_task *task) |
1076 | { | 1076 | { |
1077 | struct rpc_clnt *clnt = task->tk_client; | 1077 | struct rpc_clnt *clnt = task->tk_client; |
1078 | struct rpc_xprt *xprt = clnt->cl_xprt; | ||
1079 | struct rpc_rqst *req = task->tk_rqstp; | 1078 | struct rpc_rqst *req = task->tk_rqstp; |
1080 | u32 *p = req->rq_svec[0].iov_base; | 1079 | u32 *p = req->rq_svec[0].iov_base; |
1081 | 1080 | ||
1082 | /* FIXME: check buffer size? */ | 1081 | /* FIXME: check buffer size? */ |
1083 | if (xprt->stream) | 1082 | |
1084 | *p++ = 0; /* fill in later */ | 1083 | p = xprt_skip_transport_header(task->tk_xprt, p); |
1085 | *p++ = req->rq_xid; /* XID */ | 1084 | *p++ = req->rq_xid; /* XID */ |
1086 | *p++ = htonl(RPC_CALL); /* CALL */ | 1085 | *p++ = htonl(RPC_CALL); /* CALL */ |
1087 | *p++ = htonl(RPC_VERSION); /* RPC version */ | 1086 | *p++ = htonl(RPC_VERSION); /* RPC version */ |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 57988300640a..aaf053b1a0c4 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -282,6 +282,13 @@ static int xs_udp_send_request(struct rpc_task *task) | |||
282 | return status; | 282 | return status; |
283 | } | 283 | } |
284 | 284 | ||
285 | static inline void xs_encode_tcp_record_marker(struct xdr_buf *buf) | ||
286 | { | ||
287 | u32 reclen = buf->len - sizeof(rpc_fraghdr); | ||
288 | rpc_fraghdr *base = buf->head[0].iov_base; | ||
289 | *base = htonl(RPC_LAST_STREAM_FRAGMENT | reclen); | ||
290 | } | ||
291 | |||
285 | /** | 292 | /** |
286 | * xs_tcp_send_request - write an RPC request to a TCP socket | 293 | * xs_tcp_send_request - write an RPC request to a TCP socket |
287 | * @task: address of RPC task that manages the state of an RPC request | 294 | * @task: address of RPC task that manages the state of an RPC request |
@@ -301,11 +308,9 @@ static int xs_tcp_send_request(struct rpc_task *task) | |||
301 | struct rpc_rqst *req = task->tk_rqstp; | 308 | struct rpc_rqst *req = task->tk_rqstp; |
302 | struct rpc_xprt *xprt = req->rq_xprt; | 309 | struct rpc_xprt *xprt = req->rq_xprt; |
303 | struct xdr_buf *xdr = &req->rq_snd_buf; | 310 | struct xdr_buf *xdr = &req->rq_snd_buf; |
304 | u32 *marker = req->rq_svec[0].iov_base; | ||
305 | int status, retry = 0; | 311 | int status, retry = 0; |
306 | 312 | ||
307 | /* Write the record marker */ | 313 | xs_encode_tcp_record_marker(&req->rq_snd_buf); |
308 | *marker = htonl(0x80000000|(req->rq_slen-sizeof(*marker))); | ||
309 | 314 | ||
310 | xs_pktdump("packet data:", | 315 | xs_pktdump("packet data:", |
311 | req->rq_svec->iov_base, | 316 | req->rq_svec->iov_base, |
@@ -503,16 +508,19 @@ static inline void xs_tcp_read_fraghdr(struct rpc_xprt *xprt, skb_reader_t *desc | |||
503 | xprt->tcp_offset += used; | 508 | xprt->tcp_offset += used; |
504 | if (used != len) | 509 | if (used != len) |
505 | return; | 510 | return; |
511 | |||
506 | xprt->tcp_reclen = ntohl(xprt->tcp_recm); | 512 | xprt->tcp_reclen = ntohl(xprt->tcp_recm); |
507 | if (xprt->tcp_reclen & 0x80000000) | 513 | if (xprt->tcp_reclen & RPC_LAST_STREAM_FRAGMENT) |
508 | xprt->tcp_flags |= XPRT_LAST_FRAG; | 514 | xprt->tcp_flags |= XPRT_LAST_FRAG; |
509 | else | 515 | else |
510 | xprt->tcp_flags &= ~XPRT_LAST_FRAG; | 516 | xprt->tcp_flags &= ~XPRT_LAST_FRAG; |
511 | xprt->tcp_reclen &= 0x7fffffff; | 517 | xprt->tcp_reclen &= RPC_FRAGMENT_SIZE_MASK; |
518 | |||
512 | xprt->tcp_flags &= ~XPRT_COPY_RECM; | 519 | xprt->tcp_flags &= ~XPRT_COPY_RECM; |
513 | xprt->tcp_offset = 0; | 520 | xprt->tcp_offset = 0; |
521 | |||
514 | /* Sanity check of the record length */ | 522 | /* Sanity check of the record length */ |
515 | if (xprt->tcp_reclen < 4) { | 523 | if (unlikely(xprt->tcp_reclen < 4)) { |
516 | dprintk("RPC: invalid TCP record fragment length\n"); | 524 | dprintk("RPC: invalid TCP record fragment length\n"); |
517 | xprt_disconnect(xprt); | 525 | xprt_disconnect(xprt); |
518 | return; | 526 | return; |
@@ -1065,6 +1073,7 @@ int xs_setup_udp(struct rpc_xprt *xprt, struct rpc_timeout *to) | |||
1065 | 1073 | ||
1066 | xprt->prot = IPPROTO_UDP; | 1074 | xprt->prot = IPPROTO_UDP; |
1067 | xprt->port = XS_MAX_RESVPORT; | 1075 | xprt->port = XS_MAX_RESVPORT; |
1076 | xprt->tsh_size = 0; | ||
1068 | xprt->stream = 0; | 1077 | xprt->stream = 0; |
1069 | xprt->nocong = 0; | 1078 | xprt->nocong = 0; |
1070 | xprt->cwnd = RPC_INITCWND; | 1079 | xprt->cwnd = RPC_INITCWND; |
@@ -1105,11 +1114,12 @@ int xs_setup_tcp(struct rpc_xprt *xprt, struct rpc_timeout *to) | |||
1105 | 1114 | ||
1106 | xprt->prot = IPPROTO_TCP; | 1115 | xprt->prot = IPPROTO_TCP; |
1107 | xprt->port = XS_MAX_RESVPORT; | 1116 | xprt->port = XS_MAX_RESVPORT; |
1117 | xprt->tsh_size = sizeof(rpc_fraghdr) / sizeof(u32); | ||
1108 | xprt->stream = 1; | 1118 | xprt->stream = 1; |
1109 | xprt->nocong = 1; | 1119 | xprt->nocong = 1; |
1110 | xprt->cwnd = RPC_MAXCWND(xprt); | 1120 | xprt->cwnd = RPC_MAXCWND(xprt); |
1111 | xprt->resvport = capable(CAP_NET_BIND_SERVICE) ? 1 : 0; | 1121 | xprt->resvport = capable(CAP_NET_BIND_SERVICE) ? 1 : 0; |
1112 | xprt->max_payload = (1U << 31) - 1; | 1122 | xprt->max_payload = RPC_MAX_FRAGMENT_SIZE; |
1113 | 1123 | ||
1114 | INIT_WORK(&xprt->connect_worker, xs_tcp_connect_worker, xprt); | 1124 | INIT_WORK(&xprt->connect_worker, xs_tcp_connect_worker, xprt); |
1115 | 1125 | ||