public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* raw sockets and blocking
@ 2004-02-18  1:33 Paul Jakma
  2004-02-18  5:37 ` David Schwartz
  0 siblings, 1 reply; 12+ messages in thread
From: Paul Jakma @ 2004-02-18  1:33 UTC (permalink / raw)
  To: Linux Kernel; +Cc: Hasso Tepper

Hi,

I'm curious, is it good for raw sockets to block for writes because a 
cable of one interface has been pulled? 

We're seeing a problem with ospfd (www.zebra.org/www.quagga.net) 
which uses a single raw, AF_INET/OSPF socket and manages it's own IP 
headers, to send/receive OSPF packets to/from a number of interfaces.

The problem we see is that:

- a cable is pulled from an interface
- the application tests the file descriptor to see if it ready for 
  writing, and finds it is.
- the application constructs a packet to send out that interface
  and sends it with sendmsg(), no error is posted.
- the file descriptor never becomes available for writing again
- hence, all OSPF adjacencies are lost, because we can no longer 
write out packets to the file descriptor.

we havnt yet tested if it becomes writeable again if we put cable
back in, however if we detect absence of IFF_RUNNING and hence
manually avoid constructing packets to be sent via link-down
interfaces, we avoid this problem. However, this leaves us with a
race.

Is this proper behaviour? I'm guessing the driver or network layer is 
blocking the socket because it is waiting for the link to come back, 
however would it not be better to discard the packet, especially a 
raw packet?

(if it is "proper" behaviour that's fine, we can work with that, we 
were just surprised sendmsg() is trying to be /that/ reliable :) .)

regards,
-- 
Paul Jakma	paul@clubi.ie	paul@jakma.org	Key ID: 64A2FF6A
	warning: do not ever send email to spam@dishone.st
Fortune:
How much net work could a network work, if a network could net work?

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2004-03-22  7:14 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-18  1:33 raw sockets and blocking Paul Jakma
2004-02-18  5:37 ` David Schwartz
2004-02-18  6:42   ` Hasso Tepper
2004-02-18 11:42     ` David Schwartz
2004-02-19  6:28       ` Paul Jakma
2004-02-19  7:53         ` Jamie Lokier
2004-02-19  8:34           ` Paul Jakma
2004-02-19 12:40             ` Hasso Tepper
2004-02-19 12:54               ` Paul Jakma
2004-03-22  7:14                 ` Hasso Tepper
2004-02-18  8:43   ` Hasso Tepper
2004-02-19  6:20   ` Paul Jakma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox