Change in openvpn[master]: socket: Create socket_util with non-socket functions
A message that is not in the archive (sent off-list or not yet received): gerrit.1756396351000.I7393459b975fb9b3e0a42743f58645f769d1be5a@...2715...
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1159?usp=email
to review the following change.
Change subject: socket: Create socket_util with non-socket functions
......................................................................
socket: Create socket_util with non-socket functions
This extracts a lot of the helper functions that do not actually work on sockets, but instead on addresses or similar.
This includes
- openvpn_getaddrinfo and related functions
- print_*
- setenv_*
And lots of the inline functions.
This move will make it easier to add unit tests
for these moved functions.
---
M CMakeLists.txt
M src/openvpn/Makefile.am
M src/openvpn/clinat.c
M src/openvpn/dhcp.c
M src/openvpn/dns.c
M src/openvpn/manage.h
M src/openvpn/misc.c
M src/openvpn/misc.h
M src/openvpn/mroute.c
M src/openvpn/mss.h
M src/openvpn/networking_iproute2.c
M src/openvpn/options.c
M src/openvpn/options.h
M src/openvpn/pool.c
M src/openvpn/socket.c
M src/openvpn/socket.h
A src/openvpn/socket_util.c
A src/openvpn/socket_util.h
M src/openvpn/ssl_common.h
M src/openvpn/tun.c
20 files changed, 1,443 insertions(+), 1,380 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/59/1159/1
CMakeLists.txt +2 -0
@@ -555,6 +555,8 @@ src/openvpn/sig.h src/openvpn/socket.c src/openvpn/socket.h + src/openvpn/socket_util.c + src/openvpn/socket_util.h src/openvpn/socks.c src/openvpn/socks.h src/openvpn/ssl.c
src/openvpn/Makefile.am +1 -0
@@ -128,6 +128,7 @@ shaper.c shaper.h \ sig.c sig.h \ socket.c socket.h \ + socket_util.c socket_util.h \ socks.c socks.h \ ssl.c ssl.h ssl_backend.h \ ssl_openssl.c ssl_openssl.h \
src/openvpn/clinat.c +1 -1
@@ -28,7 +28,7 @@#include "clinat.h" #include "proto.h" -#include "socket.h" +#include "socket_util.h" #include "memdbg.h" static bool
src/openvpn/dhcp.c +1 -1
@@ -27,7 +27,7 @@#include "syshead.h" #include "dhcp.h" -#include "socket.h" +#include "socket_util.h" #include "error.h" #include "memdbg.h"
src/openvpn/dns.c +1 -1
@@ -27,7 +27,7 @@#include "syshead.h" #include "dns.h" -#include "socket.h" +#include "socket_util.h" #include "options.h" #include "run_command.h"
src/openvpn/manage.h +1 -1
@@ -48,7 +48,7 @@#include "misc.h" #include "event.h" -#include "socket.h" +#include "socket_util.h" #include "mroute.h" #define MANAGEMENT_VERSION 5
src/openvpn/misc.c +0 -21
@@ -72,27 +72,6 @@#endif } -/* -* Prepend a random string to hostname to prevent DNS caching. -* For example, foo.bar.gov would be modified to <random-chars>.foo.bar.gov. -* Of course, this requires explicit support in the DNS server (wildcard). -*/ -const char * -hostname_randomize (const char *hostname,struct gc_arena *gc) -{ -#define n_rnd_bytes 6 - -uint8_t rnd_bytes[n_rnd_bytes]; -const char *rnd_str; -struct buffer hname =alloc_buf_gc (strlen (hostname) +sizeof (rnd_bytes) *2 +4 , gc); - -prng_bytes (rnd_bytes,sizeof (rnd_bytes)); - rnd_str =format_hex_ex (rnd_bytes,sizeof (rnd_bytes),40 ,0 ,NULL , gc); -buf_printf (&hname,"%s.%s" , rnd_str, hostname); -return BSTR (&hname); -#undef n_rnd_bytes -} -#ifdef ENABLE_MANAGEMENT /* Get username/password from the management interface */ static bool
src/openvpn/misc.h +0 -3
@@ -44,9 +44,6 @@const char **make_extended_arg_array (char **p,bool is_inline,struct gc_arena *gc); -/* prepend a random prefix to hostname */ -const char *hostname_randomize (const char *hostname,struct gc_arena *gc); -/* * Get and store a username/password */
src/openvpn/mroute.c +1 -1
@@ -30,7 +30,7 @@#include "mroute.h" #include "proto.h" #include "error.h" -#include "socket.h" +#include "socket_util.h" #include "memdbg.h"
src/openvpn/mss.h +1 -0
@@ -26,6 +26,7 @@#include "proto.h" #include "error.h" #include "mtu.h" +#include "socket.h" #include "ssl_common.h" void mss_fixup_ipv4 (struct buffer *buf,uint16_t maxmss);
src/openvpn/networking_iproute2.c +1 -1
@@ -30,7 +30,7 @@#include "misc.h" #include "openvpn.h" #include "run_command.h" -#include "socket.h" +#include "socket_util.h" #include <stdbool.h> #include <netinet/in.h>
src/openvpn/options.c +1 -1
@@ -45,7 +45,7 @@#include "ssl_ncp.h" #include "options.h" #include "misc.h" -#include "socket.h" +#include "socket_util.h" #include "packet_id.h" #include "pkcs11.h" #include "win32.h"
src/openvpn/options.h +1 -1
@@ -33,7 +33,7 @@#include "mtu.h" #include "route.h" #include "tun.h" -#include "socket.h" +#include "socket_util.h" #include "plugin.h" #include "manage.h" #include "proxy.h"
src/openvpn/pool.c +1 -1
@@ -29,7 +29,7 @@#include "pool.h" #include "buffer.h" #include "error.h" -#include "socket.h" +#include "socket_util.h" #include "otime.h" #include "memdbg.h"
src/openvpn/socket.c +0 -883
895 lines not on this page · raw message
src/openvpn/socket.h +1 -462
505 lines not on this page · raw message
src/openvpn/socket_util.c new file +936 -0
936 lines not on this page · raw message
src/openvpn/socket_util.h new file +491 -0
491 lines not on this page · raw message
src/openvpn/ssl_common.h +1 -1
@@ -30,7 +30,7 @@#define SSL_COMMON_H_ #include "session_id.h" -#include "socket.h" +#include "socket_util.h" #include "packet_id.h" #include "crypto.h" #include "options.h"
src/openvpn/tun.c +1 -1
@@ -39,7 +39,7 @@#include "fdmisc.h" #include "common.h" #include "run_command.h" -#include "socket.h" +#include "socket_util.h" #include "manage.h" #include "route.h" #include "win32.h"
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1159?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: I7393459b975fb9b3e0a42743f58645f769d1be5a
Gerrit-Change-Number: 1159
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[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/+/1159?usp=email )
Change subject: socket: Create socket_util with non-socket functions
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1159?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: I7393459b975fb9b3e0a42743f58645f769d1be5a
Gerrit-Change-Number: 1159
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Sun, 31 Aug 2025 15:59:07 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
PATCH 1/1 socket: Create socket_util with non-socket functions
In reply to a message not in the archiveFrom: Frank Lichtenheld <[email protected]...>
This extracts a lot of the helper functions that do not actually work on sockets, but instead on addresses or similar.
This includes
- openvpn_getaddrinfo and related functions
- print_*
- setenv_*
And lots of the inline functions.
This move will make it easier to add unit tests
for these moved functions.
---
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/+/1159
This mail reflects revision 1 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
CMakeLists.txt +2 -0
@@ -555,6 +555,8 @@ src/openvpn/sig.h src/openvpn/socket.c src/openvpn/socket.h + src/openvpn/socket_util.c + src/openvpn/socket_util.h src/openvpn/socks.c src/openvpn/socks.h src/openvpn/ssl.c
src/openvpn/Makefile.am +1 -0
@@ -128,6 +128,7 @@ shaper.c shaper.h \ sig.c sig.h \ socket.c socket.h \ + socket_util.c socket_util.h \ socks.c socks.h \ ssl.c ssl.h ssl_backend.h \ ssl_openssl.c ssl_openssl.h \
src/openvpn/clinat.c +1 -1
@@ -28,7 +28,7 @@#include "clinat.h" #include "proto.h" -#include "socket.h" +#include "socket_util.h" #include "memdbg.h" static bool
src/openvpn/dhcp.c +1 -1
@@ -27,7 +27,7 @@#include "syshead.h" #include "dhcp.h" -#include "socket.h" +#include "socket_util.h" #include "error.h" #include "memdbg.h"
src/openvpn/dns.c +1 -1
@@ -27,7 +27,7 @@#include "syshead.h" #include "dns.h" -#include "socket.h" +#include "socket_util.h" #include "options.h" #include "run_command.h"
src/openvpn/manage.h +1 -1
@@ -48,7 +48,7 @@#include "misc.h" #include "event.h" -#include "socket.h" +#include "socket_util.h" #include "mroute.h" #define MANAGEMENT_VERSION 5
src/openvpn/misc.c +0 -21
@@ -72,27 +72,6 @@#endif } -/* -* Prepend a random string to hostname to prevent DNS caching. -* For example, foo.bar.gov would be modified to <random-chars>.foo.bar.gov. -* Of course, this requires explicit support in the DNS server (wildcard). -*/ -const char * -hostname_randomize (const char *hostname,struct gc_arena *gc) -{ -#define n_rnd_bytes 6 - -uint8_t rnd_bytes[n_rnd_bytes]; -const char *rnd_str; -struct buffer hname =alloc_buf_gc (strlen (hostname) +sizeof (rnd_bytes) *2 +4 , gc); - -prng_bytes (rnd_bytes,sizeof (rnd_bytes)); - rnd_str =format_hex_ex (rnd_bytes,sizeof (rnd_bytes),40 ,0 ,NULL , gc); -buf_printf (&hname,"%s.%s" , rnd_str, hostname); -return BSTR (&hname); -#undef n_rnd_bytes -} -#ifdef ENABLE_MANAGEMENT /* Get username/password from the management interface */ static bool
src/openvpn/misc.h +0 -3
@@ -44,9 +44,6 @@const char **make_extended_arg_array (char **p,bool is_inline,struct gc_arena *gc); -/* prepend a random prefix to hostname */ -const char *hostname_randomize (const char *hostname,struct gc_arena *gc); -/* * Get and store a username/password */
src/openvpn/mroute.c +1 -1
@@ -30,7 +30,7 @@#include "mroute.h" #include "proto.h" #include "error.h" -#include "socket.h" +#include "socket_util.h" #include "memdbg.h"
src/openvpn/mss.h +1 -0
@@ -26,6 +26,7 @@#include "proto.h" #include "error.h" #include "mtu.h" +#include "socket.h" #include "ssl_common.h" void mss_fixup_ipv4 (struct buffer *buf,uint16_t maxmss);
src/openvpn/networking_iproute2.c +1 -1
@@ -30,7 +30,7 @@#include "misc.h" #include "openvpn.h" #include "run_command.h" -#include "socket.h" +#include "socket_util.h" #include <stdbool.h> #include <netinet/in.h>
src/openvpn/options.c +1 -1
@@ -45,7 +45,7 @@#include "ssl_ncp.h" #include "options.h" #include "misc.h" -#include "socket.h" +#include "socket_util.h" #include "packet_id.h" #include "pkcs11.h" #include "win32.h"
src/openvpn/options.h +1 -1
@@ -33,7 +33,7 @@#include "mtu.h" #include "route.h" #include "tun.h" -#include "socket.h" +#include "socket_util.h" #include "plugin.h" #include "manage.h" #include "proxy.h"
src/openvpn/pool.c +1 -1
@@ -29,7 +29,7 @@#include "pool.h" #include "buffer.h" #include "error.h" -#include "socket.h" +#include "socket_util.h" #include "otime.h" #include "memdbg.h"
src/openvpn/socket.c +0 -883
895 lines not on this page · raw message
src/openvpn/socket.h +1 -462
505 lines not on this page · raw message
src/openvpn/socket_util.c new file +936 -0
936 lines not on this page · raw message
src/openvpn/socket_util.h new file +491 -0
491 lines not on this page · raw message
src/openvpn/ssl_common.h +1 -1
@@ -30,7 +30,7 @@#define SSL_COMMON_H_ #include "session_id.h" -#include "socket.h" +#include "socket_util.h" #include "packet_id.h" #include "crypto.h" #include "options.h"
src/openvpn/tun.c +1 -1
@@ -39,7 +39,7 @@#include "fdmisc.h" #include "common.h" #include "run_command.h" -#include "socket.h" +#include "socket_util.h" #include "manage.h" #include "route.h" #include "win32.h"
Gert Doering
Applied[Openvpn-devel] [PATCH applied] Re: socket: Create socket_util with non-socket functions
Decluttering socket.c is a good thing (and introducing a unit test in #1160 quite welcome). Stared at the change with "git show --color-moved" and it's quite clear that this is only moves, no code change - and the BBs confirm that it still compiles and passes all relevant tests.
Pushed to GHA for good measure (all green).
Your patch has been applied to the master branch.
commit cdd61ffbccfcc81b560d2bec54c9a431ab6a025a
Author: Frank Lichtenheld Date: Sun Aug 31 17:59:32 2025 +0200
socket: Create socket_util with non-socket functions
Signed-off-by: Frank Lichtenheld <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32727.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1159?usp=email )
Change subject: socket: Create socket_util with non-socket functions
......................................................................
socket: Create socket_util with non-socket functions
This extracts a lot of the helper functions that do not actually work on sockets, but instead on addresses or similar.
This includes
- openvpn_getaddrinfo and related functions
- print_*
- setenv_*
And lots of the inline functions.
This move will make it easier to add unit tests
for these moved functions.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32727.html
---
M CMakeLists.txt
M src/openvpn/Makefile.am
M src/openvpn/clinat.c
M src/openvpn/dhcp.c
M src/openvpn/dns.c
M src/openvpn/manage.h
M src/openvpn/misc.c
M src/openvpn/misc.h
M src/openvpn/mroute.c
M src/openvpn/mss.h
M src/openvpn/networking_iproute2.c
M src/openvpn/options.c
M src/openvpn/options.h
M src/openvpn/pool.c
M src/openvpn/socket.c
M src/openvpn/socket.h
A src/openvpn/socket_util.c
A src/openvpn/socket_util.h
M src/openvpn/ssl_common.h
M src/openvpn/tun.c
20 files changed, 1,443 insertions(+), 1,380 deletions(-)
CMakeLists.txt +2 -0
@@ -555,6 +555,8 @@ src/openvpn/sig.h src/openvpn/socket.c src/openvpn/socket.h + src/openvpn/socket_util.c + src/openvpn/socket_util.h src/openvpn/socks.c src/openvpn/socks.h src/openvpn/ssl.c
src/openvpn/Makefile.am +1 -0
@@ -128,6 +128,7 @@ shaper.c shaper.h \ sig.c sig.h \ socket.c socket.h \ + socket_util.c socket_util.h \ socks.c socks.h \ ssl.c ssl.h ssl_backend.h \ ssl_openssl.c ssl_openssl.h \
src/openvpn/clinat.c +1 -1
@@ -28,7 +28,7 @@#include "clinat.h" #include "proto.h" -#include "socket.h" +#include "socket_util.h" #include "memdbg.h" static bool
src/openvpn/dhcp.c +1 -1
@@ -27,7 +27,7 @@#include "syshead.h" #include "dhcp.h" -#include "socket.h" +#include "socket_util.h" #include "error.h" #include "memdbg.h"
src/openvpn/dns.c +1 -1
@@ -27,7 +27,7 @@#include "syshead.h" #include "dns.h" -#include "socket.h" +#include "socket_util.h" #include "options.h" #include "run_command.h"
src/openvpn/manage.h +1 -1
@@ -48,7 +48,7 @@#include "misc.h" #include "event.h" -#include "socket.h" +#include "socket_util.h" #include "mroute.h" #define MANAGEMENT_VERSION 5
src/openvpn/misc.c +0 -21
@@ -72,27 +72,6 @@#endif } -/* -* Prepend a random string to hostname to prevent DNS caching. -* For example, foo.bar.gov would be modified to <random-chars>.foo.bar.gov. -* Of course, this requires explicit support in the DNS server (wildcard). -*/ -const char * -hostname_randomize (const char *hostname,struct gc_arena *gc) -{ -#define n_rnd_bytes 6 - -uint8_t rnd_bytes[n_rnd_bytes]; -const char *rnd_str; -struct buffer hname =alloc_buf_gc (strlen (hostname) +sizeof (rnd_bytes) *2 +4 , gc); - -prng_bytes (rnd_bytes,sizeof (rnd_bytes)); - rnd_str =format_hex_ex (rnd_bytes,sizeof (rnd_bytes),40 ,0 ,NULL , gc); -buf_printf (&hname,"%s.%s" , rnd_str, hostname); -return BSTR (&hname); -#undef n_rnd_bytes -} -#ifdef ENABLE_MANAGEMENT /* Get username/password from the management interface */ static bool
src/openvpn/misc.h +0 -3
@@ -44,9 +44,6 @@const char **make_extended_arg_array (char **p,bool is_inline,struct gc_arena *gc); -/* prepend a random prefix to hostname */ -const char *hostname_randomize (const char *hostname,struct gc_arena *gc); -/* * Get and store a username/password */
src/openvpn/mroute.c +1 -1
@@ -30,7 +30,7 @@#include "mroute.h" #include "proto.h" #include "error.h" -#include "socket.h" +#include "socket_util.h" #include "memdbg.h"
src/openvpn/mss.h +1 -0
@@ -26,6 +26,7 @@#include "proto.h" #include "error.h" #include "mtu.h" +#include "socket.h" #include "ssl_common.h" void mss_fixup_ipv4 (struct buffer *buf,uint16_t maxmss);
src/openvpn/networking_iproute2.c +1 -1
@@ -30,7 +30,7 @@#include "misc.h" #include "openvpn.h" #include "run_command.h" -#include "socket.h" +#include "socket_util.h" #include <stdbool.h> #include <netinet/in.h>
src/openvpn/options.c +1 -1
@@ -45,7 +45,7 @@#include "ssl_ncp.h" #include "options.h" #include "misc.h" -#include "socket.h" +#include "socket_util.h" #include "packet_id.h" #include "pkcs11.h" #include "win32.h"
src/openvpn/options.h +1 -1
@@ -33,7 +33,7 @@#include "mtu.h" #include "route.h" #include "tun.h" -#include "socket.h" +#include "socket_util.h" #include "plugin.h" #include "manage.h" #include "proxy.h"
src/openvpn/pool.c +1 -1
@@ -29,7 +29,7 @@#include "pool.h" #include "buffer.h" #include "error.h" -#include "socket.h" +#include "socket_util.h" #include "otime.h" #include "memdbg.h"
src/openvpn/socket.c +0 -883
895 lines not on this page · raw message
src/openvpn/socket.h +1 -462
505 lines not on this page · raw message
src/openvpn/socket_util.c new file +936 -0
936 lines not on this page · raw message
src/openvpn/socket_util.h new file +491 -0
491 lines not on this page · raw message
src/openvpn/ssl_common.h +1 -1
@@ -30,7 +30,7 @@#define SSL_COMMON_H_ #include "session_id.h" -#include "socket.h" +#include "socket_util.h" #include "packet_id.h" #include "crypto.h" #include "options.h"
src/openvpn/tun.c +1 -1
@@ -39,7 +39,7 @@#include "fdmisc.h" #include "common.h" #include "run_command.h" -#include "socket.h" +#include "socket_util.h" #include "manage.h" #include "route.h" #include "win32.h"
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1159?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: I7393459b975fb9b3e0a42743f58645f769d1be5a
Gerrit-Change-Number: 1159
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged
cron2 has uploaded a new patch set (#2) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1159?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by cron2
Change subject: socket: Create socket_util with non-socket functions
......................................................................
socket: Create socket_util with non-socket functions
This extracts a lot of the helper functions that do not actually work on sockets, but instead on addresses or similar.
This includes
- openvpn_getaddrinfo and related functions
- print_*
- setenv_*
And lots of the inline functions.
This move will make it easier to add unit tests
for these moved functions.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32727.html
---
M CMakeLists.txt
M src/openvpn/Makefile.am
M src/openvpn/clinat.c
M src/openvpn/dhcp.c
M src/openvpn/dns.c
M src/openvpn/manage.h
M src/openvpn/misc.c
M src/openvpn/misc.h
M src/openvpn/mroute.c
M src/openvpn/mss.h
M src/openvpn/networking_iproute2.c
M src/openvpn/options.c
M src/openvpn/options.h
M src/openvpn/pool.c
M src/openvpn/socket.c
M src/openvpn/socket.h
A src/openvpn/socket_util.c
A src/openvpn/socket_util.h
M src/openvpn/ssl_common.h
M src/openvpn/tun.c
20 files changed, 1,443 insertions(+), 1,380 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/59/1159/2
CMakeLists.txt +2 -0
@@ -555,6 +555,8 @@ src/openvpn/sig.h src/openvpn/socket.c src/openvpn/socket.h + src/openvpn/socket_util.c + src/openvpn/socket_util.h src/openvpn/socks.c src/openvpn/socks.h src/openvpn/ssl.c
src/openvpn/Makefile.am +1 -0
@@ -128,6 +128,7 @@ shaper.c shaper.h \ sig.c sig.h \ socket.c socket.h \ + socket_util.c socket_util.h \ socks.c socks.h \ ssl.c ssl.h ssl_backend.h \ ssl_openssl.c ssl_openssl.h \
src/openvpn/clinat.c +1 -1
@@ -28,7 +28,7 @@#include "clinat.h" #include "proto.h" -#include "socket.h" +#include "socket_util.h" #include "memdbg.h" static bool
src/openvpn/dhcp.c +1 -1
@@ -27,7 +27,7 @@#include "syshead.h" #include "dhcp.h" -#include "socket.h" +#include "socket_util.h" #include "error.h" #include "memdbg.h"
src/openvpn/dns.c +1 -1
@@ -27,7 +27,7 @@#include "syshead.h" #include "dns.h" -#include "socket.h" +#include "socket_util.h" #include "options.h" #include "run_command.h"
src/openvpn/manage.h +1 -1
@@ -48,7 +48,7 @@#include "misc.h" #include "event.h" -#include "socket.h" +#include "socket_util.h" #include "mroute.h" #define MANAGEMENT_VERSION 5
src/openvpn/misc.c +0 -21
@@ -72,27 +72,6 @@#endif } -/* -* Prepend a random string to hostname to prevent DNS caching. -* For example, foo.bar.gov would be modified to <random-chars>.foo.bar.gov. -* Of course, this requires explicit support in the DNS server (wildcard). -*/ -const char * -hostname_randomize (const char *hostname,struct gc_arena *gc) -{ -#define n_rnd_bytes 6 - -uint8_t rnd_bytes[n_rnd_bytes]; -const char *rnd_str; -struct buffer hname =alloc_buf_gc (strlen (hostname) +sizeof (rnd_bytes) *2 +4 , gc); - -prng_bytes (rnd_bytes,sizeof (rnd_bytes)); - rnd_str =format_hex_ex (rnd_bytes,sizeof (rnd_bytes),40 ,0 ,NULL , gc); -buf_printf (&hname,"%s.%s" , rnd_str, hostname); -return BSTR (&hname); -#undef n_rnd_bytes -} -#ifdef ENABLE_MANAGEMENT /* Get username/password from the management interface */ static bool
src/openvpn/misc.h +0 -3
@@ -44,9 +44,6 @@const char **make_extended_arg_array (char **p,bool is_inline,struct gc_arena *gc); -/* prepend a random prefix to hostname */ -const char *hostname_randomize (const char *hostname,struct gc_arena *gc); -/* * Get and store a username/password */
src/openvpn/mroute.c +1 -1
@@ -30,7 +30,7 @@#include "mroute.h" #include "proto.h" #include "error.h" -#include "socket.h" +#include "socket_util.h" #include "memdbg.h"
src/openvpn/mss.h +1 -0
@@ -26,6 +26,7 @@#include "proto.h" #include "error.h" #include "mtu.h" +#include "socket.h" #include "ssl_common.h" void mss_fixup_ipv4 (struct buffer *buf,uint16_t maxmss);
src/openvpn/networking_iproute2.c +1 -1
@@ -30,7 +30,7 @@#include "misc.h" #include "openvpn.h" #include "run_command.h" -#include "socket.h" +#include "socket_util.h" #include <stdbool.h> #include <netinet/in.h>
src/openvpn/options.c +1 -1
@@ -45,7 +45,7 @@#include "ssl_ncp.h" #include "options.h" #include "misc.h" -#include "socket.h" +#include "socket_util.h" #include "packet_id.h" #include "pkcs11.h" #include "win32.h"
src/openvpn/options.h +1 -1
@@ -33,7 +33,7 @@#include "mtu.h" #include "route.h" #include "tun.h" -#include "socket.h" +#include "socket_util.h" #include "plugin.h" #include "manage.h" #include "proxy.h"
src/openvpn/pool.c +1 -1
@@ -29,7 +29,7 @@#include "pool.h" #include "buffer.h" #include "error.h" -#include "socket.h" +#include "socket_util.h" #include "otime.h" #include "memdbg.h"
src/openvpn/socket.c +0 -883
895 lines not on this page · raw message
src/openvpn/socket.h +1 -462
505 lines not on this page · raw message
src/openvpn/socket_util.c new file +936 -0
936 lines not on this page · raw message
src/openvpn/socket_util.h new file +491 -0
491 lines not on this page · raw message
src/openvpn/ssl_common.h +1 -1
@@ -30,7 +30,7 @@#define SSL_COMMON_H_ #include "session_id.h" -#include "socket.h" +#include "socket_util.h" #include "packet_id.h" #include "crypto.h" #include "options.h"
src/openvpn/tun.c +1 -1
@@ -39,7 +39,7 @@#include "fdmisc.h" #include "common.h" #include "run_command.h" -#include "socket.h" +#include "socket_util.h" #include "manage.h" #include "route.h" #include "win32.h"
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1159?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: I7393459b975fb9b3e0a42743f58645f769d1be5a
Gerrit-Change-Number: 1159
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset