mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Stuart Macdonald" <stuart@ken-caryl.net>
To: "Henrik Nordstrom" <hno@marasystems.com>,
	"cranium2003" <cranium2003@yahoo.com>
Cc: kernelnewbies@nl.linux.org, netfilter-devel@lists.netfilter.org,
	netdev@oss.sgi.com, linux-kernel@vger.kernel.org
Subject: RE: netfilter query
Date: Mon, 22 Nov 2004 18:47:17 -0700	[thread overview]
Message-ID: <DHEOJAHAGKDLCDOHPMIECEFNCCAA.stuart@ken-caryl.net> (raw)
In-Reply-To: <Pine.LNX.4.61.0411221245470.20973@filer.marasystems.com>

Just a parallel thought here,

A different approach is to implement the Netfilter Bridge hooks and run a
box as a bridge. This requires a kernel parameter for Bridge to be enabled
when the kernel is built and then the brctl utility to setup the bridge. In
this manner, your bridge netfilter hooks always receive packets starting at
the MAC headers. You can parse from there to derive subsequent protocols:
IP, IPX, LLC, SNAP, NETBEUI...

Stuart



-----Original Message-----
From: kernelnewbies-bounce@nl.linux.org
[mailto:kernelnewbies-bounce@nl.linux.org]On Behalf Of Henrik Nordstrom
Sent: Monday, November 22, 2004 5:03 AM
To: cranium2003
Cc: kernelnewbies@nl.linux.org; netdev@oss.sgi.com;
netfilter-devel@lists.netfilter.org; linux-kernel@vger.kernel.org
Subject: Re: netfilter query


On Sun, 21 Nov 2004, cranium2003 wrote:

> Also,which headers are added when packet
> reaches to netfilter hook NF_IP_LOCAL_OUT? I found
> TCP/UDP/ICMP ,IP. Is that correct?

Yes.

netfilter is running at the IP layer and only reliably have access to IP
headers and up. Lower level headers such as Ethernet MAC header is
transport dependent and not always available, and certainly not available
in NF_IP_LOCAL_OUT as it is not yet known the packet will be sent to an
Ethernet.

In some netfilter hooks it is possible to rewind back to the Ethernet MAC
header but one must be careful to verify that it really is an Ethernet
packet one is looking at when doing this. Unfortunately there is no
perfect solution how to detect this.. For an example of how one may try to
look at the Ethernet MAC header see ipt_mac.c. But be warned that it is
possible for non-Ethernet frames to pass the simple checks done there..

Regards
Henrik

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



  reply	other threads:[~2004-11-23  1:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-21 15:33 cranium2003
2004-11-22 12:03 ` Henrik Nordstrom
2004-11-23  1:47   ` Stuart Macdonald [this message]
2004-11-23  6:00     ` cranium2003

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=DHEOJAHAGKDLCDOHPMIECEFNCCAA.stuart@ken-caryl.net \
    --to=stuart@ken-caryl.net \
    --cc=cranium2003@yahoo.com \
    --cc=hno@marasystems.com \
    --cc=kernelnewbies@nl.linux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@oss.sgi.com \
    --cc=netfilter-devel@lists.netfilter.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®