All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] bugfix for network/lib6/getaddrinfo_01.c
Date: Tue, 11 May 2021 15:47:50 +0200	[thread overview]
Message-ID: <YJqLBoT36RG1Icon@pevik> (raw)
In-Reply-To: <d1dc697b-f73a-3be4-c5df-151aae021265@oracle.com>

Hi Alexey,

thank you for your input!

> >> For test cases (test2 ,IPV4 canonical name) and (test13 ,IPV6 canonical name)

> >> The gethostname() API returns the official name of host, not the canonical name of host.
> >> The canonical name of host needs to be obtained through the gethostbyname() API;

> > Yes, test 2 and 13 fails systems which don't use FQDN as hostname and have DNS records
> > due mismatch short name and FQDN, e.g.:
> > getaddrinfo_01    2  TFAIL  :  getaddrinfo_01.c:140: getaddrinfo IPv4 canonical name ("foo.suse.cz") doesn't match hostname ("foo")

> > It's a bit strange to use deprecated gethostbyname() in getaddrinfo() tests :).

> Yeah, gethostbyname() is obsolete, we shouldn't compare both here,
> i.e. getaddrinfo() vs gethostbyname()...

> > Yes, it's the easiest way to get FQDN instead of just "short" hostname. But
> > Maybe simple check if we have FQDN with strchr for dot and TCONF it's just short
> > name would be better.

> +1, and instead of TCONF we could check the "shortname" that
> we pass to getaddrinfo():
shortname variable always contains "short name" (obviously).
But with correct configuration (e.g. search example.com in /etc/resolv.conf for
DNS or valid IP setup ADDR foo.suse.cz foo in /etc/hosts) it works.
The problem is really with value we use to check the result (i.e. now hostname).

> >>  	shortname[MAXHOSTNAMELEN] = '\0';
> >>  	p = strchr(shortname, '.');
> >>  	if (p)

> ...

> > FYI Workaround on systems which do not have DNS record is to use /etc/fstab.
> > We should document in testcases/network/README.md that when using /etc/fstab,

> /etc/hosts

Lol, sorry :)


Kind regards,
Petr

      reply	other threads:[~2021-05-11 13:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-11  9:16 [LTP] [PATCH] bugfix for network/lib6/getaddrinfo_01.c dongshijiang
2021-05-11 12:21 ` Petr Vorel
2021-05-11 12:58   ` Alexey Kodanev
2021-05-11 13:47     ` Petr Vorel [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=YJqLBoT36RG1Icon@pevik \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.