[PATCH 1/2] ws2_32/socket: Do not change the socket address to INADDR_ANY

Michelle van Langen michelvanlangen at gmail.com
Sun Apr 7 14:28:11 CDT 2019


It turns out that I have overlooked something. It turns out that the 
file descriptor is the same for both binds, which is obviously never 
going to work. I am now going to figure out how that happens.


Best,

Michelle

On 07/04/2019 19:44, Erich E. Hoover wrote:
> On Sat, Apr 6, 2019 at 5:09 PM Michelle van Langen
> <michelvanlangen at gmail.com> wrote:
>> The application I am trying to work iterates over all available network
>> addresses and attempts to bind to a port on said address. The line I
>> changed rewrites the address to INADDR_ANY and therefore results in a
>> double bind. Because of this behaviour the applications never expects to
>> have to use SO_REUSEADDR.
> The way Wine does this (it uses SO_REUSEADDR automatically) both binds
> should succeed just fine.
>
>> I've read deeper into the code of socket.c and found that the function
>> interface_bind actually sets SO_REUSEADDR on the socket. While
>> setsockopt call is successful, the SO_REUSEADDR is never actually set
>> when the address of the socket is INADDR_ANY.
> Yes, I thought that maybe you had another (non-Wine) application
> conflicting with the behavior of the Wine application because the
> non-Wine app was missing SO_REUSEADDR.
>
>> I've tried some small modifications to socket.c to mitigate this, but I
>> haven't yet found an elegant solution. And of course, breaking the
>> ability to receive broadcast packets is a no-no.
> What exactly is the problem the application is encountering?  Is it
> possibly checking the bind in some way that's not getsockname (that
> case is already covered)?
>
> Best,
> Erich



More information about the wine-devel mailing list