From patchwork Sun May 14 08:17:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Vadai X-Patchwork-Id: 762106 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 3wQc681KPPz9s8V for ; Sun, 14 May 2017 18:18:08 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751614AbdENIR6 (ORCPT ); Sun, 14 May 2017 04:17:58 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:36638 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751403AbdENIRw (ORCPT ); Sun, 14 May 2017 04:17:52 -0400 Received: by mail-wr0-f196.google.com with SMTP id v42so11188954wrc.3 for ; Sun, 14 May 2017 01:17:51 -0700 (PDT) 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:in-reply-to :references; bh=JPpwIQoRHMLLzBLhmzfDReh7qOCjTn9FFN8DuVWar9k=; b=h7Uem15oOQCWn76dxmGlNz2u3kpdO3CcbvYfdsP9bUup00ASmaGT/d8CYrYtDJ11Fg uZiqeMhDWsT1WsS7TDiuPfzcImTIepX6ZXMJCQW0AxOgoaF/Y1IGi+I/fOuNgrcwiruu pXbIrgAJb0W7u2eKscDuYp02Oe7h5ImC2MhpYJOYoM5WUQrTEA07545SzLXeq6EV0eFe vPRMA806II7cB92waKZIh6EZIm7rlnrgcjr4ujAgR+WhgUQamzO5K2izqjkzHBUr0YdT Sftdj4AIAocBwwIj/mCbgD/+LyeAwgx3MKaV/h6EfYZGLAqOq7oUppuhmRgjUJTx6RGU XyhA== X-Gm-Message-State: AODbwcDGEwvHKwcA7iew0D5PZf1ElUOUrIc74giFyPxy1y/z6HN0XPGY bO5Z1J3D6ar+nA== X-Received: by 10.223.174.200 with SMTP id y66mr396651wrc.79.1494749870673; Sun, 14 May 2017 01:17:50 -0700 (PDT) Received: from office.vadai.me ([192.116.94.216]) by smtp.gmail.com with ESMTPSA id y190sm7836707wmy.15.2017.05.14.01.17.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 May 2017 01:17:49 -0700 (PDT) From: Amir Vadai To: Stephen Hemminger Cc: netdev@vger.kernel.org, Or Gerlitz , Amir Vadai Subject: [PATCH iproute2 master 3/4] pedit: Check for extended capability in protocol parser Date: Sun, 14 May 2017 11:17:45 +0300 Message-Id: <20170514081746.9010-4-amir@vadai.me> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170514081746.9010-1-amir@vadai.me> References: <20170514081746.9010-1-amir@vadai.me> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Do not allow using eth and udp header types if non-extended pedit kABI is being used. Other protocol parsers already have this check. Signed-off-by: Amir Vadai --- tc/p_eth.c | 3 +++ tc/p_udp.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/tc/p_eth.c b/tc/p_eth.c index ad3e28f80eb6..2d2f96ca2f0f 100644 --- a/tc/p_eth.c +++ b/tc/p_eth.c @@ -34,6 +34,9 @@ parse_eth(int *argc_p, char ***argv_p, if (argc < 2) return -1; + if (!sel->extended) + return -1; + tkey->htype = TCA_PEDIT_KEY_EX_HDR_TYPE_ETH; if (strcmp(*argv, "type") == 0) { diff --git a/tc/p_udp.c b/tc/p_udp.c index a56a1b519254..3916d9586040 100644 --- a/tc/p_udp.c +++ b/tc/p_udp.c @@ -34,6 +34,9 @@ parse_udp(int *argc_p, char ***argv_p, if (argc < 2) return -1; + if (!sel->extended) + return -1; + tkey->htype = TCA_PEDIT_KEY_EX_HDR_TYPE_UDP; if (strcmp(*argv, "sport") == 0) {