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

SUNRPC: Use short-hand IPv6 ANYADDR for RPCB_SET

Clean up: When doing an RPCB_SET, make the kernel's rpcb client use the
shorthand "::" for the universal form of the IPv6 ANY address.

Without this patch, rpcbind will advertise:

0000:0000:0000:0000:0000:0000:0000:0000.x.y

This is cosmetic only. It cleans up the display of information from
/sbin/rpcinfo.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>

authored by

Chuck Lever and committed by
J. Bruce Fields
9d548b9c 2c7eb0b2

+8 -4
+8 -4
net/sunrpc/rpcb_clnt.c
··· 20 20 #include <linux/in6.h> 21 21 #include <linux/kernel.h> 22 22 #include <linux/errno.h> 23 + #include <net/ipv6.h> 23 24 24 25 #include <linux/sunrpc/clnt.h> 25 26 #include <linux/sunrpc/sched.h> ··· 305 304 char buf[64]; 306 305 307 306 /* Construct AF_INET6 universal address */ 308 - snprintf(buf, sizeof(buf), 309 - NIP6_FMT".%u.%u", 310 - NIP6(address_to_register->sin6_addr), 311 - port >> 8, port & 0xff); 307 + if (ipv6_addr_any(&address_to_register->sin6_addr)) 308 + snprintf(buf, sizeof(buf), "::.%u.%u", 309 + port >> 8, port & 0xff); 310 + else 311 + snprintf(buf, sizeof(buf), NIP6_FMT".%u.%u", 312 + NIP6(address_to_register->sin6_addr), 313 + port >> 8, port & 0xff); 312 314 map->r_addr = buf; 313 315 314 316 dprintk("RPC: %sregistering [%u, %u, %s, '%s'] with "