]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Rename occurences of 'struct link_socket' from 'ls' to 'sock'
authorGianmarco De Gregori <gianmarco@mandelbit.com>
Thu, 6 Mar 2025 10:13:39 +0000 (11:13 +0100)
committerGert Doering <gert@greenie.muc.de>
Thu, 6 Mar 2025 11:16:30 +0000 (12:16 +0100)
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 <gianmarco@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250306101339.12985-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59156800/
URL: https://gerrit.openvpn.net/c/openvpn/+/874
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/init.c
src/openvpn/init.h
src/openvpn/mtcp.c
src/openvpn/mtcp.h
src/openvpn/mudp.c
src/openvpn/mudp.h
src/openvpn/multi.c
src/openvpn/multi.h

index c21474ae982938f28d459c93afab3372de59bcda..1be205ba7eaf4200ec772ba2144afc4a2a47416b 100644 (file)
@@ -4946,12 +4946,12 @@ close_instance(struct context *c)
 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 @@ inherit_context_child(struct context *dest,
 
     /* 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 @@ inherit_context_child(struct context *dest,
          * 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 @@ inherit_context_child(struct context *dest,
         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];
index 11c32ac100fa45d7fbe1960164f2578a15a83d92..50b38e38cc53d5bdfcb26e7e478b1d9667fcdee2 100644 (file)
@@ -96,7 +96,7 @@ bool do_deferred_options(struct context *c, const unsigned int found);
 
 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);
index 0d409b6ff71bbf84dc6b22fe8bd8d11e1c747bc9..1d62ea65342ebadd9d183cb48c971be343927ca0 100644 (file)
@@ -47,16 +47,16 @@ struct ta_iow_flags
 };
 
 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 @@ multi_tcp_delete_event(struct multi_io *multi_io, event_t event)
 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;
index 9de5203244b60175fe0ddc94ff08a359a935a6c8..7f95529927420c6445d232d387a8b0c23183017d 100644 (file)
@@ -44,7 +44,7 @@ bool multi_tcp_process_outgoing_link(struct multi_context *m, bool defer, const
 
 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);
 
index c0344b12f8c8d77c4e6f6601250868c5232941af..54dfc721d9453cf34ec77cf735e16a4d2fb97c21 100644 (file)
@@ -188,14 +188,14 @@ do_pre_decrypt_check(struct multi_context *m,
 
 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 @@ multi_get_create_instance_udp(struct multi_context *m, bool *floated,
                      * 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);
index 357b684eb7e7819c203d80cd43dbaace8a4acc5e..37752e1384b9f59d552a7fead93cdb5c3003df5a 100644 (file)
@@ -33,7 +33,7 @@ struct multi_context;
 
 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 @@ void multi_process_io_udp(struct multi_context *m, struct link_socket *ls);
  * 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 */
index 07258bed6b7e3cd856f45399b7a0dbcf78b5fd50..85a1712e2334c239684f5e4e5f83739640fca5f3 100644 (file)
@@ -751,7 +751,7 @@ multi_uninit(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)
 {
     struct gc_arena gc = gc_new();
     struct multi_instance *mi;
@@ -774,7 +774,7 @@ multi_create_instance(struct multi_context *m, const struct mroute_addr *real,
         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 @@ multi_process_post(struct multi_context *m, struct multi_instance *mi, const uns
 
 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 @@ multi_process_float(struct multi_context *m, struct multi_instance *mi,
     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 @@ multi_process_incoming_dco(struct multi_context *m)
  */
 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 @@ multi_process_incoming_link(struct multi_context *m, struct multi_instance *inst
 #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 @@ multi_process_incoming_link(struct multi_context *m, struct multi_instance *inst
             /* 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);
index 41047063e312bfc21c2e180c21a0403ca9ff0762..e14ad60ea9a92538bfc3ad13239f0b771bc2ecb7 100644 (file)
@@ -272,7 +272,7 @@ void multi_top_init(struct multi_context *m, struct context *top);
 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 @@ bool multi_process_timeout(struct multi_context *m, const unsigned int mpp_flags
  * 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 @@ bool multi_process_incoming_dco(struct multi_context *m);
  *                       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);
 
 
 /**