Subject: Re: [PATCH] net: Fix IP_UNICAST_IF option behavior for connected sockets

From: David Ahern <[email-masked]>
Date: Wed, 6 Jul 2022 09:13:51 -0600

On 7/5/22 9:50 AM, Richard Gobert wrote:
> On Tue, Jun 28, 2022 at 03:08:48PM +0200, Paolo Abeni wrote:
>> This also changes a long-established behavior for such socket option.
>> It can break existing application assuming connect() is not affected by
>> IP_UNICAST_IF. I'm unsure we can accept it.
> 
> The IP_UNICAST_IF option was initially introduced for better compatibility
> with the matching Windows socket-option. Its goal was better support for
> wine applications.
> This patch improves the compatibility even further since Windows behaves
> this way for connect()ed sockets.
> 
> Also, I have not been able to find any examples of Linux applications
> that use IP_UNICAST_IF with connect(). It would be quite confusing to use
> this sockopt and expect that it would not affect your socket.
> I think that unless someone finds an example of such a use case, then it
> is better to accept this patch to improve compatibility for applications
> that run with wine.
> 
> What are your thoughts on this?
> 

I can't imagine how a 'connected' socket would propelry work if connect
path does not consider oif and then per message does. i.e, i think the
patch has some risk but is the right thing to do.