diff options
author | akpm@linux-foundation.org <akpm@linux-foundation.org> | 2007-02-12 03:53:38 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-12 12:48:36 -0500 |
commit | cdd88b9f3ed5013de0f1085e0e2f9123c798609d (patch) | |
tree | 2e2fba732f54c487461ad0da81bc8f11daea2786 /net/sunrpc | |
parent | bcdb81ae29091f6a66369aabfd8324e4a53d05dc (diff) |
[PATCH] knfsd: SUNRPC: Support IPv6 addresses in svc_tcp_accept
Modify svc_tcp_accept to support connecting on IPv6 sockets.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/svcsock.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 01e77b8208ce..72831b8a58fb 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
@@ -960,7 +960,8 @@ static inline int svc_port_is_privileged(struct sockaddr *sin) | |||
960 | static void | 960 | static void |
961 | svc_tcp_accept(struct svc_sock *svsk) | 961 | svc_tcp_accept(struct svc_sock *svsk) |
962 | { | 962 | { |
963 | struct sockaddr_in sin; | 963 | struct sockaddr_storage addr; |
964 | struct sockaddr *sin = (struct sockaddr *) &addr; | ||
964 | struct svc_serv *serv = svsk->sk_server; | 965 | struct svc_serv *serv = svsk->sk_server; |
965 | struct socket *sock = svsk->sk_sock; | 966 | struct socket *sock = svsk->sk_sock; |
966 | struct socket *newsock; | 967 | struct socket *newsock; |
@@ -987,8 +988,7 @@ svc_tcp_accept(struct svc_sock *svsk) | |||
987 | set_bit(SK_CONN, &svsk->sk_flags); | 988 | set_bit(SK_CONN, &svsk->sk_flags); |
988 | svc_sock_enqueue(svsk); | 989 | svc_sock_enqueue(svsk); |
989 | 990 | ||
990 | slen = sizeof(sin); | 991 | err = kernel_getpeername(newsock, sin, &slen); |
991 | err = kernel_getpeername(newsock, (struct sockaddr *) &sin, &slen); | ||
992 | if (err < 0) { | 992 | if (err < 0) { |
993 | if (net_ratelimit()) | 993 | if (net_ratelimit()) |
994 | printk(KERN_WARNING "%s: peername failed (err %d)!\n", | 994 | printk(KERN_WARNING "%s: peername failed (err %d)!\n", |
@@ -1000,16 +1000,14 @@ svc_tcp_accept(struct svc_sock *svsk) | |||
1000 | * hosts here, but when we get encryption, the IP of the host won't | 1000 | * hosts here, but when we get encryption, the IP of the host won't |
1001 | * tell us anything. For now just warn about unpriv connections. | 1001 | * tell us anything. For now just warn about unpriv connections. |
1002 | */ | 1002 | */ |
1003 | if (!svc_port_is_privileged((struct sockaddr *) &sin)) { | 1003 | if (!svc_port_is_privileged(sin)) { |
1004 | dprintk(KERN_WARNING | 1004 | dprintk(KERN_WARNING |
1005 | "%s: connect from unprivileged port: %s\n", | 1005 | "%s: connect from unprivileged port: %s\n", |
1006 | serv->sv_name, | 1006 | serv->sv_name, |
1007 | __svc_print_addr((struct sockaddr *) &sin, buf, | 1007 | __svc_print_addr(sin, buf, sizeof(buf))); |
1008 | sizeof(buf))); | ||
1009 | } | 1008 | } |
1010 | dprintk("%s: connect from %s\n", serv->sv_name, | 1009 | dprintk("%s: connect from %s\n", serv->sv_name, |
1011 | __svc_print_addr((struct sockaddr *) &sin, buf, | 1010 | __svc_print_addr(sin, buf, sizeof(buf))); |
1012 | sizeof(buf))); | ||
1013 | 1011 | ||
1014 | /* make sure that a write doesn't block forever when | 1012 | /* make sure that a write doesn't block forever when |
1015 | * low on memory | 1013 | * low on memory |
@@ -1019,7 +1017,7 @@ svc_tcp_accept(struct svc_sock *svsk) | |||
1019 | if (!(newsvsk = svc_setup_socket(serv, newsock, &err, | 1017 | if (!(newsvsk = svc_setup_socket(serv, newsock, &err, |
1020 | (SVC_SOCK_ANONYMOUS | SVC_SOCK_TEMPORARY)))) | 1018 | (SVC_SOCK_ANONYMOUS | SVC_SOCK_TEMPORARY)))) |
1021 | goto failed; | 1019 | goto failed; |
1022 | memcpy(&newsvsk->sk_remote, &sin, slen); | 1020 | memcpy(&newsvsk->sk_remote, sin, slen); |
1023 | newsvsk->sk_remotelen = slen; | 1021 | newsvsk->sk_remotelen = slen; |
1024 | 1022 | ||
1025 | svc_sock_received(newsvsk); | 1023 | svc_sock_received(newsvsk); |