[ovs-discuss] Stripping VLAN tags in Openflow 1.1+

Ben Warren ben at skyportsystems.com
Thu Mar 10 18:51:35 UTC 2016


Hi,

I’m wondering how to strip VLAN tags when using OpenFlow version 1.1 or greater messaging.  The “strip_vlan” action in “ovs-ofctl” seems to be version 1.0-only.  The “parse_op_flow_mod_str()” function returns 0xa, which = (OFPUTIL_P_OF10_STD_TID | OFPUTIL_P_OF10_NXM_TID).  I’ve tried the following:

	• Use “pop_vlan” instead of “strip_vlan”, but they seem to be aliased
	• Use “mod_vlan_vid=0”, but that still sends 802.1Q frames
	• Use “mod_vlan_vid=-1” and “mod_vlan_vid=0xffff”, but get syntax errors 

Also, there’s this:

root at cd58:~# ./ovs-ofctl -O OpenFlow13 add-flow br0 "table=0,priority=40001,in_port=1,actions=strip_vlan,resubmit(,3)"
ovs-ofctl: none of the usable flow formats (OpenFlow10+table_id,NXM+table_id) is among the allowed flow formats (OXM-OpenFlow13)

Looking through the OpenFlow 1.3 spec, I see this stanza:

====
B.6.18 VLAN Action Changes

It is now possible to set the priority field in VLAN tags and stripping VLAN tags is now a separate action. The OFPAT_SET_VLAN_VID action behaves like the former OFPAT_SET_DL_VLAN action, but no longer accepts a special value that causes it to strip the VLAN tag. The OFPAT_SET_VLAN_PCP action modifies the 3-bit priority field in the VLAN tag. For existing tags, both actions only modify the bits associated with the field being updated. If a new VLAN tag needs to be added, the value of all other fields is zero.

The OFPAT_SET_VLAN_VID action looks like the following:

struct ofp_action_vlan_vid {
	uint16_t type; /* OFPAT_SET_VLAN_VID. */
	uint16_t len; /* Length is 8. */
	uint16_t vlan_vid; /* VLAN id. */
	uint8_t pad[2];
};

The OFPAT_SET_VLAN_PCP action looks like the following::

struct ofp_action_vlan_pcp {
	uint16_t type; /* OFPAT_SET_VLAN_PCP. */
	uint16_t len; /* Length is 8. */
	uint8_t vlan_pcp; /* VLAN priority. */
	uint8_t pad[3];
};

The OFPAT_STRIP_VLAN action takes no argument and strips the VLAN tag if one is present
====

but it’s not obvious to me how this is implemented in OVS.

Thanks,
Ben

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3583 bytes
Desc: not available
URL: <http://openvswitch.org/pipermail/ovs-discuss/attachments/20160310/34b6d86c/attachment.p7s>


More information about the discuss mailing list