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 7A2C742E3A; Mon, 10 Jul 2023 11:24:57 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 694A240C35; Mon, 10 Jul 2023 11:24:57 +0200 (CEST) Received: from forward500b.mail.yandex.net (forward500b.mail.yandex.net [178.154.239.144]) by mails.dpdk.org (Postfix) with ESMTP id 5BC6C40698 for ; Mon, 10 Jul 2023 11:24:56 +0200 (CEST) Received: from mail-nwsmtp-smtp-production-main-84.iva.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-84.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:332f:0:640:4ab4:0]) by forward500b.mail.yandex.net (Yandex) with ESMTP id A61125E942; Mon, 10 Jul 2023 12:24:55 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-84.iva.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id qOU6VbRDXSw0-Ub5BorSd; Mon, 10 Jul 2023 12:24:54 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1688981094; bh=QPtGft4ijuDxHU5DeidoyDM1/zJjMX/fawJa5jufXYQ=; h=From:In-Reply-To:Cc:Date:References:To:Subject:Message-ID; b=JY72FRwndWUfxqUPfhZhB8nsKZEhBCiMc2FUQgvW3Khbv6q5vPeov5ciycc7DsGCL niGMiGGIzu3g/UZphziMI6GWI25sLlpvTGdI/9WsdSYl4uQIVJyXt7K4NtkhL48lso WcX09xRcBXn72LJMnU/o+LtkP3hocZyAisVIQUaI= Authentication-Results: mail-nwsmtp-smtp-production-main-84.iva.yp-c.yandex.net; dkim=pass header.i=@yandex.ru Message-ID: Date: Mon, 10 Jul 2023 10:24:52 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [EXT] [PATCH] ipsec: fix NAT-T length calculation Content-Language: en-US To: Radu Nicolau , Xiao Liang Cc: Konstantin Ananyev , Akhil Goyal , Vladimir Medvedkin , "dev@dpdk.org" References: <20230418084613.52740-1-shaw.leon@gmail.com> <05b87294-0b96-804c-f4e7-0fc3b3ccbbf4@intel.com> From: Konstantin Ananyev In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 07/07/2023 14:26, Radu Nicolau пишет: > > On 07-Jul-23 1:51 PM, Xiao Liang wrote: >>> 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? > > I will defer to Konstantin for a definite answer, that is if sa->hdr_len > is supposed to include l2 length / offset or not. If it does, then the > change that triggered this discussion is correct and we don't need to > account for hdr_l3_off there. > Ok, have to revive my memories here. So, actually hdr_len stands for all tunell headers users want to add. It consits of optional l2_len (could be zero) plus outer ip len, plus in that case udp hdr len. hdr_l3_off is an offset withih hdr_len where outer ip header starts. So yep, initial patch looks ok to me, I just acked it. Sorry for being a bit sloppy at reviewing it.