mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "David Schwartz" <davids@webmaster.com>
To: "Linux Kernel" <linux-kernel@vger.kernel.org>
Cc: "Hasso Tepper" <hasso@estpak.ee>
Subject: RE: raw sockets and blocking
Date: Tue, 17 Feb 2004 21:37:37 -0800	[thread overview]
Message-ID: <MDEHLPKNGKAHNMBLJOLKIEMGKHAA.davids@webmaster.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0402180106150.1071@fogarty.jakma.org>


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

	This is rational behavior.

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

	I'm not sure I understand what the problem is. If the network cable is
disconnected, you couldn't usefully send anything if the socket was ready
anyway.

> Is this proper behaviour?

	Certainly.

> 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 you want to discard the packet, you do it. Why should the kernel accept
a packet just to discard it if it's smart enough to not accept it?

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

	It is proper. Being always ready and dropping the packet is proper as well
but inferior.

	If you want the behavior you say you expect, consider the packet always
ready and if it's really not ready, drop the packet on the floor yourself.
This will get you the (inferior) behavior you want. How would it help you to
find the packet ready and send data the system will just drop on the floor?
Won't you lose your adjacencies anyway -- they'll time out either way).

	DS



  reply	other threads:[~2004-02-18  5:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-18  1:33 Paul Jakma
2004-02-18  5:37 ` David Schwartz [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MDEHLPKNGKAHNMBLJOLKIEMGKHAA.davids@webmaster.com \
    --to=davids@webmaster.com \
    --cc=hasso@estpak.ee \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®