From 43aa5f47f1ece799ebb85cd1c8ddfdaefe7b7402 Mon Sep 17 00:00:00 2001 From: Jesse Gross Date: Thu, 8 Oct 2009 12:31:03 -0700 Subject: [PATCH] vlan: Compare vlan tags before implicit tagging when RSPANing. We check that a packet is not sent out the on the in port on the same VLAN when performing RSPAN. However, we were comparing the vlan tag from a packet after implicit tagging with a tag from before implicit tagging. This ensures that we always compare them before such tagging. --- vswitchd/bridge.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 4ad7e9bb7..3ee964dd6 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -1715,13 +1715,26 @@ compose_dsts(const struct bridge *br, const flow_t *flow, uint16_t vlan, if (port_includes_vlan(port, m->out_vlan) && set_dst(dst, flow, in_port, port, tags)) { + int flow_vlan; + if (port->vlan < 0) { dst->vlan = m->out_vlan; } if (dst_is_duplicate(dsts, dst - dsts, dst)) { continue; } - if (port == in_port && dst->vlan == vlan) { + + /* Use the vlan tag on the original flow instead of + * the one passed in the vlan parameter. This ensures + * that we compare the vlan from before any implicit + * tagging tags place. This is necessary because + * dst->vlan is the final vlan, after removing implicit + * tags. */ + flow_vlan = ntohs(flow->dl_vlan); + if (flow_vlan == 0) { + flow_vlan = OFP_VLAN_NONE; + } + if (port == in_port && dst->vlan == flow_vlan) { /* Don't send out input port on same VLAN. */ continue; } -- 2.43.0