From patchwork Fri Oct 13 08:04:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Duszynski X-Patchwork-Id: 30336 X-Patchwork-Delegate: pablo.de.lara.guarch@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BC5141B324; Fri, 13 Oct 2017 10:04:49 +0200 (CEST) Received: from mail-lf0-f47.google.com (mail-lf0-f47.google.com [209.85.215.47]) by dpdk.org (Postfix) with ESMTP id 4E96C1B31A for ; Fri, 13 Oct 2017 10:04:48 +0200 (CEST) Received: by mail-lf0-f47.google.com with SMTP id 90so8639657lfs.13 for ; Fri, 13 Oct 2017 01:04:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=KTDGQwLUBxDHu8ydAT5LxCH6Kc3ZGCa3JoozR1e3YA8=; b=pCrU5tmd83/lvbCXSpVb7VnSI60yryiK0Xm4DcyvSVJsdhnvWrhJCd1DEAVo4v9aDV LRFyut3oJGxDiijfO00bjci0KGKcnqsWAMEd0a05zzbuGDh3LQrQlJKpxibSeRQM87Fk 6nAR6KN9TaUxTF/HsTWuWULPlxCm9h8y7eo9SpJfa8Zn321IZdRHLzMmbojFRGrCnCCu RthFE7THCnlkKUruZwE1ZKfdPYzZH0prAi5lY1Wxzg/GAimAR6kKIeIuMPSoh6P6DIm2 q25xYBxqISWXxvj70dPpsxS1sTJA98v+ou7eZTurCVraLLgr1nfvYDya3ulLas+sEXy6 o/Ng== 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=KTDGQwLUBxDHu8ydAT5LxCH6Kc3ZGCa3JoozR1e3YA8=; b=fz6hTHWlHtCMWQv0ik+0RixYZnBAtwnLosTEQoizO1s9JAuXqmgshszyQPoqSq9dIS L4TDqQ8rs0KEXPLZyToosQ/0AiEGIVkwhoDQkS84+PPLVuDU/P1qaEA3bxSMYbSNRoE+ RJbDrDasUJP5aLeXRZoxEHOZYCdgbRAebDBiuH0OkukPiB7oFkquNUeWE8Dv7lCCTrub hW5RkvkXJWYjHa/VLty8/HK0v/a+mFpAYMCQTHwndNeYqu429qSbuKPk/KyXDEcV436+ Vo/R2zBJzn4Es+7fVC5DVZtEiM6IXQLwmiuiyoTLZuib0scyvP5kYvtC+x0T7ipUQ7WZ 39Ew== X-Gm-Message-State: AMCzsaU1btC+bSvG5i6fPVnmftNs+6NgLlVHPFr95sKbgVSteSEgFfKp INUT2t3QGNleVYUkHcrZyl06NMO75eE= X-Google-Smtp-Source: ABhQp+Sg01RpaB4BsnVaD+qPsq6OqKGUzL/Jqsaf7pKngmvhWmsJBCMvqwwKU0Kw/W+VVoh5T7K73A== X-Received: by 10.46.5.15 with SMTP id 15mr251520ljf.157.1507881887650; Fri, 13 Oct 2017 01:04:47 -0700 (PDT) Received: from tdu.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id o41sm73353lfi.93.2017.10.13.01.04.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Oct 2017 01:04:46 -0700 (PDT) From: Tomasz Duszynski To: dev@dpdk.org Cc: Tomasz Duszynski Date: Fri, 13 Oct 2017 10:04:36 +0200 Message-Id: <1507881876-20286-1-git-send-email-tdu@semihalf.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] examples/ipsec-secgw: set ip6_plen to the proper value 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" ipv6 payload length header field should contain only the number of bytes following the ipv6 header and not the entire packet size. Fixes: f159e70b0922 ("examples/ipsec-secgw: support transport mode") Fixes: 906257e965b7 ("examples/ipsec-secgw: support IPv6") Signed-off-by: Tomasz Duszynski Acked-by: Sergio Gonzalez Monroy --- examples/ipsec-secgw/esp.c | 6 ++++-- examples/ipsec-secgw/ipip.h | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/ipsec-secgw/esp.c b/examples/ipsec-secgw/esp.c index 70bb81f..2897840 100644 --- a/examples/ipsec-secgw/esp.c +++ b/examples/ipsec-secgw/esp.c @@ -211,7 +211,8 @@ esp_inbound_post(struct rte_mbuf *m, struct ipsec_sa *sa, /* XXX No option headers supported */ memmove(ip6, ip, sizeof(struct ip6_hdr)); ip6->ip6_nxt = *nexthdr; - ip6->ip6_plen = htons(rte_pktmbuf_data_len(m)); + ip6->ip6_plen = htons(rte_pktmbuf_data_len(m) - + sizeof(struct ip6_hdr)); } } else ipip_inbound(m, sizeof(struct esp_hdr) + sa->iv_len); @@ -313,7 +314,8 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, } else { ip6 = (struct ip6_hdr *)new_ip; ip6->ip6_nxt = IPPROTO_ESP; - ip6->ip6_plen = htons(rte_pktmbuf_data_len(m)); + ip6->ip6_plen = htons(rte_pktmbuf_data_len(m) - + sizeof(struct ip6_hdr)); } } diff --git a/examples/ipsec-secgw/ipip.h b/examples/ipsec-secgw/ipip.h index ff1dccd..93393d5 100644 --- a/examples/ipsec-secgw/ipip.h +++ b/examples/ipsec-secgw/ipip.h @@ -72,7 +72,8 @@ ipip_outbound(struct rte_mbuf *m, uint32_t offset, uint32_t is_ipv6, /* Per RFC4301 5.1.2.1 */ outip6->ip6_flow = htonl(IP6_VERSION << 28 | ds_ecn << 20); - outip6->ip6_plen = htons(rte_pktmbuf_data_len(m)); + outip6->ip6_plen = htons(rte_pktmbuf_data_len(m) - + sizeof(struct ip6_hdr)); outip6->ip6_nxt = IPPROTO_ESP; outip6->ip6_hops = IPDEFTTL;