diff options
Diffstat (limited to 'fs/nfs/callback.c')
-rw-r--r-- | fs/nfs/callback.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c index 7933e2e99dbc..75f309c8741a 100644 --- a/fs/nfs/callback.c +++ b/fs/nfs/callback.c | |||
@@ -71,6 +71,8 @@ static void nfs_callback_svc(struct svc_rqst *rqstp) | |||
71 | complete(&nfs_callback_info.started); | 71 | complete(&nfs_callback_info.started); |
72 | 72 | ||
73 | for(;;) { | 73 | for(;;) { |
74 | char buf[RPC_MAX_ADDRBUFLEN]; | ||
75 | |||
74 | if (signalled()) { | 76 | if (signalled()) { |
75 | if (nfs_callback_info.users == 0) | 77 | if (nfs_callback_info.users == 0) |
76 | break; | 78 | break; |
@@ -88,8 +90,8 @@ static void nfs_callback_svc(struct svc_rqst *rqstp) | |||
88 | __FUNCTION__, -err); | 90 | __FUNCTION__, -err); |
89 | break; | 91 | break; |
90 | } | 92 | } |
91 | dprintk("%s: request from %u.%u.%u.%u\n", __FUNCTION__, | 93 | dprintk("%s: request from %s\n", __FUNCTION__, |
92 | NIPQUAD(rqstp->rq_addr.sin_addr.s_addr)); | 94 | svc_print_addr(rqstp, buf, sizeof(buf))); |
93 | svc_process(rqstp); | 95 | svc_process(rqstp); |
94 | } | 96 | } |
95 | 97 | ||
@@ -106,7 +108,6 @@ static void nfs_callback_svc(struct svc_rqst *rqstp) | |||
106 | int nfs_callback_up(void) | 108 | int nfs_callback_up(void) |
107 | { | 109 | { |
108 | struct svc_serv *serv; | 110 | struct svc_serv *serv; |
109 | struct svc_sock *svsk; | ||
110 | int ret = 0; | 111 | int ret = 0; |
111 | 112 | ||
112 | lock_kernel(); | 113 | lock_kernel(); |
@@ -119,17 +120,14 @@ int nfs_callback_up(void) | |||
119 | ret = -ENOMEM; | 120 | ret = -ENOMEM; |
120 | if (!serv) | 121 | if (!serv) |
121 | goto out_err; | 122 | goto out_err; |
122 | /* FIXME: We don't want to register this socket with the portmapper */ | 123 | |
123 | ret = svc_makesock(serv, IPPROTO_TCP, nfs_callback_set_tcpport); | 124 | ret = svc_makesock(serv, IPPROTO_TCP, nfs_callback_set_tcpport, |
124 | if (ret < 0) | 125 | SVC_SOCK_ANONYMOUS); |
126 | if (ret <= 0) | ||
125 | goto out_destroy; | 127 | goto out_destroy; |
126 | if (!list_empty(&serv->sv_permsocks)) { | 128 | nfs_callback_tcpport = ret; |
127 | svsk = list_entry(serv->sv_permsocks.next, | 129 | dprintk("Callback port = 0x%x\n", nfs_callback_tcpport); |
128 | struct svc_sock, sk_list); | 130 | |
129 | nfs_callback_tcpport = ntohs(inet_sk(svsk->sk_sk)->sport); | ||
130 | dprintk ("Callback port = 0x%x\n", nfs_callback_tcpport); | ||
131 | } else | ||
132 | BUG(); | ||
133 | ret = svc_create_thread(nfs_callback_svc, serv); | 131 | ret = svc_create_thread(nfs_callback_svc, serv); |
134 | if (ret < 0) | 132 | if (ret < 0) |
135 | goto out_destroy; | 133 | goto out_destroy; |
@@ -140,6 +138,8 @@ out: | |||
140 | unlock_kernel(); | 138 | unlock_kernel(); |
141 | return ret; | 139 | return ret; |
142 | out_destroy: | 140 | out_destroy: |
141 | dprintk("Couldn't create callback socket or server thread; err = %d\n", | ||
142 | ret); | ||
143 | svc_destroy(serv); | 143 | svc_destroy(serv); |
144 | out_err: | 144 | out_err: |
145 | nfs_callback_info.users--; | 145 | nfs_callback_info.users--; |
@@ -166,15 +166,19 @@ void nfs_callback_down(void) | |||
166 | 166 | ||
167 | static int nfs_callback_authenticate(struct svc_rqst *rqstp) | 167 | static int nfs_callback_authenticate(struct svc_rqst *rqstp) |
168 | { | 168 | { |
169 | struct sockaddr_in *addr = &rqstp->rq_addr; | 169 | struct sockaddr_in *addr = svc_addr_in(rqstp); |
170 | struct nfs_client *clp; | 170 | struct nfs_client *clp; |
171 | char buf[RPC_MAX_ADDRBUFLEN]; | ||
171 | 172 | ||
172 | /* Don't talk to strangers */ | 173 | /* Don't talk to strangers */ |
173 | clp = nfs_find_client(addr, 4); | 174 | clp = nfs_find_client(addr, 4); |
174 | if (clp == NULL) | 175 | if (clp == NULL) |
175 | return SVC_DROP; | 176 | return SVC_DROP; |
176 | dprintk("%s: %u.%u.%u.%u NFSv4 callback!\n", __FUNCTION__, NIPQUAD(addr->sin_addr)); | 177 | |
178 | dprintk("%s: %s NFSv4 callback!\n", __FUNCTION__, | ||
179 | svc_print_addr(rqstp, buf, sizeof(buf))); | ||
177 | nfs_put_client(clp); | 180 | nfs_put_client(clp); |
181 | |||
178 | switch (rqstp->rq_authop->flavour) { | 182 | switch (rqstp->rq_authop->flavour) { |
179 | case RPC_AUTH_NULL: | 183 | case RPC_AUTH_NULL: |
180 | if (rqstp->rq_proc != CB_NULL) | 184 | if (rqstp->rq_proc != CB_NULL) |