提交 baf01caf 编写于 作者: C Chuck Lever 提交者: Trond Myklebust

SUNRPC: svc_setup_socket() gets protocol family from socket

Since the sv_family field is going away, modify svc_setup_socket() to
extract the protocol family from the passed-in socket instead of from
the passed-in svc_serv struct.
Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
上级 4b62e58c
...@@ -1122,7 +1122,7 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv, ...@@ -1122,7 +1122,7 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv,
/* Register socket with portmapper */ /* Register socket with portmapper */
if (*errp >= 0 && pmap_register) if (*errp >= 0 && pmap_register)
*errp = svc_register(serv, serv->sv_family, inet->sk_protocol, *errp = svc_register(serv, inet->sk_family, inet->sk_protocol,
ntohs(inet_sk(inet)->sport)); ntohs(inet_sk(inet)->sport));
if (*errp < 0) { if (*errp < 0) {
...@@ -1145,13 +1145,13 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv, ...@@ -1145,13 +1145,13 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv,
/* /*
* We start one listener per sv_serv. We want AF_INET * We start one listener per sv_serv. We want AF_INET
* requests to be automatically shunted to our AF_INET6 * requests to be automatically shunted to our PF_INET6
* listener using a mapped IPv4 address. Make sure * listener using a mapped IPv4 address. Make sure
* no-one starts an equivalent IPv4 listener, which * no-one starts an equivalent IPv4 listener, which
* would steal our incoming connections. * would steal our incoming connections.
*/ */
val = 0; val = 0;
if (serv->sv_family == AF_INET6) if (inet->sk_family == PF_INET6)
kernel_setsockopt(sock, SOL_IPV6, IPV6_V6ONLY, kernel_setsockopt(sock, SOL_IPV6, IPV6_V6ONLY,
(char *)&val, sizeof(val)); (char *)&val, sizeof(val));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册