From owner-freebsd-net Tue Feb 27 5:10:42 2001 Delivered-To: freebsd-net@freebsd.org Received: from urban.iinet.net.au (urban.iinet.net.au [203.59.24.231]) by hub.freebsd.org (Postfix) with ESMTP id 5734937B71C for ; Tue, 27 Feb 2001 05:10:38 -0800 (PST) (envelope-from julian@elischer.org) Received: from muzak.iinet.net.au (muzak.iinet.net.au [203.59.24.237]) by urban.iinet.net.au (8.8.7/8.8.7) with ESMTP id VAA15756; Tue, 27 Feb 2001 21:10:35 +0800 Received: from elischer.org (i076-133.nv.iinet.net.au [203.59.76.133]) by muzak.iinet.net.au (8.8.5/8.8.5) with ESMTP id VAA25740; Tue, 27 Feb 2001 21:07:36 +0800 Message-ID: <3A9BA720.3AFB0A9@elischer.org> Date: Tue, 27 Feb 2001 05:09:52 -0800 From: Julian Elischer X-Mailer: Mozilla 4.7 [en] (X11; U; FreeBSD 5.0-CURRENT i386) X-Accept-Language: en, hu MIME-Version: 1.0 To: Satyajeet Seth Cc: net@freebsd.org Subject: Re: Problem in configuring netgraph References: Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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