Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Feb 2000 14:07:14 -0800 (PST)
From:      Archie Cobbs <archie@whistle.com>
To:        dwmalone@maths.tcd.ie (David Malone)
Cc:        archie@whistle.com (Archie Cobbs), myevmenkin@att.com, freebsd-hackers@FreeBSD.ORG, freebsd-current@FreeBSD.ORG
Subject:   Re: raw socket, bpf, netgraph, etc
Message-ID:  <200002142207.OAA66836@bubba.whistle.com>
In-Reply-To: <20000214215059.A34982@salmon.maths.tcd.ie> from David Malone at "Feb 14, 2000 09:50:59 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
David Malone writes:
> > Compile your kernel with options NETGRAPH and then each Ethernet
> > interface is a netgraph node. Take control of it by connecting
> > to the "divert" hook.
> 
> I was trying to figure out if it is possible to route stuff out on
> a particular interface based on source address using netgraph. At
> the moment we have an NFS server which pretends to be two machines
> on the same subnet. To get this to work we're using a small hack
> in the ipfw divert code. I looked at the netgraph man pages and
> reckoned it might be possible to do somthing like:
> 
>            fxp0
>           /
> ng0 -> bpf 
>           \
>            fxp1
> 
> then ifconfig ng0 up with both IP addresses and use the bpf to
> determine which ethernet card to transmit it on. However, I don't
> think this will work. First 'cos arp stuff will probably be broken
> and second because ng0 is a point to point device and won't correctly
> encapsulate packets for ethernet.

You're right that that won't work .. you'd be sending raw IP
frames on the wire without 14 byte Ethernet headers.

> Am I correct in thinking that this isn't currently possible with the
> net graph nodes currently available?

I think so.. you would have to write a new new node type to add/strip
the headers at least.

That brings up a good point though..  the ng_iface(8) node type
should allow it to configured as a non-point-to-point interface.

Ah.. just looked at if_tun.c which does this.. it's trivial.
I'll probably check something in after 4.0 then.

But even with that change you'd need an add/strip headers thing.
In fact, that's another node type I want to write.. just a simple
thing that adds & strips headers off packets... or this could be
folded into the BPF node type (a BPF program returns a length,
after all).

-Archie

___________________________________________________________________________
Archie Cobbs   *   Whistle Communications, Inc.  *   http://www.whistle.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200002142207.OAA66836>