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

2019-03-22 Thread Pierre-Marie de Rodat

On 3/20/19 6:54 PM, Simon Wright wrote:

Thanks, Pierre-Marie: it'd be a shame if 9.1 couldn't handle IPv4.


Yes indeed :-) The change is ready to go: may I commit your testcase as 
well?


--
Pierre-Marie de Rodat


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

2019-03-20 Thread Simon Wright
Thanks, Pierre-Marie: it'd be a shame if 9.1 couldn't handle IPv4.

--S

> On 20 Mar 2019, at 13:31, Pierre-Marie de Rodat  wrote:
> 
> Hello Simon,
> 
> On 3/19/19 5:02 PM, Simon Wright wrote:
>> Ping?
> 
> Sorry for the delay! Thank you for the notice; I’ll try to get our fix ported 
> as soon as possible (hopefully before the end of the week).
> 
> Cheers,
> 
> -- 
> Pierre-Marie de Rodat



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

2019-03-20 Thread Pierre-Marie de Rodat

Hello Simon,

On 3/19/19 5:02 PM, Simon Wright wrote:

Ping?


Sorry for the delay! Thank you for the notice; I’ll try to get our fix 
ported as soon as possible (hopefully before the end of the week).


Cheers,

--
Pierre-Marie de Rodat


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

2019-03-19 Thread Simon Wright
Ping?

> On 5 Mar 2019, at 20:43, Simon Wright  wrote:
> 
> Arno,
> 
> OK.
> 
> --S
> 
>> On 5 Mar 2019, at 20:38, Arnaud Charlet  wrote:
>> 
>> 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  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 
>>> 
>>>  PR ada/89583
>>>  * libgnat/g-socket.adb (Bind_Socket): Calculate Len (the significant 
>>> length of
>>>the Sockaddr) using the Family of the Address parameter.
>>> 
>>> 
>>> 
>> 
> 



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

2019-03-05 Thread Simon Wright
Arno,

OK.

--S

> On 5 Mar 2019, at 20:38, Arnaud Charlet  wrote:
> 
> 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  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 
>> 
>>   PR ada/89583
>>   * libgnat/g-socket.adb (Bind_Socket): Calculate Len (the significant 
>> length of
>> the Sockaddr) using the Family of the Address parameter.
>> 
>> 
>> 
> 



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

2019-03-05 Thread Arnaud Charlet
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  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 
> 
>PR ada/89583
>* libgnat/g-socket.adb (Bind_Socket): Calculate Len (the significant 
> length of
>  the Sockaddr) using the Family of the Address parameter.
> 
> 
> 



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

2019-03-05 Thread Simon Wright
On 4 Mar 2019, at 19:48, Simon Wright  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 passes2961
# of expected failures  23
# of unsupported tests  10

gcc/ada/Changelog:

2019-03-05 Simon Wright 

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 

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



pr89583.diff
Description: Binary data