From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=none 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=JflMGw5y; 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 ESMTP id D0FDF5A004E for ; Fri, 15 Nov 2024 14:59:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731679144; 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=rKe7geimtqPZ96/kxN3HkgwLhPikDjoTSwJ8y2co3EQ=; b=JflMGw5yMoBSJkaUCXVaHk4nxVn7SaD8fgAgX9EgpPUPkXkpS8R9QiX+bmWE36iepdYSYH IFc5ywOgI1lNjTsZv8hcSRSCzXSQO/7S9159sTyib/PTjLrtTlCLBtshiQoGkkwsN4uM+/ LP0DLATO63+WnsdR4kHDHqCoOP5JUkg= Received: from mx-prod-mc-04.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-637-Jbn4V_dVOh-BgW9hF7LWsw-1; Fri, 15 Nov 2024 08:59:03 -0500 X-MC-Unique: Jbn4V_dVOh-BgW9hF7LWsw-1 X-Mimecast-MFC-AGG-ID: Jbn4V_dVOh-BgW9hF7LWsw Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C79941955D4C; Fri, 15 Nov 2024 13:59:02 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.39.193.96]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E37F93003B74; Fri, 15 Nov 2024 13:59:00 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH v12 05/10] tcp: Export headers functions Date: Fri, 15 Nov 2024 14:58:43 +0100 Message-ID: <20241115135850.1170744-6-lvivier@redhat.com> In-Reply-To: <20241115135850.1170744-1-lvivier@redhat.com> References: <20241115135850.1170744-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 0cvNouB61gEuhxwue382BqGDYNh5r7JdUO2jxewnb2A_1731679142 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: 2E4K2JKRVNKEE2ZEAM4MFKYGYALPK5ZC X-Message-ID-Hash: 2E4K2JKRVNKEE2ZEAM4MFKYGYALPK5ZC 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: Export tcp_fill_headers[4|6]() and tcp_update_check_tcp[4|6](). They'll be needed by vhost-user. Signed-off-by: Laurent Vivier Reviewed-by: David Gibson --- tcp.c | 30 +++++++++++++++--------------- tcp_internal.h | 15 +++++++++++++++ 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/tcp.c b/tcp.c index 6a98dfaed59b..5d9968847d20 100644 --- a/tcp.c +++ b/tcp.c @@ -758,9 +758,9 @@ static void tcp_sock_set_bufsize(const struct ctx *c, int s) * @iov_cnt: Length of the array * @l4offset: IPv4 payload offset in the iovec array */ -static void tcp_update_check_tcp4(const struct iphdr *iph, - const struct iovec *iov, int iov_cnt, - size_t l4offset) +void tcp_update_check_tcp4(const struct iphdr *iph, + const struct iovec *iov, int iov_cnt, + size_t l4offset) { uint16_t l4len = ntohs(iph->tot_len) - sizeof(struct iphdr); struct in_addr saddr = { .s_addr = iph->saddr }; @@ -810,9 +810,9 @@ static void tcp_update_check_tcp4(const struct iphdr *iph, * @iov_cnt: Length of the array * @l4offset: IPv6 payload offset in the iovec array */ -static void tcp_update_check_tcp6(const struct ipv6hdr *ip6h, - const struct iovec *iov, int iov_cnt, - size_t l4offset) +void tcp_update_check_tcp6(const struct ipv6hdr *ip6h, + const struct iovec *iov, int iov_cnt, + size_t l4offset) { uint16_t l4len = ntohs(ip6h->payload_len); size_t check_ofs; @@ -978,11 +978,11 @@ static void tcp_fill_header(struct tcphdr *th, * * Return: The IPv4 payload length, host order */ -static size_t tcp_fill_headers4(const struct tcp_tap_conn *conn, - struct tap_hdr *taph, - struct iphdr *iph, struct tcp_payload_t *bp, - size_t dlen, const uint16_t *check, - uint32_t seq, bool no_tcp_csum) +size_t tcp_fill_headers4(const struct tcp_tap_conn *conn, + struct tap_hdr *taph, + struct iphdr *iph, struct tcp_payload_t *bp, + size_t dlen, const uint16_t *check, + uint32_t seq, bool no_tcp_csum) { const struct flowside *tapside = TAPFLOW(conn); const struct in_addr *src4 = inany_v4(&tapside->oaddr); @@ -1030,10 +1030,10 @@ static size_t tcp_fill_headers4(const struct tcp_tap_conn *conn, * * Return: The IPv6 payload length, host order */ -static size_t tcp_fill_headers6(const struct tcp_tap_conn *conn, - struct tap_hdr *taph, - struct ipv6hdr *ip6h, struct tcp_payload_t *bp, - size_t dlen, uint32_t seq, bool no_tcp_csum) +size_t tcp_fill_headers6(const struct tcp_tap_conn *conn, + struct tap_hdr *taph, + struct ipv6hdr *ip6h, struct tcp_payload_t *bp, + size_t dlen, uint32_t seq, bool no_tcp_csum) { const struct flowside *tapside = TAPFLOW(conn); size_t l4len = dlen + sizeof(bp->th); diff --git a/tcp_internal.h b/tcp_internal.h index c846f605834c..8625eed894d5 100644 --- a/tcp_internal.h +++ b/tcp_internal.h @@ -162,6 +162,21 @@ void tcp_rst_do(const struct ctx *c, struct tcp_tap_conn *conn); struct tcp_info_linux; +void tcp_update_check_tcp4(const struct iphdr *iph, + const struct iovec *iov, int iov_cnt, + size_t l4offset); +void tcp_update_check_tcp6(const struct ipv6hdr *ip6h, + const struct iovec *iov, int iov_cnt, + size_t l4offset); +size_t tcp_fill_headers4(const struct tcp_tap_conn *conn, + struct tap_hdr *taph, + struct iphdr *iph, struct tcp_payload_t *bp, + size_t dlen, const uint16_t *check, + uint32_t seq, bool no_tcp_csum); +size_t tcp_fill_headers6(const struct tcp_tap_conn *conn, + struct tap_hdr *taph, + struct ipv6hdr *ip6h, struct tcp_payload_t *bp, + size_t dlen, uint32_t seq, bool no_tcp_csum); size_t tcp_l2_buf_fill_headers(const struct tcp_tap_conn *conn, struct iovec *iov, size_t dlen, const uint16_t *check, uint32_t seq, -- 2.47.0