From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org C6605814BA DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 86DC6813D8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=9XfzzI0aJv3Oy+nsDPy+TYtpW6ng2Irz9hGaMbx6s3M=; b=5rhHSPdoK0FJ67VKVFj4aFRHClNSijowYb9fWpJW4uJ68ApzouzjidnMg3ri3TJjgR AvUhX2TFYEBy0Cvgu4B4hI/MTBl7BHWx4nf60ae5M6cjCIXKbDbA9itdkc7t1vx+/jJS vCIMuXA6tJGEIEKZ9afWTbSJM6igKlg/E4njTvoJEvhWAPyhZCWEm6dPlMfeJ/OTEZek Hrw1z0SYsCuZohYRB4Kr4wY5eo/30rkvHOR8vuCIFIBfvc4vLR9bwTtCBvhJU3WGdSl7 U8vaIBoDFokDorDz744nvY6yzYKzH0GNNG8C1CwuS6UXj9ONUAe9/51w+IOX3gmHq3Bm +sDQ== Message-ID: Date: Sun, 29 Jan 2023 12:10:22 +0200 MIME-Version: 1.0 Content-Language: en-US References: <3ca0fe4de1f701befbc874e4b672c90aee602199.1674752051.git.petrm@nvidia.com> From: Nikolay Aleksandrov In-Reply-To: <3ca0fe4de1f701befbc874e4b672c90aee602199.1674752051.git.petrm@nvidia.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Bridge] [PATCH net-next 12/16] selftests: forwarding: lib: Add helpers for checksum handling List-Id: Linux Ethernet Bridging List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Petr Machata , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Roopa Prabhu , netdev@vger.kernel.org Cc: Ido Schimmel , bridge@lists.linux-foundation.org On 26/01/2023 19:01, Petr Machata wrote: > In order to generate IGMPv3 and MLDv2 packets on the fly, we will need > helpers to calculate the packet checksum. > > The approach presented in this patch revolves around payload templates > for mausezahn. These are mausezahn-like payload strings (01:23:45:...) > with possibly one 2-byte sequence replaced with the word PAYLOAD. The > main function is payload_template_calc_checksum(), which calculates > RFC 1071 checksum of the message. There are further helpers to then > convert the checksum to the payload format, and to expand it. > > For IPv6, MLDv2 message checksum is computed using a pseudoheader that > differs from the header used in the payload itself. The fact that the > two messages are different means that the checksum needs to be > returned as a separate quantity, instead of being expanded in-place in > the payload itself. Furthermore, the pseudoheader includes a length of > the message. Much like the checksum, this needs to be expanded in > mausezahn format. And likewise for number of addresses for (S,G) > entries. Thus we have several places where a computed quantity needs > to be presented in the payload format. Add a helper u16_to_bytes(), > which will be used in all these cases. > > Signed-off-by: Petr Machata > --- > tools/testing/selftests/net/forwarding/lib.sh | 56 +++++++++++++++++++ > 1 file changed, 56 insertions(+) > Acked-by: Nikolay Aleksandrov