From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 7F138214A for ; Fri, 6 Jan 2017 18:21:51 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP; 06 Jan 2017 09:21:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,325,1477983600"; d="scan'208,223";a="919672592" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga003.jf.intel.com with ESMTP; 06 Jan 2017 09:21:50 -0800 Received: from bgsmsx105.gar.corp.intel.com (10.223.43.197) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 6 Jan 2017 09:21:50 -0800 Received: from BGSMSX108.gar.corp.intel.com ([169.254.8.175]) by BGSMSX105.gar.corp.intel.com ([169.254.3.108]) with mapi id 14.03.0248.002; Fri, 6 Jan 2017 22:51:47 +0530 From: "Jyoti, Anand B" To: "dev@dpdk.org" Thread-Topic: [PATCH] examples/ip_pipeline: check vlan and mpls params Thread-Index: AdJoQVrCkBsL7Q9OQwO6LfsggR2HIA== Date: Fri, 6 Jan 2017 17:21:46 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMjFjOGFhMjktMDQwZC00MmIyLTlkODUtMWU0NzFmNTEwYTZkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjIuMTEuMCIsIlRydXN0ZWRMYWJlbEhhc2giOiJOcjlaSmVNUSt4QlFmUEo4RG5QUDNoVm45ekg1U2JTMEw1YnQ5MHFyTjlFPSJ9 x-originating-ip: [10.223.10.10] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] examples/ip_pipeline: check vlan and mpls params X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jan 2017 17:21:51 -0000 >>From e346e359ed9c5e8261f09f93629bff56d7c10a11 Mon Sep 17 00:00:00 2001 From: "Jyoti, Anand B" Date: Fri, 6 Jan 2017 08:40:55 +0530 Subject: [PATCH] examples/ip_pipeline: check vlan and mpls params This commit add to CLI command check for the following errors 1. svlan and cvlan IDs greater than 12 bits 2. mpls ID greater than 20 bits 3. max number of supported mpls labels to avoid array overflow It prevents running CLI commands with invalid parameters. Signed-off-by: Jyoti, Anand B Acked-by: Cristian Dumitrescu --- examples/ip_pipeline/pipeline/pipeline_routing.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/examples/ip_pipeline/pipeline/pipeline_routing.c b/examples/ip= _pipeline/pipeline/pipeline_routing.c index 3aadbf9..3deaff9 100644 --- a/examples/ip_pipeline/pipeline/pipeline_routing.c +++ b/examples/ip_pipeline/pipeline/pipeline_routing.c @@ -494,6 +494,26 @@ app_pipeline_routing_add_route(struct app_params *app, /* data */ if (data->port_id >=3D p->n_ports_out) return -1; + + /* Valid range of VLAN tags 12 bits */ + if (data->flags & PIPELINE_ROUTING_ROUTE_QINQ) + if ((data->l2.qinq.svlan & 0xF000) || + (data->l2.qinq.cvlan & 0xF000)) + return -1; + + /* Max number of MPLS labels supported */ + if (data->flags & PIPELINE_ROUTING_ROUTE_MPLS) { + uint32_t i; + + if (data->l2.mpls.n_labels > + PIPELINE_ROUTING_MPLS_LABELS_MAX) + return -1; + + /* Max MPLS label value 20 bits */ + for (i =3D 0; i < data->l2.mpls.n_labels; i++) + if (data->l2.mpls.labels[i] & 0xFFF00000) + return -1; + } } break; =20 --=20 2.7.4