<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/lib/libc/tests/net, branch stable/15</title>
<subtitle>FreeBSD source tree</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<entry>
<title>inet_net_test: Compare pointers against nullptr</title>
<updated>2025-10-26T02:30:05+00:00</updated>
<author>
<name>John Baldwin</name>
<email>jhb@FreeBSD.org</email>
</author>
<published>2025-10-20T18:31:41+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=848ca53d3a44ed58348878de462e4c86daa24e5e'/>
<id>848ca53d3a44ed58348878de462e4c86daa24e5e</id>
<content type='text'>
GCC does not like passing NULL (__null) to std::ostringstream::operator&lt;&lt;
inside of ATF_REQUIRE_EQ:

lib/libc/tests/net/inet_net_test.cc: In member function 'virtual void {anonymous}::atfu_tc_inet_net_ntop_invalid::body() const':
lib/libc/tests/net/inet_net_test.cc:306:9: error: passing NULL to non-pointer argument 1 of 'std::__1::basic_ostream&lt;_CharT, _Traits&gt;&amp; std::__1::basic_ostream&lt;_CharT, _Traits&gt;::operator&lt;&lt;(long int) [with _CharT = char; _Traits = std::__1::char_traits&lt;char&gt;]' [-Werror=conversion-null]
  306 |         ATF_REQUIRE_EQ(ret, NULL);
      |         ^~~~~~~~~~~~~~
In file included from /usr/obj/.../amd64.amd64/tmp/usr/include/c++/v1/sstream:317,
                 from /usr/obj/.../amd64.amd64/tmp/usr/include/atf-c++/macros.hpp:29,
                 from /usr/obj/.../amd64.amd64/tmp/usr/include/atf-c++.hpp:29,
                 from lib/libc/tests/net/inet_net_test.cc:33:
/usr/obj/.../amd64.amd64/tmp/usr/include/c++/v1/__ostream/basic_ostream.h:338:81: note:   declared here
  338 | basic_ostream&lt;_CharT, _Traits&gt;&amp; basic_ostream&lt;_CharT, _Traits&gt;::operator&lt;&lt;(long __n) {
      |                                                                            ~~~~~^~~
...

Fixes:		8f4a0d2f7b96 ("libc: Import OpenBSD's inet_net_{ntop,pton}")
(cherry picked from commit aa358ce3ca8e1fcfb305025fd00beb2a119c7c77)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
GCC does not like passing NULL (__null) to std::ostringstream::operator&lt;&lt;
inside of ATF_REQUIRE_EQ:

lib/libc/tests/net/inet_net_test.cc: In member function 'virtual void {anonymous}::atfu_tc_inet_net_ntop_invalid::body() const':
lib/libc/tests/net/inet_net_test.cc:306:9: error: passing NULL to non-pointer argument 1 of 'std::__1::basic_ostream&lt;_CharT, _Traits&gt;&amp; std::__1::basic_ostream&lt;_CharT, _Traits&gt;::operator&lt;&lt;(long int) [with _CharT = char; _Traits = std::__1::char_traits&lt;char&gt;]' [-Werror=conversion-null]
  306 |         ATF_REQUIRE_EQ(ret, NULL);
      |         ^~~~~~~~~~~~~~
In file included from /usr/obj/.../amd64.amd64/tmp/usr/include/c++/v1/sstream:317,
                 from /usr/obj/.../amd64.amd64/tmp/usr/include/atf-c++/macros.hpp:29,
                 from /usr/obj/.../amd64.amd64/tmp/usr/include/atf-c++.hpp:29,
                 from lib/libc/tests/net/inet_net_test.cc:33:
/usr/obj/.../amd64.amd64/tmp/usr/include/c++/v1/__ostream/basic_ostream.h:338:81: note:   declared here
  338 | basic_ostream&lt;_CharT, _Traits&gt;&amp; basic_ostream&lt;_CharT, _Traits&gt;::operator&lt;&lt;(long __n) {
      |                                                                            ~~~~~^~~
...

Fixes:		8f4a0d2f7b96 ("libc: Import OpenBSD's inet_net_{ntop,pton}")
(cherry picked from commit aa358ce3ca8e1fcfb305025fd00beb2a119c7c77)
</pre>
</div>
</content>
</entry>
<entry>
<title>inet_net_test: Use int to hold expected return values from inet_net_pton</title>
<updated>2025-10-26T02:29:57+00:00</updated>
<author>
<name>John Baldwin</name>
<email>jhb@FreeBSD.org</email>
</author>
<published>2025-10-20T18:31:41+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=7ffd190ae9c82e4359d8a6f6ae2d1b82e8eb6453'/>
<id>7ffd190ae9c82e4359d8a6f6ae2d1b82e8eb6453</id>
<content type='text'>
GCC warns about the sign mismatch in comparisons:

lib/libc/tests/net/inet_net_test.cc: In member function 'virtual void {anonymous}::atfu_tc_inet_net_inet4::body() const':
lib/libc/tests/net/inet_net_test.cc:86:17: error: comparison of integer expressions of different signedness: 'int' and 'const unsigned int' [-Werror=sign-compare]
   86 |                 ATF_REQUIRE_EQ(bits, addr.bits);
      |                 ^~~~~~~~~~~~~~
lib/libc/tests/net/inet_net_test.cc: In member function 'virtual void {anonymous}::atfu_tc_inet_net_inet6::body() const':
lib/libc/tests/net/inet_net_test.cc:205:17: error: comparison of integer expressions of different signedness: 'int' and 'const unsigned int' [-Werror=sign-compare]
  205 |                 ATF_REQUIRE_EQ(bits, addr.bits);
      |                 ^~~~~~~~~~~~~~

Fixes:		8f4a0d2f7b96 ("libc: Import OpenBSD's inet_net_{ntop,pton}")
(cherry picked from commit e1aeb58cbbc3839db93ec38ce491b7b9383d5649)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
GCC warns about the sign mismatch in comparisons:

lib/libc/tests/net/inet_net_test.cc: In member function 'virtual void {anonymous}::atfu_tc_inet_net_inet4::body() const':
lib/libc/tests/net/inet_net_test.cc:86:17: error: comparison of integer expressions of different signedness: 'int' and 'const unsigned int' [-Werror=sign-compare]
   86 |                 ATF_REQUIRE_EQ(bits, addr.bits);
      |                 ^~~~~~~~~~~~~~
lib/libc/tests/net/inet_net_test.cc: In member function 'virtual void {anonymous}::atfu_tc_inet_net_inet6::body() const':
lib/libc/tests/net/inet_net_test.cc:205:17: error: comparison of integer expressions of different signedness: 'int' and 'const unsigned int' [-Werror=sign-compare]
  205 |                 ATF_REQUIRE_EQ(bits, addr.bits);
      |                 ^~~~~~~~~~~~~~

Fixes:		8f4a0d2f7b96 ("libc: Import OpenBSD's inet_net_{ntop,pton}")
(cherry picked from commit e1aeb58cbbc3839db93ec38ce491b7b9383d5649)
</pre>
</div>
</content>
</entry>
<entry>
<title>libc: Import OpenBSD's inet_net_{ntop,pton}</title>
<updated>2025-10-23T00:36:51+00:00</updated>
<author>
<name>Lexi Winter</name>
<email>ivy@FreeBSD.org</email>
</author>
<published>2025-10-18T14:18:40+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=ff7a10d0e1d1498724c6a1e02a70926944a71590'/>
<id>ff7a10d0e1d1498724c6a1e02a70926944a71590</id>
<content type='text'>
Our versions of these functions (originally taken from BIND) simply
don't work correctly for AF_INET6.  These were removed from BIND itself
quite a while ago, but OpenBSD has made several fixes in the mean time,
so import their code.

Add tests for both functions.

PR:		289198
Reported by:	Nico Sonack &lt;nsonack@herrhotzenplotz.de&gt;
MFC after:	1 week
Reviewed by:	des
Obtained from:	OpenBSD (lib/libc/net)
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52629

(cherry picked from commit 8f4a0d2f7b96099001dbc51e06114df1a0e6d291)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Our versions of these functions (originally taken from BIND) simply
don't work correctly for AF_INET6.  These were removed from BIND itself
quite a while ago, but OpenBSD has made several fixes in the mean time,
so import their code.

Add tests for both functions.

PR:		289198
Reported by:	Nico Sonack &lt;nsonack@herrhotzenplotz.de&gt;
MFC after:	1 week
Reviewed by:	des
Obtained from:	OpenBSD (lib/libc/net)
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52629

(cherry picked from commit 8f4a0d2f7b96099001dbc51e06114df1a0e6d291)
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "Mark several getaddrinfo tests as XFAIL"</title>
<updated>2025-05-28T22:18:51+00:00</updated>
<author>
<name>Enji Cooper</name>
<email>ngie@FreeBSD.org</email>
</author>
<published>2025-05-28T22:18:51+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=19fb56b192442552f2f57ef35de57f55b8d050ca'/>
<id>19fb56b192442552f2f57ef35de57f55b8d050ca</id>
<content type='text'>
This change was unreviewed and should not have been committed to :main.

This reverts commit 9b37d84c87e69dabc69d818aa4d2fea718bd8b74.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This change was unreviewed and should not have been committed to :main.

This reverts commit 9b37d84c87e69dabc69d818aa4d2fea718bd8b74.
</pre>
</div>
</content>
</entry>
<entry>
<title>Mark several getaddrinfo tests as XFAIL</title>
<updated>2025-05-28T22:15:08+00:00</updated>
<author>
<name>Enji Cooper</name>
<email>ngie@FreeBSD.org</email>
</author>
<published>2025-04-01T04:51:50+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=9b37d84c87e69dabc69d818aa4d2fea718bd8b74'/>
<id>9b37d84c87e69dabc69d818aa4d2fea718bd8b74</id>
<content type='text'>
These tests were recently enabled on main and have failed consistently
since they were enabled.

- lib.libc.net.getaddrinfo.getaddrinfo.basic
- lib.libc.net.getaddrinfo.getaddrinfo.nofamily
- lib.libc.net.getaddrinfo.getaddrinfo_test.basic
- lib.libc.net.getaddrinfo.getaddrinfo_test.empty_servname
- lib.libc.net.getaddrinfo.getaddrinfo_test.sock_raw

Mark them as expected failures so they no longer count as failures in
Jenkins CI.

PR:		285826
MFC with:	5313457780, 0b773a94ab
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
These tests were recently enabled on main and have failed consistently
since they were enabled.

- lib.libc.net.getaddrinfo.getaddrinfo.basic
- lib.libc.net.getaddrinfo.getaddrinfo.nofamily
- lib.libc.net.getaddrinfo.getaddrinfo_test.basic
- lib.libc.net.getaddrinfo.getaddrinfo_test.empty_servname
- lib.libc.net.getaddrinfo.getaddrinfo_test.sock_raw

Mark them as expected failures so they no longer count as failures in
Jenkins CI.

PR:		285826
MFC with:	5313457780, 0b773a94ab
</pre>
</div>
</content>
</entry>
<entry>
<title>link_addr: be more strict about address formats</title>
<updated>2025-05-15T00:02:52+00:00</updated>
<author>
<name>Lexi Winter</name>
<email>ivy@FreeBSD.org</email>
</author>
<published>2025-05-14T22:02:59+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=a1215090416b8afb346fb2ff5b38f25ba0134a3a'/>
<id>a1215090416b8afb346fb2ff5b38f25ba0134a3a</id>
<content type='text'>
instead of accepting any character as a delimiter, only accept ':', '.'
and '-', and only permit a single delimiter in an address.

this prevents accepting bizarre addresses like:

	ifconfig epair2a link 10.1.2.200/28

... which is particularly problematic on an INET6-only system, in which
case ifconfig defaults to the 'link' family, meaning that:

	ifconfig epair2a 10.1.2.200/28

... changes the Ethernet address of the interface.

bump __FreeBSD_version so link_addr() consumers can detect the change.

Reviewed by:	kp, des
Approved by:	des (mentor)
Differential Revision:	https://reviews.freebsd.org/D49936
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
instead of accepting any character as a delimiter, only accept ':', '.'
and '-', and only permit a single delimiter in an address.

this prevents accepting bizarre addresses like:

	ifconfig epair2a link 10.1.2.200/28

... which is particularly problematic on an INET6-only system, in which
case ifconfig defaults to the 'link' family, meaning that:

	ifconfig epair2a 10.1.2.200/28

... changes the Ethernet address of the interface.

bump __FreeBSD_version so link_addr() consumers can detect the change.

Reviewed by:	kp, des
Approved by:	des (mentor)
Differential Revision:	https://reviews.freebsd.org/D49936
</pre>
</div>
</content>
</entry>
<entry>
<title>libc: add link_ntoa_r()</title>
<updated>2025-05-07T09:52:04+00:00</updated>
<author>
<name>Lexi Winter</name>
<email>ivy@FreeBSD.org</email>
</author>
<published>2025-05-07T09:34:08+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=da509c29089ab169b667ebdf82aa903987ba9c6d'/>
<id>da509c29089ab169b667ebdf82aa903987ba9c6d</id>
<content type='text'>
this is a re-entrant version of link_ntoa.  use an in-out parameter for
the buffer size, so the user requires at most two calls to determine the
needed size.

reimplement link_ntoa using link_ntoa_r with a static buffer.

Reviewed by:	des
Approved by:	des (mentor)
Differential Revision:	https://reviews.freebsd.org/D50202
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
this is a re-entrant version of link_ntoa.  use an in-out parameter for
the buffer size, so the user requires at most two calls to determine the
needed size.

reimplement link_ntoa using link_ntoa_r with a static buffer.

Reviewed by:	des
Approved by:	des (mentor)
Differential Revision:	https://reviews.freebsd.org/D50202
</pre>
</div>
</content>
</entry>
<entry>
<title>link_addr_test: use &lt;cstddef&gt;, not &lt;sys/stddef.h&gt;</title>
<updated>2025-05-06T14:49:11+00:00</updated>
<author>
<name>Lexi Winter</name>
<email>ivy@FreeBSD.org</email>
</author>
<published>2025-05-06T14:48:17+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=bbffdfef3bf04b2f89027cb20e2019fdc74c4b1b'/>
<id>bbffdfef3bf04b2f89027cb20e2019fdc74c4b1b</id>
<content type='text'>
&lt;cstddef&gt; is the correct header; this fixes the GCC build.

while here, sort the headers.

Fixes:	757e973fb211 ("libc tests: add tests for link_addr(3) and link_ntoa(3)")
Reviewed by:	des
Approved by:	des (mentor)
Differential Revision:	https://reviews.freebsd.org/D50189
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
&lt;cstddef&gt; is the correct header; this fixes the GCC build.

while here, sort the headers.

Fixes:	757e973fb211 ("libc tests: add tests for link_addr(3) and link_ntoa(3)")
Reviewed by:	des
Approved by:	des (mentor)
Differential Revision:	https://reviews.freebsd.org/D50189
</pre>
</div>
</content>
</entry>
<entry>
<title>libc tests: add tests for link_addr(3) and link_ntoa(3)</title>
<updated>2025-05-05T18:20:02+00:00</updated>
<author>
<name>Lexi Winter</name>
<email>ivy@FreeBSD.org</email>
</author>
<published>2025-05-05T17:25:03+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=757e973fb2112ea442aa8990d991f406d407b6f7'/>
<id>757e973fb2112ea442aa8990d991f406d407b6f7</id>
<content type='text'>
for now, since link_addr() has no way to indicate an error, these are
only positive tests which check the outcome of valid inputs.

Reviewed by:	ngie, des, adrian
Approved by:	des (mentor)
Differential Revision:	https://reviews.freebsd.org/D50062
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
for now, since link_addr() has no way to indicate an error, these are
only positive tests which check the outcome of valid inputs.

Reviewed by:	ngie, des, adrian
Approved by:	des (mentor)
Differential Revision:	https://reviews.freebsd.org/D50062
</pre>
</div>
</content>
</entry>
<entry>
<title>libc/tests: getaddrinfo_test: use VNET jails for testing</title>
<updated>2025-04-08T16:54:58+00:00</updated>
<author>
<name>K Rin</name>
<email>rin@sandb0x.tw</email>
</author>
<published>2025-04-06T05:04:43+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=423a21a5b65cc7b7809d29c4d40a8ca4a224a3f5'/>
<id>423a21a5b65cc7b7809d29c4d40a8ca4a224a3f5</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
