[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.01.1208211053130.1100@frira.zrqbmnf.qr>
Date: Tue, 21 Aug 2012 11:09:55 +0200 (CEST)
From: Jan Engelhardt <jengelh@...i.de>
To: Eric Dumazet <eric.dumazet@...il.com>
cc: "Tobias S. Josefowitz" <t.josefowitz@...il.com>,
netdev@...r.kernel.org
Subject: Re: binding UDP port 0 with SO_REUSEADDR
On Thursday 2012-08-02 18:57, Eric Dumazet wrote:
>>SO_REUSEADDR
>> Indicates that the rules used in validating addresses supplied
>> in a bind(2) call should allow reuse of local addresses. For
>> AF_INET sockets this means that a socket may bind, except when
>> there is an active listening socket bound to the address. When
>> the listening socket is bound to INADDR_ANY with a specific port
>> then it is not possible to bind to this port for any local
>> address. Argument is an integer boolean flag.
>>
>> I think the surprise-factor of the bind-0-behaviour even increased for
>> me. Is there a specific reason for handing out used ports when binding
>> port 0 with REUSEADDR?
>
>There is no concept of listening sockets for UDP.
>This documentation applies for TCP, and makes no sense for UDP.
>There is no value using 'port 0' and REUSEADDR on UDP, really.
Setting REUSEADDR on one UDP socket currently has the added effect
that bind(2) on another UDP socket for the same tuple will never
complain with -EADDRINUSE.
This behavior - willingly or not - is used in practice by socat(1)'s
udp-listen mode.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists