netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 1/1] net sched actions: bug fix dumping actions directly didnt produce NLMSG_DONE
@ 2016-06-13 22:08 Jamal Hadi Salim
  2016-06-13 22:58 ` Cong Wang
  2016-06-15 21:03 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Jamal Hadi Salim @ 2016-06-13 22:08 UTC (permalink / raw)
  To: davem; +Cc: netdev, daniel, xiyou.wangcong, Jamal Hadi Salim

From: Jamal Hadi Salim <jhs@mojatatu.com>

This refers to commands to direct action access as follows:

sudo tc actions add action drop index 12
sudo tc actions add action pipe index 10

And then dumping them like so:
sudo tc actions ls action gact

iproute2 worked because it depended on absence of TCA_ACT_TAB TLV
as end of message.
This fix has been tested with iproute2 and is backward compatible.

Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
 net/sched/act_api.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 336774a..c7a0b0d 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -1118,7 +1118,7 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
 		nla_nest_end(skb, nest);
 		ret = skb->len;
 	} else
-		nla_nest_cancel(skb, nest);
+		nlmsg_trim(skb, b);
 
 	nlh->nlmsg_len = skb_tail_pointer(skb) - b;
 	if (NETLINK_CB(cb->skb).portid && ret)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net 1/1] net sched actions: bug fix dumping actions directly didnt produce NLMSG_DONE
  2016-06-13 22:08 [PATCH net 1/1] net sched actions: bug fix dumping actions directly didnt produce NLMSG_DONE Jamal Hadi Salim
@ 2016-06-13 22:58 ` Cong Wang
  2016-06-15 21:03 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Cong Wang @ 2016-06-13 22:58 UTC (permalink / raw)
  To: Jamal Hadi Salim
  Cc: David Miller, Linux Kernel Network Developers, Daniel Borkmann

On Mon, Jun 13, 2016 at 3:08 PM, Jamal Hadi Salim <jhs@mojatatu.com> wrote:
> From: Jamal Hadi Salim <jhs@mojatatu.com>
>
> This refers to commands to direct action access as follows:
>
> sudo tc actions add action drop index 12
> sudo tc actions add action pipe index 10
>
> And then dumping them like so:
> sudo tc actions ls action gact
>
> iproute2 worked because it depended on absence of TCA_ACT_TAB TLV
> as end of message.
> This fix has been tested with iproute2 and is backward compatible.
>
> Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
> ---
>  net/sched/act_api.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/sched/act_api.c b/net/sched/act_api.c
> index 336774a..c7a0b0d 100644
> --- a/net/sched/act_api.c
> +++ b/net/sched/act_api.c
> @@ -1118,7 +1118,7 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
>                 nla_nest_end(skb, nest);
>                 ret = skb->len;
>         } else
> -               nla_nest_cancel(skb, nest);
> +               nlmsg_trim(skb, b);

So trim the whole tcamsg instead of just the nest attribute,
looks reasonable:

Acked-by: Cong Wang <xiyou.wangcong@gmail.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net 1/1] net sched actions: bug fix dumping actions directly didnt produce NLMSG_DONE
  2016-06-13 22:08 [PATCH net 1/1] net sched actions: bug fix dumping actions directly didnt produce NLMSG_DONE Jamal Hadi Salim
  2016-06-13 22:58 ` Cong Wang
@ 2016-06-15 21:03 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-06-15 21:03 UTC (permalink / raw)
  To: jhs; +Cc: netdev, daniel, xiyou.wangcong

From: Jamal Hadi Salim <jhs@mojatatu.com>
Date: Mon, 13 Jun 2016 18:08:42 -0400

> From: Jamal Hadi Salim <jhs@mojatatu.com>
> 
> This refers to commands to direct action access as follows:
> 
> sudo tc actions add action drop index 12
> sudo tc actions add action pipe index 10
> 
> And then dumping them like so:
> sudo tc actions ls action gact
> 
> iproute2 worked because it depended on absence of TCA_ACT_TAB TLV
> as end of message.
> This fix has been tested with iproute2 and is backward compatible.
> 
> Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-06-15 21:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-13 22:08 [PATCH net 1/1] net sched actions: bug fix dumping actions directly didnt produce NLMSG_DONE Jamal Hadi Salim
2016-06-13 22:58 ` Cong Wang
2016-06-15 21:03 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).