]> git.baikalelectronics.ru Git - kernel.git/commit
openvswitch: Create right mask with disabled megaflows
authorPravin B Shelar <pshelar@nicira.com>
Fri, 17 Oct 2014 04:55:45 +0000 (21:55 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 17 Oct 2014 20:49:34 +0000 (16:49 -0400)
commit0551a9c445ca72f554d7053fe42d79c97aa9697a
tree79aa16d0cb522b71b3ed0e73cd63a56cb1ec33ec
parentaa8c9fbe11aa9029b159746993645988f5b75631
openvswitch: Create right mask with disabled megaflows

If megaflows are disabled, the userspace does not send the netlink attribute
OVS_FLOW_ATTR_MASK, and the kernel must create an exact match mask.

sw_flow_mask_set() sets every bytes (in 'range') of the mask to 0xff, even the
bytes that represent padding for struct sw_flow, or the bytes that represent
fields that may not be set during ovs_flow_extract().
This is a problem, because when we extract a flow from a packet,
we do not memset() anymore the struct sw_flow to 0.

This commit gets rid of sw_flow_mask_set() and introduces mask_set_nlattr(),
which operates on the netlink attributes rather than on the mask key. Using
this approach we are sure that only the bytes that the user provided in the
flow are matched.

Also, if the parse_flow_mask_nlattrs() for the mask ENCAP attribute fails, we
now return with an error.

This bug is introduced by commit 4092b8ed700f68b00832e228d2a5305a1087ea1b
("openvswitch: Eliminate memset() from flow_extract").

Reported-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/openvswitch/flow_netlink.c