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

Matthias May matthias.may at neratec.com
Wed Jun 28 08:35:45 UTC 2017


On 27/06/17 23:40, Ben Pfaff wrote:
> On Tue, Jun 20, 2017 at 02:16:36PM +0200, Matthias May wrote:
>> Hi
>>
>> 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 OpenFlow specs say that the DSCP fields aren't maskable.  I don't
> know why.  OVS follows the spec on this point.
> 

Thank you for your answer.
I figured as much when I was looking at the comments in the code.
Well the workaround over reg0 is working well enough.
looking at ovs-dpctl dump-flows it seems that the mask can be applied there which is good enough for me.

recirc_id(0),in_port(6),eth(src=00:14:5a:02:10:20,dst=00:14:5a:02:30:9d),eth_type(0x0800),ipv4(src=192.168.3.16/255.255.255.240,tos=0xe0/0xe0,frag=no),
packets:10, bytes:980, used:0.580s, actions:set(ipv4(src=192.168.3.16/255.255.255.240,tos=0xa0/0xe0)),2

It's just harder to read the rule set and would have been easier if the mask could be used directly.

BR
Matthias



More information about the discuss mailing list