Date: Tue, 10 Oct 2006 13:38:43 -0300 From: "Eduardo Meyer" <dudu.meyer@gmail.com> To: stable@freebsd.org Subject: Netgraph - ng_bpf help (first experience) Message-ID: <d3ea75b30610100938k5fe929a7n3641b469b16c8bd1@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
Hello, I tried asking it on freebsd-ipfw@ but I got no luck. Maybe because this is related to Netgraph and not ipfw essentially. I want to use ng_bpf to use ng_tag to use ipfw-tag. Looks like lego, where I have to assemble my toy, but I liked Lego when I was a child. Following ng_bpf(4) man page I ran this script: PATTERN="(ether[40:4]=0x134e5844 && ether[44:4]=0x6f6d6169 && ether[48:4]=0x6e0a)" NODEPATH="my_node:" INHOOK="hook1" MATCHHOOK="hook2" NOTMATCHHOOK="hook3" cat > /tmp/bpf.awk << xxENDxx { if (!init) { printf "bpf_prog_len=%d bpf_prog=[", \$1; init=1; } else { printf " { code=%d jt=%d jf=%d k=%d }", \$1, \$2, \$3, \$4; } } END { print " ]" } xxENDxx BPFPROG=`tcpdump -s 8192 -ddd ${PATTERN} | awk -f /tmp/bpf.awk` ngctl msg ${NODEPATH} setprogram { thisHook=\"${INHOOK}\" \ ifMatch=\"${MATCHHOOK}\" \ ifNotMatch=\"${NOTMATCHHOOK}\" \ ${BPFPROG} } } But I got this message: ngctl: send msg: No such file or directory 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 } ] } } Running tcpdump -s 8192 -ddd $PATTERN manually I get: 8 32 0 0 40 21 0 5 323901508 32 0 0 44 21 0 3 1869439337 32 0 0 48 21 0 1 28170 6 0 0 8192 6 0 0 0 Which looks that the ngctl data (code, kt, jf and k) are correct. But the command returns that error for some reason. The script was taken from ng_blf(4) man page. I am all new to this netgraph thing. Can anyone help me to find out what is rong? Thank you. -- =========== Eduardo Meyer pessoal: dudu.meyer@gmail.com profissional: ddm.farmaciap@saude.gov.br
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d3ea75b30610100938k5fe929a7n3641b469b16c8bd1>