The expected length check is using the OVS_TUNNEL_ATTR_MAX, that
limits OVS_VPORT_ATTR_OPTIONS, as a limit for OVS_TUNNEL_KEY_ATTR_*
attributes.  That means that the majority of the tunnel attributes
are not checked (OVS_TUNNEL_ATTR_MAX is 2, the values above that
are skipped).  This is not a big deal, as we're parsing the values
that either we did generate ourselves, or the values that kernel
provided to us.  So the values can't really be wrong, unless there
is a bug somewhere else in OVS or in the kernel.  But we should
still check things properly.

Use the correct OVS_TUNNEL_KEY_ATTR_MAX instead.

Fixes: 6b8da9e92269 ("odp-util: Correctly generate wildcards when formating 
nested attributes.")
Signed-off-by: Ilya Maximets <[email protected]>
---
 lib/odp-util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/odp-util.c b/lib/odp-util.c
index 34c1edc71..43bb23cec 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -3314,7 +3314,7 @@ odp_tun_key_from_attr__(const struct nlattr *attr, bool 
is_mask,
         uint16_t type = nl_attr_type(a);
         size_t len = nl_attr_get_size(a);
         int expected_len = odp_key_attr_len(ovs_tun_key_attr_lens,
-                                            OVS_TUNNEL_ATTR_MAX, type);
+                                            OVS_TUNNEL_KEY_ATTR_MAX, type);
 
         if (len != expected_len && expected_len >= 0) {
             odp_parse_error(&rl, errorp, "tunnel key attribute %"PRIu16" "
-- 
2.54.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to