diff options
-rw-r--r-- | include/linux/sunrpc/msg_prot.h | 39 | ||||
-rw-r--r-- | net/sunrpc/rpcb_clnt.c | 45 |
2 files changed, 42 insertions, 42 deletions
diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h index c4beb5775111..70df4f1d8847 100644 --- a/include/linux/sunrpc/msg_prot.h +++ b/include/linux/sunrpc/msg_prot.h | |||
@@ -152,5 +152,44 @@ typedef __be32 rpc_fraghdr; | |||
152 | */ | 152 | */ |
153 | #define RPCBIND_MAXNETIDLEN (4u) | 153 | #define RPCBIND_MAXNETIDLEN (4u) |
154 | 154 | ||
155 | /* | ||
156 | * Universal addresses are introduced in RFC 1833 and further spelled | ||
157 | * out in RFC 3530. RPCBIND_MAXUADDRLEN defines a maximum byte length | ||
158 | * of a universal address for use in allocating buffers and character | ||
159 | * arrays. | ||
160 | * | ||
161 | * Quoting RFC 3530, section 2.2: | ||
162 | * | ||
163 | * For TCP over IPv4 and for UDP over IPv4, the format of r_addr is the | ||
164 | * US-ASCII string: | ||
165 | * | ||
166 | * h1.h2.h3.h4.p1.p2 | ||
167 | * | ||
168 | * The prefix, "h1.h2.h3.h4", is the standard textual form for | ||
169 | * representing an IPv4 address, which is always four octets long. | ||
170 | * Assuming big-endian ordering, h1, h2, h3, and h4, are respectively, | ||
171 | * the first through fourth octets each converted to ASCII-decimal. | ||
172 | * Assuming big-endian ordering, p1 and p2 are, respectively, the first | ||
173 | * and second octets each converted to ASCII-decimal. For example, if a | ||
174 | * host, in big-endian order, has an address of 0x0A010307 and there is | ||
175 | * a service listening on, in big endian order, port 0x020F (decimal | ||
176 | * 527), then the complete universal address is "10.1.3.7.2.15". | ||
177 | * | ||
178 | * ... | ||
179 | * | ||
180 | * For TCP over IPv6 and for UDP over IPv6, the format of r_addr is the | ||
181 | * US-ASCII string: | ||
182 | * | ||
183 | * x1:x2:x3:x4:x5:x6:x7:x8.p1.p2 | ||
184 | * | ||
185 | * The suffix "p1.p2" is the service port, and is computed the same way | ||
186 | * as with universal addresses for TCP and UDP over IPv4. The prefix, | ||
187 | * "x1:x2:x3:x4:x5:x6:x7:x8", is the standard textual form for | ||
188 | * representing an IPv6 address as defined in Section 2.2 of [RFC2373]. | ||
189 | * Additionally, the two alternative forms specified in Section 2.2 of | ||
190 | * [RFC2373] are also acceptable. | ||
191 | */ | ||
192 | #define RPCBIND_MAXUADDRLEN (56u) | ||
193 | |||
155 | #endif /* __KERNEL__ */ | 194 | #endif /* __KERNEL__ */ |
156 | #endif /* _LINUX_SUNRPC_MSGPROT_H_ */ | 195 | #endif /* _LINUX_SUNRPC_MSGPROT_H_ */ |
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c index 9696b5127060..f494e58910ec 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c | |||
@@ -55,45 +55,6 @@ enum { | |||
55 | #define RPCB_HIGHPROC_4 RPCBPROC_GETSTAT | 55 | #define RPCB_HIGHPROC_4 RPCBPROC_GETSTAT |
56 | 56 | ||
57 | /* | 57 | /* |
58 | * r_addr | ||
59 | * | ||
60 | * Quoting RFC 3530, section 2.2: | ||
61 | * | ||
62 | * For TCP over IPv4 and for UDP over IPv4, the format of r_addr is the | ||
63 | * US-ASCII string: | ||
64 | * | ||
65 | * h1.h2.h3.h4.p1.p2 | ||
66 | * | ||
67 | * The prefix, "h1.h2.h3.h4", is the standard textual form for | ||
68 | * representing an IPv4 address, which is always four octets long. | ||
69 | * Assuming big-endian ordering, h1, h2, h3, and h4, are respectively, | ||
70 | * the first through fourth octets each converted to ASCII-decimal. | ||
71 | * Assuming big-endian ordering, p1 and p2 are, respectively, the first | ||
72 | * and second octets each converted to ASCII-decimal. For example, if a | ||
73 | * host, in big-endian order, has an address of 0x0A010307 and there is | ||
74 | * a service listening on, in big endian order, port 0x020F (decimal | ||
75 | * 527), then the complete universal address is "10.1.3.7.2.15". | ||
76 | * | ||
77 | * ... | ||
78 | * | ||
79 | * For TCP over IPv6 and for UDP over IPv6, the format of r_addr is the | ||
80 | * US-ASCII string: | ||
81 | * | ||
82 | * x1:x2:x3:x4:x5:x6:x7:x8.p1.p2 | ||
83 | * | ||
84 | * The suffix "p1.p2" is the service port, and is computed the same way | ||
85 | * as with universal addresses for TCP and UDP over IPv4. The prefix, | ||
86 | * "x1:x2:x3:x4:x5:x6:x7:x8", is the standard textual form for | ||
87 | * representing an IPv6 address as defined in Section 2.2 of [RFC2373]. | ||
88 | * Additionally, the two alternative forms specified in Section 2.2 of | ||
89 | * [RFC2373] are also acceptable. | ||
90 | * | ||
91 | * XXX: Currently this implementation does not explicitly convert the | ||
92 | * stored address to US-ASCII on non-ASCII systems. | ||
93 | */ | ||
94 | #define RPCB_MAXADDRLEN (128u) | ||
95 | |||
96 | /* | ||
97 | * r_owner | 58 | * r_owner |
98 | * | 59 | * |
99 | * The "owner" is allowed to unset a service in the rpcbind database. | 60 | * The "owner" is allowed to unset a service in the rpcbind database. |
@@ -113,7 +74,7 @@ struct rpcbind_args { | |||
113 | u32 r_prot; | 74 | u32 r_prot; |
114 | unsigned short r_port; | 75 | unsigned short r_port; |
115 | char * r_netid; | 76 | char * r_netid; |
116 | char r_addr[RPCB_MAXADDRLEN]; | 77 | char r_addr[RPCBIND_MAXUADDRLEN]; |
117 | char * r_owner; | 78 | char * r_owner; |
118 | }; | 79 | }; |
119 | 80 | ||
@@ -526,7 +487,7 @@ static int rpcb_decode_getaddr(struct rpc_rqst *req, __be32 *p, | |||
526 | * Simple sanity check. The smallest possible universal | 487 | * Simple sanity check. The smallest possible universal |
527 | * address is an IPv4 address string containing 11 bytes. | 488 | * address is an IPv4 address string containing 11 bytes. |
528 | */ | 489 | */ |
529 | if (addr_len < 11 || addr_len > RPCB_MAXADDRLEN) | 490 | if (addr_len < 11 || addr_len > RPCBIND_MAXUADDRLEN) |
530 | goto out_err; | 491 | goto out_err; |
531 | 492 | ||
532 | /* | 493 | /* |
@@ -577,7 +538,7 @@ out_err: | |||
577 | #define RPCB_boolean_sz (1u) | 538 | #define RPCB_boolean_sz (1u) |
578 | 539 | ||
579 | #define RPCB_netid_sz (1+XDR_QUADLEN(RPCBIND_MAXNETIDLEN)) | 540 | #define RPCB_netid_sz (1+XDR_QUADLEN(RPCBIND_MAXNETIDLEN)) |
580 | #define RPCB_addr_sz (1+XDR_QUADLEN(RPCB_MAXADDRLEN)) | 541 | #define RPCB_addr_sz (1+XDR_QUADLEN(RPCBIND_MAXUADDRLEN)) |
581 | #define RPCB_ownerstring_sz (1+XDR_QUADLEN(RPCB_MAXOWNERLEN)) | 542 | #define RPCB_ownerstring_sz (1+XDR_QUADLEN(RPCB_MAXOWNERLEN)) |
582 | 543 | ||
583 | #define RPCB_mappingargs_sz RPCB_program_sz+RPCB_version_sz+ \ | 544 | #define RPCB_mappingargs_sz RPCB_program_sz+RPCB_version_sz+ \ |