[ovs-discuss] Match only the upper 3 bits of dscp field

Matthias May matthias.may at neratec.com
Tue Jun 20 12:16:36 UTC 2017


I need to modify the tos field of ipv4 frames.
The rule I currently have for this looks something like:
ovs-ofctl add-flow br0-wlan0 "table=20 priority=100 dl_type=0x0800 nw_tos=32 actions=mod_nw_tos:224"

I only want to match the upper most 3 bits of the DSCP field. This rule as it is has the obvious drawback of the rule
only matching when the lower 3 bits are 0.

When I try to create a rule with:
ovs-ofctl add-flow br0-wlan0 "table=22 priority=0 dl_type=0x0800 nw_tos=160/0xe0 actions=load:5->nw_tos[5..7]"
I get the message;
ovs-ofctl: 160/0xe0: invalid mask for field nw_tos

The match nw_tos=160/0xff works.

The current workaround I have for this is:

ovs-ofctl add-flow br0 "table=0 priority=0 in_port=2 actions=resubmit(,20),resubmit(,21),output:1"
ovs-ofctl add-flow br0 "table=20 priority=0 dl_type=0x0800 actions=move:NXM_OF_IP_TOS[5..7]->NXM_NX_REG0[0..2]"
ovs-ofctl add-flow br0 "table=21 priority=0 dl_type=0x0800 reg0=4 actions=load:5->nw_tos[5..7]"

Does anyone have a better idea how to do this?


More information about the discuss mailing list