This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR ada/89583, GNAT.Sockets.Bind_Socket fails with IPv4 address
- From: Arnaud Charlet <charlet at adacore dot com>
- To: Simon Wright <simon at pushface dot org>
- Cc: gcc-patches at gcc dot gnu dot org, derodat at adacore dot com, anisimko at adacore dot com
- Date: Tue, 5 Mar 2019 21:38:16 +0100
- Subject: Re: [PATCH] PR ada/89583, GNAT.Sockets.Bind_Socket fails with IPv4 address
- References: <3A0A3A1E-1AAD-44DC-A4CF-79788CB41642@pushface.org>
Simon,
Thanks for the patch.
We already have a fix pending for that in our tree that we will merge.
Arno
> On 4 Mar 2019, at 20: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).
>
> This patch provides the required length explicitly from the socket's family.
>
> Tested by rebuilding the compiler with --disable-bootstrap and re-running the reproducer.
>
> gcc/ada/Changelog:
>
> 2019-03-04 Simon Wright <simon@pushface.org>
>
> PR ada/89583
> * libgnat/g-socket.adb (Bind_Socket): Calculate Len (the significant length of
> the Sockaddr) using the Family of the Address parameter.
>
>
> <pr89583.diff>