Change in openvpn[master]: Remove a large number of unused structs and functions
A message that is not in the archive (sent off-list or not yet received): gerrit.1729216832000.I0d96ee06c355c6a5ce082af23921e329d3efae33@...2715...
Attention is currently required from: flichtenheld.
Hello flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/783?usp=email
to review the following change.
Change subject: Remove a large number of unused structs and functions
......................................................................
Remove a large number of unused structs and functions
These have been found by Clion's Inspect Code functionality and have been verified by hand. A few functions like buf_read_u32 have been kept since they still feel being useful while currently not being used.
---
M src/openvpn/buffer.c
M src/openvpn/buffer.h
M src/openvpn/crypto_mbedtls.h
M src/openvpn/crypto_openssl.h
M src/openvpn/error.h
M src/openvpn/fragment.h
M src/openvpn/init.c
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/misc.h
M src/openvpn/mtcp.c
M src/openvpn/mtcp.h
M src/openvpn/openvpn.h
M src/openvpn/packet_id.h
M src/openvpn/platform.c
M src/openvpn/platform.h
M src/openvpn/proto.h
M src/openvpn/proxy.h
M src/openvpn/ps.h
M src/openvpn/shaper.h
M src/openvpn/socket.h
M tests/unit_tests/openvpn/test_buffer.c
M tests/unit_tests/openvpn/test_pkt.c
23 files changed, 0 insertions(+), 162 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/83/783/1
src/openvpn/buffer.c +0 -18
@@ -296,24 +296,6 @@ } } -/* -* convert a multi-line output to one line -*/ -void -convert_to_one_line (struct buffer *buf) -{ -uint8_t *cp =BPTR (buf); -int len =BLEN (buf); -while (len--) - { -if (*cp =='\n' ) - { - *cp ='|' ; - } - ++cp; - } -} -bool buffer_write_file (const char *filename,const struct buffer *buf) {
src/openvpn/buffer.h +0 -5
@@ -487,11 +487,6 @@void buf_catrunc (struct buffer *buf,const char *str);/* -* convert a multi-line output to one line -*/ -void convert_to_one_line (struct buffer *buf); - -/* * Parse a string based on a given delimiter char */ bool buf_parse (struct buffer *buf,const int delim,char *line,const int size);
src/openvpn/crypto_mbedtls.h +0 -1
@@ -75,7 +75,6 @@#define MD5_DIGEST_LENGTH 16#define SHA_DIGEST_LENGTH 20#define SHA256_DIGEST_LENGTH 32 -#define DES_KEY_LENGTH 8/** * Returns a singleton instance of the mbed TLS random number generator.
src/openvpn/crypto_openssl.h +0 -1
@@ -93,7 +93,6 @@/** Cipher should decrypt */ #define OPENVPN_OP_DECRYPT 0 -#define DES_KEY_LENGTH 8#define MD4_DIGEST_LENGTH 16/**
src/openvpn/error.h +0 -4
@@ -297,10 +297,6 @@extern const char *x_msg_prefix; -void msg_thread_init (void ); - -void msg_thread_uninit (void ); -static inline void msg_set_prefix (const char *prefix) {
src/openvpn/fragment.h +0 -2
@@ -137,8 +137,6 @@struct event_timeout wakeup;/**< Timeout structure used by the main * event loop to know when to do * fragmentation housekeeping. */ -bool received_os_mtu_hint;/**< Whether the operating system has -* explicitly recommended an MTU value. */ #define N_SEQ_ID 256/**< One more than the maximum fragment * sequence ID, above which the IDs wrap
src/openvpn/init.c +0 -2
@@ -816,8 +816,6 @@bool init_static (void ) { -/* configure_path (); */ -#if defined(DMALLOC )crypto_init_dmalloc ();#endif
src/openvpn/manage.c +0 -10
@@ -3797,16 +3797,6 @@ }/* -* Return true if (from the management interface's perspective) OpenVPN should -* daemonize. -*/ -bool -management_should_daemonize (struct management *man) -{ -return management_would_hold (man) || (man->settings.flags &MF_QUERY_PASSWORDS ); -} - -/* * If the hold flag is enabled, hibernate until a management client releases the hold. * Return true if the caller should not sleep for an additional time interval. */
src/openvpn/manage.h +0 -2
@@ -390,8 +390,6 @@#endif -bool management_should_daemonize (struct management *man); -bool management_would_hold (struct management *man);bool management_hold (struct management *man,int holdtime);
src/openvpn/misc.h +0 -3
@@ -186,9 +186,6 @@*/ const char *safe_print (const char *str,struct gc_arena *gc); - -void configure_path (void ); -const char *sanitize_control_message (const char *str,struct gc_arena *gc);/*
src/openvpn/mtcp.c +0 -8
@@ -63,14 +63,6 @@#define MTCP_N ((void *)16)/* upper bound on MTCP_x */ -struct ta_iow_flags -{ -unsigned int flags; -unsigned int ret; -unsigned int tun; -unsigned int sock; -}; -#ifdef ENABLE_DEBUG static const char *pract (int action)
src/openvpn/mtcp.h +0 -3
@@ -58,9 +58,6 @@void multi_tcp_instance_specific_free (struct multi_instance *mi); -void multi_tcp_link_out_deferred (struct multi_context *m,struct multi_instance *mi); - -/**************************************************************************/ /** * Main event loop for OpenVPN in TCP server mode.
src/openvpn/openvpn.h +0 -4
@@ -200,10 +200,6 @@/**< Hash of option strings received from the * remote OpenVPN server. Only used in * client-mode. */ - -struct user_pass *auth_user_pass; -/**< Username and password for -* authentication. */ };
src/openvpn/packet_id.h +0 -17
@@ -318,23 +318,6 @@return p->id >=PACKET_ID_WRAP_TRIGGER ; } -static inline bool -check_timestamp_delta (time_t remote,unsigned int max_delta) -{ -unsigned int abs; -const time_t local_now = now; - -if (local_now >= remote) - { - abs = local_now - remote; - } -else - { - abs = remote - local_now; - } -return abs <= max_delta; -} -static inline void packet_id_reap_test (struct packet_id_rec *p) {
src/openvpn/platform.c +0 -13
@@ -483,19 +483,6 @@#endif } -/* -* Go to sleep indefinitely. -*/ -void -platform_sleep_until_signal (void ) -{ -#ifdef _WIN32 -ASSERT (0 ); -#else -select (0 ,NULL ,NULL ,NULL ,NULL ); -#endif -} -/* delete a file, return true if succeeded */ bool platform_unlink (const char *filename)
src/openvpn/platform.h +0 -4
@@ -131,13 +131,9 @@void platform_sleep_milliseconds (unsigned int n); -void platform_sleep_until_signal (void ); -/* delete a file, return true if succeeded */ bool platform_unlink (const char *filename); -int platform_putenv (char *string); -FILE *platform_fopen (const char *path,const char *mode);int platform_open (const char *path,int flags,int mode);
src/openvpn/proto.h +0 -19
@@ -83,25 +83,6 @@#define SIZE_ETH_TO_8021Q_HDR (sizeof(struct openvpn_8021qhdr) \ - sizeof(struct openvpn_ethhdr)) - -struct openvpn_arp { -#define ARP_MAC_ADDR_TYPE 0x0001 -uint16_t mac_addr_type;/* 0x0001 */ - -uint16_t proto_addr_type;/* 0x0800 */ -uint8_t mac_addr_size;/* 0x06 */ -uint8_t proto_addr_size;/* 0x04 */ - -#define ARP_REQUEST 0x0001 -#define ARP_REPLY 0x0002 -uint16_t arp_command;/* 0x0001 for ARP request, 0x0002 for ARP reply */ - -uint8_t mac_src[OPENVPN_ETH_ALEN ]; -in_addr_t ip_src; -uint8_t mac_dest[OPENVPN_ETH_ALEN ]; -in_addr_t ip_dest; -}; -struct openvpn_iphdr {#define OPENVPN_IPH_GET_VER (v) (((v) >> 4) & 0x0F)#define OPENVPN_IPH_GET_LEN (v) (((v) & 0x0F) << 2)
src/openvpn/proxy.h +0 -6
@@ -61,12 +61,6 @@bool nocache; }; -struct http_proxy_options_simple { -const char *server; -const char *port; -int auth_retry; -}; -struct http_proxy_info {bool defined;int auth_method;
src/openvpn/ps.h +0 -2
@@ -30,8 +30,6 @@#include "buffer.h" #include "ssl.h" -typedef void (*post_fork_cleanup_func_t )(void *arg); -struct port_share {/* Foreground's socket to background process */ socket_descriptor_t foreground_fd;
src/openvpn/shaper.h +0 -6
@@ -89,12 +89,6 @@shaper_reset_wakeup (s); } -static inline int -shaper_current_bandwidth (struct shaper *s) -{ -return s->bytes_per_second; -} -/* * Returns traffic shaping delay in microseconds relative to current * time, or 0 if no delay.
src/openvpn/socket.h +0 -26
@@ -362,16 +362,6 @@static inline const char * -print_openvpn_sockaddr_ex (const struct openvpn_sockaddr *addr, -const char *separator, -const unsigned int flags, -struct gc_arena *gc) -{ -return print_sockaddr_ex (&addr->addr.sa, separator, flags, gc); -} - -static inline -const char *print_openvpn_sockaddr (const struct openvpn_sockaddr *addr,struct gc_arena *gc) {
@@ -771,22 +761,6 @@return false; } -static inline in_addr_t -addr_host (const struct openvpn_sockaddr *addr) -{ -/* -* "public" addr returned is checked against ifconfig for -* possible clash: non sense for now given -* that we do ifconfig only IPv4 -*/ -if (addr->addr.sa.sa_family !=AF_INET ) - { -return 0 ; - } -return ntohl (addr->addr.in4.sin_addr.s_addr); -} - -static inline bool addrlist_port_match (const struct openvpn_sockaddr *a1,const struct addrinfo *a2) {
tests/unit_tests/openvpn/test_buffer.c +0 -1
@@ -49,7 +49,6 @@#define teststr1 "one"#define teststr2 "two"#define teststr3 "three" -#define teststr4 "four"#define assert_buf_equals_str (buf, str) \ assert_int_equal(BLEN(buf), strlen(str)); \
tests/unit_tests/openvpn/test_pkt.c +0 -5
@@ -69,11 +69,6 @@return "dummy print_link_socket_actual from unit test" ; } -struct test_pkt_context { -struct tls_auth_standalone tas_tls_auth; -struct tls_auth_standalone tas_crypt; -}; -const char static_key[] ="<tls-auth>\n" "-----BEGIN OpenVPN Static key V1-----\n" "37268ea8f95d7f71f9fb8fc03770c460\n"
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/783?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0d96ee06c355c6a5ce082af23921e329d3efae33
Gerrit-Change-Number: 783
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: flichtenheld, plaisthos.
cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/783?usp=email )
Change subject: Remove a large number of unused structs and functions
......................................................................
Patch Set 1: Code-Review+2
(1 comment)
Patchset:
PS1:
This is... amazing. Especially finding yet another "struct user_pass" tucked away "somewhere". Went through it and things look good, plus the buildbots agree.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/783?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0d96ee06c355c6a5ce082af23921e329d3efae33
Gerrit-Change-Number: 783
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Fri, 18 Oct 2024 06:34:30 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
PATCH 1/1 Remove a large number of unused structs and functions
In reply to a message not in the archiveFrom: Arne Schwabe <[email protected]...>
These have been found by Clion's Inspect Code functionality and have been verified by hand. A few functions like buf_read_u32 have been kept since they still feel being useful while currently not being used.
---
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/+/783
This mail reflects revision 1 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
src/openvpn/buffer.c +0 -18
@@ -296,24 +296,6 @@ } } -/* -* convert a multi-line output to one line -*/ -void -convert_to_one_line (struct buffer *buf) -{ -uint8_t *cp =BPTR (buf); -int len =BLEN (buf); -while (len--) - { -if (*cp =='\n' ) - { - *cp ='|' ; - } - ++cp; - } -} -bool buffer_write_file (const char *filename,const struct buffer *buf) {
src/openvpn/buffer.h +0 -5
@@ -487,11 +487,6 @@void buf_catrunc (struct buffer *buf,const char *str);/* -* convert a multi-line output to one line -*/ -void convert_to_one_line (struct buffer *buf); - -/* * Parse a string based on a given delimiter char */ bool buf_parse (struct buffer *buf,const int delim,char *line,const int size);
src/openvpn/crypto_mbedtls.h +0 -1
@@ -75,7 +75,6 @@#define MD5_DIGEST_LENGTH 16#define SHA_DIGEST_LENGTH 20#define SHA256_DIGEST_LENGTH 32 -#define DES_KEY_LENGTH 8/** * Returns a singleton instance of the mbed TLS random number generator.
src/openvpn/crypto_openssl.h +0 -1
@@ -93,7 +93,6 @@/** Cipher should decrypt */ #define OPENVPN_OP_DECRYPT 0 -#define DES_KEY_LENGTH 8#define MD4_DIGEST_LENGTH 16/**
src/openvpn/error.h +0 -4
@@ -297,10 +297,6 @@extern const char *x_msg_prefix; -void msg_thread_init (void ); - -void msg_thread_uninit (void ); -static inline void msg_set_prefix (const char *prefix) {
src/openvpn/fragment.h +0 -2
@@ -137,8 +137,6 @@struct event_timeout wakeup;/**< Timeout structure used by the main * event loop to know when to do * fragmentation housekeeping. */ -bool received_os_mtu_hint;/**< Whether the operating system has -* explicitly recommended an MTU value. */ #define N_SEQ_ID 256/**< One more than the maximum fragment * sequence ID, above which the IDs wrap
src/openvpn/init.c +0 -2
@@ -816,8 +816,6 @@bool init_static (void ) { -/* configure_path (); */ -#if defined(DMALLOC )crypto_init_dmalloc ();#endif
src/openvpn/manage.c +0 -10
@@ -3797,16 +3797,6 @@ }/* -* Return true if (from the management interface's perspective) OpenVPN should -* daemonize. -*/ -bool -management_should_daemonize (struct management *man) -{ -return management_would_hold (man) || (man->settings.flags &MF_QUERY_PASSWORDS ); -} - -/* * If the hold flag is enabled, hibernate until a management client releases the hold. * Return true if the caller should not sleep for an additional time interval. */
src/openvpn/manage.h +0 -2
@@ -390,8 +390,6 @@#endif -bool management_should_daemonize (struct management *man); -bool management_would_hold (struct management *man);bool management_hold (struct management *man,int holdtime);
src/openvpn/misc.h +0 -3
@@ -186,9 +186,6 @@*/ const char *safe_print (const char *str,struct gc_arena *gc); - -void configure_path (void ); -const char *sanitize_control_message (const char *str,struct gc_arena *gc);/*
src/openvpn/mtcp.c +0 -8
@@ -63,14 +63,6 @@#define MTCP_N ((void *)16)/* upper bound on MTCP_x */ -struct ta_iow_flags -{ -unsigned int flags; -unsigned int ret; -unsigned int tun; -unsigned int sock; -}; -#ifdef ENABLE_DEBUG static const char *pract (int action)
src/openvpn/mtcp.h +0 -3
@@ -58,9 +58,6 @@void multi_tcp_instance_specific_free (struct multi_instance *mi); -void multi_tcp_link_out_deferred (struct multi_context *m,struct multi_instance *mi); - -/**************************************************************************/ /** * Main event loop for OpenVPN in TCP server mode.
src/openvpn/openvpn.h +0 -4
@@ -200,10 +200,6 @@/**< Hash of option strings received from the * remote OpenVPN server. Only used in * client-mode. */ - -struct user_pass *auth_user_pass; -/**< Username and password for -* authentication. */ };
src/openvpn/packet_id.h +0 -17
@@ -318,23 +318,6 @@return p->id >=PACKET_ID_WRAP_TRIGGER ; } -static inline bool -check_timestamp_delta (time_t remote,unsigned int max_delta) -{ -unsigned int abs; -const time_t local_now = now; - -if (local_now >= remote) - { - abs = local_now - remote; - } -else - { - abs = remote - local_now; - } -return abs <= max_delta; -} -static inline void packet_id_reap_test (struct packet_id_rec *p) {
src/openvpn/platform.c +0 -13
@@ -483,19 +483,6 @@#endif } -/* -* Go to sleep indefinitely. -*/ -void -platform_sleep_until_signal (void ) -{ -#ifdef _WIN32 -ASSERT (0 ); -#else -select (0 ,NULL ,NULL ,NULL ,NULL ); -#endif -} -/* delete a file, return true if succeeded */ bool platform_unlink (const char *filename)
src/openvpn/platform.h +0 -4
@@ -131,13 +131,9 @@void platform_sleep_milliseconds (unsigned int n); -void platform_sleep_until_signal (void ); -/* delete a file, return true if succeeded */ bool platform_unlink (const char *filename); -int platform_putenv (char *string); -FILE *platform_fopen (const char *path,const char *mode);int platform_open (const char *path,int flags,int mode);
src/openvpn/proto.h +0 -19
@@ -83,25 +83,6 @@#define SIZE_ETH_TO_8021Q_HDR (sizeof(struct openvpn_8021qhdr) \ - sizeof(struct openvpn_ethhdr)) - -struct openvpn_arp { -#define ARP_MAC_ADDR_TYPE 0x0001 -uint16_t mac_addr_type;/* 0x0001 */ - -uint16_t proto_addr_type;/* 0x0800 */ -uint8_t mac_addr_size;/* 0x06 */ -uint8_t proto_addr_size;/* 0x04 */ - -#define ARP_REQUEST 0x0001 -#define ARP_REPLY 0x0002 -uint16_t arp_command;/* 0x0001 for ARP request, 0x0002 for ARP reply */ - -uint8_t mac_src[OPENVPN_ETH_ALEN ]; -in_addr_t ip_src; -uint8_t mac_dest[OPENVPN_ETH_ALEN ]; -in_addr_t ip_dest; -}; -struct openvpn_iphdr {#define OPENVPN_IPH_GET_VER (v) (((v) >> 4) & 0x0F)#define OPENVPN_IPH_GET_LEN (v) (((v) & 0x0F) << 2)
src/openvpn/proxy.h +0 -6
@@ -61,12 +61,6 @@bool nocache; }; -struct http_proxy_options_simple { -const char *server; -const char *port; -int auth_retry; -}; -struct http_proxy_info {bool defined;int auth_method;
src/openvpn/ps.h +0 -2
@@ -30,8 +30,6 @@#include "buffer.h" #include "ssl.h" -typedef void (*post_fork_cleanup_func_t )(void *arg); -struct port_share {/* Foreground's socket to background process */ socket_descriptor_t foreground_fd;
src/openvpn/shaper.h +0 -6
@@ -89,12 +89,6 @@shaper_reset_wakeup (s); } -static inline int -shaper_current_bandwidth (struct shaper *s) -{ -return s->bytes_per_second; -} -/* * Returns traffic shaping delay in microseconds relative to current * time, or 0 if no delay.
src/openvpn/socket.h +0 -26
@@ -362,16 +362,6 @@static inline const char * -print_openvpn_sockaddr_ex (const struct openvpn_sockaddr *addr, -const char *separator, -const unsigned int flags, -struct gc_arena *gc) -{ -return print_sockaddr_ex (&addr->addr.sa, separator, flags, gc); -} - -static inline -const char *print_openvpn_sockaddr (const struct openvpn_sockaddr *addr,struct gc_arena *gc) {
@@ -771,22 +761,6 @@return false; } -static inline in_addr_t -addr_host (const struct openvpn_sockaddr *addr) -{ -/* -* "public" addr returned is checked against ifconfig for -* possible clash: non sense for now given -* that we do ifconfig only IPv4 -*/ -if (addr->addr.sa.sa_family !=AF_INET ) - { -return 0 ; - } -return ntohl (addr->addr.in4.sin_addr.s_addr); -} - -static inline bool addrlist_port_match (const struct openvpn_sockaddr *a1,const struct addrinfo *a2) {
tests/unit_tests/openvpn/test_buffer.c +0 -1
@@ -49,7 +49,6 @@#define teststr1 "one"#define teststr2 "two"#define teststr3 "three" -#define teststr4 "four"#define assert_buf_equals_str (buf, str) \ assert_int_equal(BLEN(buf), strlen(str)); \
tests/unit_tests/openvpn/test_pkt.c +0 -5
@@ -69,11 +69,6 @@return "dummy print_link_socket_actual from unit test" ; } -struct test_pkt_context { -struct tls_auth_standalone tas_tls_auth; -struct tls_auth_standalone tas_crypt; -}; -const char static_key[] ="<tls-auth>\n" "-----BEGIN OpenVPN Static key V1-----\n" "37268ea8f95d7f71f9fb8fc03770c460\n"
[Openvpn-devel] [PATCH applied] Re: Remove a large number of unused structs and functions
Stared at the changes, scratched my head, checked individual "things" with "git grep", and also had GH do a test build on platforms that buildbot doesn't cover (BB is all green) - GH also all green.
Your patch has been applied to the master branch.
commit fcbb62375c3fe02549da57b05afb871bf44df338
Author: Arne Schwabe Date: Fri Oct 18 08:37:17 2024 +0200
Remove a large number of unused structs and functions
Signed-off-by: Arne Schwabe <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg29594.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#2) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/783?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by cron2
Change subject: Remove a large number of unused structs and functions
......................................................................
Remove a large number of unused structs and functions
These have been found by Clion's Inspect Code functionality and have been verified by hand. A few functions like buf_read_u32 have been kept since they still feel being useful while currently not being used.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg29594.html
---
M src/openvpn/buffer.c
M src/openvpn/buffer.h
M src/openvpn/crypto_mbedtls.h
M src/openvpn/crypto_openssl.h
M src/openvpn/error.h
M src/openvpn/fragment.h
M src/openvpn/init.c
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/misc.h
M src/openvpn/mtcp.c
M src/openvpn/mtcp.h
M src/openvpn/openvpn.h
M src/openvpn/packet_id.h
M src/openvpn/platform.c
M src/openvpn/platform.h
M src/openvpn/proto.h
M src/openvpn/proxy.h
M src/openvpn/ps.h
M src/openvpn/shaper.h
M src/openvpn/socket.h
M tests/unit_tests/openvpn/test_buffer.c
M tests/unit_tests/openvpn/test_pkt.c
23 files changed, 0 insertions(+), 162 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/83/783/2
src/openvpn/buffer.c +0 -18
@@ -296,24 +296,6 @@ } } -/* -* convert a multi-line output to one line -*/ -void -convert_to_one_line (struct buffer *buf) -{ -uint8_t *cp =BPTR (buf); -int len =BLEN (buf); -while (len--) - { -if (*cp =='\n' ) - { - *cp ='|' ; - } - ++cp; - } -} -bool buffer_write_file (const char *filename,const struct buffer *buf) {
src/openvpn/buffer.h +0 -5
@@ -487,11 +487,6 @@void buf_catrunc (struct buffer *buf,const char *str);/* -* convert a multi-line output to one line -*/ -void convert_to_one_line (struct buffer *buf); - -/* * Parse a string based on a given delimiter char */ bool buf_parse (struct buffer *buf,const int delim,char *line,const int size);
src/openvpn/crypto_mbedtls.h +0 -1
@@ -75,7 +75,6 @@#define MD5_DIGEST_LENGTH 16#define SHA_DIGEST_LENGTH 20#define SHA256_DIGEST_LENGTH 32 -#define DES_KEY_LENGTH 8/** * Returns a singleton instance of the mbed TLS random number generator.
src/openvpn/crypto_openssl.h +0 -1
@@ -93,7 +93,6 @@/** Cipher should decrypt */ #define OPENVPN_OP_DECRYPT 0 -#define DES_KEY_LENGTH 8#define MD4_DIGEST_LENGTH 16/**
src/openvpn/error.h +0 -4
@@ -297,10 +297,6 @@extern const char *x_msg_prefix; -void msg_thread_init (void ); - -void msg_thread_uninit (void ); -static inline void msg_set_prefix (const char *prefix) {
src/openvpn/fragment.h +0 -2
@@ -137,8 +137,6 @@struct event_timeout wakeup;/**< Timeout structure used by the main * event loop to know when to do * fragmentation housekeeping. */ -bool received_os_mtu_hint;/**< Whether the operating system has -* explicitly recommended an MTU value. */ #define N_SEQ_ID 256/**< One more than the maximum fragment * sequence ID, above which the IDs wrap
src/openvpn/init.c +0 -2
@@ -816,8 +816,6 @@bool init_static (void ) { -/* configure_path (); */ -#if defined(DMALLOC )crypto_init_dmalloc ();#endif
src/openvpn/manage.c +0 -10
@@ -3797,16 +3797,6 @@ }/* -* Return true if (from the management interface's perspective) OpenVPN should -* daemonize. -*/ -bool -management_should_daemonize (struct management *man) -{ -return management_would_hold (man) || (man->settings.flags &MF_QUERY_PASSWORDS ); -} - -/* * If the hold flag is enabled, hibernate until a management client releases the hold. * Return true if the caller should not sleep for an additional time interval. */
src/openvpn/manage.h +0 -2
@@ -390,8 +390,6 @@#endif -bool management_should_daemonize (struct management *man); -bool management_would_hold (struct management *man);bool management_hold (struct management *man,int holdtime);
src/openvpn/misc.h +0 -3
@@ -186,9 +186,6 @@*/ const char *safe_print (const char *str,struct gc_arena *gc); - -void configure_path (void ); -const char *sanitize_control_message (const char *str,struct gc_arena *gc);/*
src/openvpn/mtcp.c +0 -8
@@ -63,14 +63,6 @@#define MTCP_N ((void *)16)/* upper bound on MTCP_x */ -struct ta_iow_flags -{ -unsigned int flags; -unsigned int ret; -unsigned int tun; -unsigned int sock; -}; -#ifdef ENABLE_DEBUG static const char *pract (int action)
src/openvpn/mtcp.h +0 -3
@@ -58,9 +58,6 @@void multi_tcp_instance_specific_free (struct multi_instance *mi); -void multi_tcp_link_out_deferred (struct multi_context *m,struct multi_instance *mi); - -/**************************************************************************/ /** * Main event loop for OpenVPN in TCP server mode.
src/openvpn/openvpn.h +0 -4
@@ -200,10 +200,6 @@/**< Hash of option strings received from the * remote OpenVPN server. Only used in * client-mode. */ - -struct user_pass *auth_user_pass; -/**< Username and password for -* authentication. */ };
src/openvpn/packet_id.h +0 -17
@@ -318,23 +318,6 @@return p->id >=PACKET_ID_WRAP_TRIGGER ; } -static inline bool -check_timestamp_delta (time_t remote,unsigned int max_delta) -{ -unsigned int abs; -const time_t local_now = now; - -if (local_now >= remote) - { - abs = local_now - remote; - } -else - { - abs = remote - local_now; - } -return abs <= max_delta; -} -static inline void packet_id_reap_test (struct packet_id_rec *p) {
src/openvpn/platform.c +0 -13
@@ -483,19 +483,6 @@#endif } -/* -* Go to sleep indefinitely. -*/ -void -platform_sleep_until_signal (void ) -{ -#ifdef _WIN32 -ASSERT (0 ); -#else -select (0 ,NULL ,NULL ,NULL ,NULL ); -#endif -} -/* delete a file, return true if succeeded */ bool platform_unlink (const char *filename)
src/openvpn/platform.h +0 -4
@@ -131,13 +131,9 @@void platform_sleep_milliseconds (unsigned int n); -void platform_sleep_until_signal (void ); -/* delete a file, return true if succeeded */ bool platform_unlink (const char *filename); -int platform_putenv (char *string); -FILE *platform_fopen (const char *path,const char *mode);int platform_open (const char *path,int flags,int mode);
src/openvpn/proto.h +0 -19
@@ -83,25 +83,6 @@#define SIZE_ETH_TO_8021Q_HDR (sizeof(struct openvpn_8021qhdr) \ - sizeof(struct openvpn_ethhdr)) - -struct openvpn_arp { -#define ARP_MAC_ADDR_TYPE 0x0001 -uint16_t mac_addr_type;/* 0x0001 */ - -uint16_t proto_addr_type;/* 0x0800 */ -uint8_t mac_addr_size;/* 0x06 */ -uint8_t proto_addr_size;/* 0x04 */ - -#define ARP_REQUEST 0x0001 -#define ARP_REPLY 0x0002 -uint16_t arp_command;/* 0x0001 for ARP request, 0x0002 for ARP reply */ - -uint8_t mac_src[OPENVPN_ETH_ALEN ]; -in_addr_t ip_src; -uint8_t mac_dest[OPENVPN_ETH_ALEN ]; -in_addr_t ip_dest; -}; -struct openvpn_iphdr {#define OPENVPN_IPH_GET_VER (v) (((v) >> 4) & 0x0F)#define OPENVPN_IPH_GET_LEN (v) (((v) & 0x0F) << 2)
src/openvpn/proxy.h +0 -6
@@ -61,12 +61,6 @@bool nocache; }; -struct http_proxy_options_simple { -const char *server; -const char *port; -int auth_retry; -}; -struct http_proxy_info {bool defined;int auth_method;
src/openvpn/ps.h +0 -2
@@ -30,8 +30,6 @@#include "buffer.h" #include "ssl.h" -typedef void (*post_fork_cleanup_func_t )(void *arg); -struct port_share {/* Foreground's socket to background process */ socket_descriptor_t foreground_fd;
src/openvpn/shaper.h +0 -6
@@ -89,12 +89,6 @@shaper_reset_wakeup (s); } -static inline int -shaper_current_bandwidth (struct shaper *s) -{ -return s->bytes_per_second; -} -/* * Returns traffic shaping delay in microseconds relative to current * time, or 0 if no delay.
src/openvpn/socket.h +0 -26
@@ -362,16 +362,6 @@static inline const char * -print_openvpn_sockaddr_ex (const struct openvpn_sockaddr *addr, -const char *separator, -const unsigned int flags, -struct gc_arena *gc) -{ -return print_sockaddr_ex (&addr->addr.sa, separator, flags, gc); -} - -static inline -const char *print_openvpn_sockaddr (const struct openvpn_sockaddr *addr,struct gc_arena *gc) {
@@ -771,22 +761,6 @@return false; } -static inline in_addr_t -addr_host (const struct openvpn_sockaddr *addr) -{ -/* -* "public" addr returned is checked against ifconfig for -* possible clash: non sense for now given -* that we do ifconfig only IPv4 -*/ -if (addr->addr.sa.sa_family !=AF_INET ) - { -return 0 ; - } -return ntohl (addr->addr.in4.sin_addr.s_addr); -} - -static inline bool addrlist_port_match (const struct openvpn_sockaddr *a1,const struct addrinfo *a2) {
tests/unit_tests/openvpn/test_buffer.c +0 -1
@@ -49,7 +49,6 @@#define teststr1 "one"#define teststr2 "two"#define teststr3 "three" -#define teststr4 "four"#define assert_buf_equals_str (buf, str) \ assert_int_equal(BLEN(buf), strlen(str)); \
tests/unit_tests/openvpn/test_pkt.c +0 -5
@@ -69,11 +69,6 @@return "dummy print_link_socket_actual from unit test" ; } -struct test_pkt_context { -struct tls_auth_standalone tas_tls_auth; -struct tls_auth_standalone tas_crypt; -}; -const char static_key[] ="<tls-auth>\n" "-----BEGIN OpenVPN Static key V1-----\n" "37268ea8f95d7f71f9fb8fc03770c460\n"
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/783?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0d96ee06c355c6a5ce082af23921e329d3efae33
Gerrit-Change-Number: 783
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/783?usp=email )
Change subject: Remove a large number of unused structs and functions
......................................................................
Remove a large number of unused structs and functions
These have been found by Clion's Inspect Code functionality and have been verified by hand. A few functions like buf_read_u32 have been kept since they still feel being useful while currently not being used.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg29594.html
---
M src/openvpn/buffer.c
M src/openvpn/buffer.h
M src/openvpn/crypto_mbedtls.h
M src/openvpn/crypto_openssl.h
M src/openvpn/error.h
M src/openvpn/fragment.h
M src/openvpn/init.c
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/misc.h
M src/openvpn/mtcp.c
M src/openvpn/mtcp.h
M src/openvpn/openvpn.h
M src/openvpn/packet_id.h
M src/openvpn/platform.c
M src/openvpn/platform.h
M src/openvpn/proto.h
M src/openvpn/proxy.h
M src/openvpn/ps.h
M src/openvpn/shaper.h
M src/openvpn/socket.h
M tests/unit_tests/openvpn/test_buffer.c
M tests/unit_tests/openvpn/test_pkt.c
23 files changed, 0 insertions(+), 162 deletions(-)
src/openvpn/buffer.c +0 -18
@@ -296,24 +296,6 @@ } } -/* -* convert a multi-line output to one line -*/ -void -convert_to_one_line (struct buffer *buf) -{ -uint8_t *cp =BPTR (buf); -int len =BLEN (buf); -while (len--) - { -if (*cp =='\n' ) - { - *cp ='|' ; - } - ++cp; - } -} -bool buffer_write_file (const char *filename,const struct buffer *buf) {
src/openvpn/buffer.h +0 -5
@@ -487,11 +487,6 @@void buf_catrunc (struct buffer *buf,const char *str);/* -* convert a multi-line output to one line -*/ -void convert_to_one_line (struct buffer *buf); - -/* * Parse a string based on a given delimiter char */ bool buf_parse (struct buffer *buf,const int delim,char *line,const int size);
src/openvpn/crypto_mbedtls.h +0 -1
@@ -75,7 +75,6 @@#define MD5_DIGEST_LENGTH 16#define SHA_DIGEST_LENGTH 20#define SHA256_DIGEST_LENGTH 32 -#define DES_KEY_LENGTH 8/** * Returns a singleton instance of the mbed TLS random number generator.
src/openvpn/crypto_openssl.h +0 -1
@@ -93,7 +93,6 @@/** Cipher should decrypt */ #define OPENVPN_OP_DECRYPT 0 -#define DES_KEY_LENGTH 8#define MD4_DIGEST_LENGTH 16/**
src/openvpn/error.h +0 -4
@@ -297,10 +297,6 @@extern const char *x_msg_prefix; -void msg_thread_init (void ); - -void msg_thread_uninit (void ); -static inline void msg_set_prefix (const char *prefix) {
src/openvpn/fragment.h +0 -2
@@ -137,8 +137,6 @@struct event_timeout wakeup;/**< Timeout structure used by the main * event loop to know when to do * fragmentation housekeeping. */ -bool received_os_mtu_hint;/**< Whether the operating system has -* explicitly recommended an MTU value. */ #define N_SEQ_ID 256/**< One more than the maximum fragment * sequence ID, above which the IDs wrap
src/openvpn/init.c +0 -2
@@ -816,8 +816,6 @@bool init_static (void ) { -/* configure_path (); */ -#if defined(DMALLOC )crypto_init_dmalloc ();#endif
src/openvpn/manage.c +0 -10
@@ -3797,16 +3797,6 @@ }/* -* Return true if (from the management interface's perspective) OpenVPN should -* daemonize. -*/ -bool -management_should_daemonize (struct management *man) -{ -return management_would_hold (man) || (man->settings.flags &MF_QUERY_PASSWORDS ); -} - -/* * If the hold flag is enabled, hibernate until a management client releases the hold. * Return true if the caller should not sleep for an additional time interval. */
src/openvpn/manage.h +0 -2
@@ -390,8 +390,6 @@#endif -bool management_should_daemonize (struct management *man); -bool management_would_hold (struct management *man);bool management_hold (struct management *man,int holdtime);
src/openvpn/misc.h +0 -3
@@ -186,9 +186,6 @@*/ const char *safe_print (const char *str,struct gc_arena *gc); - -void configure_path (void ); -const char *sanitize_control_message (const char *str,struct gc_arena *gc);/*
src/openvpn/mtcp.c +0 -8
@@ -63,14 +63,6 @@#define MTCP_N ((void *)16)/* upper bound on MTCP_x */ -struct ta_iow_flags -{ -unsigned int flags; -unsigned int ret; -unsigned int tun; -unsigned int sock; -}; -#ifdef ENABLE_DEBUG static const char *pract (int action)
src/openvpn/mtcp.h +0 -3
@@ -58,9 +58,6 @@void multi_tcp_instance_specific_free (struct multi_instance *mi); -void multi_tcp_link_out_deferred (struct multi_context *m,struct multi_instance *mi); - -/**************************************************************************/ /** * Main event loop for OpenVPN in TCP server mode.
src/openvpn/openvpn.h +0 -4
@@ -200,10 +200,6 @@/**< Hash of option strings received from the * remote OpenVPN server. Only used in * client-mode. */ - -struct user_pass *auth_user_pass; -/**< Username and password for -* authentication. */ };
src/openvpn/packet_id.h +0 -17
@@ -318,23 +318,6 @@return p->id >=PACKET_ID_WRAP_TRIGGER ; } -static inline bool -check_timestamp_delta (time_t remote,unsigned int max_delta) -{ -unsigned int abs; -const time_t local_now = now; - -if (local_now >= remote) - { - abs = local_now - remote; - } -else - { - abs = remote - local_now; - } -return abs <= max_delta; -} -static inline void packet_id_reap_test (struct packet_id_rec *p) {
src/openvpn/platform.c +0 -13
@@ -483,19 +483,6 @@#endif } -/* -* Go to sleep indefinitely. -*/ -void -platform_sleep_until_signal (void ) -{ -#ifdef _WIN32 -ASSERT (0 ); -#else -select (0 ,NULL ,NULL ,NULL ,NULL ); -#endif -} -/* delete a file, return true if succeeded */ bool platform_unlink (const char *filename)
src/openvpn/platform.h +0 -4
@@ -131,13 +131,9 @@void platform_sleep_milliseconds (unsigned int n); -void platform_sleep_until_signal (void ); -/* delete a file, return true if succeeded */ bool platform_unlink (const char *filename); -int platform_putenv (char *string); -FILE *platform_fopen (const char *path,const char *mode);int platform_open (const char *path,int flags,int mode);
src/openvpn/proto.h +0 -19
@@ -83,25 +83,6 @@#define SIZE_ETH_TO_8021Q_HDR (sizeof(struct openvpn_8021qhdr) \ - sizeof(struct openvpn_ethhdr)) - -struct openvpn_arp { -#define ARP_MAC_ADDR_TYPE 0x0001 -uint16_t mac_addr_type;/* 0x0001 */ - -uint16_t proto_addr_type;/* 0x0800 */ -uint8_t mac_addr_size;/* 0x06 */ -uint8_t proto_addr_size;/* 0x04 */ - -#define ARP_REQUEST 0x0001 -#define ARP_REPLY 0x0002 -uint16_t arp_command;/* 0x0001 for ARP request, 0x0002 for ARP reply */ - -uint8_t mac_src[OPENVPN_ETH_ALEN ]; -in_addr_t ip_src; -uint8_t mac_dest[OPENVPN_ETH_ALEN ]; -in_addr_t ip_dest; -}; -struct openvpn_iphdr {#define OPENVPN_IPH_GET_VER (v) (((v) >> 4) & 0x0F)#define OPENVPN_IPH_GET_LEN (v) (((v) & 0x0F) << 2)
src/openvpn/proxy.h +0 -6
@@ -61,12 +61,6 @@bool nocache; }; -struct http_proxy_options_simple { -const char *server; -const char *port; -int auth_retry; -}; -struct http_proxy_info {bool defined;int auth_method;
src/openvpn/ps.h +0 -2
@@ -30,8 +30,6 @@#include "buffer.h" #include "ssl.h" -typedef void (*post_fork_cleanup_func_t )(void *arg); -struct port_share {/* Foreground's socket to background process */ socket_descriptor_t foreground_fd;
src/openvpn/shaper.h +0 -6
@@ -89,12 +89,6 @@shaper_reset_wakeup (s); } -static inline int -shaper_current_bandwidth (struct shaper *s) -{ -return s->bytes_per_second; -} -/* * Returns traffic shaping delay in microseconds relative to current * time, or 0 if no delay.
src/openvpn/socket.h +0 -26
@@ -362,16 +362,6 @@static inline const char * -print_openvpn_sockaddr_ex (const struct openvpn_sockaddr *addr, -const char *separator, -const unsigned int flags, -struct gc_arena *gc) -{ -return print_sockaddr_ex (&addr->addr.sa, separator, flags, gc); -} - -static inline -const char *print_openvpn_sockaddr (const struct openvpn_sockaddr *addr,struct gc_arena *gc) {
@@ -771,22 +761,6 @@return false; } -static inline in_addr_t -addr_host (const struct openvpn_sockaddr *addr) -{ -/* -* "public" addr returned is checked against ifconfig for -* possible clash: non sense for now given -* that we do ifconfig only IPv4 -*/ -if (addr->addr.sa.sa_family !=AF_INET ) - { -return 0 ; - } -return ntohl (addr->addr.in4.sin_addr.s_addr); -} - -static inline bool addrlist_port_match (const struct openvpn_sockaddr *a1,const struct addrinfo *a2) {
tests/unit_tests/openvpn/test_buffer.c +0 -1
@@ -49,7 +49,6 @@#define teststr1 "one"#define teststr2 "two"#define teststr3 "three" -#define teststr4 "four"#define assert_buf_equals_str (buf, str) \ assert_int_equal(BLEN(buf), strlen(str)); \
tests/unit_tests/openvpn/test_pkt.c +0 -5
@@ -69,11 +69,6 @@return "dummy print_link_socket_actual from unit test" ; } -struct test_pkt_context { -struct tls_auth_standalone tas_tls_auth; -struct tls_auth_standalone tas_crypt; -}; -const char static_key[] ="<tls-auth>\n" "-----BEGIN OpenVPN Static key V1-----\n" "37268ea8f95d7f71f9fb8fc03770c460\n"
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/783?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0d96ee06c355c6a5ce082af23921e329d3efae33
Gerrit-Change-Number: 783
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged