From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <anatoly.burakov@intel.com>
Received: from mga12.intel.com (mga12.intel.com [192.55.52.136])
 by dpdk.org (Postfix) with ESMTP id 598BD3195;
 Tue,  6 Nov 2018 11:53:48 +0100 (CET)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga006.fm.intel.com ([10.253.24.20])
 by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 06 Nov 2018 02:53:47 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.54,471,1534834800"; d="scan'208";a="278717670"
Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.237.220.143])
 ([10.237.220.143])
 by fmsmga006.fm.intel.com with ESMTP; 06 Nov 2018 02:53:46 -0800
To: Konstantin Ananyev <konstantin.ananyev@intel.com>, dev@dpdk.org
Cc: stable@dpdk.org, ryan.e.hall@intel.com, alexander.v.gutkin@intel.com
References: <1541413603-4792-1-git-send-email-konstantin.ananyev@intel.com>
 <1541420338-300-3-git-send-email-konstantin.ananyev@intel.com>
From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
Message-ID: <d93bfd0d-b02b-bb57-18c4-75c514606cbf@intel.com>
Date: Tue, 6 Nov 2018 10:53:45 +0000
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
 Thunderbird/52.9.1
MIME-Version: 1.0
In-Reply-To: <1541420338-300-3-git-send-email-konstantin.ananyev@intel.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-dev] [PATCH v2 2/2] ip_frag: use key length for key
 comparision
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 06 Nov 2018 10:53:48 -0000

On 05-Nov-18 12:18 PM, Konstantin Ananyev wrote:
> Right now reassembly code relies on src_dst[] being all zeroes to
> determine is it  free/occupied entry in the fragments table.
> This is suboptimal and error prone - user can crash DPDK ip_reassembly
> app by something like the following scapy script:
> x=Ether(src=...,dst=...)/IP(dst='0.0.0.0',src='0.0.0.0',id=0)/('X'*1000)
> frags=fragment(x, fragsize=500)
> sendp(frags, iface=...)
> To overcome that issue and reduce overhead of
> 'key invalidate'  and 'key is empty' operations -
> add key_len into keys comparision procedure.
> 
> Fixes: 4f1a8f633862 ("ip_frag: add IPv6 reassembly")
> Cc: stable@dpdk.org
> 
> Reported-by: Ryan E Hall <ryan.e.hall@intel.com>
> Reported-by: Alexander V Gutkin <alexander.v.gutkin@intel.com>
> Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> ---



> @@ -44,9 +44,17 @@ struct ip_frag {
>   
>   /** @internal <src addr, dst_addr, id> to uniquely identify fragmented datagram. */
>   struct ip_frag_key {
> -	uint64_t src_dst[4];      /**< src address, first 8 bytes used for IPv4 */
> -	uint32_t id;           /**< dst address */
> -	uint32_t key_len;      /**< src/dst key length */
> +	uint64_t src_dst[4];
> +	/**< src and dst address, only first 8 bytes used for IPv4 */
> +	RTE_STD_C11
> +	union {
> +		uint64_t id_key_len; /**< combined for easy fetch */
> +		__extension__
> +		struct {
> +			uint32_t id;       /**< packet id */
> +			uint32_t key_len;  /**< src/dst key length */
> +		};
> +	};
>   };

Would that break ABI?

>   
>   /**
> 


-- 
Thanks,
Anatoly