This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR ada/89583, GNAT.Sockets.Bind_Socket fails with IPv4 address


On 4 Mar 2019, at 19:48, Simon Wright <simon@pushface.org> wrote:

> With GCC9, GNAT.Sockets includes support for IPv6. Sockaddr is an Unchecked_Union, which now includes IPv6 fields, bringing the total possible size to 28 bytes. The code in Bind_Socket currently calculates the length of the struct sockaddr to be passed to bind(2) as this size, which (at any rate on Darwin x86_64) results in failure (EINVAL).

My previous version of this patch calculated the required length explicitly, rather than re-using the same calculation already made in GNAT.Sockets.Thin_Common.Lengths.

Also added new testcase.

Tested by rebuilding gnatlib (make -C gcc gnatlib) and running make check-gnat:

		=== gnat Summary ===

# of expected passes		2961
# of expected failures		23
# of unsupported tests		10

gcc/ada/Changelog:

	2019-03-05 Simon Wright <simon@pushface.org>

	PR ada/89583
	* libgnat/g-socket.adb (Bind_Socket): Calculate Len (the significant
          length of the Sockaddr) using GNAT.Sockets.Thin_Common.Lengths.

gcc/testsuite/Changelog:

	2019-03-05 Simon Wright <simon@pushface.org>

	PR ada/89583
	* gnat.dg/socket2.adb: New.

Attachment: pr89583.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]