diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2008-10-16 17:41:11 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-10-17 13:06:41 -0400 |
commit | 18de9735300756e3ca9c361ef58409d8561dfe0d (patch) | |
tree | 5222cb1952b6de6d3b36576384026a7c2f4c0395 /fs/nfs | |
parent | 2e532d68a2b3e2aa6b19731501222069735c741c (diff) |
NFS: Enable NFSv4 callback server to listen on AF_INET6 sockets
Allow the NFS callback server to listen for requests via an AF_INET6 or
AF_INET socket when IPv6 support is present in the kernel.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/callback.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c index 6a09760c5960..c2e9cfd9e5a4 100644 --- a/fs/nfs/callback.c +++ b/fs/nfs/callback.c | |||
@@ -40,6 +40,16 @@ unsigned short nfs_callback_tcpport; | |||
40 | static const int nfs_set_port_min = 0; | 40 | static const int nfs_set_port_min = 0; |
41 | static const int nfs_set_port_max = 65535; | 41 | static const int nfs_set_port_max = 65535; |
42 | 42 | ||
43 | /* | ||
44 | * If the kernel has IPv6 support available, always listen for | ||
45 | * both AF_INET and AF_INET6 requests. | ||
46 | */ | ||
47 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
48 | static const sa_family_t nfs_callback_family = AF_INET6; | ||
49 | #else | ||
50 | static const sa_family_t nfs_callback_family = AF_INET; | ||
51 | #endif | ||
52 | |||
43 | static int param_set_port(const char *val, struct kernel_param *kp) | 53 | static int param_set_port(const char *val, struct kernel_param *kp) |
44 | { | 54 | { |
45 | char *endp; | 55 | char *endp; |
@@ -106,7 +116,7 @@ int nfs_callback_up(void) | |||
106 | if (nfs_callback_info.users++ || nfs_callback_info.task != NULL) | 116 | if (nfs_callback_info.users++ || nfs_callback_info.task != NULL) |
107 | goto out; | 117 | goto out; |
108 | serv = svc_create(&nfs4_callback_program, NFS4_CALLBACK_BUFSIZE, | 118 | serv = svc_create(&nfs4_callback_program, NFS4_CALLBACK_BUFSIZE, |
109 | AF_INET, NULL); | 119 | nfs_callback_family, NULL); |
110 | ret = -ENOMEM; | 120 | ret = -ENOMEM; |
111 | if (!serv) | 121 | if (!serv) |
112 | goto out_err; | 122 | goto out_err; |
@@ -116,7 +126,8 @@ int nfs_callback_up(void) | |||
116 | if (ret <= 0) | 126 | if (ret <= 0) |
117 | goto out_err; | 127 | goto out_err; |
118 | nfs_callback_tcpport = ret; | 128 | nfs_callback_tcpport = ret; |
119 | dprintk("Callback port = 0x%x\n", nfs_callback_tcpport); | 129 | dprintk("NFS: Callback listener port = %u (af %u)\n", |
130 | nfs_callback_tcpport, nfs_callback_family); | ||
120 | 131 | ||
121 | nfs_callback_info.rqst = svc_prepare_thread(serv, &serv->sv_pools[0]); | 132 | nfs_callback_info.rqst = svc_prepare_thread(serv, &serv->sv_pools[0]); |
122 | if (IS_ERR(nfs_callback_info.rqst)) { | 133 | if (IS_ERR(nfs_callback_info.rqst)) { |
@@ -149,8 +160,8 @@ out: | |||
149 | mutex_unlock(&nfs_callback_mutex); | 160 | mutex_unlock(&nfs_callback_mutex); |
150 | return ret; | 161 | return ret; |
151 | out_err: | 162 | out_err: |
152 | dprintk("Couldn't create callback socket or server thread; err = %d\n", | 163 | dprintk("NFS: Couldn't create callback socket or server thread; " |
153 | ret); | 164 | "err = %d\n", ret); |
154 | nfs_callback_info.users--; | 165 | nfs_callback_info.users--; |
155 | goto out; | 166 | goto out; |
156 | } | 167 | } |