[ovs-dev] [PATCH] datapath: flow_netlink: Fix a bug.

Alex Wang alexw at nicira.com
Wed Jul 23 06:36:42 UTC 2014


Commit 62974663fe (datapath/flow_netlink: Create right mask with
disabled megaflows) introduced the bug which caused
ovs_nla_get_match() returns immediately after parsing the flow
mask for OVS_KEY_ATTR_ENCAP.  Consequently, when vlan encapsulated
packets are present, the corresponding datapath flows will have
incorrect mask like below.  And the incorrect flows could affect
other non-vlan packets.

~/ovs# ovs-dpctl dump-flows
in_port(3/0xffff0000),eth_type(0x8100),encap(), packets:0,
bytes:0, used:never, actions:2

This commit fixes the bug by checking and handling the return
value of the parsing function correctly.

Signed-off-by: Alex Wang <alexw at nicira.com>
---
 datapath/flow_netlink.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/datapath/flow_netlink.c b/datapath/flow_netlink.c
index 5f975a1..445fa88 100644
--- a/datapath/flow_netlink.c
+++ b/datapath/flow_netlink.c
@@ -938,7 +938,8 @@ int ovs_nla_get_match(struct sw_flow_match *match,
 				mask_attrs &= ~(1ULL << OVS_KEY_ATTR_ETHERTYPE);
 				encap = a[OVS_KEY_ATTR_ENCAP];
 				err = parse_flow_mask_nlattrs(encap, a, &mask_attrs);
-				goto free_newmask;
+				if (err)
+					goto free_newmask;
 			} else {
 				OVS_NLERR("VLAN frames must have an exact match on the TPID (mask=%x).\n",
 						ntohs(eth_type));
-- 
1.7.9.5




More information about the dev mailing list