Unregister both AF_INET and AF_INET6 capabilities for a service advertised in the local rpcbind database. Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx> --- net/sunrpc/svc.c | 37 +++++++++++++++++++++++++++++++++---- 1 files changed, 33 insertions(+), 4 deletions(-) diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 576efa7..42f83b4 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -28,6 +28,18 @@ #define RPCDBG_FACILITY RPCDBG_SVCDSP +#ifdef CONFIG_SUNRPC_REGISTER_V4 +static const struct sockaddr_in svc_inaddr_any = { + .sin_family = AF_INET, + .sin_addr.s_addr = htonl(INADDR_ANY), +}; + +static const struct sockaddr_in6 svc_in6addr_any = { + .sin6_family = AF_INET6, + .sin6_addr = IN6ADDR_ANY_INIT, +}; +#endif + #define svc_serv_is_pooled(serv) ((serv)->sv_function) /* @@ -800,20 +812,37 @@ static void __svc_unregister(struct svc_program *program, u32 version) { int error, boolean = 0; +#ifdef CONFIG_SUNRPC_REGISTER_V4 + error = rpcb_v4_register(program->pg_prog, version, + (struct sockaddr *)&svc_inaddr_any, + "", &boolean); + dprintk("svc: svc_unregister(%sv%u, AF_INET), error %d, %s\n", + program->pg_name, version, error, + (boolean ? "succeeded" : "failed")); + + boolean = 0; + error = rpcb_v4_register(program->pg_prog, version, + (struct sockaddr *)&svc_in6addr_any, + "", &boolean); + dprintk("svc: svc_unregister(%sv%u, AF_INET6), error %d, %s\n", + program->pg_name, version, error, + (boolean ? "succeeded" : "failed")); +#else error = rpcb_register(program->pg_prog, version, 0, 0, &boolean); dprintk("svc: svc_unregister(%sv%u), error %d, %s\n", program->pg_name, version, error, (boolean ? "succeeded" : "failed")); +#endif } /** * 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. The result of unregistration is reported - * via dprintk for those who want verification of the result, but is - * otherwise not important. + * All address families, transport protocols, and ports for this service + * are removed from the local rpcbind database. The result of unregis- + * tration is reported via dprintk for those who want verification of the + * result, but is otherwise not important. */ void svc_unregister(const struct svc_serv *serv) { -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html