bridge Untagged packets on an interface

Özkan KIRIK ozkan.kirik at gmail.com
Fri May 2 20:59:44 UTC 2014


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 ?

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.kirik at 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,
>


More information about the freebsd-net mailing list