Subject: Re: kern/29750: send/sendto/sendmsg don't block when no buffer space is available
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Emmanuel Dreyfus <manu@netbsd.org>
List: netbsd-bugs
Date: 03/22/2005 23:34:01
The following reply was made to PR kern/29750; it has been noted by GNATS.

From: manu@netbsd.org (Emmanuel Dreyfus)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/29750: send/sendto/sendmsg don't block when no buffer space is available
Date: Wed, 23 Mar 2005 00:33:22 +0100

 In-depth analysis of the problem:
 
 sosend() checks that there is enough buffer space and sleep awaiting for
 buffer space if it gets scarce. That code works: the problem is not
 caused because buffer space get depleted.
 
 If there is buffer space, sosend() calls lower layer output functions.
 Here udp_output(), then ip_output(), and ether_output().
 
 ether_output() uses IFQ_ENQUEUE() to queue the packet. That macro checks
 that the queue is not full through IF_QFULL(), and return ENOBUFS if the
 interface queue is full. This is what happens here. 
 
 ENOBUFS is returned up to send() and causes the problem. 
 
 
 Other systems:
 FreeBSD 4.11-RELEASE i386 also fails the test
 Linux passes the test
 
 -- 
 Emmanuel Dreyfus
 Le cahier de l'admin BSD 2eme ed. est dans toutes les bonnes librairies
 http://www.eyrolles.com/Informatique/Livre/9782212114638/livre-bsd.php
 manu@netbsd.org