From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7D67942DF8; Fri, 7 Jul 2023 14:51:44 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F035C406B5; Fri, 7 Jul 2023 14:51:43 +0200 (CEST) Received: from mail-ua1-f49.google.com (mail-ua1-f49.google.com [209.85.222.49]) by mails.dpdk.org (Postfix) with ESMTP id 0A7D140685 for ; Fri, 7 Jul 2023 14:51:42 +0200 (CEST) Received: by mail-ua1-f49.google.com with SMTP id a1e0cc1a2514c-784f7f7deddso715354241.3 for ; Fri, 07 Jul 2023 05:51:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688734301; x=1691326301; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=+8L7Za2MZbRRtOj0qmtpIq6AYs1ZaNUhfDKfhR7/GUM=; b=ccyGYck1712YujTAAt4C8gKaRRGPxL26aJTq1iUSZSBQ81GAOZRUr2RGs/lVIDJD2U pvvx0/03N/JltG1WqQlAu1sisW4Ez9LTkzVdvEs8esOAJIlqTRopEgUCPVo41sOoBa8k CA6j4jx09tDxopeZ3PM+H3q64WmdRwb6gDYAHyEp2WyMNQDEYkWB4PtKd3YE3jQBEuBa DD9NusI5eqdrgNHn8qAaxL6kQdoovKOCT5dIJfBFb3n2+y9isGsh4yuoHPQKFLyXo6Fg TQio4Yq6o6ulXqSvSICVXnB8OQv/px2CH81fUTTX94DO6+eowU+z/9KoIFLOVmyNgwmK h1NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688734301; x=1691326301; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+8L7Za2MZbRRtOj0qmtpIq6AYs1ZaNUhfDKfhR7/GUM=; b=jILISZXUnJqx5AfQ6uWLHgymiWek2wbcRbbme447Qesw9yvk60bIsZbEj5ywgU3N3r TBs9Gxlg4euMowND9F5kQjSN+sur/9NOy2IWHJhVEQ9mouaQThhEE+JVmog/jmQdmqyK CTXnQTUKITtQhp6JSoAkY6AsQDBlAiFLYkLPaVCfVJh5rCkFCdrNdXDotE0uMy5y9WqX eWMcRmViiOWik77rQCV5DuZ8dyfu7mY6U2P+WXE9FlLzvVdxsoEQVSXyIRM8dHG4qjOX 3xr88UeSiuAyLO+MGI/F8kH36+1HoJtGcAGv82a1UvpafuVsvIfSiJaDwpknMWl2/yXx kTqA== X-Gm-Message-State: ABy/qLa0gWIwVzpvDlI10kqzUuxK6qEIZheoszR2x5uqnfFU01CJTyWI HLx6ed6sI92uz0MxCaJVfPT9jVLnolAmyBY9pUE= X-Google-Smtp-Source: APBJJlEMvg7T3Y/3PPDLlnatRKivrI3WGSYDtMg8MSbdo5y7jRJKcpwTrP/498vEH9pVrHAdy214bTHnc4nMnas75Us= X-Received: by 2002:a67:ead2:0:b0:443:4f72:fd35 with SMTP id s18-20020a67ead2000000b004434f72fd35mr3262314vso.1.1688734301310; Fri, 07 Jul 2023 05:51:41 -0700 (PDT) MIME-Version: 1.0 References: <20230418084613.52740-1-shaw.leon@gmail.com> <05b87294-0b96-804c-f4e7-0fc3b3ccbbf4@intel.com> In-Reply-To: From: Xiao Liang Date: Fri, 7 Jul 2023 20:51:05 +0800 Message-ID: Subject: Re: [EXT] [PATCH] ipsec: fix NAT-T length calculation To: Radu Nicolau Cc: Konstantin Ananyev , Akhil Goyal , Konstantin Ananyev , Vladimir Medvedkin , "dev@dpdk.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > sa->hdr_len and prm->tun.hdr_len don't include L2 length so both should > start in the diagram at the end of the ETH header. > > So the right way to compute datagram length is > > dgram_len = mb->pkt_len - sqh_len - sa->hdr_l3_off - sa->hdr_len + > sizeof(struct rte_udp_hdr) > |<- mb->pkt_len - sqh_len ->| |<- sa->hdr_l3_off ->|<- sa->hdr_len ->| |<- udph->dgram_len ->| +--------------------+------------+-----+-----+---------+-----+ | ETH | IP | UDP | ESP | payload | sqh | +--------------------+------------+-----+-----+---------+-----+ |<- sa->hdr_l3_off ->|<- l3_len ->| |<- sa->hdr_len ->| If hdr_len doesn't include L2 length, I would agree that dgram_len = mb->pkt_len - sqh_len - sa->hdr_l3_off - sa->hdr_len + sizeof(struct rte_udp_hdr) But then what's the point of sa->hdr_len - sa->hdr_l3_off in lib/ipsec/sa.c?