From patchwork Wed Sep 18 20:48:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 3846 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:6794:b0:5b9:581e:f939 with SMTP id c20csp969432mao; Wed, 18 Sep 2024 13:49:09 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWsB3GeJm6f8CLzG0Jxxcgwen9TdNZjhjqr/r7PtWbvceuvKIxJwn2xO4GxN/Oex/kPbC5cfCAZfEs=@openvpn.net X-Google-Smtp-Source: AGHT+IHgtU5tcmZm6BAuvmawmgxfyBVNaCWto7n43QNvUMmG9ZnFyOc1tTVkNvnSaWyGbT7DIArT X-Received: by 2002:a05:6830:6606:b0:710:ff77:226b with SMTP id 46e09a7af769-711094876c8mr16702469a34.16.1726692549683; Wed, 18 Sep 2024 13:49:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726692549; cv=none; d=google.com; s=arc-20240605; b=anp7Kktq4A7/J4kIcpM/8y8X0NXA0hLBDaUlBJnnpGV3VtchIuZqRQjazFr5xfEhNk loQsg7WDavhobRWEZpfcx5zXOAXwWP62wsRP7f2LFUt7i7HPz5c8DqleOEFq75ctxkW3 648tJ6ux962hr2GTz5e4XpwjB/LFea376ZtKuEszYLck614wys00y7DdRx9/AnGY39wo u89Ih4qHOm69Iz3DEK1RFxwGkPY2lHEYnYa3V50Z2g3k0xBKf9tx7Fk5BwnLk0M0M3vE wfLv21QLA2MnLdWmpE4BevzYtXGmd2T7AmzgcrRhiYv1FfNe9Sh+EIyi1oZpTuGFuA4Y N8lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature; bh=9ONHo3lEYn08iHLRb4SFN5mJiUqXIle11R4GS/N88do=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=jfA4lQwnNM4KCDGwapyirhc+Ft1KClYsJKTLRUp9jdEtEB5B2jvLlLzMnVvjDr/KOW XKq+pRukKxsBHWbwovqkysdoVxFgnRKosv91dDPUojMzfOb1vdaZe3fozblmnyBi97Pm zyhqAaHE/3dRJwK3pvsmo69MgZSeOVq5efM3LEIdbsI4JbW9ifYHGxWUtBLpv7zEu2Ry qWJrlhRXSwh8tz+jDLZrHgIxnxB/FNziEMtCcDfljP2sYw1UaXJ6nTtzovNjfWpL6o5p h6qXJP9tt7NsOz8XWs0NrWI8V6su4wHAk2w97a0sHPg1S/2l7+pcJe7UAtzJA0vMgXp5 eGhQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=kMoPSrH4; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=NAbemzPb; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 46e09a7af769-71389b6877dsi75016a34.90.2024.09.18.13.49.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Sep 2024 13:49:09 -0700 (PDT) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=kMoPSrH4; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=NAbemzPb; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1sr1bg-00017y-4h; Wed, 18 Sep 2024 20:49:00 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1sr1bd-00017k-Uc for openvpn-devel@lists.sourceforge.net; Wed, 18 Sep 2024 20:48:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=iIoun0Lc14TE6f/Fng/p+dsjj/5zqqlSjIgMlD/GN4Y=; b=kMoPSrH4nzSSG4PI2XzwKHOrO6 SxaumwzN1/+VYzIy6NT1HStLaBDhKr/hj5cIIa97RPxobwtqFZ2j6Zy+qRuDhy2zFsQF9x04n17Kb 0HLhEEBJgbRtC5KhyZ8t8uCzvxs22kdp48HJ+9rzVooj6hvJoaCP7n//fX3MPMmL7PT8=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=iIoun0Lc14TE6f/Fng/p+dsjj/5zqqlSjIgMlD/GN4Y=; b=NAbemzPbv9UMjyc27+ruad77I0 WfyIRWWrlpNwUBINEmGyt8CWqQyuFgwYeRKi/gd4uJpjQkqWyKy5zHfvQZvuAVZROg3YnXvgzZwgn OjeHxlzciX6ZSZ+PsrfqEXhoBw6r4xJu0r4ViEazK73E3Vj0la1f6pXLYMRmxPBkAlCo=; Received: from dhcp-174.greenie.muc.de ([193.149.48.174] helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1sr1bc-00016V-VD for openvpn-devel@lists.sourceforge.net; Wed, 18 Sep 2024 20:48:57 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.17.1.9/8.17.1.9) with ESMTP id 48IKmjnm002830 for ; Wed, 18 Sep 2024 22:48:45 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.17.1.9/8.17.1.9/Submit) id 48IKmjE3002829 for openvpn-devel@lists.sourceforge.net; Wed, 18 Sep 2024 22:48:45 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Wed, 18 Sep 2024 22:48:44 +0200 Message-ID: <20240918204844.2820-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.44.2 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: -0.0 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-2.v13.lw.sourceforge.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Frank Lichtenheld This is the actual return value of send/sendto/sendmsg. We will leave it to the single caller of link_socket_write() to decide how to map that to the int buffer world. For now just cast it explicitly. Content analysis details: (-0.0 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record X-Headers-End: 1sr1bc-00016V-VD Subject: [Openvpn-devel] [PATCH v1] socket: Change return types of link_socket_write* to ssize_t X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1810568367452948911?= X-GMAIL-MSGID: =?utf-8?q?1810568367452948911?= From: Frank Lichtenheld This is the actual return value of send/sendto/sendmsg. We will leave it to the single caller of link_socket_write() to decide how to map that to the int buffer world. For now just cast it explicitly. Change-Id: I7852c06d331326c1dbab7b642254c0c00d4cebb8 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/740 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index 40b7cc4..84c23b3 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -1790,7 +1790,7 @@ socks_preprocess_outgoing_link(c, &to_addr, &size_delta); /* Send packet */ - size = link_socket_write(c->c2.link_socket, &c->c2.to_link, to_addr); + size = (int)link_socket_write(c->c2.link_socket, &c->c2.to_link, to_addr); /* Undo effect of prepend */ link_socket_write_post_size_adjust(&size, size_delta, &c->c2.to_link); diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index 17c5e76..6c790a0 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -3399,7 +3399,7 @@ * Socket Write Routines */ -int +ssize_t link_socket_write_tcp(struct link_socket *sock, struct buffer *buf, struct link_socket_actual *to) @@ -3418,7 +3418,7 @@ #if ENABLE_IP_PKTINFO -size_t +ssize_t link_socket_write_udp_posix_sendmsg(struct link_socket *sock, struct buffer *buf, struct link_socket_actual *to) diff --git a/src/openvpn/socket.h b/src/openvpn/socket.h index 47083ad..bbdabfb 100644 --- a/src/openvpn/socket.h +++ b/src/openvpn/socket.h @@ -1099,9 +1099,9 @@ * Socket Write routines */ -int link_socket_write_tcp(struct link_socket *sock, - struct buffer *buf, - struct link_socket_actual *to); +ssize_t link_socket_write_tcp(struct link_socket *sock, + struct buffer *buf, + struct link_socket_actual *to); #ifdef _WIN32 @@ -1135,12 +1135,12 @@ #else /* ifdef _WIN32 */ -size_t link_socket_write_udp_posix_sendmsg(struct link_socket *sock, - struct buffer *buf, - struct link_socket_actual *to); +ssize_t link_socket_write_udp_posix_sendmsg(struct link_socket *sock, + struct buffer *buf, + struct link_socket_actual *to); -static inline size_t +static inline ssize_t link_socket_write_udp_posix(struct link_socket *sock, struct buffer *buf, struct link_socket_actual *to) @@ -1158,7 +1158,7 @@ (socklen_t) af_addr_size(to->dest.addr.sa.sa_family)); } -static inline size_t +static inline ssize_t link_socket_write_tcp_posix(struct link_socket *sock, struct buffer *buf, struct link_socket_actual *to) @@ -1168,7 +1168,7 @@ #endif /* ifdef _WIN32 */ -static inline size_t +static inline ssize_t link_socket_write_udp(struct link_socket *sock, struct buffer *buf, struct link_socket_actual *to) @@ -1181,7 +1181,7 @@ } /* write a TCP or UDP packet to link */ -static inline int +static inline ssize_t link_socket_write(struct link_socket *sock, struct buffer *buf, struct link_socket_actual *to)