On 5/3/14, 4:59 AM, Özkan KIRIK wrote:
And also i tried ng_bpf + ng_eiface conjuction, but ng_bpf doesnt match
"vlan" filter.

With the script below, ng_bpf always calls ifNotMatch hook.   When the
pattern is "ip", ng_bpf matches frames have both vlan and ip headers.
I think ng_bpf doesnt process ethernet header.  Is there a way to process
ethernet header with ng_bpf ?

once you have worked out what the framework is doing then it is very easy to read the code of netgraph modules
because each module does only one thing.
read the sample module for descriptions of what the parts do and then look at the modules you are trying to use.
it should be pretty quickly obvious what they are doing.

Julian


Script is below:

#!/bin/sh
ETHER_IF=em0
PATTERN="vlan"
BPFPROG=$( tcpdump -s 8192 -ddd ${PATTERN} | \
                     ( read len ; \
                       echo -n "bpf_prog_len=$len " ; \
                       echo -n "bpf_prog=[" ; \
                       while read code jt jf k ; do \
                           echo -n " { code=$code jt=$jt jf=$jf k=$k }" ; \
                       done ; \
                       echo " ]" ) )

echo $BPFPROG

# Shutdown nodes if exists
ngctl shutdown ${ETHER_IF}:
ngctl shutdown vlan_filter:
ngctl shutdown tag0:
ngctl shutdown untag0:

ngctl -f- <<EOF
mkpeer ${ETHER_IF}: bpf lower filter_in
name ${ETHER_IF}:lower vlan_filter
mkpeer vlan_filter: eiface taggedPacket ether
mkpeer vlan_filter: eiface untaggedPacket ether
name vlan_filter:taggedPacket tag0
name vlan_filter:untaggedPacket untag0
msg vlan_filter: setprogram { thisHook="filter_in" ifMatch="taggedPacket"
ifNotMatch="untaggedPacket" $BPFPROG }
EOF
ifconfig ngeth0 up
ifconfig ngeth1 up



On Fri, May 2, 2014 at 11:53 PM, Özkan KIRIK <ozkan.ki...@gmail.com> wrote:

Hi,

Assume that default vlan untagged and VLAN 10, 20, 30, 40 tagged on switch
connected to em0 interface.

i am trying to bridge only untagged frames on em0 with em1.

Does if_vlan handle untagged frames?

# ifconfig em0.0 create
ifconfig: SIOCIFCREATE2: Invalid argument

Any ideas?

Best regards,

_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"



_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"

Reply via email to