]> git.decadent.org.uk Git - nfs-utils.git/commit
statd: statd_matchhostname() doesn't handle localhost properly
authorChuck Lever <chuck.lever@oracle.com>
Mon, 29 Aug 2011 17:18:25 +0000 (13:18 -0400)
committerLuk Claes <luk@debian.org>
Sun, 2 Oct 2011 14:16:47 +0000 (16:16 +0200)
commite140f282e413ac8076531636fdc9c0f8f177112b
treea47aa6321f67b49c4c2af412d79161a1fc02a703
parent8c2ab7116ee81619d4c24d5b97a36635a046b650
statd: statd_matchhostname() doesn't handle localhost properly

The job of statd_matchhostname() is to work hard at matching two
hostnames or presentation IP addresses that may refer to the same
host.

statd_matchhostname() turns the hostname of the local system into a
list of addresses containing only the loopback address.  The actual
DNS registered address of the system does not appear in that list.

Presentation IP addresses, on the other hand, are soundly ignored by
the AI_CANONNAME option of getaddrinfo(3).  The ai_canonname string
that is returned is just the same presentation IP address.  And the
resulting list of addresses contains just that IP address.

So if the DNS registered IP address of the local host is passed in as
one argument, and the local hostname is passed as the other argument,
statd_matchhostname() whiffs and believes there is no match.  To fix
this, the logic needs to be smarter about deriving a hostname from an
IP address.

This appears to cause no end of trouble: monitor records pile up in
/var/lib/nfs/sm and sm.bak, notifications are missed, and so on.  This
has likely been around since commit cbd3a131 "statd: Introduce statd
version of matchhostname()" (Jan 14, 2010).

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
utils/statd/hostname.c