Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

NeilBrown and committed by
Trond Myklebust
4388ce05 86e2e1f6

+13 -4
+6 -2
net/sunrpc/clnt.c
··· 565 565 servername[0] = '\0'; 566 566 switch (args->address->sa_family) { 567 567 case AF_LOCAL: 568 - snprintf(servername, sizeof(servername), "%s", 569 - sun->sun_path); 568 + if (sun->sun_path[0]) 569 + snprintf(servername, sizeof(servername), "%s", 570 + sun->sun_path); 571 + else 572 + snprintf(servername, sizeof(servername), "@%s", 573 + sun->sun_path+1); 570 574 break; 571 575 case AF_INET: 572 576 snprintf(servername, sizeof(servername), "%pI4",
+7 -2
net/sunrpc/xprtsock.c
··· 253 253 switch (sap->sa_family) { 254 254 case AF_LOCAL: 255 255 sun = xs_addr_un(xprt); 256 - strscpy(buf, sun->sun_path, sizeof(buf)); 256 + if (sun->sun_path[0]) { 257 + strscpy(buf, sun->sun_path, sizeof(buf)); 258 + } else { 259 + buf[0] = '@'; 260 + strscpy(buf+1, sun->sun_path+1, sizeof(buf)-1); 261 + } 257 262 xprt->address_strings[RPC_DISPLAY_ADDR] = 258 263 kstrdup(buf, GFP_KERNEL); 259 264 break; ··· 2863 2858 2864 2859 switch (sun->sun_family) { 2865 2860 case AF_LOCAL: 2866 - if (sun->sun_path[0] != '/') { 2861 + if (sun->sun_path[0] != '/' && sun->sun_path[0] != '\0') { 2867 2862 dprintk("RPC: bad AF_LOCAL address: %s\n", 2868 2863 sun->sun_path); 2869 2864 ret = ERR_PTR(-EINVAL);