diff options
author | Olaf Kirch <okir@suse.de> | 2006-10-04 05:16:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-04 10:55:19 -0400 |
commit | bc5fea4299b8bda5f73c6f79dc35d388caf8bced (patch) | |
tree | e8822bdad94634e896690a285e1e26b54a0f09d5 | |
parent | 0ade060ee51b9b6cf18d580405dc9ab90067f69f (diff) |
[PATCH] knfsd: register all RPC programs with portmapper by default
The NFSACL patches introduced support for multiple RPC services listening on
the same transport. However, only the first of these services was registered
with portmapper. This was perfectly fine for nfsacl, as you traditionally do
not want these to show up in a portmapper listing.
The patch below changes the default behavior to always register all services
listening on a given transport, but retains the old behavior for nfsacl
services.
Signed-off-by: Olaf Kirch <okir@suse.de>
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | fs/nfsd/nfs2acl.c | 1 | ||||
-rw-r--r-- | fs/nfsd/nfs3acl.c | 1 | ||||
-rw-r--r-- | include/linux/sunrpc/svc.h | 3 | ||||
-rw-r--r-- | net/sunrpc/svc.c | 37 |
4 files changed, 28 insertions, 14 deletions
diff --git a/fs/nfsd/nfs2acl.c b/fs/nfsd/nfs2acl.c index 71108da2e54e..9187755661df 100644 --- a/fs/nfsd/nfs2acl.c +++ b/fs/nfsd/nfs2acl.c | |||
@@ -333,4 +333,5 @@ struct svc_version nfsd_acl_version2 = { | |||
333 | .vs_proc = nfsd_acl_procedures2, | 333 | .vs_proc = nfsd_acl_procedures2, |
334 | .vs_dispatch = nfsd_dispatch, | 334 | .vs_dispatch = nfsd_dispatch, |
335 | .vs_xdrsize = NFS3_SVC_XDRSIZE, | 335 | .vs_xdrsize = NFS3_SVC_XDRSIZE, |
336 | .vs_hidden = 1, | ||
336 | }; | 337 | }; |
diff --git a/fs/nfsd/nfs3acl.c b/fs/nfsd/nfs3acl.c index f813b054f4a1..d4bdc00c1169 100644 --- a/fs/nfsd/nfs3acl.c +++ b/fs/nfsd/nfs3acl.c | |||
@@ -263,5 +263,6 @@ struct svc_version nfsd_acl_version3 = { | |||
263 | .vs_proc = nfsd_acl_procedures3, | 263 | .vs_proc = nfsd_acl_procedures3, |
264 | .vs_dispatch = nfsd_dispatch, | 264 | .vs_dispatch = nfsd_dispatch, |
265 | .vs_xdrsize = NFS3_SVC_XDRSIZE, | 265 | .vs_xdrsize = NFS3_SVC_XDRSIZE, |
266 | .vs_hidden = 1, | ||
266 | }; | 267 | }; |
267 | 268 | ||
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 74e52c245da4..d6288e89fd9d 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h | |||
@@ -321,6 +321,9 @@ struct svc_version { | |||
321 | struct svc_procedure * vs_proc; /* per-procedure info */ | 321 | struct svc_procedure * vs_proc; /* per-procedure info */ |
322 | u32 vs_xdrsize; /* xdrsize needed for this version */ | 322 | u32 vs_xdrsize; /* xdrsize needed for this version */ |
323 | 323 | ||
324 | unsigned int vs_hidden : 1; /* Don't register with portmapper. | ||
325 | * Only used for nfsacl so far. */ | ||
326 | |||
324 | /* Override dispatch function (e.g. when caching replies). | 327 | /* Override dispatch function (e.g. when caching replies). |
325 | * A return value of 0 means drop the request. | 328 | * A return value of 0 means drop the request. |
326 | * vs_dispatch == NULL means use default dispatcher. | 329 | * vs_dispatch == NULL means use default dispatcher. |
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index b252401c8601..550441d13a08 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c | |||
@@ -644,23 +644,32 @@ svc_register(struct svc_serv *serv, int proto, unsigned short port) | |||
644 | unsigned long flags; | 644 | unsigned long flags; |
645 | int i, error = 0, dummy; | 645 | int i, error = 0, dummy; |
646 | 646 | ||
647 | progp = serv->sv_program; | ||
648 | |||
649 | dprintk("RPC: svc_register(%s, %s, %d)\n", | ||
650 | progp->pg_name, proto == IPPROTO_UDP? "udp" : "tcp", port); | ||
651 | |||
652 | if (!port) | 647 | if (!port) |
653 | clear_thread_flag(TIF_SIGPENDING); | 648 | clear_thread_flag(TIF_SIGPENDING); |
654 | 649 | ||
655 | for (i = 0; i < progp->pg_nvers; i++) { | 650 | for (progp = serv->sv_program; progp; progp = progp->pg_next) { |
656 | if (progp->pg_vers[i] == NULL) | 651 | for (i = 0; i < progp->pg_nvers; i++) { |
657 | continue; | 652 | if (progp->pg_vers[i] == NULL) |
658 | error = rpc_register(progp->pg_prog, i, proto, port, &dummy); | 653 | continue; |
659 | if (error < 0) | 654 | |
660 | break; | 655 | dprintk("RPC: svc_register(%s, %s, %d, %d)%s\n", |
661 | if (port && !dummy) { | 656 | progp->pg_name, |
662 | error = -EACCES; | 657 | proto == IPPROTO_UDP? "udp" : "tcp", |
663 | break; | 658 | port, |
659 | i, | ||
660 | progp->pg_vers[i]->vs_hidden? | ||
661 | " (but not telling portmap)" : ""); | ||
662 | |||
663 | if (progp->pg_vers[i]->vs_hidden) | ||
664 | continue; | ||
665 | |||
666 | error = rpc_register(progp->pg_prog, i, proto, port, &dummy); | ||
667 | if (error < 0) | ||
668 | break; | ||
669 | if (port && !dummy) { | ||
670 | error = -EACCES; | ||
671 | break; | ||
672 | } | ||
664 | } | 673 | } |
665 | } | 674 | } |
666 | 675 | ||