aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author\"Talpey, Thomas\ <Thomas.Talpey@netapp.com>2007-09-10 13:42:38 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-10-09 17:17:18 -0400
commit4f40ee4a02a2d017b714d5b2faaf5c25bf9eae47 (patch)
treeb5de8ba7983428f3764e24664a4ae790efb2b596
parent817cb9d43d4c330f9fc023d96e5beaa1abe8c4b7 (diff)
SUNRPC: move per-transport rpcbind netid's
Move the TCP/UDP rpcbind netid's from the rpcbind client to a global header. Signed-off-by: Tom Talpey <tmt@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--include/linux/sunrpc/msg_prot.h13
-rw-r--r--net/sunrpc/rpcb_clnt.c26
2 files changed, 16 insertions, 23 deletions
diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h
index 784d4c3ef651..c4beb5775111 100644
--- a/include/linux/sunrpc/msg_prot.h
+++ b/include/linux/sunrpc/msg_prot.h
@@ -138,6 +138,19 @@ typedef __be32 rpc_fraghdr;
138#define RPC_MAX_HEADER_WITH_AUTH \ 138#define RPC_MAX_HEADER_WITH_AUTH \
139 (RPC_CALLHDRSIZE + 2*(2+RPC_MAX_AUTH_SIZE/4)) 139 (RPC_CALLHDRSIZE + 2*(2+RPC_MAX_AUTH_SIZE/4))
140 140
141/*
142 * RFC1833/RFC3530 rpcbind (v3+) well-known netid's.
143 */
144#define RPCBIND_NETID_UDP "udp"
145#define RPCBIND_NETID_TCP "tcp"
146#define RPCBIND_NETID_UDP6 "udp6"
147#define RPCBIND_NETID_TCP6 "tcp6"
148
149/*
150 * Note that RFC 1833 does not put any size restrictions on the
151 * netid string, but all currently defined netid's fit in 4 bytes.
152 */
153#define RPCBIND_MAXNETIDLEN (4u)
141 154
142#endif /* __KERNEL__ */ 155#endif /* __KERNEL__ */
143#endif /* _LINUX_SUNRPC_MSGPROT_H_ */ 156#endif /* _LINUX_SUNRPC_MSGPROT_H_ */
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c
index d7b9f02489e6..b028a0ecd593 100644
--- a/net/sunrpc/rpcb_clnt.c
+++ b/net/sunrpc/rpcb_clnt.c
@@ -93,26 +93,6 @@ enum {
93#define RPCB_MAXADDRLEN (128u) 93#define RPCB_MAXADDRLEN (128u)
94 94
95/* 95/*
96 * r_netid
97 *
98 * Quoting RFC 3530, section 2.2:
99 *
100 * For TCP over IPv4 the value of r_netid is the string "tcp". For UDP
101 * over IPv4 the value of r_netid is the string "udp".
102 *
103 * ...
104 *
105 * For TCP over IPv6 the value of r_netid is the string "tcp6". For UDP
106 * over IPv6 the value of r_netid is the string "udp6".
107 */
108#define RPCB_NETID_UDP "\165\144\160" /* "udp" */
109#define RPCB_NETID_TCP "\164\143\160" /* "tcp" */
110#define RPCB_NETID_UDP6 "\165\144\160\066" /* "udp6" */
111#define RPCB_NETID_TCP6 "\164\143\160\066" /* "tcp6" */
112
113#define RPCB_MAXNETIDLEN (4u)
114
115/*
116 * r_owner 96 * r_owner
117 * 97 *
118 * The "owner" is allowed to unset a service in the rpcbind database. 98 * The "owner" is allowed to unset a service in the rpcbind database.
@@ -408,8 +388,8 @@ void rpcb_getport_async(struct rpc_task *task)
408 map->r_prot = xprt->prot; 388 map->r_prot = xprt->prot;
409 map->r_port = 0; 389 map->r_port = 0;
410 map->r_xprt = xprt_get(xprt); 390 map->r_xprt = xprt_get(xprt);
411 map->r_netid = (xprt->prot == IPPROTO_TCP) ? RPCB_NETID_TCP : 391 map->r_netid = (xprt->prot == IPPROTO_TCP) ? RPCBIND_NETID_TCP :
412 RPCB_NETID_UDP; 392 RPCBIND_NETID_UDP;
413 memcpy(map->r_addr, 393 memcpy(map->r_addr,
414 rpc_peeraddr2str(rpcb_clnt, RPC_DISPLAY_UNIVERSAL_ADDR), 394 rpc_peeraddr2str(rpcb_clnt, RPC_DISPLAY_UNIVERSAL_ADDR),
415 sizeof(map->r_addr)); 395 sizeof(map->r_addr));
@@ -587,7 +567,7 @@ out_err:
587#define RPCB_port_sz (1u) 567#define RPCB_port_sz (1u)
588#define RPCB_boolean_sz (1u) 568#define RPCB_boolean_sz (1u)
589 569
590#define RPCB_netid_sz (1+XDR_QUADLEN(RPCB_MAXNETIDLEN)) 570#define RPCB_netid_sz (1+XDR_QUADLEN(RPCBIND_MAXNETIDLEN))
591#define RPCB_addr_sz (1+XDR_QUADLEN(RPCB_MAXADDRLEN)) 571#define RPCB_addr_sz (1+XDR_QUADLEN(RPCB_MAXADDRLEN))
592#define RPCB_ownerstring_sz (1+XDR_QUADLEN(RPCB_MAXOWNERLEN)) 572#define RPCB_ownerstring_sz (1+XDR_QUADLEN(RPCB_MAXOWNERLEN))
593 573