From patchwork Tue Nov 6 03:23:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 993499 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@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=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=netronome.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=netronome-com.20150623.gappssmtp.com header.i=@netronome-com.20150623.gappssmtp.com header.b="oR19gQ4+"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 42pvym1fqNz9sBk for ; Tue, 6 Nov 2018 14:23:43 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729505AbeKFMqh (ORCPT ); Tue, 6 Nov 2018 07:46:37 -0500 Received: from mail-qk1-f196.google.com ([209.85.222.196]:34646 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727481AbeKFMqg (ORCPT ); Tue, 6 Nov 2018 07:46:36 -0500 Received: by mail-qk1-f196.google.com with SMTP id a132so17736801qkg.1 for ; Mon, 05 Nov 2018 19:23:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=DXeHPLvdCdXxdozTlvGJbwJciSfB1ZKXqnMSGWkdB+o=; b=oR19gQ4+OoYShV1P2I8Xw6iRoMYukJykCcNAHiRc8N1zzBlQV38CQJFrrVacy/h4eA HsGRP79+btQORRw2sKtNbwQHJbJBIO/RoVYsDvSPU81ODkZp06gmZNbPzsP+aj9hYpTd dbDjbPeg00ew/jGNre0fVBLfMdg+eMmKIVLw+2FPdyslAVVurex8zBR8x+4ZlvNtg0xL 8+qR1Iq6fc82vtCgJAJRmWq1X0cUqcpVr7J3W1+2UFy81wh0KklwCpDF8qhwUZyNKFZ8 GgJ7xPK/dx4o5GNaGqR23dgA0AnWDItgNDqk6YmU3nh6K5vWag91ZP+mkn6ijl4ug9RA ftXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=DXeHPLvdCdXxdozTlvGJbwJciSfB1ZKXqnMSGWkdB+o=; b=HJI9/TAeimZfhSb1q2XBgOLcIl9CMqSbCHg92VDQARTPAV+VVi1QqQOwvPR336LMcR eDPZQDZaB2hlr6O9KrtWNbr8ZV/78VlK3ODwnKZDVrC0OQQpFfcU9hihQooHJsBWdcuL BxB9mOdSTKIEq75pOc4Rb/yIkboyiJyPjZh5BQrhWc3hIzkVl8yGARbyaiXGok2uWsyF ryUJLnp1JG9o4xAoFGRkimEJltoVAeYDEnoQpGt0Iqf7HwICvEa58Y8yxHqYA+IqcTOj a/oHyt/4OWmm2MO8A+FtnVkHWQhzhCZaWtpirOVXLVj4gXYZ5kFgkKQ1fnaUEG3BN7lU rgjA== X-Gm-Message-State: AGRZ1gKfsI/MXYE4RFSLhfq5Ayrw712DKcbnh0/pe8Msr5auyJwpnRYm CSBzcOi6WG3HKxRkjNlD75wbmw== X-Google-Smtp-Source: AJdET5e5ry6jEN7V1FJ2bQNfCEvZ6ihB7E0KeZOcMCsDwvNpFEpV5YQYzGZ2TiO82GMWsQk6iNVe9g== X-Received: by 2002:a37:aa91:: with SMTP id t139mr22788302qke.139.1541474613747; Mon, 05 Nov 2018 19:23:33 -0800 (PST) Received: from jkicinski-Precision-T1700.netronome.com ([66.60.152.14]) by smtp.gmail.com with ESMTPSA id h67-v6sm26051715qkf.32.2018.11.05.19.23.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 19:23:32 -0800 (PST) From: Jakub Kicinski To: stephen@networkplumber.org, dsahern@gmail.com Cc: netdev@vger.kernel.org, oss-drivers@netronome.com, Jakub Kicinski Subject: [PATCH iproute2] tc: f_u32: allow skip_hw and skip_sw flags to be last Date: Mon, 5 Nov 2018 19:23:27 -0800 Message-Id: <20181106032327.9470-1-jakub.kicinski@netronome.com> X-Mailer: git-send-email 2.17.1 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org u32 uses NEXT_ARG() incorrectly when parsing skip_hw and skip_sw flags. NEXT_ARG() ensures there is another argument on the command line, and is used in handling syntax to move past and ensure there is a to read. Commit 5e5b3008d1fb ("tc: f_u32: Add support for skip_hw and skip_sw flags") seems to have copy pasted the handling from the previous command - "police", which needs an extra parameter and is kind of special due to the use of parse_police() helper. The combination of NEXT_ARG() and continue worked fine as long as skip_sw/skip_hw wasn't last, e.g.: $ tc filter add dev dummy0 ingress prio 101 protocol ipv6 \ u32 match ip6 priority 0xa0 0xe0 skip_hw action pass But would fail if it was last: $ tc filter add dev dummy0 ingress prio 101 protocol ipv6 \ u32 match ip6 priority 0xa0 0xe0 flowid :1 skip_hw Command line is not complete. Try option "help" Remove the NEXT_ARG()s and the continues, and let the argc--; argv++; at the end of the loop do its job. Fixes: 5e5b3008d1fb ("tc: f_u32: Add support for skip_hw and skip_sw flags") Signed-off-by: Jakub Kicinski --- tc/f_u32.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tc/f_u32.c b/tc/f_u32.c index bff4be637728..e0a322d5a11c 100644 --- a/tc/f_u32.c +++ b/tc/f_u32.c @@ -1147,13 +1147,9 @@ static int u32_parse_opt(struct filter_util *qu, char *handle, terminal_ok++; continue; } else if (strcmp(*argv, "skip_hw") == 0) { - NEXT_ARG(); flags |= TCA_CLS_FLAGS_SKIP_HW; - continue; } else if (strcmp(*argv, "skip_sw") == 0) { - NEXT_ARG(); flags |= TCA_CLS_FLAGS_SKIP_SW; - continue; } else if (strcmp(*argv, "help") == 0) { explain(); return -1;