diff options
author | Thomas Graf <tgraf@suug.ch> | 2005-03-30 05:34:30 +0200 |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2005-03-30 05:34:30 +0200 |
commit | 7a69697fdef4f3d51ffbb931885eb387f28e9a2f (patch) | |
tree | 5bd96ea7fc12212d1efa70bda4af2b58c0c44eda | |
parent | 1b29c38606b1f41d9831c28f5d7cfbd965282d3f (diff) | |
download | history-7a69697fdef4f3d51ffbb931885eb387f28e9a2f.tar.gz |
[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 <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/act_api.h | 2 | ||||
-rw-r--r-- | net/sched/act_api.c | 19 | ||||
-rw-r--r-- | net/sched/cls_api.c | 2 |
3 files changed, 14 insertions, 9 deletions
diff --git a/include/net/act_api.h b/include/net/act_api.h index 12736d17d3a30..ed00a995f576f 100644 --- a/include/net/act_api.h +++ b/include/net/act_api.h @@ -81,7 +81,7 @@ extern struct tc_action *tcf_action_init_1(struct rtattr *rta, struct rtattr *es 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 --git a/net/sched/act_api.c b/net/sched/act_api.c index eebef4e16a2f9..88962fa33199f 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -228,7 +228,7 @@ tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref) 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 @@ err: 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 --git a/net/sched/cls_api.c b/net/sched/cls_api.c index fe85d5588b46e..56e66c3fe0fa0 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -602,7 +602,7 @@ tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts, { #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) |