diff options
author | NeilBrown <neilb@suse.de> | 2023-05-11 08:06:24 +1000 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@hammerspace.com> | 2023-06-19 12:12:22 -0400 |
commit | 4388ce05fa38b17e7d9ddabffcb16ed778ee417c (patch) | |
tree | 8cf67d53e7769d9901f7dd165035ba89c38eacc0 /net/sunrpc/clnt.c | |
parent | 86e2e1f6d9215bfec88b82c16936ba0f3ddaeb00 (diff) |
SUNRPC: support abstract unix socket addresses
An "abtract" address for an AF_UNIX socket start with a nul and can
contain any bytes for the given length, but traditionally doesn't
contain other nuls. When reported, the leading nul is replaced by '@'.
sunrpc currently rejects connections to these addresses and reports them
as an empty string. To provide support for future use of these
addresses, allow them for outgoing connections and report them more
usefully.
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'net/sunrpc/clnt.c')
-rw-r--r-- | net/sunrpc/clnt.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index d2ee56634308..18f70854f528 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -565,8 +565,12 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) servername[0] = '\0'; switch (args->address->sa_family) { case AF_LOCAL: - snprintf(servername, sizeof(servername), "%s", - sun->sun_path); + if (sun->sun_path[0]) + snprintf(servername, sizeof(servername), "%s", + sun->sun_path); + else + snprintf(servername, sizeof(servername), "@%s", + sun->sun_path+1); break; case AF_INET: snprintf(servername, sizeof(servername), "%pI4", |