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 1823A42DE7; Thu, 6 Jul 2023 12:20:33 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AFA78410FA; Thu, 6 Jul 2023 12:20:32 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id F211840A79 for ; Thu, 6 Jul 2023 12:20:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1688638831; x=1720174831; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=4lq9ZvQTMNB7ldff+ZV84bPEU51+gqrQLSbEuXQ6k+Y=; b=J3PrsoLak23NR6RvN53afFynPTGZBZoa4Incnr20GDzwNgw4EKEXBdRE 6+YOTSr5flv7OlhqSmTqpNzsy5bLQeyTlyU00UMfwOKUMqDZ6xELtgi9g yL/V0G1ZynLhme8p3TD0y1Qbdcvhv5rR6IRZSBtUJuXpQi8yTD8xaC5Ls 5Vt7chQiWyKjmo741Rlmi/9ZodfxI57P/Ieqb01Vj0GVGmbgAeRqhMMfG LOAXx/TtHyMxExI/Z039qdMguGB5a7K3bMmNIJl7Y24/OxKxXRQ0m0Phc QENSP8ua2PHHvIeKGA5+kEZkHTDJjKvF2V4jans5iS5f0eAI5ZTFfPywY A==; X-IronPort-AV: E=McAfee;i="6600,9927,10762"; a="449924095" X-IronPort-AV: E=Sophos;i="6.01,185,1684825200"; d="scan'208";a="449924095" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2023 03:20:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10762"; a="864055312" X-IronPort-AV: E=Sophos;i="6.01,185,1684825200"; d="scan'208";a="864055312" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga001.fm.intel.com with ESMTP; 06 Jul 2023 03:20:29 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Thu, 6 Jul 2023 03:20:29 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Thu, 6 Jul 2023 03:20:28 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27 via Frontend Transport; Thu, 6 Jul 2023 03:20:28 -0700 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (104.47.51.46) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.27; Thu, 6 Jul 2023 03:20:28 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iNnBFROzSnojH6CyP94x+t/eMCutAA/+lWieYx3TDxQC63BpNzYFp7YDo6l1dIzxLfEywGcjQOTwvICyRVN1+we0Jc8p5yEQYFz+NctIWJHPwtWyku4eDSslyM+RI5eZnKiDzua3agZEYBab60ufcRPCQ9NJEJR9UiBrgMmuc9+vGNwLQsc2hsirFJD2jktbaVkexWxhnUPpVd0IX+n3LkPhAGV06iO1KhpcAjueaSy8JKQLJV7uk+YP+2bdtHVwb0n8ZlHOWnwBV4j/D80ySdZAMX4PXnO/AX4OTOnJvGEx9vBmTffv2o1N2OLRuV/M0BwNGTavuJGZKIVQht6VHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8k6bYrdvX6reeTqJ66nEgKsnC18zbzEdXJdiqUsO3t8=; b=OUWWIdO+Dqehy3DDxQ+YvHGmWGn0NKt4140AAMDxpSnyU0PZJnE8gPpAuCBlgOGZXGxEtFS2i1HQXd78SgsLeHW09SO4X3lFNrpin/cEe6OO3LKOsvCPdOP/apoiqG8i1+PthTS1XVT7HZl8sqZ1AZ+E5IvnIYcRxuue8I4BvMXPS+LgJBvDbXNapWa8iPK/UqFSfAJSc9iIEpqkYAs1vAbq+5BUo/VjEcWuf81OIr8uacFbiBB/ReCDbhPVsyNXeSWDJp55LFmdMuzxJlnTBxPG1gfNxKEXm8fwtGwQYHaj2Ss5glBIeIB58KyFManEG4+9Mxil368CE/YT9jSBng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DM8PR11MB5653.namprd11.prod.outlook.com (2603:10b6:8:25::8) by IA1PR11MB7388.namprd11.prod.outlook.com (2603:10b6:208:420::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.24; Thu, 6 Jul 2023 10:20:25 +0000 Received: from DM8PR11MB5653.namprd11.prod.outlook.com ([fe80::9d26:3f6:8afa:4543]) by DM8PR11MB5653.namprd11.prod.outlook.com ([fe80::9d26:3f6:8afa:4543%6]) with mapi id 15.20.6565.016; Thu, 6 Jul 2023 10:20:25 +0000 Message-ID: <05b87294-0b96-804c-f4e7-0fc3b3ccbbf4@intel.com> Date: Thu, 6 Jul 2023 11:20:18 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [EXT] [PATCH] ipsec: fix NAT-T length calculation To: Konstantin Ananyev , Akhil Goyal , Xiao Liang , Konstantin Ananyev , Vladimir Medvedkin CC: "dev@dpdk.org" References: <20230418084613.52740-1-shaw.leon@gmail.com> Content-Language: en-US From: Radu Nicolau In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: FR0P281CA0208.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:ad::16) To DM8PR11MB5653.namprd11.prod.outlook.com (2603:10b6:8:25::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM8PR11MB5653:EE_|IA1PR11MB7388:EE_ X-MS-Office365-Filtering-Correlation-Id: 59909abf-1ee9-4d81-2834-08db7e0a9ca4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4cAcxCQ4MF3JfLQI47g7nep6uEHDbEZlqRoI6/GMuVGiNKzBZtNqzFK+KHBrlk7Gafw5/UeTZIYci0cfRsJQ+ZOJlDG/0DjYnC+P+oEglb9XUGNLv/it6//0AyZcBwWTEUktP5mKqLJx2mHTV1Zz1ZFAHR3K6PdcTQr0GsFSgJ8n3er3EYqFxHjbUNDEGINm/euuvppdNCvQz13Z5TBkcK6ILy3ADUggJOmkWrrcw98m0U7RzMX/vLhfJLwKPbWVsHPGDgG2uNf3S/jdXRUKX9kztbRl4PoOu4xc4PjnyM30Qd/oKgal6Pq4TENZyFmPKQ3RYbq2evZSV9vGr5GSF6sEl3J5e+StrUGuKuECL3tKuNWtfNarjNhrIE0dL1HJkIRKxarjOu0isy9DodiLnfMAbZdEonNjHCRPoHEsLN4odn9DSKcq7AKi5S49sDJlROWFVL1zlNGHzVsJFLxsLU4/iNTcy4Omb5LbMZOvwYFzO1dWLwdvCnaL9t6tJBFAuuI9bmTlk0BoJulbLgnOKamx9SHG0mM9G9VHKVnY9K7Hx5ZuhXki2MtbwVO/5/Zj3jLGFlSoYWaDFPKyHo/MJAkJhTpo5mfzpZ97J288iMnY5cEqZ0Rrd1gIVOZDDOh/4RS98g1ctma7d1OnWND9RQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM8PR11MB5653.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(396003)(39860400002)(366004)(136003)(376002)(346002)(451199021)(5660300002)(66476007)(66556008)(6636002)(4326008)(66946007)(44832011)(38100700002)(41300700001)(8936002)(316002)(8676002)(86362001)(31696002)(36756003)(2906002)(6486002)(31686004)(6666004)(83380400001)(55236004)(53546011)(6506007)(26005)(186003)(6512007)(2616005)(82960400001)(110136005)(478600001)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Rmx5TkxSYVF3MlFMeHJNMFpmdDBKS1RTS1Jqd0EyVGszbk95S21hR2h1Ykpn?= =?utf-8?B?b1lzY2o1Slo3SitZaFlzdStTd3A5WUxSYXRqZzNHV3ZSengyYnFaS1pxZUZh?= =?utf-8?B?cHAwWmhtcFlWdkljdVlOVTRUczREbWVWc09LOEdSM25VcVUycFBsRFZacER6?= =?utf-8?B?cGp5dkx0amRLTGlVZjIwbjlpS09sOE5pYlN2QWlJaTU2VGt2a0lLRmVkcW5I?= =?utf-8?B?WElaSU5HYy9HMEY5S1luV2t6Yktrd1Y3Z3ExNFZsdEJDKzdWU2xVeHQ0bG11?= =?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xdVh3L1RUblc3L3hBZnZCMGs5?= =?utf-8?B?VFgxUWpXdmp6YUtvQ3VUSFBuMmFVSm5iMDZuNGJkbkRxVnpTOVV1U3NUMUhX?= =?utf-8?B?L3c9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: 59909abf-1ee9-4d81-2834-08db7e0a9ca4 X-MS-Exchange-CrossTenant-AuthSource: DM8PR11MB5653.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2023 10:20:25.0271 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: W7sCHJM9AM0Nu7Xykuz1Vt1HIm1UqkFuFYdhCdulkcfIEXr4VHfIZkFo1qokp+V5WbPAy4IGJIOl10WVDBCFFg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR11MB7388 X-OriginatorOrg: intel.com 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 On 06-Jul-23 10:08 AM, Konstantin Ananyev wrote: > Hi Akhil, > >> Hi Konstantin, >> Can you review this patch? >> >>> UDP header length is included in sa->hdr_len. Take care of that in >>> L3 header and pakcet length calculation. >>> >>> Fixes: 01eef5907fc3 ("ipsec: support NAT-T") >>> >>> Signed-off-by: Xiao Liang >>> --- >>> lib/ipsec/esp_outb.c | 2 +- >>> lib/ipsec/sa.c | 2 +- >>> 2 files changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/lib/ipsec/esp_outb.c b/lib/ipsec/esp_outb.c >>> index 9cbd9202f6..ec87b1dce2 100644 >>> --- a/lib/ipsec/esp_outb.c >>> +++ b/lib/ipsec/esp_outb.c >>> @@ -198,7 +198,7 @@ outb_tun_pkt_prepare(struct rte_ipsec_sa *sa, >>> rte_be64_t sqc, >>> struct rte_udp_hdr *udph = (struct rte_udp_hdr *) >>> (ph + sa->hdr_len - sizeof(struct rte_udp_hdr)); >>> udph->dgram_len = rte_cpu_to_be_16(mb->pkt_len - sqh_len - >>> - sa->hdr_l3_off - sa->hdr_len); >>> + sa->hdr_len + sizeof(struct rte_udp_hdr)); > To be honest, it is not clear to me why we shouldn't take into account sa->hdr_l3_off > any more. > Probably the author can explain. > Also would like author of NAT-T support to chime in. > Radu, any comments on that patch? I agree, hdr_l3_off should not be ignored. Also sa->hdr_len already includes the size of UDP header, see line 366 in esp_outb_tun_init in sa.c (or the line above this change, where the udph pointer is computed assuming this) > Thanks > Konstantin > >>> } >>> >>> /* update original and new ip header fields */ >>> diff --git a/lib/ipsec/sa.c b/lib/ipsec/sa.c >>> index 59a547637d..2297bd6d72 100644 >>> --- a/lib/ipsec/sa.c >>> +++ b/lib/ipsec/sa.c >>> @@ -371,7 +371,7 @@ esp_outb_tun_init(struct rte_ipsec_sa *sa, const struct >>> rte_ipsec_sa_prm *prm) >>> >>> /* update l2_len and l3_len fields for outbound mbuf */ >>> sa->tx_offload.val = rte_mbuf_tx_offload(sa->hdr_l3_off, >>> - sa->hdr_len - sa->hdr_l3_off, 0, 0, 0, 0, 0); >>> + prm->tun.hdr_len - sa->hdr_l3_off, 0, 0, 0, 0, 0); >>> >>> esp_outb_init(sa, sa->hdr_len, prm->ipsec_xform.esn.value); >>> } >>> -- >>> 2.40.0