From patchwork Sat May 24 13:13:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jamal Hadi Salim X-Patchwork-Id: 352107 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 6C0711400A8 for ; Sat, 24 May 2014 23:13:58 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751207AbaEXNNq (ORCPT ); Sat, 24 May 2014 09:13:46 -0400 Received: from mail-pb0-f41.google.com ([209.85.160.41]:39939 "EHLO mail-pb0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750845AbaEXNNp (ORCPT ); Sat, 24 May 2014 09:13:45 -0400 Received: by mail-pb0-f41.google.com with SMTP id uo5so5416526pbc.14 for ; Sat, 24 May 2014 06:13:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=cllli8wo5VdyeGansvHt/2wVjk8fjXGSPkMQ9V4p4Z8=; b=DyTkVUl5bfqKra7W6UESYmD3ZPEjrCZHjXlOXcOKcPvtk+CosINzFR34X/PBBKkEtE EpqqjK7ihZfCwXgGJHpj0IejpQ7bGHOPpmDAzkYEr1RrcMEKSQATpE2WfuguPy1JJ0gM fCdm711cn2G8YnAFjWdXSio9gJJJSugW6TgmtnP6HgLzBIvqvM0JbBIzGo10jsHGDMqd 7rEWOfNCHGZ3UcWeuXCtpLwLEo4U9GFaJulrh8SSwm7qHNR7v0aJoruCOPPq6aA6Umz+ QJfv45r5sHIKBWrmgpgMxh86l7QWDClZa/FRD37jimnJNNomJhogjdoT/8ByrTfBQssS 8gKA== X-Gm-Message-State: ALoCoQnvzQJYxvt7GMDUe+HI9Dj2rl5yEJufHB9xiGHNamDkKbj7tTGcu1RL0zemQ49FH3RcSS37 X-Received: by 10.66.121.131 with SMTP id lk3mr13771002pab.61.1400937224529; Sat, 24 May 2014 06:13:44 -0700 (PDT) Received: from jhs-1.lan (198-84-205-203.cpe.teksavvy.com. [198.84.205.203]) by mx.google.com with ESMTPSA id gg3sm9398598pbc.34.2014.05.24.06.13.42 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 24 May 2014 06:13:43 -0700 (PDT) From: Jamal Hadi Salim X-Google-Original-From: Jamal Hadi Salim To: stephen@networkplumber.org Cc: netdev@vger.kernel.org, Jamal Hadi Salim Subject: [PATCH 1/1] actions: correctly report the number of actions flushed Date: Sat, 24 May 2014 09:13:35 -0400 Message-Id: <1400937215-15542-1-git-send-email-jhs@emojatatu.com> X-Mailer: git-send-email 1.7.9.5 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jamal Hadi Salim This also fixes a long standing bug of not sanely reporting the action chain ordering Sample scenario test on window 1(event window): run "tc monitor" and observe events on window 2: sudo tc actions add action drop index 10 sudo tc actions add action ok index 12 sudo tc actions ls action gact sudo tc actions flush action gact See the event window reporting two entries (doing another listing should show empty generic actions) Signed-off-by: Jamal Hadi Salim --- tc/m_action.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tc/m_action.c b/tc/m_action.c index 5cd5e67..7dbcf5b 100644 --- a/tc/m_action.c +++ b/tc/m_action.c @@ -249,37 +249,38 @@ static int tc_print_one_action(FILE * f, struct rtattr *arg) { - struct rtattr *tb[TCA_ACT_MAX + 1]; + struct rtattr *tb[TCA_MAX + 1]; int err = 0; struct action_util *a = NULL; if (arg == NULL) return -1; - parse_rtattr_nested(tb, TCA_ACT_MAX, arg); - if (tb[TCA_ACT_KIND] == NULL) { + parse_rtattr_nested(tb, TCA_MAX, arg); + if (tb[TCA_KIND] == NULL) { fprintf(stderr, "NULL Action!\n"); return -1; } - a = get_action_kind(RTA_DATA(tb[TCA_ACT_KIND])); + a = get_action_kind(RTA_DATA(tb[TCA_KIND])); if (NULL == a) return err; if (tab_flush) { - fprintf(f," %s \n", a->id); + __u32 *delete_count = RTA_DATA(tb[TCA_FCNT]); + fprintf(f," %s (%d entries)\n", a->id, *delete_count); tab_flush = 0; return 0; } - err = a->print_aopt(a,f,tb[TCA_ACT_OPTIONS]); + err = a->print_aopt(a,f,tb[TCA_OPTIONS]); if (0 > err) return err; - if (show_stats && tb[TCA_ACT_STATS]) { + if (show_stats && tb[TCA_STATS]) { fprintf(f, "\tAction statistics:\n"); print_tcstats2_attr(f, tb[TCA_ACT_STATS], "\t", NULL); fprintf(f, "\n");