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=TDR2IhEa; 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 D88995A0280 for ; Mon, 26 May 2025 16:20:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1748269239; 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=ZXJonlMV/PWiGY5B28dzF8mS44nWB7AqkoeMcaavNQU=; b=TDR2IhEaDhPCdeZ4eCK+Ef46CpPnpH6Qrwvh84NXmvtHGQ7zH4Y1JEuJqFxXn8EMvAxwCK nT8Lc+zgjIVOz+fL6sVSAo+FFBoPon+rjQaZQMIdz/wrOwVwCQulfGUpARTOlfUj5meJSd 13DcEOB9DWPq1QB/2KYp9Wa5HF9Ll88= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-459-kWShqooCP8ObSb7i0P8A5A-1; Mon, 26 May 2025 10:20:36 -0400 X-MC-Unique: kWShqooCP8ObSb7i0P8A5A-1 X-Mimecast-MFC-AGG-ID: kWShqooCP8ObSb7i0P8A5A_1748269235 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-441c96c1977so13297175e9.0 for ; Mon, 26 May 2025 07:20:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748269235; x=1748874035; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=ZXJonlMV/PWiGY5B28dzF8mS44nWB7AqkoeMcaavNQU=; b=vZ1rFsPKjTU+RZLFnNIrTVkFE7qsDQ9TM7upoNE9UmzY4dg88YK/ToVSLFwjdDtMIQ F1YurVZiIM34RQvk49AIyE2x6A67gUUpiT4AnNqo5gow0bGCK6ztzlgO8jM8pNDHcQ97 06Alu3BKHGHRao63kAcIFL6tLvrZHy74y5po579qF3qx55AOCOUvySFXh7FIS2ZLB19j V8ZPQlibxPvv05u6BeCSCdFevU2TYfmr4EJKkcy5aw6biHGUHyyjKTMsQQQVdwCs7J6B NrDwZ7bMsZ2dXf4SGlztcajJMX9wcufCK8cDr3S8f0W1Mv6/VhbEHaZ8d+17CXMENAR/ 1Ocg== X-Gm-Message-State: AOJu0Ywiz3UgzHJk0bbFWmqMpxmXFo3vLyfD+PMPO95ndaNjdgd1MhpF XwuL1rtC693Dws/Gry0ofY2zlfWKoXbgohHKlH6ikuG26ujIZpLlREkMEd4rlk551NY4j3MhQM2 Q/otS9NdlbZikUt6fF/CBYrvr/T/qC9S9Ns56dgfXahRGfMC4xtEp3qJhPUu/mg== X-Gm-Gg: ASbGnctqbKDUR7dfd6l+dWrWB59f/eFoZIrTJar3SQcWGR3ZWz2ntRKVVwRL3v6AdAJ czNpTf+fxoOjlzKUTOJgUp9Q4brrhls8ed2UvyNayOC6Y/RKb9TfXKopPENupxijPvJITyz3wJV gs92ycPFrQqY/siq9lUrMpVKv/G4NpsnolarjEBeWdwlZ2DKA4Pp5GufRNpcrvGcgW2pkv7X6zF vg8DmKhcbULyOUlhVFbPVkaCVlCcMFIpMfCllS4jA6xJKwDm9PcouO8jcIG6Mx+9UAryk9XmWCo n2zFXPU2A6IfpCUDaajU3+IZLET+lO5TQAVWJLIw X-Received: by 2002:a05:600c:4e14:b0:444:34c7:3ed9 with SMTP id 5b1f17b1804b1-44c955da4f7mr80052755e9.26.1748269235247; Mon, 26 May 2025 07:20:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE6XyiyTwM7Ofvr8U63DlCVhKpnN4Zl3pl0OTKAhIgCRJdeNd9vLUEqKbPNvGo0glhFU7fmfA== X-Received: by 2002:a05:600c:4e14:b0:444:34c7:3ed9 with SMTP id 5b1f17b1804b1-44c955da4f7mr80052485e9.26.1748269234893; Mon, 26 May 2025 07:20:34 -0700 (PDT) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [176.103.220.4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-442ebdc362fsm320225105e9.1.2025.05.26.07.20.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 May 2025 07:20:34 -0700 (PDT) Date: Mon, 26 May 2025 16:20:33 +0200 From: Stefano Brivio To: Laurent Vivier Subject: Re: [PATCH v5 15/29] dhcpv6: Convert to iov_tail Message-ID: <20250526162033.46ca6b9a@elisabeth> In-Reply-To: <20250417165136.2688884-16-lvivier@redhat.com> References: <20250417165136.2688884-1-lvivier@redhat.com> <20250417165136.2688884-16-lvivier@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 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: BGxjd91jftjI6STWfN-YiT3NEvxeNO1-ezu4dWdbJ7Y_1748269235 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: CC2B6YZUM3YE6UF2KKC4CJQWHW2ODM4M X-Message-ID-Hash: CC2B6YZUM3YE6UF2KKC4CJQWHW2ODM4M 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, 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 Thu, 17 Apr 2025 18:51:22 +0200 Laurent Vivier wrote: > Use packet_data() and extract headers using IOV_REMOVE_HEADER() > and IOV_PEEK_HEADER() rather than packet_get(). > > Signed-off-by: Laurent Vivier > Reviewed-by: David Gibson > --- > dhcpv6.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/dhcpv6.c b/dhcpv6.c > index 549ddbbea735..a52af1b7a0fe 100644 > --- a/dhcpv6.c > +++ b/dhcpv6.c > @@ -534,9 +534,15 @@ int dhcpv6(struct ctx *c, const struct pool *p, > const struct msg_hdr *mh; > const struct udphdr *uh; > struct opt_hdr *bad_ia; > + struct iov_tail data; > + struct msg_hdr mhc; > + struct udphdr uhc; Same as the comment to 10/29: how bad would it be to call those mh_storage and uh_storage? > size_t mlen, n; > > - uh = packet_get(p, 0, 0, sizeof(*uh), &mlen); > + if (!packet_data(p, 0, &data)) > + return -1; > + > + uh = IOV_REMOVE_HEADER(&data, uhc); > if (!uh) > return -1; > > @@ -549,6 +555,7 @@ int dhcpv6(struct ctx *c, const struct pool *p, > if (!IN6_IS_ADDR_MULTICAST(daddr)) > return -1; > > + mlen = iov_tail_size(&data); > if (mlen + sizeof(*uh) != ntohs(uh->len) || mlen < sizeof(*mh)) > return -1; > > @@ -556,7 +563,7 @@ int dhcpv6(struct ctx *c, const struct pool *p, > > src = &c->ip6.our_tap_ll; > > - mh = packet_get(p, 0, sizeof(*uh), sizeof(*mh), NULL); > + mh = IOV_PEEK_HEADER(&data, mhc); > if (!mh) > return -1; > -- Stefano