[ovs-dev] [PATCH] netdev implementation for FreeBSD

Ed Maste emaste at freebsd.org
Sat Jul 7 01:51:12 UTC 2012


On 6 July 2012 08:59, Giuseppe Lettieri <g.lettieri at iet.unipi.it> wrote:
> Hi,
>
> the attached patch implements new netdev classes for "system" and "tap"
> devices in FreeBSD, by using the libpcap library. With this patch (and
> some firewall rules) the user-level datapath of Open vSwitch can be made
> to work on FreeBSD.

The firewall rule Giuseppe mentioned is needed to avoid duplicate
packets.  Consider a bridge with one pysical port, and an IP address
assigned to the tap device (br0):

# ovs-vsctl show
46fb11b5-13b8-4c7e-ba73-161df4741d27
    Bridge "br0"
        Port "br0"
            Interface "br0"
                type: internal
        Port "em0"
            Interface "em0"

A packet received by em0 is intercepted by BPF and delivered to Open
vSwitch via libpcap.  Open vSwitch delivers it to the tap device, and
the stack then gets copies from both em0 and br0.  This can be addressed
by a firewall rule to discard packets received by em0 so that they don't
make it beyond the BPF call.

It isn't clear to me though why the Linux userspace mode does not behave
the same way though.  I had a (very) brief look at the way PF_PACKET is
handled in Linux and it seemed like the packet would still be passed up
the stack -- there must be something else that I'm missing.

-Ed



More information about the dev mailing list