tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Patch: accept filters for NetBSD

On Tue, Jan 29, 2008 at 06:32:31PM +0100, Martin Husemann wrote:
> I wonder if this could be simplified to:
>  (1) a socketopt to turn on/off "dataready" behaviour
>  (2) a socketopt to set a "banner" string, output to each new connection
>      by the kernel on accept, followed by waiting for an input packet
>      if dataready is turned on
> Incompatible with freebsd, slighly less versatile. Simple & elegant - or
> evil hack?

You may very well want to make some connections go away without ever
bothering userspace.  That almost always requires looking at the data.
Consider SMTP -- these days you might want to hang up the phone on
someone who doesn't HELO (or EHLO) you.  Or "HTTP" peers who don't send
you a GET or POST.

Or consider a protocol that is record-oriented but runs over TCP.  The
records may be large, and may arrive in multiple TCP packets (you would
not believe the kind of pathological peer behavior I've seen in this
regard, including an HTTP peer who sent exactly one byte per packet).
Just waiting for one packet won't do: you have to peek into
the first one to get the record length, and then bother userspace after
you've got the whole thing.

  Thor Lancelot Simon                               

  "The inconsistency is startling, though admittedly, if consistency is to
   be abandoned or transcended, there is no problem."         - Noam Chomsky

Home | Main Index | Thread Index | Old Index