From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ZM4f93rJ; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id 1519B5A0653 for ; Tue, 05 May 2026 01:11:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1777936265; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4V6eyLCnDVhxeE9xTBe9rIfhYrtl1gMjieGimbNuIMg=; b=ZM4f93rJe6ctPdq3S+iFr7skc3x4i+yAeWyxgESvigoJG/0oYNW0b5kJi1v2UsEnbUlcZg +nIpWVsO0zQtEERewMFdDGcz7JVPAL0FXWowM14d3mgd9DNm8wbcdiLFtdOq1yW/vV0pm4 FhNj5tybvSSOjfT6v/8zRqgL2Nwq36w= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-589-VXbRuvgDM6yX82_vRY3hhA-1; Mon, 04 May 2026 19:11:03 -0400 X-MC-Unique: VXbRuvgDM6yX82_vRY3hhA-1 X-Mimecast-MFC-AGG-ID: VXbRuvgDM6yX82_vRY3hhA_1777936262 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-44b2b38648eso2600375f8f.3 for ; Mon, 04 May 2026 16:11:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777936261; x=1778541061; h=date:content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4V6eyLCnDVhxeE9xTBe9rIfhYrtl1gMjieGimbNuIMg=; b=gorO3wtONni/7GgH7NcCL0mTWqh6//83zmJRrkDOhx0elBD4ij5i3DsfAgunJz9hEl fGXvDCDq3TSfVm42W8b7oZY1LpHjungZb8p0LwylIuqJQxWsEAif2P4Oj3xF7mS5mW7f J9mVORuNisrK9kOhe94gWvnCzqxzrVScHAx+CFFQHrEofXGHqQEV+xon23SvGFm0I7Sb Uke8nr6HWeviiXEr/XUJ5MYOuaZUsIyrsXh1twMP+zo95gAmSby0qf7Klw9D6FYQwB5O F2HcB4XpjDaVm8EY1EEMrXXctLrOu/oA0WNetnZ2sJq+VBmpZ5fb+9Bo5LozUa8K1p5N uRkg== X-Gm-Message-State: AOJu0Yyuo2zIfxy+dYSjzQU4nrGD1QT2LxCxQFt8fMibXJPLxhxYapKl g85knn23qjcwLkgFV7BR15R+Hcd+gX6TrJEv3RbR5Rzu2bbXiAOUKfzTt5Pv/p2/JKeGokXkkKP DUXWBD/8uk07zqnxrdECaA32FXh5pQvak3kE9Kskuv77HlpkDj4IJXOqhF37osg== X-Gm-Gg: AeBDieuJAtFn1Fw0XLTOJ3rCcrlJPWJtdnbsfqLsAAVu04CXzsyIYKneFCZidrlultk xrUHwCaLhsSOuky+apco9wprgoVE6uPCwzsXChrswADug5RNw6NqSfxRSiyszbiCNV6rfcjw/Lz 2K5KUgE0H5UypctfQUg+WsjZxz3fZjG0NI8YDA9OCdujlGiAK9LAqpiigU+Gh/smxhCMPenex71 9MfdzTMKcrkdeFO/kLO4YFrCaT13c1q82p6XA+vcYoJqYr/rING7taznLukL4MprJxq8QYCYQsM qQS4Cj0kRWgGtJ/58iBywHyBekB7XcgKCGsIo0Kl9FSllLQC0boUmaSDSi5KvSLyktEpuVS0d6d uRcyA7liiikuDJ+QOonZYpIdMJIwf0U/eW2WSX2GtuGRRmlXovCZfrjy9wdZ2 X-Received: by 2002:adf:e443:0:b0:44b:c972:a46a with SMTP id ffacd0b85a97d-44bc972a4c1mr14210885f8f.2.1777936260977; Mon, 04 May 2026 16:11:00 -0700 (PDT) X-Received: by 2002:adf:e443:0:b0:44b:c972:a46a with SMTP id ffacd0b85a97d-44bc972a4c1mr14210860f8f.2.1777936260557; Mon, 04 May 2026 16:11:00 -0700 (PDT) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [176.103.220.4]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4502ba4206dsm604385f8f.30.2026.05.04.16.10.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 May 2026 16:10:59 -0700 (PDT) From: Stefano Brivio To: Laurent Vivier Subject: Re: [PATCH v6 12/18] ip: Prepare ip.[ch] for sharing with pesto tool Message-ID: <20260505011058.4a379100@elisabeth> In-Reply-To: References: <20260503215601.823029-1-sbrivio@redhat.com> <20260503215601.823029-13-sbrivio@redhat.com> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 Date: Tue, 05 May 2026 01:10:59 +0200 (CEST) X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 4GpjLNz6xXASiU6EKZAVfknlRte_aCBPzY1xTUBCa9U_1777936262 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: 3AD4CWGLWFHBJLPNDKH23RTXZG5OIMZR X-Message-ID-Hash: 3AD4CWGLWFHBJLPNDKH23RTXZG5OIMZR X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top, Jon Maloy , David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Mon, 4 May 2026 16:52:47 +0200 Laurent Vivier wrote: > On 5/3/26 23:55, Stefano Brivio wrote: > > From: David Gibson > > > > Most things in ip.[ch] related purely to IP addresses and headers with > > no dependency on other passt/pasta internals. A number of these will be > > useful to re-use in pesto. The exception is ipv6_l4hdr() which uses > > iov_tail. > > > > The only caller of this is in tap.c, so move the function there. Along > > with moving the constant byteswapping functions to common.h, that lets > > ip.[ch] to be linked into pesto as well as passt/pasta. > > > > Signed-off-by: David Gibson > > Signed-off-by: Stefano Brivio > > Reviewed-by: Laurent Vivier > > But we can fix a pre-existing error while doing the move, see below: > > > --- > > common.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ > > inany.h | 2 ++ > > ip.c | 56 +++----------------------------------------------------- > > ip.h | 4 +--- > > tap.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ > > util.h | 48 ------------------------------------------------ > > 6 files changed, 106 insertions(+), 104 deletions(-) > > > > diff --git a/common.h b/common.h > > index 45f66ea..4a167ae 100644 > > --- a/common.h > > +++ b/common.h > > @@ -55,4 +55,52 @@ static inline const char *strerror_(int errnum) > > > > #define ARRAY_SIZE(a) ((int)(sizeof(a) / sizeof((a)[0]))) > > > > +#ifndef __bswap_constant_16 > > +#define __bswap_constant_16(x) \ > > + ((uint16_t) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))) > > +#endif > > + > > +#ifndef __bswap_constant_32 > > +#define __bswap_constant_32(x) \ > > + ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \ > > + (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) > > +#endif > > + > > +#ifndef __bswap_constant_32 > > +#define __bswap_constant_32(x) \ > > + ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \ > > + (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) > > +#endif > > __bswap_constant_32 block is written twice. Fixed in v7. -- Stefano