From patchwork Mon Jan 29 11:13:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfgang Bumiller X-Patchwork-Id: 867064 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zVRhG2vBrz9s1h for ; Mon, 29 Jan 2018 22:13:18 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751370AbeA2LNP (ORCPT ); Mon, 29 Jan 2018 06:13:15 -0500 Received: from proxmox-new.maurer-it.com ([212.186.127.180]:19500 "EHLO proxmox-new.maurer-it.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750913AbeA2LNO (ORCPT ); Mon, 29 Jan 2018 06:13:14 -0500 Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id B058F43438; Mon, 29 Jan 2018 12:13:12 +0100 (CET) From: Wolfgang Bumiller To: netdev@vger.kernel.org Cc: Stephen Hemminger , Jiri Pirko Subject: [PATCH iproute2] police: don't skip parameters after actions Date: Mon, 29 Jan 2018 12:13:11 +0100 Message-Id: <20180129111311.21610-1-w.bumiller@proxmox.com> X-Mailer: git-send-email 2.11.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The 'parse_action_control()' helper advances the argument pointers to past its parsed action already, so don't advance it further in 'act_parse_polic()'. Fixes: e67aba559581 ("tc: actions: add helpers to parse and print control actions") Signed-off-by: Wolfgang Bumiller --- Basically parse_action_control() silently added a NEXT_ARG() while the cases before didn't have one. Not sure whether the goto is okay style-wise, let me know if you prefer some other solution. Example for triggering this: Specifying a 'flowid X' after a `police ... drop` will skip the 'flowid' and error with "What is X" $ tc filter add dev eth0 parent ffff: basic police rate 13371337bps burst 1337b mtu 64kb drop flowid :1 What is ":1"? ... tc/m_police.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tc/m_police.c b/tc/m_police.c index ff1dcb7d..f0878b3a 100644 --- a/tc/m_police.c +++ b/tc/m_police.c @@ -154,6 +154,7 @@ int act_parse_police(struct action_util *a, int *argc_p, char ***argv_p, matches(*argv, "goto") == 0) { if (parse_action_control(&argc, &argv, &p.action, false)) return -1; + goto keep_arg; } else if (strcmp(*argv, "conform-exceed") == 0) { NEXT_ARG(); if (parse_action_control_slash(&argc, &argv, &p.action, @@ -174,8 +175,9 @@ int act_parse_police(struct action_util *a, int *argc_p, char ***argv_p, } else { break; } - ok++; argc--; argv++; +keep_arg: + ok++; } if (!ok)