[L] Change in openvpn[master]: Remove various unused functions

"flichtenheld \(Code Review\) via Openvpn-devel" <[email protected]>
Newsgroups gmane.network.openvpn.devel
Message-ID <8e60335069e926468f35616c088a124f8b813f96-EmailReplacePatchSet-HTML@gerrit.openvpn.net>
Attention is currently required from: plaisthos, stipa.

Hello plaisthos, stipa, 

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1610?usp=email

to look at the new patch set (#14).


Change subject: Remove various unused functions
......................................................................

Remove various unused functions

Change-Id: I82a4e82ff876fab715e052de1903c65b835360b5
Signed-off-by: Frank Lichtenheld <[email protected]>
---
M src/openvpn/buffer.h
M src/openvpn/crypto_backend.h
M src/openvpn/crypto_mbedtls.c
M src/openvpn/crypto_mbedtls_legacy.c
M src/openvpn/crypto_openssl.c
M src/openvpn/dco_win.h
M src/openvpn/env_set.c
M src/openvpn/env_set.h
M src/openvpn/event.h
M src/openvpn/interval.h
M src/openvpn/manage.h
M src/openvpn/mroute.h
M src/openvpn/multi_io.c
M src/openvpn/multi_io.h
M src/openvpn/openvpn.c
M src/openvpn/plugin.c
M src/openvpn/plugin.h
M src/openvpn/route.c
M src/openvpn/route.h
19 files changed, 0 insertions(+), 256 deletions(-)


  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/10/1610/14

diff --git a/src/openvpn/buffer.h b/src/openvpn/buffer.h
index 85277ff..47c9420 100644
--- a/src/openvpn/buffer.h
+++ b/src/openvpn/buffer.h
@@ -1848,17 +1848,6 @@
 void x_gc_freespecial(struct gc_arena *a);
 
 /**
- * Return true iff the arena contains at least one allocation.
- *
- * @param a  The arena to test.
- */
-static inline bool
-gc_defined(struct gc_arena *a)
-{
-    return a->list != NULL;
-}
-
-/**
  * Initialise a garbage collection arena to an empty state.
  *
  * @param a  The arena to initialise.
diff --git a/src/openvpn/crypto_backend.h b/src/openvpn/crypto_backend.h
index 17085d6..b7f820d 100644
--- a/src/openvpn/crypto_backend.h
+++ b/src/openvpn/crypto_backend.h
@@ -569,15 +569,6 @@
 void md_ctx_cleanup(md_ctx_t *ctx);
 
 /*
- * Returns the size of the message digest output by the given context
- *
- * @param ctx           Message digest context.
- *
- * @return              Size of the message digest, or \0 if ctx is NULL.
- */
-int md_ctx_size(const md_ctx_t *ctx);
-
-/*
  * Process the given data for use in the message digest.
  *
  * @param ctx           Message digest context. May not be NULL.
diff --git a/src/openvpn/crypto_mbedtls.c b/src/openvpn/crypto_mbedtls.c
index 6662def..665257c0 100644
--- a/src/openvpn/crypto_mbedtls.c
+++ b/src/openvpn/crypto_mbedtls.c
@@ -718,16 +718,6 @@
     ASSERT(psa_hash_abort(&ctx->operation) == PSA_SUCCESS);
 }
 
-int
-md_ctx_size(const md_ctx_t *ctx)
-{
-    if (ctx == NULL)
-    {
-        return 0;
-    }
-    return (int)PSA_HASH_LENGTH(ctx->md_info->psa_alg);
-}
-
 void
 md_ctx_update(md_ctx_t *ctx, const uint8_t *src, size_t src_len)
 {
diff --git a/src/openvpn/crypto_mbedtls_legacy.c b/src/openvpn/crypto_mbedtls_legacy.c
index 9e47c26..8b187bf 100644
--- a/src/openvpn/crypto_mbedtls_legacy.c
+++ b/src/openvpn/crypto_mbedtls_legacy.c
@@ -848,16 +848,6 @@
     mbedtls_md_free(ctx);
 }
 
-int
-md_ctx_size(const mbedtls_md_context_t *ctx)
-{
-    if (NULL == ctx)
-    {
-        return 0;
-    }
-    return (int)mbedtls_md_get_size(mbedtls_md_info_from_ctx(ctx));
-}
-
 void
 md_ctx_update(mbedtls_md_context_t *ctx, const uint8_t *src, size_t src_len)
 {
diff --git a/src/openvpn/crypto_openssl.c b/src/openvpn/crypto_openssl.c
index 2019280..0be87e4 100644
--- a/src/openvpn/crypto_openssl.c
+++ b/src/openvpn/crypto_openssl.c
@@ -1108,12 +1108,6 @@
     EVP_MD_CTX_reset(ctx);
 }
 
-int
-md_ctx_size(const EVP_MD_CTX *ctx)
-{
-    return (int)EVP_MD_CTX_size(ctx);
-}
-
 void
 md_ctx_update(EVP_MD_CTX *ctx, const uint8_t *src, size_t src_len)
 {
diff --git a/src/openvpn/dco_win.h b/src/openvpn/dco_win.h
index ac3ce33..a92e5ad 100644
--- a/src/openvpn/dco_win.h
+++ b/src/openvpn/dco_win.h
@@ -65,8 +65,6 @@
 void dco_p2p_new_peer(HANDLE handle, OVERLAPPED *ov, struct link_socket *sock,
                       struct signal_info *sig_info);
 
-void dco_start_tun(struct tuntap *tt);
-
 bool dco_win_supports_multipeer(void);
 
 void dco_win_add_iroute_ipv4(dco_context_t *dco, in_addr_t dst, unsigned int netbits,
@@ -79,13 +77,5 @@
 
 void dco_win_del_iroute_ipv6(dco_context_t *dco, struct in6_addr dst, unsigned int netbits);
 
-#else  /* if defined(ENABLE_DCO) && defined(_WIN32) */
-
-static inline void
-dco_start_tun(struct tuntap *tt)
-{
-    ASSERT(false);
-}
-
 #endif /* defined(_WIN32) */
 #endif /* ifndef DCO_H */
diff --git a/src/openvpn/env_set.c b/src/openvpn/env_set.c
index d992097..e147913 100644
--- a/src/openvpn/env_set.c
+++ b/src/openvpn/env_set.c
@@ -209,32 +209,6 @@
 }
 
 void
-env_set_print(msglvl_t msglevel, const struct env_set *es)
-{
-    if (check_debug_level(msglevel))
-    {
-        const struct env_item *e;
-        int i;
-
-        if (es)
-        {
-            e = es->list;
-            i = 0;
-
-            while (e)
-            {
-                if (env_safe_to_print(e->string))
-                {
-                    msg(msglevel, "ENV [%d] '%s'", i, e->string);
-                }
-                ++i;
-                e = e->next;
-            }
-        }
-    }
-}
-
-void
 env_set_write_file(const char *path, const struct env_set *es)
 {
     FILE *fp = platform_fopen(path, "w");
@@ -411,15 +385,6 @@
 }
 
 void
-setenv_int_i(struct env_set *es, const char *name, const int value, const int i)
-{
-    struct gc_arena gc = gc_new();
-    const char *name_str = setenv_format_indexed_name(name, i, &gc);
-    setenv_int(es, name_str, value);
-    gc_free(&gc);
-}
-
-void
 setenv_str_i(struct env_set *es, const char *name, const char *value, const int i)
 {
     struct gc_arena gc = gc_new();
diff --git a/src/openvpn/env_set.h b/src/openvpn/env_set.h
index fcfc3ca..9b4a1e7 100644
--- a/src/openvpn/env_set.h
+++ b/src/openvpn/env_set.h
@@ -69,8 +69,6 @@
  */
 void setenv_str_incr(struct env_set *es, const char *name, const char *value);
 
-void setenv_int_i(struct env_set *es, const char *name, const int value, const int i);
-
 void setenv_str_i(struct env_set *es, const char *name, const char *value, const int i);
 
 /* struct env_set functions */
@@ -85,8 +83,6 @@
 
 const char *env_set_get(const struct env_set *es, const char *name);
 
-void env_set_print(msglvl_t msglevel, const struct env_set *es);
-
 /**
  * Write a struct env_set to a file. Each item on one line.
  *
diff --git a/src/openvpn/event.h b/src/openvpn/event.h
index 40ed161..b784dfe 100644
--- a/src/openvpn/event.h
+++ b/src/openvpn/event.h
@@ -190,13 +190,6 @@
     return ret;
 }
 
-static inline void
-event_set_return_init(struct event_set_return *esr)
-{
-    esr->rwflags = 0;
-    esr->arg = NULL;
-}
-
 #ifdef _WIN32
 
 static inline void
diff --git a/src/openvpn/interval.h b/src/openvpn/interval.h
index f6d3503..59051bd 100644
--- a/src/openvpn/interval.h
+++ b/src/openvpn/interval.h
@@ -255,47 +255,4 @@
  */
 bool event_timeout_trigger(struct event_timeout *et, struct timeval *tv, int et_const_retry);
 
-/*
- * Measure time intervals in microseconds
- */
-
-#define USEC_TIMER_MAX 60 /* maximum interval size in seconds */
-
-#define USEC_TIMER_MAX_USEC (USEC_TIMER_MAX * 1000000)
-
-struct usec_timer
-{
-    struct timeval start;
-    struct timeval end;
-};
-
-#ifdef HAVE_GETTIMEOFDAY
-
-static inline void
-usec_timer_start(struct usec_timer *obj)
-{
-    CLEAR(*obj);
-    openvpn_gettimeofday(&obj->start, NULL);
-}
-
-static inline void
-usec_timer_end(struct usec_timer *obj)
-{
-    openvpn_gettimeofday(&obj->end, NULL);
-}
-
-#endif /* HAVE_GETTIMEOFDAY */
-
-static inline bool
-usec_timer_interval_defined(struct usec_timer *obj)
-{
-    return obj->start.tv_sec && obj->end.tv_sec;
-}
-
-static inline int
-usec_timer_interval(struct usec_timer *obj)
-{
-    return tv_subtract(&obj->end, &obj->start, USEC_TIMER_MAX);
-}
-
 #endif /* INTERVAL_H */
diff --git a/src/openvpn/manage.h b/src/openvpn/manage.h
index 27d3b60..1be3549 100644
--- a/src/openvpn/manage.h
+++ b/src/openvpn/manage.h
@@ -158,12 +158,6 @@
     return h->size;
 }
 
-static inline int
-log_history_capacity(const struct log_history *h)
-{
-    return h->capacity;
-}
-
 /*
  * Callbacks for 'status' and 'kill' commands.
  * Also for management-based deferred authentication and packet filter.
diff --git a/src/openvpn/mroute.h b/src/openvpn/mroute.h
index 639281b..9d61b22 100644
--- a/src/openvpn/mroute.h
+++ b/src/openvpn/mroute.h
@@ -249,24 +249,4 @@
     dest->v4.addr = htonl(src);
 }
 
-static inline in_addr_t
-in_addr_t_from_mroute_addr(const struct mroute_addr *addr)
-{
-    if ((addr->type & MR_ADDR_MASK) == MR_ADDR_IPV4 && addr->netbits == 0 && addr->len == 4)
-    {
-        return ntohl(addr->v4.addr);
-    }
-    else
-    {
-        return 0;
-    }
-}
-
-static inline void
-mroute_addr_reset(struct mroute_addr *ma)
-{
-    ma->len = 0;
-    ma->type = MR_ADDR_NONE;
-}
-
 #endif /* MROUTE_H */
diff --git a/src/openvpn/multi_io.c b/src/openvpn/multi_io.c
index d8cc708..bb1fbce 100644
--- a/src/openvpn/multi_io.c
+++ b/src/openvpn/multi_io.c
@@ -661,12 +661,3 @@
 
     } while (action != TA_UNDEF);
 }
-
-void
-multi_io_delete_event(struct multi_io *multi_io, event_t event)
-{
-    if (multi_io && multi_io->es)
-    {
-        event_del(multi_io->es, event);
-    }
-}
diff --git a/src/openvpn/multi_io.h b/src/openvpn/multi_io.h
index d6734bd..38825ab 100644
--- a/src/openvpn/multi_io.h
+++ b/src/openvpn/multi_io.h
@@ -72,6 +72,4 @@
 
 void multi_io_action(struct multi_context *m, struct multi_instance *mi, int action, bool poll);
 
-void multi_io_delete_event(struct multi_io *multi_io, event_t event);
-
 #endif /* ifndef MULTI_IO_H */
diff --git a/src/openvpn/openvpn.c b/src/openvpn/openvpn.c
index 7d35195..24d6bb6 100644
--- a/src/openvpn/openvpn.c
+++ b/src/openvpn/openvpn.c
@@ -32,7 +32,6 @@
 #include "win32.h"
 #include "options_show.h"
 #include "platform.h"
-#include "string.h"
 
 #include "memdbg.h"
 
diff --git a/src/openvpn/plugin.c b/src/openvpn/plugin.c
index f8adde5..29f9327 100644
--- a/src/openvpn/plugin.c
+++ b/src/openvpn/plugin.c
@@ -993,24 +993,4 @@
     pr->n = 0;
 }
 
-#ifdef ENABLE_DEBUG
-void
-plugin_return_print(const msglvl_t msglevel, const char *prefix, const struct plugin_return *pr)
-{
-    int i;
-    msg(msglevel, "PLUGIN_RETURN_PRINT %s", prefix);
-    for (i = 0; i < pr->n; ++i)
-    {
-        struct openvpn_plugin_string_list *l = pr->list[i];
-        int count = 0;
-
-        msg(msglevel, "PLUGIN #%d (%s)", i, prefix);
-        while (l)
-        {
-            msg(msglevel, "[%d] '%s' -> '%s'", ++count, l->name, l->value);
-            l = l->next;
-        }
-    }
-}
-#endif /* ifdef ENABLE_DEBUG */
 #endif /* ENABLE_PLUGIN */
diff --git a/src/openvpn/plugin.h b/src/openvpn/plugin.h
index 7e9faf3..b5fb916 100644
--- a/src/openvpn/plugin.h
+++ b/src/openvpn/plugin.h
@@ -135,10 +135,6 @@
 
 void plugin_return_free(struct plugin_return *pr);
 
-#ifdef ENABLE_DEBUG
-void plugin_return_print(const msglvl_t msglevel, const char *prefix, const struct plugin_return *pr);
-
-#endif
 
 static inline int
 plugin_n(const struct plugin_list *pl)
diff --git a/src/openvpn/route.c b/src/openvpn/route.c
index 8ea745d..6dbe3ec 100644
--- a/src/openvpn/route.c
+++ b/src/openvpn/route.c
@@ -185,19 +185,6 @@
     dest->gc = a;
 }
 
-static const char *
-route_string(const struct route_ipv4 *r, struct gc_arena *gc)
-{
-    struct buffer out = alloc_buf_gc(256, gc);
-    buf_printf(&out, "ROUTE network %s netmask %s gateway %s", print_in_addr_t(r->network, 0, gc),
-               print_in_addr_t(r->netmask, 0, gc), print_in_addr_t(r->gateway, 0, gc));
-    if (r->flags & RT_METRIC_DEFINED)
-    {
-        buf_printf(&out, " metric %d", r->metric);
-    }
-    return BSTR(&out);
-}
-
 static bool
 is_route_parm_defined(const char *parm)
 {
@@ -1325,27 +1312,6 @@
 #endif /* ifndef ENABLE_SMALL */
 
 static void
-print_route(const struct route_ipv4 *r, msglvl_t msglevel)
-{
-    struct gc_arena gc = gc_new();
-    if (r->flags & RT_DEFINED)
-    {
-        msg(msglevel, "%s", route_string(r, &gc));
-    }
-    gc_free(&gc);
-}
-
-void
-print_routes(const struct route_list *rl, msglvl_t msglevel)
-{
-    struct route_ipv4 *r;
-    for (r = rl->routes; r; r = r->next)
-    {
-        print_route(r, msglevel);
-    }
-}
-
-static void
 setenv_route(struct env_set *es, const struct route_ipv4 *r, int i)
 {
     struct gc_arena gc = gc_new();
diff --git a/src/openvpn/route.h b/src/openvpn/route.h
index 88107e9..0d33d36 100644
--- a/src/openvpn/route.h
+++ b/src/openvpn/route.h
@@ -377,8 +377,6 @@
 
 #endif
 
-void print_routes(const struct route_list *rl, msglvl_t msglevel);
-
 #ifdef _WIN32
 
 void show_routes(msglvl_t msglevel);
@@ -409,19 +407,6 @@
     return mask;
 }
 
-static inline bool
-route_list_vpn_gateway_needed(const struct route_list *rl)
-{
-    if (!rl)
-    {
-        return false;
-    }
-    else
-    {
-        return !(rl->spec.flags & RTSA_REMOTE_ENDPOINT);
-    }
-}
-
 static inline int
 route_did_redirect_default_gateway(const struct route_list *rl)
 {

-- 
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1610?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I82a4e82ff876fab715e052de1903c65b835360b5
Gerrit-Change-Number: 1610
Gerrit-PatchSet: 14
Gerrit-Owner: flichtenheld <[email protected]>
Gerrit-Reviewer: plaisthos <[email protected]>
Gerrit-Reviewer: stipa <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>
Gerrit-Attention: stipa <[email protected]>

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.