Skip to contentSkip to conversation

SUNRPC: Use the new rpc_v3_register() API in svc_unregister()

PATCH New Chuck Lever 1 participant 1 message Jan 8, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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.

---

 net/sunrpc/svc.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)
net/sunrpc/svc.c +16 -3
index eb3bb24..1f4ec51 100644
@@ -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, "");
 		}
 	}