[ovs-dev] [PATCH 03/10] ofp-actions: Enforce minimum length for packet truncation during parsing.

Ben Pfaff blp at ovn.org
Tue Apr 30 23:27:21 UTC 2019


Otherwise, specifying something like output(port=1,max_len=5) would parse
OK and then cause a failure when it was received by the switch.

Signed-off-by: Ben Pfaff <blp at ovn.org>
---
 lib/ofp-actions.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c
index c2cef769e839..405b7c7eff81 100644
--- a/lib/ofp-actions.c
+++ b/lib/ofp-actions.c
@@ -640,6 +640,12 @@ parse_truncate_subfield(const char *arg_,
             if (err) {
                 return err;
             }
+
+            if (output_trunc->max_len < ETH_HEADER_LEN) {
+                return xasprintf("max_len %"PRIu32" is less than the minimum "
+                                 "value %d",
+                                 output_trunc->max_len, ETH_HEADER_LEN);
+            }
         } else {
             return xasprintf("invalid key '%s' in output_trunc argument",
                                 key);
-- 
2.20.1



More information about the dev mailing list