Date: Tue, 27 Feb 2001 05:09:52 -0800 From: Julian Elischer <julian@elischer.org> To: Satyajeet Seth <sseth@sasken.com> Cc: net@freebsd.org Subject: Re: Problem in configuring netgraph Message-ID: <3A9BA720.3AFB0A9@elischer.org> References: <Pine.GSO.4.30.0102270141460.28244-100000@suns3.sasi.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Satyajeet Seth wrote:
>
> Hi
>
> I tried to use ng_ether and ng_bpf as follows:
>
> fxp0(lower) --- (bhook)[bpf](nomatch)(hook1)----(upper)fxp0
> [ ]( match )(hook2)----not connected
>
> $ ngctl mkpeer fxp0: bpf divert bhook
>
> $ ngctl name fxp0:divert bpf0
>
> $ ngctl
> + msg bpf0: setprogram { thisHook="bhook" ifMatch="hook2"
> ifNotMatch="hook1" bpf_prog_len=1 bpf_prog=[ { code=6 } ] }
>
> Now 'nghook -a bpf0: hook1' shows output while 'nghook -a bpf0: hook2'
> doesn't.
>
> $ ngctl connect fxp0: bpf0: upper hook1
>
> 1. After this I am unable to ping any of the lan machines.
> Could you suggest what I could be doing wrong?
>
> 2. I am writing a BPF program(for filtering packets destined to particular
> MAC addresses) by converting instructions like:
> BPF_STMT(BPF_LD+BPF_H+BPF_ABS,12), BPF_STMT(BPF_RET+BPF_K,0)
> into:
> [ {code=28 jt=0 jf=0 k=0x0c} {code=6 jt=0 jf=0 k=0}]
> After seeing the definitions of BPF_STMT,BPF_LD etc. in /sys/net/bpf.h. Is
> this the correct way?
>
> 3. I noticed a problem that the filter could not be set as :
> ngctl msg bpf0: setprogram {...}
> It gave the message:
> ngctl: send msg: Invalid argument
that's becaue you must escape the arguments so that the shell does not try
to interpret things.
>
> I am using FreeBSD 4.1.
>
> Thanks
> Satya
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-net" in the body of the message
the man page for -current ng_bpf (you can get it from
http://www.freebsd.org/cgi/cvsweb.cgi/src/share/man/man4/ng_bpf.4
shows how to program a bpf node with a good example
(it was not in the 4.x man page)
--
__--_|\ Julian Elischer
/ \ julian@elischer.org
( OZ ) World tour 2000-2001
---> X_.---._/
v
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3A9BA720.3AFB0A9>
