diff mbox

[net,1/1] net sched actions: bug fix dumping actions directly didnt produce NLMSG_DONE

Message ID 1465855722-26727-1-git-send-email-jhs@emojatatu.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Jamal Hadi Salim June 13, 2016, 10:08 p.m. UTC
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(-)

Comments

Cong Wang June 13, 2016, 10:58 p.m. UTC | #1
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>
David Miller June 15, 2016, 9:03 p.m. UTC | #2
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.
diff mbox

Patch

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)