diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2007-02-12 03:53:39 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-12 12:48:36 -0500 |
commit | 77f1f67a1a56defa210c3d8857f3e5eee3990a99 (patch) | |
tree | 9d34af393db31a566c01f915074ff070c644ecc1 /net/sunrpc/svcsock.c | |
parent | 95756482c9bfa375418c5a32455494a3042f65cd (diff) |
[PATCH] knfsd: SUNRPC: fix up svc_create_socket() to take a sockaddr struct + length
Replace existing svc_create_socket() API to allow callers to pass addresses
larger than a sockaddr_in.
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/svcsock.c')
-rw-r--r-- | net/sunrpc/svcsock.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 6f509b9cae2..63ae94771b8 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
@@ -1700,7 +1700,7 @@ EXPORT_SYMBOL_GPL(svc_addsock); | |||
1700 | * Create socket for RPC service. | 1700 | * Create socket for RPC service. |
1701 | */ | 1701 | */ |
1702 | static int svc_create_socket(struct svc_serv *serv, int protocol, | 1702 | static int svc_create_socket(struct svc_serv *serv, int protocol, |
1703 | struct sockaddr_in *sin, int flags) | 1703 | struct sockaddr *sin, int len, int flags) |
1704 | { | 1704 | { |
1705 | struct svc_sock *svsk; | 1705 | struct svc_sock *svsk; |
1706 | struct socket *sock; | 1706 | struct socket *sock; |
@@ -1710,8 +1710,7 @@ static int svc_create_socket(struct svc_serv *serv, int protocol, | |||
1710 | 1710 | ||
1711 | dprintk("svc: svc_create_socket(%s, %d, %s)\n", | 1711 | dprintk("svc: svc_create_socket(%s, %d, %s)\n", |
1712 | serv->sv_program->pg_name, protocol, | 1712 | serv->sv_program->pg_name, protocol, |
1713 | __svc_print_addr((struct sockaddr *) sin, buf, | 1713 | __svc_print_addr(sin, buf, sizeof(buf))); |
1714 | sizeof(buf))); | ||
1715 | 1714 | ||
1716 | if (protocol != IPPROTO_UDP && protocol != IPPROTO_TCP) { | 1715 | if (protocol != IPPROTO_UDP && protocol != IPPROTO_TCP) { |
1717 | printk(KERN_WARNING "svc: only UDP and TCP " | 1716 | printk(KERN_WARNING "svc: only UDP and TCP " |
@@ -1720,15 +1719,15 @@ static int svc_create_socket(struct svc_serv *serv, int protocol, | |||
1720 | } | 1719 | } |
1721 | type = (protocol == IPPROTO_UDP)? SOCK_DGRAM : SOCK_STREAM; | 1720 | type = (protocol == IPPROTO_UDP)? SOCK_DGRAM : SOCK_STREAM; |
1722 | 1721 | ||
1723 | if ((error = sock_create_kern(PF_INET, type, protocol, &sock)) < 0) | 1722 | error = sock_create_kern(sin->sa_family, type, protocol, &sock); |
1723 | if (error < 0) | ||
1724 | return error; | 1724 | return error; |
1725 | 1725 | ||
1726 | svc_reclassify_socket(sock); | 1726 | svc_reclassify_socket(sock); |
1727 | 1727 | ||
1728 | if (type == SOCK_STREAM) | 1728 | if (type == SOCK_STREAM) |
1729 | sock->sk->sk_reuse = 1; /* allow address reuse */ | 1729 | sock->sk->sk_reuse = 1; /* allow address reuse */ |
1730 | error = kernel_bind(sock, (struct sockaddr *) sin, | 1730 | error = kernel_bind(sock, sin, len); |
1731 | sizeof(*sin)); | ||
1732 | if (error < 0) | 1731 | if (error < 0) |
1733 | goto bummer; | 1732 | goto bummer; |
1734 | 1733 | ||
@@ -1818,7 +1817,8 @@ int svc_makesock(struct svc_serv *serv, int protocol, unsigned short port, | |||
1818 | }; | 1817 | }; |
1819 | 1818 | ||
1820 | dprintk("svc: creating socket proto = %d\n", protocol); | 1819 | dprintk("svc: creating socket proto = %d\n", protocol); |
1821 | return svc_create_socket(serv, protocol, &sin, flags); | 1820 | return svc_create_socket(serv, protocol, (struct sockaddr *) &sin, |
1821 | sizeof(sin), flags); | ||
1822 | } | 1822 | } |
1823 | 1823 | ||
1824 | /* | 1824 | /* |