If someone is adding new fields, they need to be aware that the OXM
field id cannot exceed 127, as only 7 bits are reserved for it in the
header. See "7.2.3.2 Flow Match Field Structures" in the OpenFlow 1.5
spec or the comment at the top of lib/nx-match.c.
Add a check for the value range, so the build fails if it's incorrect.
Otherwise the field will be truncated or overflow into the class and
break message parsing.
Exmaple:
include/openvswitch/meta-flow.h
- * NXM: NXM_NX_REG15(15) since v2.6. <15>
+ * NXM: NXM_NX_REG15(130) since v2.6. <15>
$ make
./include/openvswitch/meta-flow.h:1029:
NXM_NX_REG15: OXM field is out of range (130 > 127)
Note: the script calls the number 'oxm_type', which is a little
confusing, since type includes both the class and the field. But
that's a separate story.
Signed-off-by: Ilya Maximets <[email protected]>
---
python/ovs_build_helpers/extract_ofp_fields.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/python/ovs_build_helpers/extract_ofp_fields.py
b/python/ovs_build_helpers/extract_ofp_fields.py
index a70eabdb0..e9c1431e3 100644
--- a/python/ovs_build_helpers/extract_ofp_fields.py
+++ b/python/ovs_build_helpers/extract_ofp_fields.py
@@ -149,6 +149,9 @@ def parse_oxm(s, prefix, n_bytes):
fatal("unknown OXM class for %s" % name)
oxm_vendor, oxm_class, oxm_class_type = class_
+ if int(oxm_type) > 127:
+ fatal("%s: OXM field is out of range (%s > 127)" % (name, oxm_type))
+
if class_ in match_types:
if oxm_type in match_types[class_]:
fatal(
--
2.52.0
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev