From patchwork Thu Mar 6 10:13:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4166 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:b9c6:b0:60a:d70a:d3c7 with SMTP id gh6csp194095mab; Thu, 6 Mar 2025 02:14:01 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU/z2Y2pk53tl5dgx3c9PeZgHxZDhxLhBTlF6WLRmCequZgzVB9CPXeNyrkirhjJaJ8xnFRdTjhFSM=@openvpn.net X-Google-Smtp-Source: AGHT+IG6Cg2zjAJEEAXp0SoqcKxYyKDPxVToiMrvKd7lQ3l4OZFX/H/HljyQmR7DneP+ySXFQCE2 X-Received: by 2002:a05:6871:3311:b0:2bc:7c3d:18d8 with SMTP id 586e51a60fabf-2c21cdb5bfamr3311315fac.33.1741256041140; Thu, 06 Mar 2025 02:14:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1741256041; cv=none; d=google.com; s=arc-20240605; b=HAMBIfAzJyLYptQbqKLYgCiy2iRu55zay8yWGcSai6zTZeAw9usMz6oqSiRC8vlqwv Q7+p4RJw6J10BOoqb7drZfyXXrMdwwB5gH1Q6frKhhtj8R16reIq+lIWHrMai0MCRZBn TGhZEVODN74Z8ZVA7KtMbvLgCaylIpo3k9EWPYRjBa5sfhTT97UeIFOz9JdHMQ4S4FRr /1e3Or/YLrzaBSFvvUIG06a9PsNL1yzTUZAFY7MrgRb1TuihsDfL9TJ5semlyYTAtyN1 pEY5R3P9g1qPLz3waLK3J0kd7dneoN0caHXPZzYgPP42CeBSAlmwt2NVM6hArhs96A1L tFuw== 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=tz6V47jMISJpWC9g3+xxDCkWQ2AwzXNRsRKW1qtDbXM=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=ftiEpmVnyd3CIVEeWYln+6ZZKkVGGOHWVVB2iHd8z59mIXqiqI/ObegNrPxFeB/qry DDq6q/pkthvRJU66f9LsxkAgvvuZ6iiz6ZDuuF4l7xp3diulNE31MBu2HyQt4HGwfkDK muoosCvyy8ugIs2pG+FV+q39bbaF3WxWEDowz3UvDbwGKf77wxHU51pfgDj5MwhVp7tJ hs+gPSXzn4v3IRpKUVksax+isLh1CvFOnKsLhXJeIw0QKghSEfKIojpC+xDa1s4Q4Gz8 M0OzPn4hIZjKX+rW3jHtyibYQ1U9DUmgGB0LNi3NJE5Hgz5v5Vj9vshq0WhczajeiUdQ jVmA==; 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=eRSqge0c; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=COCXhOXB; 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-72a2daf0363si583728a34.120.2025.03.06.02.14.00 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Mar 2025 02:14:01 -0800 (PST) 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=eRSqge0c; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=COCXhOXB; 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-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1tq8Eo-0003Ql-ND; Thu, 06 Mar 2025 10:13:58 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tq8En-0003Qe-Fw for openvpn-devel@lists.sourceforge.net; Thu, 06 Mar 2025 10:13:56 +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=vw2a7vK9syik77A+GtE/RqVonP7nG6VN833KWDTNJ88=; b=eRSqge0cUU8gVHy3uDK6qxmR0X Es4VCxerZhGw1+qdKd0akG4wu7bT2hjkIehONITThVsAQfbtncwOI4CuyiKdWe3ENdjJw+Fvcr9Xj CyMh/mIWIKr7GHl2xXgbp+bpKCBTwSAlGJEWwLHQEcjRfOBBQidvTMsEkbO1DbjJ2IuY=; 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=vw2a7vK9syik77A+GtE/RqVonP7nG6VN833KWDTNJ88=; b=COCXhOXBS5P4JI2xNRHTBEhLg7 A8EbbwG27/XecpH/BY568iEwbNNL4v4Ox1bmCd/SS4Hm8lXXxGQCO4RSjr1DiIRJV2hLtHmyuJn0p I/OE9TvptIe/T5PlFxYOxxfQOh4SI703lFU224NqGrUClAlft7rsQIzNVRGB0020rp6g=; 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 1tq8Eh-000812-QA for openvpn-devel@lists.sourceforge.net; Thu, 06 Mar 2025 10:13:56 +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 526ADeEj013004 for ; Thu, 6 Mar 2025 11:13:40 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.17.1.9/8.17.1.9/Submit) id 526ADepn012996 for openvpn-devel@lists.sourceforge.net; Thu, 6 Mar 2025 11:13:40 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Thu, 6 Mar 2025 11:13:39 +0100 Message-ID: <20250306101339.12985-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.45.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: Gianmarco De Gregori This commit renames all instances of 'struct link_socket' from the abbreviation 'ls' to the more descriptive 'sock' making it clearer that the variables represent socket-related structures. 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 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [193.149.48.174 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [193.149.48.174 listed in bl.score.senderscore.com] X-Headers-End: 1tq8Eh-000812-QA Subject: [Openvpn-devel] [PATCH v7] Rename occurences of 'struct link_socket' from 'ls' to 'sock' 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?1822214501358006608?= X-GMAIL-MSGID: =?utf-8?q?1825839294747442436?= From: Gianmarco De Gregori This commit renames all instances of 'struct link_socket' from the abbreviation 'ls' to the more descriptive 'sock' making it clearer that the variables represent socket-related structures. No functional changes have been introduced. Change-Id: Iff12c4dbac84a814612aa8b5b89224be08bb9058 Signed-off-by: Gianmarco De Gregori 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/+/874 This mail reflects revision 7 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpn/init.c b/src/openvpn/init.c index c21474a..1be205b 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -4946,12 +4946,12 @@ void inherit_context_child(struct context *dest, const struct context *src, - struct link_socket *ls) + struct link_socket *sock) { CLEAR(*dest); /* proto_is_dgram will ASSERT(0) if proto is invalid */ - dest->mode = proto_is_dgram(ls->info.proto) ? CM_CHILD_UDP : CM_CHILD_TCP; + dest->mode = proto_is_dgram(sock->info.proto) ? CM_CHILD_UDP : CM_CHILD_TCP; dest->gc = gc_new(); @@ -4977,7 +4977,7 @@ /* options */ dest->options = src->options; - dest->options.ce.proto = ls->info.proto; + dest->options.ce.proto = sock->info.proto; options_detach(&dest->options); dest->c2.event_set = src->c2.event_set; @@ -4988,7 +4988,7 @@ * The CM_TOP context does the socket listen(), * and the CM_CHILD_TCP context does the accept(). */ - dest->c2.accept_from = ls; + dest->c2.accept_from = sock; } #ifdef ENABLE_PLUGIN @@ -5015,11 +5015,11 @@ ALLOC_ARRAY_GC(dest->c2.link_sockets, struct link_socket *, 1, &dest->gc); /* inherit parent link_socket and tuntap */ - dest->c2.link_sockets[0] = ls; + dest->c2.link_sockets[0] = sock; ALLOC_ARRAY_GC(dest->c2.link_socket_infos, struct link_socket_info *, 1, &dest->gc); ALLOC_OBJ_GC(dest->c2.link_socket_infos[0], struct link_socket_info, &dest->gc); - *dest->c2.link_socket_infos[0] = ls->info; + *dest->c2.link_socket_infos[0] = sock->info; /* locally override some link_socket_info fields */ dest->c2.link_socket_infos[0]->lsa = &dest->c1.link_socket_addrs[0]; diff --git a/src/openvpn/init.h b/src/openvpn/init.h index 11c32ac..50b38e3 100644 --- a/src/openvpn/init.h +++ b/src/openvpn/init.h @@ -96,7 +96,7 @@ void inherit_context_child(struct context *dest, const struct context *src, - struct link_socket *ls); + struct link_socket *sock); void inherit_context_top(struct context *dest, const struct context *src); diff --git a/src/openvpn/mtcp.c b/src/openvpn/mtcp.c index 0d409b6..1d62ea6 100644 --- a/src/openvpn/mtcp.c +++ b/src/openvpn/mtcp.c @@ -47,16 +47,16 @@ }; struct multi_instance * -multi_create_instance_tcp(struct multi_context *m, struct link_socket *ls) +multi_create_instance_tcp(struct multi_context *m, struct link_socket *sock) { struct gc_arena gc = gc_new(); struct multi_instance *mi = NULL; struct hash *hash = m->hash; - mi = multi_create_instance(m, NULL, ls); + mi = multi_create_instance(m, NULL, sock); if (mi) { - mi->real.proto = ls->info.proto; + mi->real.proto = sock->info.proto; struct hash_element *he; const uint32_t hv = hash_value(hash, &mi->real); struct hash_bucket *bucket = hash_bucket(hash, hv); @@ -140,10 +140,10 @@ void multi_tcp_dereference_instance(struct multi_io *multi_io, struct multi_instance *mi) { - struct link_socket *ls = mi->context.c2.link_sockets[0]; - if (ls && mi->socket_set_called) + struct link_socket *sock = mi->context.c2.link_sockets[0]; + if (sock && mi->socket_set_called) { - event_del(multi_io->es, socket_event_handle(ls)); + event_del(multi_io->es, socket_event_handle(sock)); mi->socket_set_called = false; } multi_io->n_esr = 0; diff --git a/src/openvpn/mtcp.h b/src/openvpn/mtcp.h index 9de5203..7f95529 100644 --- a/src/openvpn/mtcp.h +++ b/src/openvpn/mtcp.h @@ -44,7 +44,7 @@ bool multi_tcp_process_outgoing_link_ready(struct multi_context *m, struct multi_instance *mi, const unsigned int mpp_flags); -struct multi_instance *multi_create_instance_tcp(struct multi_context *m, struct link_socket *ls); +struct multi_instance *multi_create_instance_tcp(struct multi_context *m, struct link_socket *sock); void multi_tcp_link_out_deferred(struct multi_context *m, struct multi_instance *mi); diff --git a/src/openvpn/mudp.c b/src/openvpn/mudp.c index c0344b1..54dfc72 100644 --- a/src/openvpn/mudp.c +++ b/src/openvpn/mudp.c @@ -188,14 +188,14 @@ struct multi_instance * multi_get_create_instance_udp(struct multi_context *m, bool *floated, - struct link_socket *ls) + struct link_socket *sock) { struct gc_arena gc = gc_new(); struct mroute_addr real = {0}; struct multi_instance *mi = NULL; struct hash *hash = m->hash; - real.proto = ls->info.proto; - m->hmac_reply_ls = ls; + real.proto = sock->info.proto; + m->hmac_reply_ls = sock; if (mroute_extract_openvpn_sockaddr(&real, &m->top.c2.from.dest, true) && m->top.c2.buf.len > 0) @@ -261,7 +261,7 @@ * connect-freq but not against connect-freq-initial */ reflect_filter_rate_limit_decrease(m->initial_rate_limiter); - mi = multi_create_instance(m, &real, ls); + mi = multi_create_instance(m, &real, sock); if (mi) { hash_add_fast(hash, bucket, &mi->real, hv, mi); diff --git a/src/openvpn/mudp.h b/src/openvpn/mudp.h index 357b684..37752e1 100644 --- a/src/openvpn/mudp.h +++ b/src/openvpn/mudp.h @@ -33,7 +33,7 @@ unsigned int p2mp_iow_flags(const struct multi_context *m); -void multi_process_io_udp(struct multi_context *m, struct link_socket *ls); +void multi_process_io_udp(struct multi_context *m, struct link_socket *sock); /**************************************************************************/ /** * Get, and if necessary create, the multi_instance associated with a @@ -47,13 +47,13 @@ * successful, returns the newly created instance. * * @param m - The single multi_context structure. - * @param ls - Listening socket where this instance is connecting to + * @param sock - Listening socket where this instance is connecting to * * @return A pointer to a multi_instance if one already existed for the * packet's source address or if one was a newly created successfully. * NULL if one did not yet exist and a new one was not created. */ struct multi_instance *multi_get_create_instance_udp(struct multi_context *m, bool *floated, - struct link_socket *ls); + struct link_socket *sock); #endif /* ifndef MUDP_H */ diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index 07258be..85a1712 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -751,7 +751,7 @@ */ struct multi_instance * multi_create_instance(struct multi_context *m, const struct mroute_addr *real, - struct link_socket *ls) + struct link_socket *sock) { struct gc_arena gc = gc_new(); struct multi_instance *mi; @@ -774,7 +774,7 @@ generate_prefix(mi); } - inherit_context_child(&mi->context, &m->top, ls); + inherit_context_child(&mi->context, &m->top, sock); if (IS_SIG(&mi->context)) { goto err; @@ -3139,7 +3139,7 @@ void multi_process_float(struct multi_context *m, struct multi_instance *mi, - struct link_socket *ls) + struct link_socket *sock) { struct mroute_addr real = {0}; struct hash *hash = m->hash; @@ -3195,7 +3195,7 @@ mi->context.c2.to_link_addr = &mi->context.c2.from; /* inherit parent link_socket and link_socket_info */ - mi->context.c2.link_sockets[0] = ls; + mi->context.c2.link_sockets[0] = sock; mi->context.c2.link_socket_infos[0]->lsa->actual = m->top.c2.from; tls_update_remote_addr(mi->context.c2.tls_multi, &mi->context.c2.from); @@ -3346,7 +3346,7 @@ */ bool multi_process_incoming_link(struct multi_context *m, struct multi_instance *instance, - const unsigned int mpp_flags, struct link_socket *ls) + const unsigned int mpp_flags, struct link_socket *sock) { struct gc_arena gc = gc_new(); @@ -3367,7 +3367,7 @@ #ifdef MULTI_DEBUG_EVENT_LOOP printf("TCP/UDP -> TUN [%d]\n", BLEN(&m->top.c2.buf)); #endif - multi_set_pending(m, multi_get_create_instance_udp(m, &floated, ls)); + multi_set_pending(m, multi_get_create_instance_udp(m, &floated, sock)); } else { @@ -3401,14 +3401,14 @@ /* decrypt in instance context */ perf_push(PERF_PROC_IN_LINK); - lsi = &ls->info; + lsi = &sock->info; orig_buf = c->c2.buf.data; if (process_incoming_link_part1(c, lsi, floated)) { /* nonzero length means that we have a valid, decrypted packed */ if (floated && c->c2.buf.len > 0) { - multi_process_float(m, m->pending, ls); + multi_process_float(m, m->pending, sock); } process_incoming_link_part2(c, lsi, orig_buf); diff --git a/src/openvpn/multi.h b/src/openvpn/multi.h index 4104706..e14ad60 100644 --- a/src/openvpn/multi.h +++ b/src/openvpn/multi.h @@ -272,7 +272,7 @@ void multi_top_free(struct multi_context *m); struct multi_instance *multi_create_instance(struct multi_context *m, const struct mroute_addr *real, - struct link_socket *ls); + struct link_socket *sock); void multi_close_instance(struct multi_context *m, struct multi_instance *mi, bool shutdown); @@ -287,7 +287,7 @@ * updates hashtables in multi_context. */ void multi_process_float(struct multi_context *m, struct multi_instance *mi, - struct link_socket *ls); + struct link_socket *sock); #define MPP_PRE_SELECT (1<<0) #define MPP_CONDITIONAL_PRE_SELECT (1<<1) @@ -352,10 +352,10 @@ * when using TCP transport. Otherwise NULL, as is * the case when using UDP transport. * @param mpp_flags - Fast I/O optimization flags. - * @param ls - Socket where the packet was received. + * @param sock - Socket where the packet was received. */ bool multi_process_incoming_link(struct multi_context *m, struct multi_instance *instance, const unsigned int mpp_flags, - struct link_socket *ls); + struct link_socket *sock); /**