Netgraph - ng_bpf help (first experience)

Eduardo Meyer dudu.meyer at gmail.com
Tue Oct 10 19:25:33 UTC 2006


New try, now by hand:

# ngctl msg dcbpf: setprogram { thisHook="ipfw" ifMatch="matched"
ifNotMatch="ipfw" bpf_prog_len=8 bpf_prog=[ { code=32 jt=0 jf=0 k=40 }
{ code=21 jt=0 jf=5 k=323901508 } { code=32 jt=0 jf=0 k=44 } { code=21
jt=0 jf=3 k=1869439337 } { code=32 jt=0 jf=0 k=48 } { code=21 jt=0
jf=1 k=28170 } { code=6 jt=0 jf=0 k=8192 } { code=6 jt=0 jf=0 k=0 } ]
} }

ngctl: send msg: No such file or directory

I cant figure out which "file or directory" was not found :(

Now exactly with the command originated from the man page - ng_bpf(4):

ngctl msg my_node: setprogram { thisHook="hook1" ifMatch="hook2"
ifNotMatch="hook3" bpf_prog_len=16 bpf_prog=[ { code=40 jt=0 jf=0 k=12
} { code=21 jt=0 jf=4 k=34525 } { code=48 jt=0 jf=0 k=20 } { code=21
jt=0 jf=11 k=6 } { code=40 jt=0 jf=0 k=56 } { code=21 jt=8 jf=9 k=80 }
{ code=21 jt=0 jf=8 k=2048 } { code=48 jt=0 jf=0 k=23 } { code=21 jt=0
jf=6 k=6 } { code=40 jt=0 jf=0 k=20 } { code=69 jt=4 jf=0 k=8191 } {
code=177 jt=0 jf=0 k=14 } { code=72 jt=0 jf=0 k=16 } { code=21 jt=0
jf=1 k=80 } { code=6 jt=0 jf=0 k=8192 } { code=6 jt=0 jf=0 k=0 } ] } }
ngctl: send msg: No such file or directory
Exit 71

Same problem.  With ngctl list the only node I see is:

There are 1 total nodes:
  Name: ngctl19792      Type: socket          ID: 0000003f   Num hooks: 0

My kldstat:

Id Refs Address    Size     Name
 1   10 0xc0400000 40e440   kernel
 2    2 0xc080f000 22ae8    sound.ko
 3    1 0xc0832000 51f8     snd_t4dwave.ko
 4    1 0xc0838000 59e60    acpi.ko
 5    1 0xc24e6000 1a000    usb.ko
 6    1 0xc3754000 4000     ng_bpf.ko
 7    3 0xc3758000 a000     netgraph.ko
 8    1 0xc3766000 3000     ng_tag.ko
 9    1 0xc3769000 4000     ng_socket.ko

What am I missing here, and why the example from the man page wont work?





On 10/10/06, Eduardo Meyer <dudu.meyer at gmail.com> wrote:
> Pete, thank you for asking.
>
> > are you sure you are able to write to /tmp, this error looks like it
> > is not able to read /tmp/bpf.awk.
>
> Yes, I can write. It is not the problem, since the generated code from
> the awk file is  OK.
>
> >
> > > I printed the full commands that returns the error, it is:
> > >
> > > ngctl msg setprogram { thisHook="" ifMatch="" ifNotMatch=""
> > > bpf_prog_len=8 bpf_prog=[ { code=32 jt=0 jf=0 k=40 } { code=21 jt=0
> > > jf=5 k=323901508 } { code=32 jt=0 jf=0 k=44 } { code=21 jt=0 jf=3
> > > k=1869439337 } { code=32 jt=0 jf=0 k=48 } { code=21 jt=0 jf=1 k=28170
> > > } { code=6 jt=0 jf=0 k=8192 } { code=6 jt=0 jf=0 k=0 } ] } }
> > >
> >
> > i suspect this is what the contents of /tmp/bpf.awk are.  if not maybe
> > post that to the thread....
>
> No, this is the out from
>
> echo ngctl msg ${NODEPATH} setprogram { thisHook=\"${INHOOK}\"
> ifMatch=\"${MATCHHOOK}\" ifNotMatch=\"${NOTMATCHHOOK}\" ${BPFPROG} } }
>
> I added the echo command to see how it is getting executed. So I have
> the echo and on the next line the command itself. Note that this was
> just copied/pasted from the man page, with the exception of the
> PATTERN.
>
>
> --
> ===========
> Eduardo Meyer
> pessoal: dudu.meyer at gmail.com
> profissional: ddm.farmaciap at saude.gov.br
>


-- 
===========
Eduardo Meyer
pessoal: dudu.meyer at gmail.com
profissional: ddm.farmaciap at saude.gov.br


More information about the freebsd-stable mailing list