build: always use local inet_pton()/inet_ntop() implementations

Also repurpose existing build-time feature checks into unit test 1961,
to verify.

Prior to this patch these functions were auto-detected with both
autotools and cmake. In case of autotools there was an extra
verification phase ensuring the functions work as expected. This step
required running the function, thus was limited to non-cross-builds. For
cross-builds and CMake it always used the system implementation if
present. On Windows it always used the local implementation, because
availability/use is complicated there.

After this patch all platforms, always use the local implementation,
which is known to be accurate. This makes curl behave more consistently,
and simplifies the build process, a fixes cross-builds and CMake
auto-detection differences.

Also:
- test1960: enable unconditionally.
- checksrc: disallow globally, allowlist in `block_ip.c` example.
- dnsd: verify ntop result for NULL before passing to printf.

Ref: https://github.com/curl/curl/pull/22137#issuecomment-4797440983
Ref: #22137
Ref: 8537a5b0bc #16577

Closes #22170
This commit is contained in:
Viktor Szakats 2026-06-25 12:48:26 +02:00
parent a62e08c5eb
commit 39dec13ec0
No known key found for this signature in database
22 changed files with 214 additions and 448 deletions

View file

@ -235,10 +235,10 @@ test1916 test1917 test1918 test1919 test1920 test1921 test1922 \
\
test1933 test1934 test1935 test1936 test1937 test1938 test1939 test1940 \
test1941 test1942 test1943 test1944 test1945 test1946 test1947 test1948 \
test1955 test1956 test1957 test1958 test1959 test1960 test1964 test1965 \
test1966 test1967 test1970 test1971 test1972 test1973 \
test1974 test1975 test1976 test1977 test1978 test1979 test1980 test1981 \
test1982 test1983 test1984 \
test1955 test1956 test1957 test1958 test1959 test1960 test1961 \
test1964 test1965 test1966 test1967 test1970 \
test1971 test1972 test1973 test1974 test1975 test1976 test1977 test1978 \
test1979 test1980 test1981 test1982 test1983 test1984 \
\
test2000 test2001 test2002 test2003 test2004 test2005 test2006 test2007 \
test2008 test2009 test2010 test2011 test2012 test2013 test2014 test2015 \

18
tests/data/test1961 Normal file
View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="US-ASCII"?>
<testcase>
<info>
<keywords>
unittest
</keywords>
</info>
# Client-side
<client>
<features>
unittest
</features>
<name>
curlx_inet_ntop() and curlx_inet_pton()
</name>
</client>
</testcase>