Question about the "connected" UDP sockets

Oleg Moskalenko mom040267 at gmail.com
Tue Dec 31 04:03:13 UTC 2013


Thanks a lot !
Oleg

Sent from my iPhone

On Dec 30, 2013, at 7:38 PM, Sepherosa Ziehau <sepherosa at gmail.com> wrote:

> On Fri, Dec 27, 2013 at 1:49 AM, Oleg Moskalenko <mom040267 at gmail.com> wrote:
>> Hi
>> 
>> I cannot find the information about the implementation details of the
>> "connected" UDP sockets in FreeBSD. I know that in older Linux kernels all
> 
> 
> You could start from sys/netinet/udp_usrreq.c:udp_connect().
> 
> 
>> UDP sockets are stored in a hash table - and the remote IP:port are not
>> used for the hash calculation, so the performance is awful when you have
>> thousands "connected" UDP sockets on the same local IP:port address. So a
>> UDP packet incoming to the local address has to go through the long list of
>> sockets to find the proper destination.
>> 
>> How it is done in the FreeBSD ? Are the UDP "connected" sockets using a
>> hash table with key based upon 5-tuple (protocol, remote-ip, remote-port,
>> local-ip, local-port} ?
> 
> 
> UDP uses its own hash table for "connected" sockets (inpcb actually).
> The "connected" inpcbs are hashed using lport/fport/laddr/faddr
> (4-tuple).
> 
> Best Regards,
> sephe


More information about the freebsd-net mailing list