- const union odp_action *actions;
- struct ofpbuf payload;
- size_t n_actions, n_outputs;
- size_t min_size;
- flow_t flow;
- size_t i;
-
- /* Get odp_sflow_sample_header. */
- min_size = sizeof *msg + sizeof *hdr;
- if (min_size > msg->length) {
- VLOG_WARN_RL(&rl, "sFlow packet too small (%"PRIu32" < %zu)",
- msg->length, min_size);
+ const struct nlattr *actions, *a;
+ unsigned int left;
+ struct ofpbuf b;
+ size_t n_outputs;
+ struct flow flow;
+
+ /* Pull odp_msg header. */
+ ofpbuf_use_const(&b, msg, msg->length);
+ ofpbuf_pull(&b, sizeof *msg);
+
+ /* Pull odp_sflow_sample_header. */
+ hdr = ofpbuf_try_pull(&b, sizeof *hdr);
+ if (!hdr) {
+ VLOG_WARN_RL(&rl, "missing odp_sflow_sample_header");