Subject: Re: kern/29750: send/sendto/sendmsg don't block when no buffer space is available
To: None <gnats-bugs@netbsd.org>
From: Jason Thorpe <thorpej@shagadelic.org>
List: netbsd-bugs
Date: 03/22/2005 15:42:19
On Mar 22, 2005, at 3:34 PM, Emmanuel Dreyfus wrote:

>  If there is buffer space, sosend() calls lower layer output  
> functions.
>  Here udp_output(), then ip_output(), and ether_output().

By this time, the data is properly enqueued in the socket buffer, right?

>  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.

Yuck.  Arguably, what should happen is that this ENOBUFS should get  
translated to 0 (no error) in sosend().  However, we still need some  
way to kick the socket into calling udp_output() again once ifqueue  
space becomes available.

Or we could just say "screw it!" and get rid of ifqeueue max lengths  
all together.

-- thorpej