netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: dhcp client packet sniffing...
Date: Thu, 08 Apr 2010 14:49:49 +0200	[thread overview]
Message-ID: <4BBDD0ED.1010203@trash.net> (raw)
In-Reply-To: <20100408123025.GA23762@gondor.apana.org.au>

Herbert Xu wrote:
> On Thu, Apr 08, 2010 at 05:11:44AM -0700, David Miller wrote:
>> We have the socket pointer etc. already in dev_queue_xmit_nit(), so we
>> can easily do it.
> 
> It doesn't look trivial to me since AF_PACKET fiddles with packet
> headers before running the filter...

Yes, that looks difficult. What might work is to pass the skb->data
offsets resulting from those modifications to sk_run_filter to
adjust the postition when loading data from the packet. That would
allow to run the filter on the original packet before cloning it.

Regarding your idea of only receiving incoming packets, userspace could
use the SKF_AD_PKTTYPE filter with PACKET_HOST. During filter attachment
and checks, we could mark the socket as only interested in incoming or
outgoing packets.

This would require userspace changes of course, but we should be able
to avoid passing outgoing packets to af_packet with very low overhead.

  reply	other threads:[~2010-04-08 12:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-08 10:50 dhcp client packet sniffing David Miller
2010-04-08 10:59 ` Neil Horman
2010-04-08 11:01   ` David Miller
2010-04-08 11:47 ` Herbert Xu
2010-04-08 12:11   ` David Miller
2010-04-08 12:30     ` Herbert Xu
2010-04-08 12:49       ` Patrick McHardy [this message]
2010-04-08 13:12         ` Herbert Xu
2010-04-08 13:23           ` Patrick McHardy
2010-04-08 14:27   ` Herbert Xu
2010-04-08 14:37     ` Maxime Bizon
2010-04-08 15:07       ` Herbert Xu

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=4BBDD0ED.1010203@trash.net \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=netdev@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;
as well as URLs for NNTP newsgroup(s).