ChangeSet 1.2181.38.3, 2005/03/30 01:34:30+02:00, [EMAIL PROTECTED]
[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 <[EMAIL PROTECTED]>
Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
include/net/act_api.h | 2 +-
net/sched/act_api.c | 19 ++++++++++++-------
net/sched/cls_api.c | 2 +-
3 files changed, 14 insertions(+), 9 deletions(-)
diff -Nru a/include/net/act_api.h b/include/net/act_api.h
--- a/include/net/act_api.h 2005-03-30 20:06:12 -08:00
+++ b/include/net/act_api.h 2005-03-30 20:06:12 -08: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 20:06:12 -08:00
+++ b/net/sched/act_api.c 2005-03-30 20:06:12 -08: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 20:06:12 -08:00
+++ b/net/sched/cls_api.c 2005-03-30 20:06:12 -08: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)
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html