From: Eli Britstein <[email protected]>

Parsing of the packet has some validity checks. Return it as a return
value.

Signed-off-by: Eli Britstein <[email protected]>
Acked-by: Roi Dayan <[email protected]>
---
 lib/flow.c | 6 +++++-
 lib/flow.h | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/flow.c b/lib/flow.c
index 8e3402388cbc..417e0a63acd0 100644
--- a/lib/flow.c
+++ b/lib/flow.c
@@ -785,7 +785,7 @@ dump_invalid_packet(struct dp_packet *packet, const char 
*reason)
  *      present and the packet has at least the content used for the fields
  *      of interest for the flow, otherwise UINT16_MAX.
  */
-void
+bool
 miniflow_extract(struct dp_packet *packet, struct miniflow *dst)
 {
     /* Add code to this function (or its callees) to extract new fields. */
@@ -803,6 +803,7 @@ miniflow_extract(struct dp_packet *packet, struct miniflow 
*dst)
     uint8_t nw_frag, nw_tos, nw_ttl, nw_proto;
     uint8_t *ct_nw_proto_p = NULL;
     ovs_be16 ct_tp_src = 0, ct_tp_dst = 0;
+    bool rv = false;
 
     /* Metadata. */
     if (flow_tnl_dst_is_set(&md->tunnel)) {
@@ -1027,6 +1028,7 @@ miniflow_extract(struct dp_packet *packet, struct 
miniflow *dst)
                                     sizeof(uint64_t));
             }
         }
+        rv = true;
         goto out;
     }
 
@@ -1166,8 +1168,10 @@ miniflow_extract(struct dp_packet *packet, struct 
miniflow *dst)
             }
         }
     }
+    rv = true;
  out:
     dst->map = mf.map;
+    return rv;
 }
 
 static ovs_be16
diff --git a/lib/flow.h b/lib/flow.h
index 75a9be3c19d3..f91e074e2279 100644
--- a/lib/flow.h
+++ b/lib/flow.h
@@ -541,7 +541,7 @@ struct pkt_metadata;
 /* The 'dst' must follow with buffer space for FLOW_U64S 64-bit units.
  * 'dst->map' is ignored on input and set on output to indicate which fields
  * were extracted. */
-void miniflow_extract(struct dp_packet *packet, struct miniflow *dst);
+bool miniflow_extract(struct dp_packet *packet, struct miniflow *dst);
 void miniflow_map_init(struct miniflow *, const struct flow *);
 void flow_wc_map(const struct flow *, struct flowmap *);
 size_t miniflow_alloc(struct miniflow *dsts[], size_t n,
-- 
2.44.0

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

Reply via email to