# This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2005/03/30 01:34:30+02:00 tgraf@xxxxxxx # [PKT_SCHED]: Fix action statistics dumping in compatibility mode # # Extends the action dumping function by a parameter to differ between # regular calls and the one supposed to add the backward compatiblity # bits for old userspace applications. # # Signed-off-by: Thomas Graf # Signed-off-by: David S. Miller # # net/sched/cls_api.c # 2005/03/30 01:34:14+02:00 tgraf@xxxxxxx +1 -1 # [PKT_SCHED]: Fix action statistics dumping in compatibility mode # # net/sched/act_api.c # 2005/03/30 01:34:14+02:00 tgraf@xxxxxxx +12 -7 # [PKT_SCHED]: Fix action statistics dumping in compatibility mode # # include/net/act_api.h # 2005/03/30 01:34:14+02:00 tgraf@xxxxxxx +1 -1 # [PKT_SCHED]: Fix action statistics dumping in compatibility mode # diff -Nru a/include/net/act_api.h b/include/net/act_api.h --- a/include/net/act_api.h 2005-03-30 03:00:38 +02:00 +++ b/include/net/act_api.h 2005-03-30 03:00:38 +02:00 @@ -81,7 +81,7 @@ extern int tcf_action_dump(struct sk_buff *skb, struct tc_action *a, int, int); extern int tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int, int); extern int tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int, int); -extern int tcf_action_copy_stats (struct sk_buff *,struct tc_action *); +extern int tcf_action_copy_stats (struct sk_buff *,struct tc_action *, int); #endif /* CONFIG_NET_CLS_ACT */ extern int tcf_police(struct sk_buff *skb, struct tcf_police *p); diff -Nru a/net/sched/act_api.c b/net/sched/act_api.c --- a/net/sched/act_api.c 2005-03-30 03:00:38 +02:00 +++ b/net/sched/act_api.c 2005-03-30 03:00:38 +02:00 @@ -228,7 +228,7 @@ return err; RTA_PUT(skb, TCA_KIND, IFNAMSIZ, a->ops->kind); - if (tcf_action_copy_stats(skb, a)) + if (tcf_action_copy_stats(skb, a, 0)) goto rtattr_failure; r = (struct rtattr*) skb->tail; RTA_PUT(skb, TCA_OPTIONS, 0, NULL); @@ -380,19 +380,24 @@ return NULL; } -int tcf_action_copy_stats(struct sk_buff *skb, struct tc_action *a) +int tcf_action_copy_stats(struct sk_buff *skb, struct tc_action *a, + int compat_mode) { - int err; + int err = 0; struct gnet_dump d; struct tcf_act_hdr *h = a->priv; if (h == NULL) goto errout; - if (a->type == TCA_OLD_COMPAT) - err = gnet_stats_start_copy_compat(skb, TCA_ACT_STATS, - TCA_STATS, TCA_XSTATS, h->stats_lock, &d); - else + /* compat_mode being true specifies a call that is supposed + * to add additional backward compatiblity statistic TLVs. + */ + if (compat_mode) { + if (a->type == TCA_OLD_COMPAT) + err = gnet_stats_start_copy_compat(skb, 0, + TCA_STATS, TCA_XSTATS, h->stats_lock, &d); + } else err = gnet_stats_start_copy(skb, TCA_ACT_STATS, h->stats_lock, &d); diff -Nru a/net/sched/cls_api.c b/net/sched/cls_api.c --- a/net/sched/cls_api.c 2005-03-30 03:00:38 +02:00 +++ b/net/sched/cls_api.c 2005-03-30 03:00:38 +02:00 @@ -602,7 +602,7 @@ { #ifdef CONFIG_NET_CLS_ACT if (exts->action) - if (tcf_action_copy_stats(skb, exts->action) < 0) + if (tcf_action_copy_stats(skb, exts->action, 1) < 0) goto rtattr_failure; #elif defined CONFIG_NET_CLS_POLICE if (exts->police)