diff options
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r-- | net/sunrpc/xprtsock.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 26402c063f00..62c2e7caa345 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -36,11 +36,6 @@ | |||
36 | #include <net/tcp.h> | 36 | #include <net/tcp.h> |
37 | 37 | ||
38 | /* | 38 | /* |
39 | * Maximum port number to use when requesting a reserved port. | ||
40 | */ | ||
41 | #define XS_MAX_RESVPORT (800U) | ||
42 | |||
43 | /* | ||
44 | * How many times to try sending a request on a socket before waiting | 39 | * How many times to try sending a request on a socket before waiting |
45 | * for the socket buffer to clear. | 40 | * for the socket buffer to clear. |
46 | */ | 41 | */ |
@@ -873,10 +868,9 @@ static int xs_bindresvport(struct rpc_xprt *xprt, struct socket *sock) | |||
873 | struct sockaddr_in myaddr = { | 868 | struct sockaddr_in myaddr = { |
874 | .sin_family = AF_INET, | 869 | .sin_family = AF_INET, |
875 | }; | 870 | }; |
876 | int err, port; | 871 | int err; |
872 | unsigned short port = xprt->port; | ||
877 | 873 | ||
878 | /* Were we already bound to a given port? Try to reuse it */ | ||
879 | port = xprt->port; | ||
880 | do { | 874 | do { |
881 | myaddr.sin_port = htons(port); | 875 | myaddr.sin_port = htons(port); |
882 | err = sock->ops->bind(sock, (struct sockaddr *) &myaddr, | 876 | err = sock->ops->bind(sock, (struct sockaddr *) &myaddr, |
@@ -887,8 +881,10 @@ static int xs_bindresvport(struct rpc_xprt *xprt, struct socket *sock) | |||
887 | port); | 881 | port); |
888 | return 0; | 882 | return 0; |
889 | } | 883 | } |
890 | if (--port == 0) | 884 | if (port <= xprt_min_resvport) |
891 | port = XS_MAX_RESVPORT; | 885 | port = xprt_max_resvport; |
886 | else | ||
887 | port--; | ||
892 | } while (err == -EADDRINUSE && port != xprt->port); | 888 | } while (err == -EADDRINUSE && port != xprt->port); |
893 | 889 | ||
894 | dprintk("RPC: can't bind to reserved port (%d).\n", -err); | 890 | dprintk("RPC: can't bind to reserved port (%d).\n", -err); |
@@ -1075,9 +1071,6 @@ static struct rpc_xprt_ops xs_tcp_ops = { | |||
1075 | .destroy = xs_destroy, | 1071 | .destroy = xs_destroy, |
1076 | }; | 1072 | }; |
1077 | 1073 | ||
1078 | extern unsigned int xprt_udp_slot_table_entries; | ||
1079 | extern unsigned int xprt_tcp_slot_table_entries; | ||
1080 | |||
1081 | /** | 1074 | /** |
1082 | * xs_setup_udp - Set up transport to use a UDP socket | 1075 | * xs_setup_udp - Set up transport to use a UDP socket |
1083 | * @xprt: transport to set up | 1076 | * @xprt: transport to set up |
@@ -1098,7 +1091,7 @@ int xs_setup_udp(struct rpc_xprt *xprt, struct rpc_timeout *to) | |||
1098 | memset(xprt->slot, 0, slot_table_size); | 1091 | memset(xprt->slot, 0, slot_table_size); |
1099 | 1092 | ||
1100 | xprt->prot = IPPROTO_UDP; | 1093 | xprt->prot = IPPROTO_UDP; |
1101 | xprt->port = XS_MAX_RESVPORT; | 1094 | xprt->port = xprt_max_resvport; |
1102 | xprt->tsh_size = 0; | 1095 | xprt->tsh_size = 0; |
1103 | xprt->resvport = capable(CAP_NET_BIND_SERVICE) ? 1 : 0; | 1096 | xprt->resvport = capable(CAP_NET_BIND_SERVICE) ? 1 : 0; |
1104 | /* XXX: header size can vary due to auth type, IPv6, etc. */ | 1097 | /* XXX: header size can vary due to auth type, IPv6, etc. */ |
@@ -1136,7 +1129,7 @@ int xs_setup_tcp(struct rpc_xprt *xprt, struct rpc_timeout *to) | |||
1136 | memset(xprt->slot, 0, slot_table_size); | 1129 | memset(xprt->slot, 0, slot_table_size); |
1137 | 1130 | ||
1138 | xprt->prot = IPPROTO_TCP; | 1131 | xprt->prot = IPPROTO_TCP; |
1139 | xprt->port = XS_MAX_RESVPORT; | 1132 | xprt->port = xprt_max_resvport; |
1140 | xprt->tsh_size = sizeof(rpc_fraghdr) / sizeof(u32); | 1133 | xprt->tsh_size = sizeof(rpc_fraghdr) / sizeof(u32); |
1141 | xprt->resvport = capable(CAP_NET_BIND_SERVICE) ? 1 : 0; | 1134 | xprt->resvport = capable(CAP_NET_BIND_SERVICE) ? 1 : 0; |
1142 | xprt->max_payload = RPC_MAX_FRAGMENT_SIZE; | 1135 | xprt->max_payload = RPC_MAX_FRAGMENT_SIZE; |