2008-01-08 16:31:19

by Chuck Lever

[permalink] [raw]
Subject: [PATCH 3/4] SUNRPC: Use the new rpc_v3_register() API in svc_unregister()

Unregister both AF_INET and AF_INET6 capabilities for a service advertised
in the local rpcbind database.

Signed-off-by: Chuck Lever <[email protected]>
---

net/sunrpc/svc.c | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index eb3bb24..1f4ec51 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -767,11 +767,21 @@ svc_register(struct svc_serv *serv, int proto, unsigned short port)
* svc_unregister - remove an RPC server from the local rpcbind database
* @serv: svc_serv struct for the service to register
*
- * All transport protocols, and ports for this service are removed from
- * the local rpcbind database.
+ * All address families, transport protocols, and ports for this service
+ * are removed from the local rpcbind database.
*/
void svc_unregister(struct svc_serv *serv)
{
+ struct sockaddr_in sin = {
+ .sin_family = AF_INET,
+ .sin_addr.s_addr = htonl(INADDR_ANY),
+ .sin_port = 0,
+ };
+ struct sockaddr_in6 sin6 = {
+ .sin6_family = AF_INET6,
+ .sin6_addr = IN6ADDR_ANY_INIT,
+ .sin6_port = 0,
+ };
struct svc_program *progp;
unsigned long flags;
u32 version;
@@ -785,7 +795,10 @@ void svc_unregister(struct svc_serv *serv)
continue;
if (progp->pg_vers[version]->vs_hidden)
continue;
- rpcb_register(progp->pg_prog, version, 0, 0, &dummy);
+ rpcb_v3_register(progp->pg_prog, version,
+ (struct sockaddr *)&sin, &dummy, "");
+ rpcb_v3_register(progp->pg_prog, version,
+ (struct sockaddr *)&sin6, &dummy, "");
}
}