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=iycS261S; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTPS id C68BB5A0287 for ; Fri, 08 Aug 2025 16:02:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1754661725; 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=P3avZFvs0tlWI7tqr/nwlcgmCkfMiXUQRY4O/22KxAM=; b=iycS261SMeEfNHs5RTNysLuaTS0sA2hJEJtiHtNqUR9sQTjvTKDLIsWsf4YqstgIRwYLYt uR0M9L4lovSRENNaWgD/9ytojTKMM5e5wz5OPPxU6RlExsETv6dduYAFxHDR+tlu+tSyAp MOGUbgjpnspRVqwFJSUbWX95C5B9mto= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-246-dMBrsdxNPlSG0ORe27xMvA-1; Fri, 08 Aug 2025 10:02:02 -0400 X-MC-Unique: dMBrsdxNPlSG0ORe27xMvA-1 X-Mimecast-MFC-AGG-ID: dMBrsdxNPlSG0ORe27xMvA_1754661721 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C3BEC19560A6; Fri, 8 Aug 2025 14:02:01 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.45.225.81]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 612EA180029B; Fri, 8 Aug 2025 14:02:00 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH v9 08/30] ndp: Convert to iov_tail Date: Fri, 8 Aug 2025 16:01:20 +0200 Message-ID: <20250808140142.3404325-9-lvivier@redhat.com> In-Reply-To: <20250808140142.3404325-1-lvivier@redhat.com> References: <20250808140142.3404325-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: dFxtLL5ly10_pLCnYc6LtDZtM5ZSQkx7K-ewEnAb7Jc_1754661721 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: TNKNX2ESW5UZDPRS2JNFBNIV5CO7UHMY X-Message-ID-Hash: TNKNX2ESW5UZDPRS2JNFBNIV5CO7UHMY X-MailFrom: lvivier@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: Laurent Vivier , 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: Use packet_data() and extract headers using IOV_REMOVE_HEADER() rather than packet_get(). Signed-off-by: Laurent Vivier Reviewed-by: David Gibson --- ndp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ndp.c b/ndp.c index 3e1549456839..5de4e508dc52 100644 --- a/ndp.c +++ b/ndp.c @@ -350,9 +350,14 @@ int ndp(const struct ctx *c, const struct icmp6hdr *ih, return 1; if (ih->icmp6_type == NS) { + struct ndp_ns ns_storage; const struct ndp_ns *ns; + struct iov_tail data; - ns = packet_get(p, 0, 0, sizeof(struct ndp_ns), NULL); + if (!packet_data(p, 0, &data)) + return -1; + + ns = IOV_REMOVE_HEADER(&data, ns_storage); if (!ns) return -1; -- 2.49.0