git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Fix inet_ntop and inet_pton on Solaris

From
Jeff King <peff@peff.net>
Date
Feb 14, 2020, 06:50 UTC
Message-ID
<20200214065041.GF605125@coredump.intra.peff.net>
In-Reply-To
<CAH8yC8kaWXbN+RYMJnM9em7KKW54+N07JtyS1MZk0qppD=m2BA@mail.gmail.com>
On Mon, Feb 03, 2020 at 10:22:46AM -0500, Jeffrey Walton wrote:
Show 11 quoted lines
> inet_ntop and inet_pton were not being detected properly on modern on
> Solaris. This patch revisits the the socket gear configuration on
> SunOS and brings it up to date for Solaris 11.
> 
> According to configure.ac, the three or four functions of interest
> include hstrerror, inet_ntop and inet_pton. The libraries of interest
> are -lresolv -lsocket -lnsl. The configure tests now look for
> inet_ntop and inet_pton in -lsocket -lnsl per the man page. If not
> found, the configure tests fall back to existing behavior by searching
> in -lresolv. And if not found in -lresolv, then NO_INET_NTOP and
> NO_INET_PTON are set.

This makes sense, and the patch looks plausibly correct (which is the best I can say given my general lack of autoconf knowledge).

I was a little surprised by this hunk:
Show 20 quoted lines
> diff --git a/Makefile b/Makefile
> index 09f98b777c..7166b19ab4 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1461,15 +1461,15 @@ ifndef LIBC_CONTAINS_LIBINTL
>  	EXTLIBS += -lintl
>  endif
>  endif
> +ifdef NEEDS_RESOLV
> +	EXTLIBS += -lresolv
> +endif
>  ifdef NEEDS_SOCKET
>  	EXTLIBS += -lsocket
>  endif
>  ifdef NEEDS_NSL
>  	EXTLIBS += -lnsl
>  endif
> -ifdef NEEDS_RESOLV
> -	EXTLIBS += -lresolv
> -endif

But I guess it is trying to mimic the "-lresolv -lsocket -lnsl" order you mentioned in the Solaris manpage. You should be able to test if that's necessary by compiling with:

  make NEEDS_RESOLV=Yes NEEDS_SOCKET=Yes NEEDS_NSL=Yes

If so, that ordering switch could probably happen as a separate commit before the configure.ac change.

> diff --git a/configure.ac b/configure.ac
> index 66aedb9288..b83a0e970d 100644
> --- a/configure.ac
> +++ b/configure.ac

The rest of it looks OK to me. Do you want to send it as a regular Git patch with a commit message and your signoff (see SubmittingPatches)?

-Peff
Previous: Jeffrey Walton
Message 3 of 3 in “Fix inet_ntop and inet_pton on Solaris”
  1. Jeffrey WaltonFeb 3, 2020
  2. Jeffrey WaltonFeb 4, 2020
  3. Jeff KingFeb 14, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.