]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
sm-notify: "-v hostname" doesn't work when IPV6_SUPPORT is enabled
authorChuck Lever <chuck.lever@oracle.com>
Fri, 19 Apr 2013 17:13:57 +0000 (13:13 -0400)
committerSteve Dickson <steved@redhat.com>
Mon, 22 Apr 2013 16:47:20 +0000 (12:47 -0400)
Marc Eshel reports that using the -v command line option on the
sm-notify command stopped working after nfs-utils 1.2.2, when IPv6
support was added.  If nfs-utils is built without IPv6 support, it
still works.  Marc specified a hostname with a single A record.

smn_bind_address() must construct a bind address with the same
family as the RPC socket's protocol family.  Add an AI_V4MAPPED hint
so an appropriate IPv6 bind address is constructed even if -v
specifies an IPv4 presentation address, or a hostname with only IPv4
mappings.

We still use an IPv4 bind address if IPv6 support is compiled out or
the host does not support IPv6.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
Cc: Marc Eshel <eshel@us.ibm.com>
utils/statd/sm-notify.c

index a3290aa82a84cf5d517212a7c2fa90b2dbb9bc11..9dbe5d9083361f2422716b004d029ff19e222779 100644 (file)
@@ -349,7 +349,7 @@ smn_bind_address(const char *srcaddr, const char *srcport)
 {
        struct addrinfo *ai = NULL;
        struct addrinfo hint = {
-               .ai_flags       = AI_NUMERICSERV,
+               .ai_flags       = AI_NUMERICSERV | AI_V4MAPPED,
                .ai_family      = nsm_family,
                .ai_protocol    = (int)IPPROTO_UDP,
        };