[PATCH 011 of 14] knfsd: SUNRPC: Support IPv6 addresses in svc_tcp_accept

From: NeilBrown
Date: Tue Dec 12 2006 - 19:19:30 EST



From: Chuck Lever <chuck.lever@xxxxxxxxxx>
Modify svc_tcp_accept to support connecting on IPv6 sockets.

Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
Cc: Aurelien Charbon <aurelien.charbon@xxxxxxxxxxxx>
Signed-off-by: Neil Brown <neilb@xxxxxxx>

### Diffstat output
./net/sunrpc/svcsock.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff .prev/net/sunrpc/svcsock.c ./net/sunrpc/svcsock.c
--- .prev/net/sunrpc/svcsock.c 2006-12-13 10:32:17.000000000 +1100
+++ ./net/sunrpc/svcsock.c 2006-12-13 10:32:19.000000000 +1100
@@ -946,7 +946,8 @@ static inline int svc_port_is_privileged
static void
svc_tcp_accept(struct svc_sock *svsk)
{
- struct sockaddr_in sin;
+ struct sockaddr_storage addr;
+ struct sockaddr *sin = (struct sockaddr *) &addr;
struct svc_serv *serv = svsk->sk_server;
struct socket *sock = svsk->sk_sock;
struct socket *newsock;
@@ -973,8 +974,7 @@ svc_tcp_accept(struct svc_sock *svsk)
set_bit(SK_CONN, &svsk->sk_flags);
svc_sock_enqueue(svsk);

- slen = sizeof(sin);
- err = kernel_getpeername(newsock, (struct sockaddr *) &sin, &slen);
+ err = kernel_getpeername(newsock, sin, &slen);
if (err < 0) {
if (net_ratelimit())
printk(KERN_WARNING "%s: peername failed (err %d)!\n",
@@ -986,12 +986,11 @@ svc_tcp_accept(struct svc_sock *svsk)
* hosts here, but when we get encryption, the IP of the host won't
* tell us anything. For now just warn about unpriv connections.
*/
- if (!svc_port_is_privileged((struct sockaddr *) &sin)) {
+ if (!svc_port_is_privileged(sin)) {
dprintk(KERN_WARNING
"%s: connect from unprivileged port: %s\n",
serv->sv_name,
- __svc_print_addr((struct sockaddr *) &sin, buf,
- sizeof(buf)));
+ __svc_print_addr(sin, buf, sizeof(buf)));
}
dprintk("%s: connect from %s\n", serv->sv_name, buf);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/