TCP listenall

Matus Harvan mharvan at inf.ethz.ch
Wed Oct 31 14:51:39 PDT 2007


On Sat, Oct 27, 2007 at 04:55:15AM +0100, Bruce M. Simpson wrote:
> Matus Harvan wrote:
>> Hi,
>>   I was wondering if I could get some feedback about the patch and
>> whether others think it could be committed. A slightly update version
>> of the patch is at the end of this email.
>>   
> 
> I have mixed feelings about this patch.
> 
> The idea of a TCP socket which magically loses its TCP semantics is 
> unattractive -- SOCK_RAW is traditionally where we've put things which 
> don't fit the rest of the BSD socket API -- however in this case I don't 
> see we have much choice, if what we desire is the ability for a client to 
> establish a connection to any ephemeral port with the mtund returning from 
> an accept() as usual.
> 
> We are bending the rules of the usual TCP semantics here, but that is OK 
> because if we directed tlistenall to be a raw IP socket, we'd need a way to 
> say to TCP, 'I'd like to create a socket which is already in SYN_RCVD state 
> with a SYN whose mbuf has now gone to lunch', assuming we wish to create 
> TCP streams business as usual.

Exactly.

[...]
> How will inp_tlistenall appear in netstat output? Perhaps assigning a 
> LISTEN_ALL state would be helpful for an administrator to clearly see that 
> a listenall socket is active? Perhaps checking for TCP_LISTENALL set on an 
> unbound socket in tcp_usr_listen() when listen() is called is the way to go 
> instead of, or in addition to, using inp_tlistenall?

I think there can be only one LISTEN_ALL socket. Hence, inp_tlistenall
should be ok. Furthermore, having inp_tlistenall allows me to
immediately know which is the listenall socket without having to
search through all the sockets.

Currently, the user has to setsockopt() TCP_LISTENALL on the socket
after calling listen(). One disadvanatage is that the user has to
select a port when calling listen(). However, it minimizes the changes
needed to get the listenall funcitonality. Are you suggesting that the
setsockopt() could be called first and the listen() would follow?

With the state for netstat, wouldn't this require adding the
LISTEN_ALL state to the TCPS_* states in sys/netinet/tcp_fsm.h:45? If
yes, then this might require more modifications.

Matus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-net/attachments/20071031/eee845fa/attachment.pgp


More information about the freebsd-net mailing list