Commit 9d548b9c955c0709d1229d21d0bc14afa6b356de

Authored by Chuck Lever
Committed by J. Bruce Fields
1 parent 2c7eb0b206

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>

Showing 1 changed file with 8 additions and 4 deletions Side-by-side Diff

net/sunrpc/rpcb_clnt.c
... ... @@ -20,6 +20,7 @@
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>
... ... @@ -304,10 +305,13 @@
304 305 char buf[64];
305 306  
306 307 /* Construct AF_INET6 universal address */
307   - snprintf(buf, sizeof(buf),
308   - NIP6_FMT".%u.%u",
309   - NIP6(address_to_register->sin6_addr),
310   - port >> 8, port & 0xff);
  308 + if (ipv6_addr_any(&address_to_register->sin6_addr))
  309 + snprintf(buf, sizeof(buf), "::.%u.%u",
  310 + port >> 8, port & 0xff);
  311 + else
  312 + snprintf(buf, sizeof(buf), NIP6_FMT".%u.%u",
  313 + NIP6(address_to_register->sin6_addr),
  314 + port >> 8, port & 0xff);
311 315 map->r_addr = buf;
312 316  
313 317 dprintk("RPC: %sregistering [%u, %u, %s, '%s'] with "