]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Clean-up: Remove more dead and inactive code paths
authorDavid Sommerseth <dazo@users.sourceforge.net>
Sat, 28 Aug 2010 18:44:07 +0000 (20:44 +0200)
committerDavid Sommerseth <dazo@users.sourceforge.net>
Sun, 14 Nov 2010 21:09:42 +0000 (22:09 +0100)
These code paths was practically not needed with no locking mechanisms
enabled and was just bloating the source code.

Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
Acked-by: James Yonan <james@openvpn.net>
buffer.c
forward.c
mbuf.c
mbuf.h
mroute.c
mroute.h
mtcp.c
multi.c
openvpn.h
ssl.c
ssl.h

index e9ae21a1e34e2e484e3809c3adc98f803f6fdef4..729495cfd44d01b8f3f504896a9f6dc5d1a31bf8 100644 (file)
--- a/buffer.c
+++ b/buffer.c
@@ -298,10 +298,8 @@ gc_malloc (size_t size, bool clear, struct gc_arena *a)
 #endif
       check_malloc_return (e);
       ret = (char *) e + sizeof (struct gc_entry);
-      /*mutex_lock_static (L_GC_MALLOC);*/
       e->next = a->list;
       a->list = e;
-      /*mutex_unlock_static (L_GC_MALLOC);*/
     }
   else
     {
@@ -323,10 +321,8 @@ void
 x_gc_free (struct gc_arena *a)
 {
   struct gc_entry *e;
-  /*mutex_lock_static (L_GC_MALLOC);*/
   e = a->list;
   a->list = NULL;
-  /*mutex_unlock_static (L_GC_MALLOC);*/
   
   while (e != NULL)
     {
index d563e11af7ee31f255b9a50b11bd58381b05c0fe..463a2e81ba70d10abbc46e4d0643044ebc137d75 100644 (file)
--- a/forward.c
+++ b/forward.c
@@ -454,7 +454,6 @@ encrypt_sign (struct context *c, bool comp_frag)
    */
   if (c->c2.tls_multi)
     {
-      /*tls_mutex_lock (c->c2.tls_multi);*/
       tls_pre_encrypt (c->c2.tls_multi, &c->c2.buf, &c->c2.crypto_options);
     }
 #endif
@@ -482,7 +481,6 @@ encrypt_sign (struct context *c, bool comp_frag)
   if (c->c2.tls_multi)
     {
       tls_post_encrypt (c->c2.tls_multi, &c->c2.buf);
-      /*tls_mutex_unlock (c->c2.tls_multi);*/
     }
 #endif
 #endif
@@ -790,7 +788,6 @@ process_incoming_link (struct context *c)
           * will load crypto_options with the correct encryption key
           * and return false.
           */
-         /*tls_mutex_lock (c->c2.tls_multi);*/
          if (tls_pre_decrypt (c->c2.tls_multi, &c->c2.from, &c->c2.buf, &c->c2.crypto_options))
            {
              interval_action (&c->c2.tmp_int);
@@ -813,13 +810,6 @@ process_incoming_link (struct context *c)
       /* authenticate and decrypt the incoming packet */
       decrypt_status = openvpn_decrypt (&c->c2.buf, c->c2.buffers->decrypt_buf, &c->c2.crypto_options, &c->c2.frame);
 
-#ifdef USE_SSL
-      if (c->c2.tls_multi)
-       {
-         /*tls_mutex_unlock (c->c2.tls_multi);*/
-       }
-#endif
-      
       if (!decrypt_status && link_socket_connection_oriented (c->c2.link_socket))
        {
          /* decryption errors are fatal in TCP mode */
diff --git a/mbuf.c b/mbuf.c
index 8ffda00c1218c463bd70da3a63bddc710d7c2917..cb83ac70ee71f22625a805f7a9a6fb0cf0df585d 100644 (file)
--- a/mbuf.c
+++ b/mbuf.c
@@ -90,7 +90,7 @@ mbuf_add_item (struct mbuf_set *ms, const struct mbuf_item *item)
   if (ms->len == ms->capacity)
     {
       struct mbuf_item rm;
-      ASSERT (mbuf_extract_item (ms, &rm, false));
+      ASSERT (mbuf_extract_item (ms, &rm));
       mbuf_free_buf (rm.buffer);
       msg (D_MULTI_DROPPED, "MBUF: mbuf packet dropped");
     }
@@ -104,7 +104,7 @@ mbuf_add_item (struct mbuf_set *ms, const struct mbuf_item *item)
 }
 
 bool
-mbuf_extract_item (struct mbuf_set *ms, struct mbuf_item *item, const bool lock)
+mbuf_extract_item (struct mbuf_set *ms, struct mbuf_item *item)
 {
   bool ret = false;
   if (ms)
diff --git a/mbuf.h b/mbuf.h
index 7be45559e9574ce9ea010c43197e867ca3c1e781..230b5b5ad98205846b328ae8401bbbdb6cf955a0 100644 (file)
--- a/mbuf.h
+++ b/mbuf.h
@@ -73,7 +73,7 @@ void mbuf_free_buf (struct mbuf_buffer *mb);
 
 void mbuf_add_item (struct mbuf_set *ms, const struct mbuf_item *item);
 
-bool mbuf_extract_item (struct mbuf_set *ms, struct mbuf_item *item, const bool lock);
+bool mbuf_extract_item (struct mbuf_set *ms, struct mbuf_item *item);
 
 void mbuf_dereference_instance (struct mbuf_set *ms, struct multi_instance *mi);
 
index 9d8fa664feff6e0fb49603517b7c7272a938a938..f068e06356f380a5e0aa5d2598ba1c6d9b691080 100644 (file)
--- a/mroute.c
+++ b/mroute.c
@@ -360,7 +360,6 @@ mroute_helper_init (int ageable_ttl_secs)
 {
   struct mroute_helper *mh;
   ALLOC_OBJ_CLEAR (mh, struct mroute_helper);
-  /*mutex_init (&mh->mutex);*/
   mh->ageable_ttl_secs = ageable_ttl_secs;
   return mh;
 }
@@ -398,12 +397,10 @@ mroute_helper_add_iroute (struct mroute_helper *mh, const struct iroute *ir)
   if (ir->netbits >= 0)
     {
       ASSERT (ir->netbits < MR_HELPER_NET_LEN);
-      mroute_helper_lock (mh);
       ++mh->cache_generation;
       ++mh->net_len_refcount[ir->netbits];
       if (mh->net_len_refcount[ir->netbits] == 1)
        mroute_helper_regenerate (mh);
-      mroute_helper_unlock (mh);
     }
 }
 
@@ -413,20 +410,17 @@ mroute_helper_del_iroute (struct mroute_helper *mh, const struct iroute *ir)
   if (ir->netbits >= 0)
     {
       ASSERT (ir->netbits < MR_HELPER_NET_LEN);
-      mroute_helper_lock (mh);
       ++mh->cache_generation;
       --mh->net_len_refcount[ir->netbits];
       ASSERT (mh->net_len_refcount[ir->netbits] >= 0);
       if (!mh->net_len_refcount[ir->netbits])
        mroute_helper_regenerate (mh);
-      mroute_helper_unlock (mh);
     }
 }
 
 void
 mroute_helper_free (struct mroute_helper *mh)
 {
-  /*mutex_destroy (&mh->mutex);*/
   free (mh);
 }
 
index 9b9087dd6f4d67866de4d51ecee0c7c2398ea73e..283d4c2801888da9b75838c210ee89f6760d3d63 100644 (file)
--- a/mroute.h
+++ b/mroute.h
@@ -91,7 +91,6 @@ struct mroute_addr {
  * Used to help maintain CIDR routing table.
  */
 struct mroute_helper {
-  /*MUTEX_DEFINE (mutex);*/
   unsigned int cache_generation; /* incremented when route added */
   int ageable_ttl_secs;          /* host route cache entry time-to-live*/
   int n_net_len;                 /* length of net_len array */
@@ -159,18 +158,6 @@ mroute_extract_addr_from_packet (struct mroute_addr *src,
   return ret;
 }
 
-static inline void
-mroute_helper_lock (struct mroute_helper *mh)
-{
-  /*mutex_lock (&mh->mutex);*/
-}
-
-static inline void
-mroute_helper_unlock (struct mroute_helper *mh)
-{
-  /*mutex_unlock (&mh->mutex);*/
-}
-
 static inline bool
 mroute_addr_equal (const struct mroute_addr *a1, const struct mroute_addr *a2)
 {
diff --git a/mtcp.c b/mtcp.c
index 72c9618e45b2cf81ccd28f09e8e1e25262e4ff25..cc0bab87291fc131d1e13401289958f9a502dcd8 100644 (file)
--- a/mtcp.c
+++ b/mtcp.c
@@ -264,7 +264,7 @@ multi_tcp_process_outgoing_link_ready (struct multi_context *m, struct multi_ins
   ASSERT (mi);
 
   /* extract from queue */
-  if (mbuf_extract_item (mi->tcp_link_out_deferred, &item, true)) /* ciphertext IP packet */
+  if (mbuf_extract_item (mi->tcp_link_out_deferred, &item)) /* ciphertext IP packet */
     {
       dmsg (D_MULTI_TCP, "MULTI TCP: transmitting previously deferred packet");
 
diff --git a/multi.c b/multi.c
index c2f2dbcd7b19c1b29baf4a4f2041d4538ef220b9..bf9e88962538281dd45e77c52e0f7f87c65607a2 100644 (file)
--- a/multi.c
+++ b/multi.c
@@ -1000,8 +1000,6 @@ multi_get_instance_by_virtual_addr (struct multi_context *m,
       struct mroute_addr tryaddr;
       int i;
 
-      mroute_helper_lock (rh);
-
       /* cycle through each CIDR length */
       for (i = 0; i < rh->n_net_len; ++i)
        {
@@ -1022,8 +1020,6 @@ multi_get_instance_by_virtual_addr (struct multi_context *m,
              break;
            }
        }
-      
-      mroute_helper_unlock (rh);
     }
   
 #ifdef ENABLE_DEBUG
@@ -2240,7 +2236,7 @@ multi_get_queue (struct mbuf_set *ms)
 {
   struct mbuf_item item;
 
-  if (mbuf_extract_item (ms, &item, true)) /* cleartext IP packet */
+  if (mbuf_extract_item (ms, &item)) /* cleartext IP packet */
     {
       unsigned int pipv4_flags = PIPV4_PASSTOS;
 
index 1df46a1a362b2a7377d5693c87ab1919e54c8075..6e6e1f89eb5fbedf13acfa0c9671032ad54645ab 100644 (file)
--- a/openvpn.h
+++ b/openvpn.h
@@ -460,9 +460,6 @@ struct context
   /* true on initial VPN iteration */
   bool first_time;
 
-  /* used by multi-client code to lock the context */
-  /*MUTEX_DEFINE (mutex);*/
-
   /* context modes */
 # define CM_P2P            0 /* standalone point-to-point session or client */
 # define CM_TOP            1 /* top level of a multi-client or point-to-multipoint server */
diff --git a/ssl.c b/ssl.c
index 5809f945751ee3a6598b467594f84093df5ec04b..c05d34fcd253763804fe7bd7f57186cd4460f6ee 100644 (file)
--- a/ssl.c
+++ b/ssl.c
@@ -3814,8 +3814,6 @@ tls_process (struct tls_multi *multi,
        msg (D_TLS_DEBUG_LOW, "TLS: tls_process: killed expiring key");
   }
 
-  /*mutex_cycle (multi->mutex);*/
-
   do
     {
       update_time ();
@@ -4099,7 +4097,6 @@ tls_process (struct tls_multi *multi,
                }
            }
        }
-      /*mutex_cycle (multi->mutex);*/
     }
   while (state_change);
 
@@ -4253,7 +4250,6 @@ tls_multi_process (struct tls_multi *multi,
                reset_session (multi, session);
            }
        }
-      /*mutex_cycle (multi->mutex);*/
     }
 
   update_time ();
diff --git a/ssl.h b/ssl.h
index 709b56a2127b9c8cbaafe2625863d94bc028abe1..78ce57eca9e0ea7bf4c291b21039bc0c96de5a41 100644 (file)
--- a/ssl.h
+++ b/ssl.h
@@ -573,9 +573,6 @@ struct tls_session
  */
 struct tls_multi
 {
-  /* used to coordinate access between main thread and TLS thread */
-  /*MUTEX_PTR_DEFINE (mutex);*/
-
   /* const options and config info */
   struct tls_options opt;