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=fmkdQmm+; 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 3322C5A026E for ; Tue, 16 Jun 2026 14:51:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1781614306; 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=gOAwJNZ7HL+lsRhWIrO27IhJEXrk1UZB2gVB/p1St8Q=; b=fmkdQmm+0zV3Rx5pZX7WUd3/Owpoe5BO30lHVYYY/Q26JSO3SqN9XcDCB1zpitT0c/ZVrH AhsEgkDMvbsuLbmjUBpG18r6FuiJ0Jf538dSZKFUlIjPQ997YZdhRY1Rfaj6rp79v+SYsm GjL0t342v9DYoDrUXcBflee/6LJ9Svk= Received: from mx-prod-mc-01.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-360-tSoTvkPtMg2qXFCXQA0guw-1; Tue, 16 Jun 2026 08:51:45 -0400 X-MC-Unique: tSoTvkPtMg2qXFCXQA0guw-1 X-Mimecast-MFC-AGG-ID: tSoTvkPtMg2qXFCXQA0guw_1781614304 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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 33A021956094 for ; Tue, 16 Jun 2026 12:51:44 +0000 (UTC) Received: from lenovo-t14s.redhat.corp (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5F77E1800591; Tue, 16 Jun 2026 12:51:43 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH v5 08/12] dhcp/dhcpv6: Pass queue pair explicitly through DHCP send path Date: Tue, 16 Jun 2026 14:51:26 +0200 Message-ID: <20260616125130.1324274-9-lvivier@redhat.com> In-Reply-To: <20260616125130.1324274-1-lvivier@redhat.com> References: <20260616125130.1324274-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: 9vACW-9zmQdOQyX2d8UAls3vR8hRgPZIjabdsWS0-GI_1781614304 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: TCGEU4HWQBKKJMCFXU2HLW5PQTMRR6N4 X-Message-ID-Hash: TCGEU4HWQBKKJMCFXU2HLW5PQTMRR6N4 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 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: Add a qpair parameter to dhcp(), dhcpv6(), and dhcpv6_send_ia_notonlink(), forwarding it to tap_udp4_send() and tap_udp6_send() instead of hardcoding QPAIR_DEFAULT. No functional change. Signed-off-by: Laurent Vivier --- dhcp.c | 6 +++--- dhcp.h | 2 +- dhcpv6.c | 12 +++++++----- dhcpv6.h | 2 +- tap.c | 4 ++-- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/dhcp.c b/dhcp.c index e652659138b8..6ff094c9179e 100644 --- a/dhcp.c +++ b/dhcp.c @@ -296,11 +296,12 @@ static void opt_set_dns_search(const struct ctx *c, size_t max_len) /** * dhcp() - Check if this is a DHCP message, reply as needed * @c: Execution context + * @qpair: Queue pair on which to send the reply * @data: Single packet with Ethernet buffer * * Return: 0 if it's not a DHCP message, 1 if handled, -1 on failure */ -int dhcp(const struct ctx *c, struct iov_tail *data) +int dhcp(const struct ctx *c, unsigned int qpair, struct iov_tail *data) { char macstr[ETH_ADDRSTRLEN]; size_t mlen, dlen, opt_len; @@ -473,8 +474,7 @@ int dhcp(const struct ctx *c, struct iov_tail *data) else dst = c->ip4.addr; - tap_udp4_send(c, QPAIR_DEFAULT, c->ip4.our_tap_addr, 67, dst, 68, - &reply, dlen); + tap_udp4_send(c, qpair, c->ip4.our_tap_addr, 67, dst, 68, &reply, dlen); return 1; } diff --git a/dhcp.h b/dhcp.h index cd50c99b8856..6d034f0c58af 100644 --- a/dhcp.h +++ b/dhcp.h @@ -6,7 +6,7 @@ #ifndef DHCP_H #define DHCP_H -int dhcp(const struct ctx *c, struct iov_tail *data); +int dhcp(const struct ctx *c, unsigned int qpair, struct iov_tail *data); void dhcp_init(void); #endif /* DHCP_H */ diff --git a/dhcpv6.c b/dhcpv6.c index f4ebeccf912c..3c97c921a849 100644 --- a/dhcpv6.c +++ b/dhcpv6.c @@ -370,12 +370,13 @@ notonlink: /** * dhcpv6_send_ia_notonlink() - Send NotOnLink status * @c: Execution context + * @qpair: Queue pair on which to send the reply * @ia_base: Non-appropriate IA_NA or IA_TA base * @client_id_base: Client ID message option base * @len: Client ID length * @xid: Transaction ID for message exchange */ -static void dhcpv6_send_ia_notonlink(struct ctx *c, +static void dhcpv6_send_ia_notonlink(struct ctx *c, unsigned int qpair, const struct iov_tail *ia_base, const struct iov_tail *client_id_base, int len, uint32_t xid) @@ -405,7 +406,7 @@ static void dhcpv6_send_ia_notonlink(struct ctx *c, resp_not_on_link.hdr.xid = xid; - tap_udp6_send(c, QPAIR_DEFAULT, src, 547, tap_ip6_daddr(c, src), 546, + tap_udp6_send(c, qpair, src, 547, tap_ip6_daddr(c, src), 546, xid, &resp_not_on_link, n); } @@ -542,13 +543,14 @@ static size_t dhcpv6_client_fqdn_fill(const struct iov_tail *data, /** * dhcpv6() - Check if this is a DHCPv6 message, reply as needed * @c: Execution context + * @qpair: Queue pair on which to send the reply * @data: Single packet starting from UDP header * @saddr: Source IPv6 address of original message * @daddr: Destination IPv6 address of original message * * Return: 0 if it's not a DHCPv6 message, 1 if handled, -1 on failure */ -int dhcpv6(struct ctx *c, struct iov_tail *data, +int dhcpv6(struct ctx *c, unsigned int qpair, struct iov_tail *data, const struct in6_addr *saddr, const struct in6_addr *daddr) { const struct opt_server_id *server_id = NULL; @@ -630,7 +632,7 @@ int dhcpv6(struct ctx *c, struct iov_tail *data, if (dhcpv6_ia_notonlink(data, &c->ip6.addr)) { - dhcpv6_send_ia_notonlink(c, data, &client_id_base, + dhcpv6_send_ia_notonlink(c, qpair, data, &client_id_base, ntohs(client_id->l), mh->xid); return 1; @@ -680,7 +682,7 @@ int dhcpv6(struct ctx *c, struct iov_tail *data, resp.hdr.xid = mh->xid; - tap_udp6_send(c, QPAIR_DEFAULT, src, 547, tap_ip6_daddr(c, src), 546, + tap_udp6_send(c, qpair, src, 547, tap_ip6_daddr(c, src), 546, mh->xid, &resp, n); c->ip6.addr_seen = c->ip6.addr; diff --git a/dhcpv6.h b/dhcpv6.h index c706dfdbb2ac..3a249b39e6c7 100644 --- a/dhcpv6.h +++ b/dhcpv6.h @@ -6,7 +6,7 @@ #ifndef DHCPV6_H #define DHCPV6_H -int dhcpv6(struct ctx *c, struct iov_tail *data, +int dhcpv6(struct ctx *c, unsigned int qpair, struct iov_tail *data, struct in6_addr *saddr, struct in6_addr *daddr); void dhcpv6_init(const struct ctx *c); diff --git a/tap.c b/tap.c index e8fd3661ebb5..8e19390f7273 100644 --- a/tap.c +++ b/tap.c @@ -805,7 +805,7 @@ resume: struct iov_tail eh_data; packet_get(pool_tap4, i, &eh_data); - if (dhcp(c, &eh_data)) + if (dhcp(c, qpair, &eh_data)) continue; } @@ -1049,7 +1049,7 @@ resume: if (proto == IPPROTO_UDP) { struct iov_tail uh_data = data; - if (dhcpv6(c, &uh_data, saddr, daddr)) + if (dhcpv6(c, qpair, &uh_data, saddr, daddr)) continue; } -- 2.54.0