Thread (1 message) 1 message, 1 author, 2016-06-09

Re: [PATCH] openvswitch: Add packet truncation support.

From: pravin shelar <hidden>
Date: 2016-06-09 22:04:55

On Thu, Jun 9, 2016 at 1:02 PM, William Tu [off-list ref] wrote:
quoted
quoted
        /* The only known usage of sample action is having a single
user-space
+        * action, or having a truncate action followed by a single
user-space
         * action. Treat this usage as a special case.
         * The output_userspace() should clone the skb to be sent to the
         * user space. This skb will be consumed by its caller.
         */
+       if (unlikely(nla_type(a) == OVS_ACTION_ATTR_TRUNC)) {
+               struct ovs_action_trunc *trunc = nla_data(a);
+
+               OVS_CB(skb)->cutlen = skb->len > trunc->max_len ?
+                                               skb->len -
trunc->max_len : 0;
There is no need to initialize the cutlen to zero if max-len is
greater then skb len. it should be already zero.
quoted
+               a = nla_next(a, &rem);
+       }
+
There cutlen is set in skb cb, but next action could be other than
userspace, in that case cutlen is leaked to remain action list.
Thanks! I will fix it.

Thinking about cutlen to the remaining action list, should we consider the
truncate and output in sample action? ex:  "sample(truncate(64), output:2)"
The patch already covers it. sample calls add_deferred_actions() which
would execute nested set of actions later on.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help