Linux NFS development
 help / color / mirror / Atom feed
From: Steve Dickson <SteveD@redhat.com>
To: Scott Mayhew <smayhew@redhat.com>, linux-nfs@vger.kernel.org
Subject: Re: [nfs-utils PATCH v2] statd: make statd_canonical_name return the presentation address if it maps to an empty hostname
Date: Sat, 12 Dec 2015 07:13:44 -0500	[thread overview]
Message-ID: <566C0F78.4070006@RedHat.com> (raw)
In-Reply-To: <1449512542-19826-1-git-send-email-smayhew@redhat.com>



On 12/07/2015 01:22 PM, Scott Mayhew wrote:
> Certain name resolution misconfigurations (for example, a hosts file
> entry with an ip address but no hostnames) can cause get_nameinfo() to
> return an empty string in buf, which will lead to this cryptic failure:
> 
> Dec  7 09:37:44 hostname rpc.statd[8024]: Failed to insert: creating
> /var/lib/nfs/statd/sm/: Is a directory
> Dec  7 09:37:44 hostname rpc.statd[8024]: STAT_FAIL to
> hostname.example.com for SM_MON of 192.168.1.2
> Dec  7 09:37:44 hostname kernel: lockd: cannot monitor 192.168.1.2
> 
> It's better in that case to just go ahead and use the presentation
> address instead.
> 
> Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Committed... 

steved.

> ---
>  utils/statd/hostname.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/utils/statd/hostname.c b/utils/statd/hostname.c
> index c61087c..8cccdb8 100644
> --- a/utils/statd/hostname.c
> +++ b/utils/statd/hostname.c
> @@ -180,9 +180,6 @@ get_nameinfo(const struct sockaddr *sap,
>   * Incoming hostnames are looked up to determine the canonical hostname,
>   * and incoming presentation addresses are converted to canonical
>   * hostnames.
> - *
> - * We won't monitor peers that don't have a reverse map.  The canonical
> - * name gives us a key for our monitor list.
>   */
>  __attribute__((__malloc__))
>  char *
> @@ -207,7 +204,7 @@ statd_canonical_name(const char *hostname)
>  		result = get_nameinfo(ai->ai_addr, ai->ai_addrlen,
>  					buf, (socklen_t)sizeof(buf));
>  		freeaddrinfo(ai);
> -		if (!result)
> +		if (!result || buf[0] == '\0')
>  			/* OK to use presentation address,
>  			 * if no reverse map exists */
>  			return strdup(hostname);
> 

      reply	other threads:[~2015-12-12 12:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-07 18:22 [nfs-utils PATCH v2] statd: make statd_canonical_name return the presentation address if it maps to an empty hostname Scott Mayhew
2015-12-12 12:13 ` Steve Dickson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=566C0F78.4070006@RedHat.com \
    --to=steved@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=smayhew@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox