diff options
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/auth_null.c | 2 | ||||
-rw-r--r-- | net/sunrpc/auth_unix.c | 1 | ||||
-rw-r--r-- | net/sunrpc/rpc_pipe.c | 2 | ||||
-rw-r--r-- | net/sunrpc/xdr.c | 28 | ||||
-rw-r--r-- | net/sunrpc/xprt.c | 4 | ||||
-rw-r--r-- | net/sunrpc/xprtsock.c | 11 |
6 files changed, 41 insertions, 7 deletions
diff --git a/net/sunrpc/auth_null.c b/net/sunrpc/auth_null.c index f56767aaa927..2eccffa96ba1 100644 --- a/net/sunrpc/auth_null.c +++ b/net/sunrpc/auth_null.c | |||
@@ -118,6 +118,8 @@ struct rpc_auth null_auth = { | |||
118 | .au_cslack = 4, | 118 | .au_cslack = 4, |
119 | .au_rslack = 2, | 119 | .au_rslack = 2, |
120 | .au_ops = &authnull_ops, | 120 | .au_ops = &authnull_ops, |
121 | .au_flavor = RPC_AUTH_NULL, | ||
122 | .au_count = ATOMIC_INIT(0), | ||
121 | }; | 123 | }; |
122 | 124 | ||
123 | static | 125 | static |
diff --git a/net/sunrpc/auth_unix.c b/net/sunrpc/auth_unix.c index df14b6bfbf10..74c7406a1054 100644 --- a/net/sunrpc/auth_unix.c +++ b/net/sunrpc/auth_unix.c | |||
@@ -225,6 +225,7 @@ struct rpc_auth unix_auth = { | |||
225 | .au_cslack = UNX_WRITESLACK, | 225 | .au_cslack = UNX_WRITESLACK, |
226 | .au_rslack = 2, /* assume AUTH_NULL verf */ | 226 | .au_rslack = 2, /* assume AUTH_NULL verf */ |
227 | .au_ops = &authunix_ops, | 227 | .au_ops = &authunix_ops, |
228 | .au_flavor = RPC_AUTH_UNIX, | ||
228 | .au_count = ATOMIC_INIT(0), | 229 | .au_count = ATOMIC_INIT(0), |
229 | .au_credcache = &unix_cred_cache, | 230 | .au_credcache = &unix_cred_cache, |
230 | }; | 231 | }; |
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index 8241fa726803..dafe793c774e 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
@@ -439,7 +439,7 @@ struct vfsmount *rpc_get_mount(void) | |||
439 | { | 439 | { |
440 | int err; | 440 | int err; |
441 | 441 | ||
442 | err = simple_pin_fs("rpc_pipefs", &rpc_mount, &rpc_mount_count); | 442 | err = simple_pin_fs(&rpc_pipe_fs_type, &rpc_mount, &rpc_mount_count); |
443 | if (err != 0) | 443 | if (err != 0) |
444 | return ERR_PTR(err); | 444 | return ERR_PTR(err); |
445 | return rpc_mount; | 445 | return rpc_mount; |
diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c index ca4bfa57e116..49174f0d0a3e 100644 --- a/net/sunrpc/xdr.c +++ b/net/sunrpc/xdr.c | |||
@@ -568,8 +568,7 @@ EXPORT_SYMBOL(xdr_inline_decode); | |||
568 | * | 568 | * |
569 | * Moves data beyond the current pointer position from the XDR head[] buffer | 569 | * Moves data beyond the current pointer position from the XDR head[] buffer |
570 | * into the page list. Any data that lies beyond current position + "len" | 570 | * into the page list. Any data that lies beyond current position + "len" |
571 | * bytes is moved into the XDR tail[]. The current pointer is then | 571 | * bytes is moved into the XDR tail[]. |
572 | * repositioned at the beginning of the XDR tail. | ||
573 | */ | 572 | */ |
574 | void xdr_read_pages(struct xdr_stream *xdr, unsigned int len) | 573 | void xdr_read_pages(struct xdr_stream *xdr, unsigned int len) |
575 | { | 574 | { |
@@ -606,6 +605,31 @@ void xdr_read_pages(struct xdr_stream *xdr, unsigned int len) | |||
606 | } | 605 | } |
607 | EXPORT_SYMBOL(xdr_read_pages); | 606 | EXPORT_SYMBOL(xdr_read_pages); |
608 | 607 | ||
608 | /** | ||
609 | * xdr_enter_page - decode data from the XDR page | ||
610 | * @xdr: pointer to xdr_stream struct | ||
611 | * @len: number of bytes of page data | ||
612 | * | ||
613 | * Moves data beyond the current pointer position from the XDR head[] buffer | ||
614 | * into the page list. Any data that lies beyond current position + "len" | ||
615 | * bytes is moved into the XDR tail[]. The current pointer is then | ||
616 | * repositioned at the beginning of the first XDR page. | ||
617 | */ | ||
618 | void xdr_enter_page(struct xdr_stream *xdr, unsigned int len) | ||
619 | { | ||
620 | char * kaddr = page_address(xdr->buf->pages[0]); | ||
621 | xdr_read_pages(xdr, len); | ||
622 | /* | ||
623 | * Position current pointer at beginning of tail, and | ||
624 | * set remaining message length. | ||
625 | */ | ||
626 | if (len > PAGE_CACHE_SIZE - xdr->buf->page_base) | ||
627 | len = PAGE_CACHE_SIZE - xdr->buf->page_base; | ||
628 | xdr->p = (uint32_t *)(kaddr + xdr->buf->page_base); | ||
629 | xdr->end = (uint32_t *)((char *)xdr->p + len); | ||
630 | } | ||
631 | EXPORT_SYMBOL(xdr_enter_page); | ||
632 | |||
609 | static struct kvec empty_iov = {.iov_base = NULL, .iov_len = 0}; | 633 | static struct kvec empty_iov = {.iov_base = NULL, .iov_len = 0}; |
610 | 634 | ||
611 | void | 635 | void |
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 4dd5b3cfe754..02060d0e7be8 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
@@ -41,7 +41,7 @@ | |||
41 | #include <linux/types.h> | 41 | #include <linux/types.h> |
42 | #include <linux/interrupt.h> | 42 | #include <linux/interrupt.h> |
43 | #include <linux/workqueue.h> | 43 | #include <linux/workqueue.h> |
44 | #include <linux/random.h> | 44 | #include <linux/net.h> |
45 | 45 | ||
46 | #include <linux/sunrpc/clnt.h> | 46 | #include <linux/sunrpc/clnt.h> |
47 | #include <linux/sunrpc/metrics.h> | 47 | #include <linux/sunrpc/metrics.h> |
@@ -830,7 +830,7 @@ static inline u32 xprt_alloc_xid(struct rpc_xprt *xprt) | |||
830 | 830 | ||
831 | static inline void xprt_init_xid(struct rpc_xprt *xprt) | 831 | static inline void xprt_init_xid(struct rpc_xprt *xprt) |
832 | { | 832 | { |
833 | get_random_bytes(&xprt->xid, sizeof(xprt->xid)); | 833 | xprt->xid = net_random(); |
834 | } | 834 | } |
835 | 835 | ||
836 | static void xprt_request_init(struct rpc_task *task, struct rpc_xprt *xprt) | 836 | static void xprt_request_init(struct rpc_task *task, struct rpc_xprt *xprt) |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 4b4e7dfdff14..21006b109101 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -930,6 +930,13 @@ static void xs_udp_timer(struct rpc_task *task) | |||
930 | xprt_adjust_cwnd(task, -ETIMEDOUT); | 930 | xprt_adjust_cwnd(task, -ETIMEDOUT); |
931 | } | 931 | } |
932 | 932 | ||
933 | static unsigned short xs_get_random_port(void) | ||
934 | { | ||
935 | unsigned short range = xprt_max_resvport - xprt_min_resvport; | ||
936 | unsigned short rand = (unsigned short) net_random() % range; | ||
937 | return rand + xprt_min_resvport; | ||
938 | } | ||
939 | |||
933 | /** | 940 | /** |
934 | * xs_set_port - reset the port number in the remote endpoint address | 941 | * xs_set_port - reset the port number in the remote endpoint address |
935 | * @xprt: generic transport | 942 | * @xprt: generic transport |
@@ -1275,7 +1282,7 @@ int xs_setup_udp(struct rpc_xprt *xprt, struct rpc_timeout *to) | |||
1275 | memset(xprt->slot, 0, slot_table_size); | 1282 | memset(xprt->slot, 0, slot_table_size); |
1276 | 1283 | ||
1277 | xprt->prot = IPPROTO_UDP; | 1284 | xprt->prot = IPPROTO_UDP; |
1278 | xprt->port = xprt_max_resvport; | 1285 | xprt->port = xs_get_random_port(); |
1279 | xprt->tsh_size = 0; | 1286 | xprt->tsh_size = 0; |
1280 | xprt->resvport = capable(CAP_NET_BIND_SERVICE) ? 1 : 0; | 1287 | xprt->resvport = capable(CAP_NET_BIND_SERVICE) ? 1 : 0; |
1281 | /* XXX: header size can vary due to auth type, IPv6, etc. */ | 1288 | /* XXX: header size can vary due to auth type, IPv6, etc. */ |
@@ -1317,7 +1324,7 @@ int xs_setup_tcp(struct rpc_xprt *xprt, struct rpc_timeout *to) | |||
1317 | memset(xprt->slot, 0, slot_table_size); | 1324 | memset(xprt->slot, 0, slot_table_size); |
1318 | 1325 | ||
1319 | xprt->prot = IPPROTO_TCP; | 1326 | xprt->prot = IPPROTO_TCP; |
1320 | xprt->port = xprt_max_resvport; | 1327 | xprt->port = xs_get_random_port(); |
1321 | xprt->tsh_size = sizeof(rpc_fraghdr) / sizeof(u32); | 1328 | xprt->tsh_size = sizeof(rpc_fraghdr) / sizeof(u32); |
1322 | xprt->resvport = capable(CAP_NET_BIND_SERVICE) ? 1 : 0; | 1329 | xprt->resvport = capable(CAP_NET_BIND_SERVICE) ? 1 : 0; |
1323 | xprt->max_payload = RPC_MAX_FRAGMENT_SIZE; | 1330 | xprt->max_payload = RPC_MAX_FRAGMENT_SIZE; |