[ovs-dev] [minor fixes 5/6] bridge: Fix VLAN selection mirroring logic.

Ethan Jackson ethan at nicira.com
Mon Apr 18 18:10:55 UTC 2011


Wow.  That's a bit scary.

Looks Good.

Ethan

On Mon, Apr 11, 2011 at 11:02 AM, Ben Pfaff <blp at nicira.com> wrote:
> The logic here did not make sense.  A packet arriving on a port is mirrored
> if the port is a mirroring source port AND (not OR) the packet is in one of
> the VLANs that is mirrored.
>
> This test has been here since the mirroring code was introduced.  It seems
> to me that it was never correct.
> ---
>  vswitchd/bridge.c |   19 +------------------
>  1 files changed, 1 insertions(+), 18 deletions(-)
>
> diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
> index b2e55bd..220d599 100644
> --- a/vswitchd/bridge.c
> +++ b/vswitchd/bridge.c
> @@ -3594,19 +3594,6 @@ vlan_is_mirrored(const struct mirror *m, int vlan)
>     return false;
>  }
>
> -static bool
> -port_trunks_any_mirrored_vlan(const struct mirror *m, const struct port *p)
> -{
> -    size_t i;
> -
> -    for (i = 0; i < m->n_vlans; i++) {
> -        if (port_trunks_vlan(p, m->vlans[i])) {
> -            return true;
> -        }
> -    }
> -    return false;
> -}
> -
>  static void
>  mirror_reconfigure_one(struct mirror *m, struct ovsrec_mirror *cfg)
>  {
> @@ -3691,11 +3678,7 @@ mirror_reconfigure_one(struct mirror *m, struct ovsrec_mirror *cfg)
>     /* Update ports. */
>     mirror_bit = MIRROR_MASK_C(1) << m->idx;
>     HMAP_FOR_EACH (port, hmap_node, &m->bridge->ports) {
> -        if (sset_contains(&m->src_ports, port->name)
> -            || (m->n_vlans
> -                && (!port->vlan
> -                    ? port_trunks_any_mirrored_vlan(m, port)
> -                    : vlan_is_mirrored(m, port->vlan)))) {
> +        if (sset_contains(&m->src_ports, port->name)) {
>             port->src_mirrors |= mirror_bit;
>         } else {
>             port->src_mirrors &= ~mirror_bit;
> --
> 1.7.1
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>



More information about the dev mailing list