Remove #ifdefs for client nat support.
PATCH 1/4 Remove #ifdefs for client nat support.
The client-nat feature was always unconditionally enabled
--- src/openvpn/clinat.c | 4 ---- src/openvpn/clinat.h | 2 +- src/openvpn/forward.c | 12 +++++++----- src/openvpn/multi.c | 2 -- src/openvpn/openvpn.h | 2 -- src/openvpn/options.c | 18 +----------------- src/openvpn/options.h | 7 ------- src/openvpn/push.c | 4 ---- src/openvpn/syshead.h | 5 ----- 9 files changed, 9 insertions(+), 47 deletions(-)
src/openvpn/clinat.c +0 -4
@@ -30,8 +30,6 @@#include "syshead.h" -#if defined(ENABLE_CLIENT_NAT ) -#include "clinat.h" #include "proto.h" #include "socket.h"
@@ -265,5 +263,3 @@ client_nat_transform (const struct client_nat_option_list *list, } } } - -#endif
src/openvpn/clinat.h +1 -1
@@ -22,7 +22,7 @@* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#if !defined(CLINAT_H ) && defined(ENABLE_CLIENT_NAT ) +#if !defined(CLINAT_H )#define CLINAT_H #include "buffer.h"
src/openvpn/forward.c +7 -5
@@ -1018,6 +1018,8 @@ process_ip_header (struct context *c, unsigned int flags, struct buffer *buf)if (!c->options.passtos) flags &= ~PIPV4_PASSTOS ;#endif +if (!c->options.client_nat) + flags &= ~PIPV4_CLIENT_NAT ;if (!c->options.route_gateway_via_dhcp) flags &= ~PIPV4_EXTRACT_DHCP_ROUTER ;
@@ -1027,11 +1029,13 @@ process_ip_header (struct context *c, unsigned int flags, struct buffer *buf)* The --passtos and --mssfix options require * us to examine the IPv4 header. */ + +if (flags & (PIP_MSSFIX #if PASSTOS_CAPABILITY -if (flags & (PIPV4_PASSTOS |PIP_MSSFIX )) -#else - if (flags & PIP_MSSFIX) + |PIPV4_PASSTOS #endif + |PIPV4_CLIENT_NAT + )) {struct buffer ipbuf = *buf;if (is_ipv4 (TUNNEL_TYPE (c->c1.tuntap), &ipbuf))
@@ -1046,14 +1050,12 @@ process_ip_header (struct context *c, unsigned int flags, struct buffer *buf)if (flags &PIP_MSSFIX )mss_fixup_ipv4 (&ipbuf,MTU_TO_MSS (TUN_MTU_SIZE_DYNAMIC (&c->c2.frame))); -#ifdef ENABLE_CLIENT_NAT /* possibly do NAT on packet */ if ((flags &PIPV4_CLIENT_NAT ) && c->options.client_nat) {const int direction = (flags &PIPV4_OUTGOING ) ?CN_INCOMING :CN_OUTGOING ;client_nat_transform (c->options.client_nat, &ipbuf, direction); } -#endif /* possibly extract a DHCP router message */ if (flags &PIPV4_EXTRACT_DHCP_ROUTER ) {
src/openvpn/multi.c +0 -2
@@ -1296,9 +1296,7 @@ multi_select_virtual_addr (struct multi_context *m, struct multi_instance *mi) mi->context.c2.push_ifconfig_defined = true; mi->context.c2.push_ifconfig_local = mi->context.options.push_ifconfig_local; mi->context.c2.push_ifconfig_remote_netmask = mi->context.options.push_ifconfig_remote_netmask; -#ifdef ENABLE_CLIENT_NAT mi->context.c2.push_ifconfig_local_alias = mi->context.options.push_ifconfig_local_alias; -#endif /* the current implementation does not allow "static IPv4, pool IPv6", * (see below) so issue a warning if that happens - don't break the
src/openvpn/openvpn.h +0 -2
@@ -454,9 +454,7 @@ struct context_2time_t sent_push_reply_expiry;in_addr_t push_ifconfig_local;in_addr_t push_ifconfig_remote_netmask; -#ifdef ENABLE_CLIENT_NAT in_addr_t push_ifconfig_local_alias; -#endif bool push_ifconfig_ipv6_defined;struct in6_addr push_ifconfig_ipv6_local;
src/openvpn/options.c +1 -17
@@ -243,9 +243,7 @@ static const char usage_message[] =" Add 'bypass-dns' flag to similarly bypass tunnel for DNS.\n" "--redirect-private [flags]: Like --redirect-gateway, but omit actually changing\n" " the default gateway. Useful when pushing private subnets.\n" -#ifdef ENABLE_CLIENT_NAT"--client-nat snat|dnat network netmask alias : on client add 1-to-1 NAT rule.\n" -#endif #ifdef ENABLE_PUSH_PEER_INFO"--push-peer-info : (client only) push client info to server.\n" #endif
@@ -1322,9 +1320,7 @@ options_detach (struct options *o) {gc_detach (&o->gc); o->routes =NULL ; -#ifdef ENABLE_CLIENT_NAT o->client_nat =NULL ; -#endif #if P2MP_SERVER clone_push_list (o);#endif
@@ -1344,14 +1340,12 @@ rol6_check_alloc (struct options *options) options->routes_ipv6 =new_route_ipv6_option_list (&options->gc); } -#ifdef ENABLE_CLIENT_NAT static void cnol_check_alloc (struct options *options) {if (!options->client_nat) options->client_nat =new_client_nat_list (&options->gc); } -#endif #ifndef ENABLE_SMALL static void
@@ -1553,11 +1547,9 @@ show_settings (const struct options *o)SHOW_BOOL (allow_pull_fqdn);if (o->routes)print_route_options (o->routes,D_SHOW_PARMS ); - -#ifdef ENABLE_CLIENT_NAT +if (o->client_nat)print_client_nat_list (o->client_nat,D_SHOW_PARMS ); -#endif #ifdef ENABLE_MANAGEMENT SHOW_STR (management_addr);
@@ -2819,13 +2811,11 @@ pre_pull_save (struct options *o) o->pre_pull->routes_ipv6 =clone_route_ipv6_option_list (o->routes_ipv6, &o->gc); o->pre_pull->routes_ipv6_defined = true; } -#ifdef ENABLE_CLIENT_NAT if (o->client_nat) { o->pre_pull->client_nat =clone_client_nat_option_list (o->client_nat, &o->gc); o->pre_pull->client_nat_defined = true; } -#endif } }
@@ -2855,7 +2845,6 @@ pre_pull_restore (struct options *o, struct gc_arena *gc)else o->routes_ipv6 =NULL ; -#ifdef ENABLE_CLIENT_NAT if (pp->client_nat_defined) {cnol_check_alloc (o);
@@ -2863,7 +2852,6 @@ pre_pull_restore (struct options *o, struct gc_arena *gc) }else o->client_nat =NULL ; -#endif o->foreign_option_index = pp->foreign_option_index; }
@@ -5212,14 +5200,12 @@ add_option (struct options *options,VERIFY_PERMISSION (OPT_P_PERSIST_IP ); options->persist_remote_ip = true; } -#ifdef ENABLE_CLIENT_NAT else if (streq (p[0 ],"client-nat" ) && p[1 ] && p[2 ] && p[3 ] && p[4 ]) {VERIFY_PERMISSION (OPT_P_ROUTE );cnol_check_alloc (options);add_client_nat_to_option_list (options->client_nat, p[1 ], p[2 ], p[3 ], p[4 ], msglevel); } -#endif else if (streq (p[0 ],"route" ) && p[1 ]) {VERIFY_PERMISSION (OPT_P_ROUTE );
@@ -5805,10 +5791,8 @@ add_option (struct options *options, options->push_ifconfig_defined = true; options->push_ifconfig_local = local; options->push_ifconfig_remote_netmask = remote_netmask; -#ifdef ENABLE_CLIENT_NAT if (p[3 ]) options->push_ifconfig_local_alias =getaddr (GETADDR_HOST_ORDER |GETADDR_RESOLVE , p[3 ],0 ,NULL ,NULL ); -#endif }else {
src/openvpn/options.h +0 -7
@@ -71,10 +71,8 @@ struct options_pre_pullbool routes_ipv6_defined;struct route_ipv6_option_list *routes_ipv6; -#ifdef ENABLE_CLIENT_NAT bool client_nat_defined;struct client_nat_option_list *client_nat; -#endif int foreign_option_index; };
@@ -352,10 +350,7 @@ struct optionsbool route_nopull;bool route_gateway_via_dhcp;bool allow_pull_fqdn;/* as a client, allow server to push a FQDN for certain parameters */ - -#ifdef ENABLE_CLIENT_NAT struct client_nat_option_list *client_nat; -#endif #ifdef ENABLE_OCC /* Enable options consistency check between peers */
@@ -436,9 +431,7 @@ struct optionsbool push_ifconfig_defined;in_addr_t push_ifconfig_local;in_addr_t push_ifconfig_remote_netmask; -#ifdef ENABLE_CLIENT_NAT in_addr_t push_ifconfig_local_alias; -#endif bool push_ifconfig_constraint_defined;in_addr_t push_ifconfig_constraint_network;in_addr_t push_ifconfig_constraint_netmask;
src/openvpn/push.c +0 -4
@@ -68,7 +68,6 @@ receive_auth_failed (struct context *c, const struct buffer *buffer)ASSERT (0 ); } c->sig->signal_text ="auth-failure" ; -#ifdef ENABLE_MANAGEMENT if (management) {const char *reason =NULL ;
@@ -77,7 +76,6 @@ receive_auth_failed (struct context *c, const struct buffer *buffer) reason =BSTR (&buf);management_auth_failure (management,UP_TYPE_AUTH , reason); }else -#endif {#ifdef ENABLE_CLIENT_CR struct buffer buf = *buffer;
@@ -294,10 +292,8 @@ send_push_reply (struct context *c)if (c->c2.push_ifconfig_defined && c->c2.push_ifconfig_local && c->c2.push_ifconfig_remote_netmask) {in_addr_t ifconfig_local = c->c2.push_ifconfig_local; -#ifdef ENABLE_CLIENT_NAT if (c->c2.push_ifconfig_local_alias) ifconfig_local = c->c2.push_ifconfig_local_alias; -#endif buf_printf (&buf,",ifconfig %s %s" ,print_in_addr_t (ifconfig_local,0 , &gc),print_in_addr_t (c->c2.push_ifconfig_remote_netmask,0 , &gc));
src/openvpn/syshead.h +0 -5
@@ -723,11 +723,6 @@ socket_defined (const socket_descriptor_t sd)#endif /* -* Do we support internal client-side NAT? -*/ -#define ENABLE_CLIENT_NAT - -/* * Compression support */ #if defined(ENABLE_SNAPPY) || defined(ENABLE_LZO) || defined(ENABLE_LZ4) || \
Signature · 1 line
1.8.5.2 (Apple Git-48)
PATCH 2/4 Always enable http-proxy and socks-proxy
--- configure.ac | 16 ---------------- src/openvpn/base64.c | 6 ------ src/openvpn/base64.h | 4 ---- src/openvpn/forward.c | 12 +----------- src/openvpn/init.c | 44 +------------------------------------------- src/openvpn/openvpn.h | 4 ---- src/openvpn/options.c | 40 ++++------------------------------------ src/openvpn/options.h | 6 +----- src/openvpn/proxy.c | 7 ------- src/openvpn/proxy.h | 4 ---- src/openvpn/socket.c | 37 ------------------------------------- src/openvpn/socket.h | 13 ------------- src/openvpn/socks.c | 6 ------ src/openvpn/socks.h | 3 --- src/openvpn/syshead.h | 20 ++------------------ 15 files changed, 9 insertions(+), 213 deletions(-)
configure.ac +0 -16
@@ -128,20 +128,6 @@ AC_ARG_ENABLE( ) AC_ARG_ENABLE( - [socks], - [AS_HELP_STRING([--disable-socks], [disable Socks support @<:@default=yes@:>@])], - , - [enable_socks="yes"] -) - -AC_ARG_ENABLE( - [http-proxy], - [AS_HELP_STRING([--disable-http-proxy], [disable HTTP proxy support @<:@default=yes@:>@])], - , - [enable_http_proxy="yes"] -) - -AC_ARG_ENABLE( [fragment], [AS_HELP_STRING([--disable-fragment], [disable internal fragmentation support (--fragment) @<:@default=yes@:>@])], ,
@@ -1051,8 +1037,6 @@ test "${ac_cv_header_sys_uio_h}" = "yes" && AC_DEFINE([HAVE_IOVEC], [1], [struct test "${enable_multi}" = "yes" && AC_DEFINE([ENABLE_CLIENT_SERVER], [1], [Enable client/server capability]) test "${enable_server}" = "no" && AC_DEFINE([ENABLE_CLIENT_ONLY], [1], [Enable client capability only]) test "${enable_management}" = "yes" && AC_DEFINE([ENABLE_MANAGEMENT], [1], [Enable management server capability]) -test "${enable_socks}" = "yes" && AC_DEFINE([ENABLE_SOCKS], [1], [Enable Socks proxy support]) -test "${enable_http_proxy}" = "yes" && AC_DEFINE([ENABLE_HTTP_PROXY], [1], [Enable HTTP proxy support]) test "${enable_multihome}" = "yes" && AC_DEFINE([ENABLE_MULTIHOME], [1], [Enable multi-homed UDP server capability]) test "${enable_debug}" = "yes" && AC_DEFINE([ENABLE_DEBUG], [1], [Enable debugging support]) test "${enable_small}" = "yes" && AC_DEFINE([ENABLE_SMALL], [1], [Enable smaller executable size])
src/openvpn/base64.c +0 -6
@@ -39,8 +39,6 @@#include "syshead.h" -#if defined(ENABLE_HTTP_PROXY ) || defined(ENABLE_PKCS11 ) || defined(ENABLE_CLIENT_CR ) || defined(MANAGMENT_EXTERNAL_KEY ) -#include "base64.h" #include "memdbg.h"
@@ -163,7 +161,3 @@ openvpn_base64_decode(const char *str, void *data, int size) }return q - (unsigned char *) data; } - -#else -static void dummy (void ) {} -#endif /* ENABLE_HTTP_PROXY, ENABLE_PKCS11, ENABLE_CLIENT_CR */
src/openvpn/base64.h +0 -4
@@ -34,11 +34,7 @@#ifndef _BASE64_H_#define _BASE64_H_ -#if defined(ENABLE_HTTP_PROXY ) || defined(ENABLE_PKCS11 ) || defined(ENABLE_CLIENT_CR ) || defined(MANAGMENT_EXTERNAL_KEY ) -int openvpn_base64_encode (const void *data,int size,char **str);int openvpn_base64_decode (const char *str,void *data,int size);#endif - -#endif
src/openvpn/forward.c +1 -11
@@ -611,8 +611,6 @@ check_timeout_random_component (struct context *c)tv_add (&c->c2.timeval, &c->c2.timeout_random_component); } -#ifdef ENABLE_SOCKS -/* * Handle addition and removal of the 10-byte Socks5 header * in UDP packets.
@@ -650,7 +648,6 @@ link_socket_write_post_size_adjust (int *size, *size =0 ; } } -#endif /* * Output: c->c2.buf
@@ -719,10 +716,8 @@ read_incoming_link (struct context *c)/* check recvfrom status */ check_status (status,"read" , c->c2.link_socket,NULL ); -#ifdef ENABLE_SOCKS /* Remove socks header if applicable */ socks_postprocess_incoming_link (c); -#endif perf_pop (); }
@@ -1133,23 +1128,18 @@ process_outgoing_link (struct context *c)/* Packet send complexified by possible Socks5 usage */ {struct link_socket_actual *to_addr = c->c2.to_link_addr; -#ifdef ENABLE_SOCKS int size_delta =0 ; -#endif -#ifdef ENABLE_SOCKS /* If Socks5 over UDP, prepend header */ socks_preprocess_outgoing_link (c, &to_addr, &size_delta); -#endif +/* Send packet */ size =link_socket_write (c->c2.link_socket, &c->c2.to_link, to_addr); -#ifdef ENABLE_SOCKS /* Undo effect of prepend */ link_socket_write_post_size_adjust (&size, size_delta, &c->c2.to_link); -#endif }if (size >0 )
src/openvpn/init.c +1 -43
130 lines not on this page · raw message
src/openvpn/openvpn.h +0 -4
@@ -188,17 +188,13 @@ struct context_1struct status_output *status_output;bool status_output_owned; -#ifdef ENABLE_HTTP_PROXY /* HTTP proxy object */ struct http_proxy_info *http_proxy;bool http_proxy_owned; -#endif -#ifdef ENABLE_SOCKS /* SOCKS proxy object */ struct socks_proxy_info *socks_proxy;bool socks_proxy_owned; -#endif #if P2MP
src/openvpn/options.c +4 -36
@@ -140,7 +140,6 @@ static const char usage_message[] =" between connection retries (default=%d).\n" "--connect-timeout n : For --proto tcp-client, connection timeout (in seconds).\n" "--connect-retry-max n : Maximum connection attempt retries, default infinite.\n" -#ifdef ENABLE_HTTP_PROXY"--http-proxy s p [up] [auth] : Connect to remote host\n" " through an HTTP proxy at address s and port p.\n" " If proxy authentication is required,\n"
@@ -156,15 +155,12 @@ static const char usage_message[] =" Repeat to set multiple options.\n" " VERSION version (default=1.0)\n" " AGENT user-agent\n" -#endif -#ifdef ENABLE_SOCKS "--socks-proxy s [p] [up] : Connect to remote host through a Socks5 proxy at\n" " address s and port p (default port = 1080).\n" " If proxy authentication is required,\n" " up is a file containing username/password on 2 lines, or\n" " 'stdin' to prompt for console.\n" "--socks-proxy-retry : Retry indefinitely on Socks proxy errors.\n" -#endif "--resolv-retry n: If hostname resolve fails for --remote, retry\n" " resolve for n seconds before failing (disabled by default).\n" " Set n=\"infinite\" to retry indefinitely.\n"
@@ -177,12 +173,8 @@ static const char usage_message[] ="--rport port : TCP/UDP port # for remote (default=%s).\n" "--bind : Bind to local address and port. (This is the default unless\n" " --proto tcp-client" -#ifdef ENABLE_HTTP_PROXY" or --http-proxy" -#endif -#ifdef ENABLE_SOCKS " or --socks-proxy" -#endif " is used).\n" "--nobind : Do not bind to local address and port.\n" "--dev tunX|tapX : tun/tap device (X can be omitted for dynamic device.\n"
@@ -910,20 +902,16 @@ setenv_connection_entry (struct env_set *es,setenv_str_i (es,"remote" , e->remote, i);setenv_str_i (es,"remote_port" , e->remote_port, i); -#ifdef ENABLE_HTTP_PROXY if (e->http_proxy_options) {setenv_str_i (es,"http_proxy_server" , e->http_proxy_options->server, i);setenv_str_i (es,"http_proxy_port" , e->http_proxy_options->port, i); } -#endif -#ifdef ENABLE_SOCKS if (e->socks_proxy_server) {setenv_str_i (es,"socks_proxy_server" , e->socks_proxy_server, i);setenv_str_i (es,"socks_proxy_port" , e->socks_proxy_port, i); } -#endif }void
@@ -1288,7 +1276,7 @@ option_iroute_ipv6 (struct options *o,#endif /* P2MP_SERVER */ #endif /* P2MP */ -#if defined(ENABLE_HTTP_PROXY ) && !defined(ENABLE_SMALL ) +#ifndef ENABLE_SMALL static void show_http_proxy_options (const struct http_proxy_options *o) {
@@ -1363,15 +1351,11 @@ show_connection_entry (const struct connection_entry *o)SHOW_INT (connect_retry_seconds);SHOW_INT (connect_timeout); -#ifdef ENABLE_HTTP_PROXY if (o->http_proxy_options)show_http_proxy_options (o->http_proxy_options); -#endif -#ifdef ENABLE_SOCKS SHOW_STR (socks_proxy_server);SHOW_STR (socks_proxy_port);SHOW_BOOL (socks_proxy_retry); -#endif SHOW_INT (tun_mtu);SHOW_BOOL (tun_mtu_defined);SHOW_INT (link_mtu);
@@ -1689,7 +1673,7 @@ show_settings (const struct options *o)#undef SHOW_INT#undef SHOW_BOOL -#if HTTP_PROXY_OVERRIDE +#ifdef ENABLE_MANAGEMENT static struct http_proxy_options * parse_http_proxy_override (const char *server,
@@ -1978,22 +1962,16 @@ options_postprocess_verify_ce (const struct options *options, const struct conneif (!ce->remote && ce->proto ==PROTO_TCP_CLIENT )msg (M_USAGE ,"--remote MUST be used in TCP Client mode" ); -#ifdef ENABLE_HTTP_PROXY if ((ce->http_proxy_options) && ce->proto !=PROTO_TCP_CLIENT )msg (M_USAGE ,"--http-proxy MUST be used in TCP Client mode (i.e. --proto tcp-client)" );if ((ce->http_proxy_options) && !ce->http_proxy_options->server)msg (M_USAGE ,"--http-proxy not specified but other http proxy options present" ); -#endif -#if defined(ENABLE_HTTP_PROXY ) && defined(ENABLE_SOCKS )if (ce->http_proxy_options && ce->socks_proxy_server)msg (M_USAGE ,"--http-proxy can not be used together with --socks-proxy" ); -#endif -#ifdef ENABLE_SOCKS if (ce->socks_proxy_server && ce->proto ==PROTO_TCP_SERVER )msg (M_USAGE ,"--socks-proxy can not be used in TCP Server mode" ); -#endif if (ce->proto ==PROTO_TCP_SERVER && (options->connection_list->len >1 ))msg (M_USAGE ,"TCP server mode allows at most one --remote address" );
@@ -2024,14 +2002,10 @@ options_postprocess_verify_ce (const struct options *options, const struct connemsg (M_USAGE ,"--remote cannot be used with --mode server" );if (!ce->bind_local)msg (M_USAGE ,"--nobind cannot be used with --mode server" ); -#ifdef ENABLE_HTTP_PROXY if (ce->http_proxy_options)msg (M_USAGE ,"--http-proxy cannot be used with --mode server" ); -#endif -#ifdef ENABLE_SOCKS if (ce->socks_proxy_server)msg (M_USAGE ,"--socks-proxy cannot be used with --mode server" ); -#endif /* <connection> blocks force to have a remote embedded, so we check for the * --remote and bail out if it is present */ if (options->connection_list->len >1 ||
@@ -2372,10 +2346,8 @@ options_postprocess_mutate_ce (struct options *o, struct connection_entry *ce)if (ce->proto ==PROTO_TCP_CLIENT && !ce->local && !ce->local_port_defined && !ce->bind_defined) ce->bind_local = false; -#ifdef ENABLE_SOCKS if (ce->proto ==PROTO_UDP && ce->socks_proxy_server && !ce->local && !ce->local_port_defined && !ce->bind_defined) ce->bind_local = false; -#endif if (!ce->bind_local) ce->local_port =NULL ;
@@ -2524,7 +2496,7 @@ options_postprocess_mutate (struct options *o)for (i =0 ; i < o->connection_list->len; ++i)options_postprocess_mutate_ce (o, o->connection_list->array[i]); -#if HTTP_PROXY_OVERRIDE +#if ENABLE_MANAGEMENT if (o->http_proxy_override)options_postprocess_http_proxy_override (o);#endif
@@ -4496,7 +4468,7 @@ add_option (struct options *options, options->ignore_unknown_option[i] =NULL ; } -#if HTTP_PROXY_OVERRIDE +#if ENABLE_MANAGEMENT else if (streq (p[0], "http-proxy-override") && p[1] && p[2]) {VERIFY_PERMISSION (OPT_P_GENERAL );
@@ -5008,7 +4980,6 @@ add_option (struct options *options, } options->proto_force = proto_force; } -#ifdef ENABLE_HTTP_PROXY else if (streq (p[0 ],"http-proxy" ) && p[1 ]) {struct http_proxy_options *ho;
@@ -5115,8 +5086,6 @@ add_option (struct options *options,msg (msglevel,"Bad http-proxy-option or missing parameter: '%s'" , p[1 ]); } } -#endif -#ifdef ENABLE_SOCKS else if (streq (p[0 ],"socks-proxy" ) && p[1 ]) {VERIFY_PERMISSION (OPT_P_GENERAL |OPT_P_CONNECTION );
@@ -5137,7 +5106,6 @@ add_option (struct options *options,VERIFY_PERMISSION (OPT_P_GENERAL |OPT_P_CONNECTION ); options->ce.socks_proxy_retry = true; } -#endif else if (streq (p[0 ],"keepalive" ) && p[1 ] && p[2 ]) {VERIFY_PERMISSION (OPT_P_GENERAL );
src/openvpn/options.h +1 -5
@@ -98,15 +98,11 @@ struct connection_entryint connect_retry_seconds;int connect_timeout;bool connect_timeout_defined; -#ifdef ENABLE_HTTP_PROXY struct http_proxy_options *http_proxy_options; -#endif -#ifdef ENABLE_SOCKS const char *socks_proxy_server;const char *socks_proxy_port;const char *socks_proxy_authfile;bool socks_proxy_retry; -#endif int tun_mtu;/* MTU of tun device */ bool tun_mtu_defined;/* true if user overriding parm with command line option */
@@ -215,7 +211,7 @@ struct options/* Counts the number of unsuccessful connection attempts */ unsigned int unsuccessful_attempts; -#if HTTP_PROXY_OVERRIDE +#if ENABLE_MANAGEMENT struct http_proxy_options *http_proxy_override;#endif
src/openvpn/proxy.c +0 -7
@@ -42,8 +42,6 @@#include "ntlm.h" #include "memdbg.h" -#ifdef ENABLE_HTTP_PROXY -#define UP_TYPE_PROXY "HTTP Proxy" struct http_proxy_options *
@@ -945,8 +943,3 @@ establish_http_proxy_passthru (struct http_proxy_info *p,gc_free (&gc);return ret; } - -#else -static void dummy (void ) {} -#endif /* ENABLE_HTTP_PROXY */ -
src/openvpn/proxy.h +0 -4
@@ -28,8 +28,6 @@#include "buffer.h" #include "misc.h" -#ifdef ENABLE_HTTP_PROXY -/* HTTP CONNECT authentication methods */ #define HTTP_AUTH_NONE 0#define HTTP_AUTH_BASIC 1
@@ -94,6 +92,4 @@ bool establish_http_proxy_passthru (struct http_proxy_info *p,uint8_t *make_base64_string2 (const uint8_t *str,int str_len,struct gc_arena *gc);uint8_t *make_base64_string (const uint8_t *str,struct gc_arena *gc); -#endif /* ENABLE_HTTP_PROXY */ -#endif /* PROXY_H */
src/openvpn/socket.c +0 -37
@@ -841,12 +841,10 @@ static void bind_local (struct link_socket *sock, const sa_family_t ai_family)/* bind to local address/port */ if (sock->bind_local) { -#ifdef ENABLE_SOCKS if (sock->socks_proxy && sock->info.proto ==PROTO_UDP )socket_bind (sock->ctrl_sd, sock->info.lsa->bind_local, ai_family,"SOCKS" , false);else -#endif socket_bind (sock->sd, sock->info.lsa->bind_local, ai_family,"TCP/UDP" , sock->info.bind_ipv6_only);
@@ -861,7 +859,6 @@ create_socket (struct link_socket* sock, struct addrinfo* addr) sock->sd =create_socket_udp (addr, sock->sockflags); sock->sockflags |=SF_GETADDRINFO_DGRAM ; -#ifdef ENABLE_SOCKS /* Assume that control socket and data socket to the socks proxy * are using the same IP family */ if (sock->socks_proxy)
@@ -874,7 +871,6 @@ create_socket (struct link_socket* sock, struct addrinfo* addr) addrinfo_tmp.ai_protocol =IPPROTO_TCP ; sock->ctrl_sd =create_socket_tcp (&addrinfo_tmp); } -#endif }else if (addr->ai_protocol ==IPPROTO_TCP || addr->ai_socktype ==SOCK_STREAM ) {
@@ -1494,9 +1490,7 @@ link_socket_new (void) ALLOC_OBJ_CLEAR (sock, struct link_socket); sock->sd =SOCKET_UNDEFINED ; -#ifdef ENABLE_SOCKS sock->ctrl_sd =SOCKET_UNDEFINED ; -#endif return sock; }
@@ -1512,12 +1506,8 @@ link_socket_init_phase1 (struct link_socket *sock,bool bind_ipv6_only, int mode, const struct link_socket *accept_from, -#ifdef ENABLE_HTTP_PROXY struct http_proxy_info *http_proxy, -#endif -#ifdef ENABLE_SOCKS struct socks_proxy_info *socks_proxy, -#endif #ifdef ENABLE_DEBUG int gremlin, #endif
@@ -1542,15 +1532,8 @@ link_socket_init_phase1 (struct link_socket *sock, sock->remote_host = remote_host; sock->remote_port = remote_port; sock->dns_cache = dns_cache; - -#ifdef ENABLE_HTTP_PROXY sock->http_proxy = http_proxy; -#endif - -#ifdef ENABLE_SOCKS sock->socks_proxy = socks_proxy; -#endif - sock->bind_local = bind_local; sock->inetd = inetd; sock->resolve_retry_seconds = resolve_retry_seconds;
@@ -1586,7 +1569,6 @@ link_socket_init_phase1 (struct link_socket *sock,if (false) ; -#ifdef ENABLE_HTTP_PROXY /* are we running in HTTP proxy mode? */ else if (sock->http_proxy) {
@@ -1601,8 +1583,6 @@ link_socket_init_phase1 (struct link_socket *sock, sock->proxy_dest_host = remote_host; sock->proxy_dest_port = remote_port; } -#endif -#ifdef ENABLE_SOCKS /* or in Socks proxy mode? */ else if (sock->socks_proxy) {
@@ -1616,7 +1596,6 @@ link_socket_init_phase1 (struct link_socket *sock, sock->proxy_dest_host = remote_host; sock->proxy_dest_port = remote_port; } -#endif else { sock->remote_host = remote_host;
@@ -1702,10 +1681,8 @@ phase2_set_socket_flags (struct link_socket* sock)scripts don't have access to it */ set_cloexec (sock->sd); -#ifdef ENABLE_SOCKS if (socket_defined (sock->ctrl_sd))set_cloexec (sock->ctrl_sd); -#endif /* set Path MTU discovery options on the socket */ set_mtu_discover_type (sock->sd, sock->mtu_discover_type);
@@ -1798,11 +1775,7 @@ phase2_tcp_server (struct link_socket *sock, const char *remote_dynamic, static void phase2_tcp_client (struct link_socket *sock, struct signal_info *sig_info) { -#ifdef GENERAL_PROXY_SUPPORT bool proxy_retry = false; -#else - const bool proxy_retry = false; -#endif do { socket_connect (&sock->sd, sock->info.lsa->current_remote->ai_addr,
@@ -1814,7 +1787,6 @@ phase2_tcp_client (struct link_socket *sock, struct signal_info *sig_info)if (false) ; -#ifdef ENABLE_HTTP_PROXY else if (sock->http_proxy) { proxy_retry = establish_http_proxy_passthru (sock->http_proxy,
@@ -1824,8 +1796,6 @@ phase2_tcp_client (struct link_socket *sock, struct signal_info *sig_info) &sock->stream_buf.residual, &sig_info->signal_received); } -#endif -#ifdef ENABLE_SOCKS else if (sock->socks_proxy) { establish_socks_proxy_passthru (sock->socks_proxy,
@@ -1834,7 +1804,6 @@ phase2_tcp_client (struct link_socket *sock, struct signal_info *sig_info) sock->proxy_dest_port, &sig_info->signal_received); } -#endif if (proxy_retry) {openvpn_close_socket (sock->sd);
@@ -1845,7 +1814,6 @@ phase2_tcp_client (struct link_socket *sock, struct signal_info *sig_info) } -#ifdef ENABLE_SOCKS static void phase2_socks_client (struct link_socket *sock,struct signal_info *sig_info) {
@@ -1879,7 +1847,6 @@ phase2_socks_client (struct link_socket *sock, struct signal_info *sig_info)resolve_remote (sock,1 ,NULL , &sig_info->signal_received); } -#endif /* finalize socket initialization */ void
@@ -1965,11 +1932,9 @@ link_socket_init_phase2 (struct link_socket *sock,phase2_tcp_client (sock, sig_info); } -#ifdef ENABLE_SOCKS else if (sock->info.proto ==PROTO_UDP && sock->socks_proxy) {phase2_socks_client (sock, sig_info); -#endif }#ifdef TARGET_ANDROID if (sock->sd !=-1 )
@@ -2022,14 +1987,12 @@ link_socket_close (struct link_socket *sock)#endif } -#ifdef ENABLE_SOCKS if (socket_defined (sock->ctrl_sd)) {if (openvpn_close_socket (sock->ctrl_sd))msg (M_WARN |M_ERRNO ,"TCP/UDP: Close Socket (ctrl_sd) failed" ); sock->ctrl_sd =SOCKET_UNDEFINED ; } -#endif stream_buf_close (&sock->stream_buf);free_buf (&sock->stream_buf_data);
src/openvpn/socket.h +0 -13
@@ -172,10 +172,7 @@ struct link_socketstruct link_socket_info info;socket_descriptor_t sd; - -#ifdef ENABLE_SOCKS socket_descriptor_t ctrl_sd;/* only used for UDP over Socks */ -#endif #ifdef WIN32 struct overlapped_io reads;
@@ -228,22 +225,16 @@ struct link_socketstruct buffer stream_buf_data;bool stream_reset; -#ifdef ENABLE_HTTP_PROXY /* HTTP proxy */ struct http_proxy_info *http_proxy; -#endif -#ifdef ENABLE_SOCKS /* Socks proxy */ struct socks_proxy_info *socks_proxy;struct link_socket_actual socks_relay;/* Socks UDP relay address */ -#endif -#if defined(ENABLE_HTTP_PROXY ) || defined(ENABLE_SOCKS )/* The OpenVPN server we will use the proxy to connect to */ const char *proxy_dest_host;const char *proxy_dest_port; -#endif #if PASSTOS_CAPABILITY /* used to get/set TOS. */
@@ -321,12 +312,8 @@ link_socket_init_phase1 (struct link_socket *sock,bool bind_ipv6_only, int mode, const struct link_socket *accept_from, -#ifdef ENABLE_HTTP_PROXY struct http_proxy_info *http_proxy, -#endif -#ifdef ENABLE_SOCKS struct socks_proxy_info *socks_proxy, -#endif #ifdef ENABLE_DEBUG int gremlin, #endif
src/openvpn/socks.c +0 -6
@@ -38,8 +38,6 @@#include "syshead.h" -#ifdef ENABLE_SOCKS -#include "common.h" #include "misc.h" #include "win32.h"
@@ -574,7 +572,3 @@ socks_process_outgoing_udp (struct buffer *buf,return 10 ; } - -#else -static void dummy (void ) {} -#endif /* ENABLE_SOCKS */
src/openvpn/socks.h +0 -3
@@ -30,8 +30,6 @@#ifndef SOCKS_H #define SOCKS_H -#ifdef ENABLE_SOCKS -#include "buffer.h" struct openvpn_sockaddr ;
@@ -74,4 +72,3 @@ int socks_process_outgoing_udp (struct buffer *buf, const struct link_socket_actual *to);#endif -#endif
src/openvpn/syshead.h +2 -18
@@ -608,7 +608,7 @@ socket_defined (const socket_descriptor_t sd)/* * Should we include NTLM proxy functionality */ -#if defined(ENABLE_CRYPTO ) && defined(ENABLE_HTTP_PROXY ) +#if defined(ENABLE_CRYPTO )#define NTLM 1#else #define NTLM 0
@@ -617,20 +617,13 @@ socket_defined (const socket_descriptor_t sd)/* * Should we include proxy digest auth functionality */ -#if defined(ENABLE_CRYPTO ) && defined(ENABLE_HTTP_PROXY ) +#if defined(ENABLE_CRYPTO )#define PROXY_DIGEST_AUTH 1#else #define PROXY_DIGEST_AUTH 0#endif /* -* Should we include code common to all proxy methods? -*/ -#if defined(ENABLE_HTTP_PROXY ) || defined(ENABLE_SOCKS ) -#define GENERAL_PROXY_SUPPORT -#endif - -/* * Do we have CryptoAPI capability? */ #if defined(WIN32 ) && defined(ENABLE_CRYPTO ) && defined(ENABLE_SSL ) && defined(ENABLE_CRYPTO_OPENSSL )
@@ -669,15 +662,6 @@ socket_defined (const socket_descriptor_t sd)#endif /* -* Should we include http proxy override functionality -*/ -#if defined(ENABLE_MANAGEMENT ) && defined(ENABLE_HTTP_PROXY ) -#define HTTP_PROXY_OVERRIDE 1 -#else -#define HTTP_PROXY_OVERRIDE 0 -#endif - -/* * Reduce sensitivity to system clock instability * and backtracks. */
Signature · 1 line
1.8.5.2 (Apple Git-48)
[Openvpn-devel] [PATCH applied] Re: Always enable http-proxy and socks-proxy
ACK. Users have been asked if anyone would miss it, no reply in 10 days, gone with the wind.
Your patch has been applied to the master branch.
commit a4b8f653ee5be9c2292cf92dac09d7aadcc9a487 (master)
Author: Arne Schwabe Date: Mon Jul 7 14:12:20 2014 +0200
Always enable http-proxy and socks-proxy
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8840
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
PATCH 3/4 Fix compiling without ENABLE_MANAGEMENT
In reply to Arne Schwabe--- src/openvpn/push.c | 2 ++ 1 file changed, 2 insertions(+)
src/openvpn/push.c +2 -0
@@ -68,6 +68,7 @@ receive_auth_failed (struct context *c, const struct buffer *buffer)ASSERT (0 ); } c->sig->signal_text ="auth-failure" ; +#ifdef ENABLE_MANAGEMENT if (management) {const char *reason =NULL ;
@@ -76,6 +77,7 @@ receive_auth_failed (struct context *c, const struct buffer *buffer) reason =BSTR (&buf);management_auth_failure (management,UP_TYPE_AUTH , reason); } else +#endif {#ifdef ENABLE_CLIENT_CR struct buffer buf = *buffer;
Signature · 1 line
1.8.5.2 (Apple Git-48)
Re: [Openvpn-devel] [PATCH 3/4] Fix compiling without ENABLE_MANAGEMENT
Hi,
while this patch looks reasonable, and I was just to ACK and merge it, it confuses me just so slightly - if I look into my copy of push.c, "git blame" tells me that these two lines in there already, and have been so "since ever":
^6fbf66f push.c (James Yonan 2005-09-26 05:28:27 +0000 71) #ifdef ENABLE_MANAGEMENT
^6fbf66f push.c (James Yonan 2005-09-26 05:28:27 +0000 72) if (management)
5733ef66 push.c (James Yonan 2009-09-29 23:10:14 +0000 73) {
...
8c7c6be4 push.c (James Yonan 2010-03-12 03:05:34 +0000 78) management_auth_failure (management, UP_TYPE_AUTH, reason);
3cf9dd88 push.c (James Yonan 2010-10-24 09:12:47 +0000 79) } else
^6fbf66f push.c (James Yonan 2005-09-26 05:28:27 +0000 80) #endif... could you double check your tree, please? ;-)
gert
Quoted 39 lines · Arne Schwabe
--- src/openvpn/push.c | 2 ++ 1 file changed, 2 insertions(+)src/openvpn/push.c +2
-0@@ -68,6 +68,7 @@ receive_auth_failed (struct context *c, const struct buffer *buffer)ASSERT (0 ); } c->sig->signal_text ="auth-failure" ; +#ifdef ENABLE_MANAGEMENT if (management) {const char *reason =NULL ;@@ -76,6 +77,7 @@ receive_auth_failed (struct context *c, const struct buffer *buffer) reason =BSTR (&buf);management_auth_failure (management,UP_TYPE_AUTH , reason); } else +#endif {#ifdef ENABLE_CLIENT_CR struct buffer buf = *buffer;Signature · 13 lines
1.8.5.2 (Apple Git-48) ------------------------------------------------------------------------------ Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft _______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...PATCH 4/4 Remove ENABLE_BUFFER_LIST
In reply to Arne Schwabeit is unconditionally enabled and OpenVPN does not compile if disabled
--- src/openvpn/buffer.c | 5 ----- src/openvpn/buffer.h | 6 ------ src/openvpn/syshead.h | 5 ----- 3 files changed, 16 deletions(-)
src/openvpn/buffer.c +0 -5
@@ -976,9 +976,6 @@ valign4 (const struct buffer *buf, const char *file, const int line)/* * struct buffer_list */ - -#ifdef ENABLE_BUFFER_LIST -struct buffer_list *buffer_list_new (const int max_size) {
@@ -1154,5 +1151,3 @@ buffer_list_file (const char *fn, int max_line_len) }return bl; } - -#endif
src/openvpn/buffer.h +0 -6
@@ -904,9 +904,6 @@ check_malloc_return (void *p)/* * Manage lists of buffers */ - -#ifdef ENABLE_BUFFER_LIST -struct buffer_entry {struct buffer buf;
@@ -936,7 +933,4 @@ void buffer_list_pop (struct buffer_list *ol);void buffer_list_aggregate (struct buffer_list *bl,const size_t max);struct buffer_list *buffer_list_file (const char *fn,int max_line_len); - -#endif -#endif /* BUFFER_H */
src/openvpn/syshead.h +0 -5
@@ -594,11 +594,6 @@ socket_defined (const socket_descriptor_t sd)#endif /* -* Compile the struct buffer_list code -*/ -#define ENABLE_BUFFER_LIST - -/* * Should we include OCC (options consistency check) code? */ #ifndef ENABLE_SMALL
Signature · 1 line
1.8.5.2 (Apple Git-48)
[Openvpn-devel] [PATCH applied] Re: Remove ENABLE_BUFFER_LIST
ACK. Straightforward, and not really "optional" code in any way.
Your patch has been applied to the master branch.
commit 0c21b2dba9fca5f3e7effc45a495be1f5a9d0246
Author: Arne Schwabe Date: Mon Jul 7 14:12:22 2014 +0200
Remove ENABLE_BUFFER_LIST
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8841
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
PATCH v3 1/1 Remove #ifdefs for client nat support.
In reply to Arne SchwabeThe client-nat feature was always unconditionally enabled
--- src/openvpn/clinat.c | 4 ---- src/openvpn/clinat.h | 2 +- src/openvpn/forward.c | 12 +++++++----- src/openvpn/multi.c | 2 -- src/openvpn/openvpn.h | 2 -- src/openvpn/options.c | 18 +----------------- src/openvpn/options.h | 7 ------- src/openvpn/push.c | 2 -- src/openvpn/syshead.h | 5 ----- 9 files changed, 9 insertions(+), 45 deletions(-)
src/openvpn/clinat.c +0 -4
@@ -30,8 +30,6 @@#include "syshead.h" -#if defined(ENABLE_CLIENT_NAT ) -#include "clinat.h" #include "proto.h" #include "socket.h"
@@ -265,5 +263,3 @@ client_nat_transform (const struct client_nat_option_list *list, } } } - -#endif
src/openvpn/clinat.h +1 -1
@@ -22,7 +22,7 @@* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#if !defined(CLINAT_H ) && defined(ENABLE_CLIENT_NAT ) +#if !defined(CLINAT_H )#define CLINAT_H #include "buffer.h"
src/openvpn/forward.c +7 -5
@@ -1018,6 +1018,8 @@ process_ip_header (struct context *c, unsigned int flags, struct buffer *buf)if (!c->options.passtos) flags &= ~PIPV4_PASSTOS ;#endif +if (!c->options.client_nat) + flags &= ~PIPV4_CLIENT_NAT ;if (!c->options.route_gateway_via_dhcp) flags &= ~PIPV4_EXTRACT_DHCP_ROUTER ;
@@ -1027,11 +1029,13 @@ process_ip_header (struct context *c, unsigned int flags, struct buffer *buf)* The --passtos and --mssfix options require * us to examine the IPv4 header. */ + +if (flags & (PIP_MSSFIX #if PASSTOS_CAPABILITY -if (flags & (PIPV4_PASSTOS |PIP_MSSFIX )) -#else - if (flags & PIP_MSSFIX) + |PIPV4_PASSTOS #endif + |PIPV4_CLIENT_NAT + )) {struct buffer ipbuf = *buf;if (is_ipv4 (TUNNEL_TYPE (c->c1.tuntap), &ipbuf))
@@ -1046,14 +1050,12 @@ process_ip_header (struct context *c, unsigned int flags, struct buffer *buf)if (flags &PIP_MSSFIX )mss_fixup_ipv4 (&ipbuf,MTU_TO_MSS (TUN_MTU_SIZE_DYNAMIC (&c->c2.frame))); -#ifdef ENABLE_CLIENT_NAT /* possibly do NAT on packet */ if ((flags &PIPV4_CLIENT_NAT ) && c->options.client_nat) {const int direction = (flags &PIPV4_OUTGOING ) ?CN_INCOMING :CN_OUTGOING ;client_nat_transform (c->options.client_nat, &ipbuf, direction); } -#endif /* possibly extract a DHCP router message */ if (flags &PIPV4_EXTRACT_DHCP_ROUTER ) {
src/openvpn/multi.c +0 -2
@@ -1296,9 +1296,7 @@ multi_select_virtual_addr (struct multi_context *m, struct multi_instance *mi) mi->context.c2.push_ifconfig_defined = true; mi->context.c2.push_ifconfig_local = mi->context.options.push_ifconfig_local; mi->context.c2.push_ifconfig_remote_netmask = mi->context.options.push_ifconfig_remote_netmask; -#ifdef ENABLE_CLIENT_NAT mi->context.c2.push_ifconfig_local_alias = mi->context.options.push_ifconfig_local_alias; -#endif /* the current implementation does not allow "static IPv4, pool IPv6", * (see below) so issue a warning if that happens - don't break the
src/openvpn/openvpn.h +0 -2
@@ -454,9 +454,7 @@ struct context_2time_t sent_push_reply_expiry;in_addr_t push_ifconfig_local;in_addr_t push_ifconfig_remote_netmask; -#ifdef ENABLE_CLIENT_NAT in_addr_t push_ifconfig_local_alias; -#endif bool push_ifconfig_ipv6_defined;struct in6_addr push_ifconfig_ipv6_local;
src/openvpn/options.c +1 -17
@@ -243,9 +243,7 @@ static const char usage_message[] =" Add 'bypass-dns' flag to similarly bypass tunnel for DNS.\n" "--redirect-private [flags]: Like --redirect-gateway, but omit actually changing\n" " the default gateway. Useful when pushing private subnets.\n" -#ifdef ENABLE_CLIENT_NAT"--client-nat snat|dnat network netmask alias : on client add 1-to-1 NAT rule.\n" -#endif #ifdef ENABLE_PUSH_PEER_INFO"--push-peer-info : (client only) push client info to server.\n" #endif
@@ -1322,9 +1320,7 @@ options_detach (struct options *o) {gc_detach (&o->gc); o->routes =NULL ; -#ifdef ENABLE_CLIENT_NAT o->client_nat =NULL ; -#endif #if P2MP_SERVER clone_push_list (o);#endif
@@ -1344,14 +1340,12 @@ rol6_check_alloc (struct options *options) options->routes_ipv6 =new_route_ipv6_option_list (&options->gc); } -#ifdef ENABLE_CLIENT_NAT static void cnol_check_alloc (struct options *options) {if (!options->client_nat) options->client_nat =new_client_nat_list (&options->gc); } -#endif #ifndef ENABLE_SMALL static void
@@ -1553,11 +1547,9 @@ show_settings (const struct options *o)SHOW_BOOL (allow_pull_fqdn);if (o->routes)print_route_options (o->routes,D_SHOW_PARMS ); - -#ifdef ENABLE_CLIENT_NAT +if (o->client_nat)print_client_nat_list (o->client_nat,D_SHOW_PARMS ); -#endif #ifdef ENABLE_MANAGEMENT SHOW_STR (management_addr);
@@ -2819,13 +2811,11 @@ pre_pull_save (struct options *o) o->pre_pull->routes_ipv6 =clone_route_ipv6_option_list (o->routes_ipv6, &o->gc); o->pre_pull->routes_ipv6_defined = true; } -#ifdef ENABLE_CLIENT_NAT if (o->client_nat) { o->pre_pull->client_nat =clone_client_nat_option_list (o->client_nat, &o->gc); o->pre_pull->client_nat_defined = true; } -#endif } }
@@ -2855,7 +2845,6 @@ pre_pull_restore (struct options *o, struct gc_arena *gc)else o->routes_ipv6 =NULL ; -#ifdef ENABLE_CLIENT_NAT if (pp->client_nat_defined) {cnol_check_alloc (o);
@@ -2863,7 +2852,6 @@ pre_pull_restore (struct options *o, struct gc_arena *gc) }else o->client_nat =NULL ; -#endif o->foreign_option_index = pp->foreign_option_index; }
@@ -5212,14 +5200,12 @@ add_option (struct options *options,VERIFY_PERMISSION (OPT_P_PERSIST_IP ); options->persist_remote_ip = true; } -#ifdef ENABLE_CLIENT_NAT else if (streq (p[0 ],"client-nat" ) && p[1 ] && p[2 ] && p[3 ] && p[4 ]) {VERIFY_PERMISSION (OPT_P_ROUTE );cnol_check_alloc (options);add_client_nat_to_option_list (options->client_nat, p[1 ], p[2 ], p[3 ], p[4 ], msglevel); } -#endif else if (streq (p[0 ],"route" ) && p[1 ]) {VERIFY_PERMISSION (OPT_P_ROUTE );
@@ -5805,10 +5791,8 @@ add_option (struct options *options, options->push_ifconfig_defined = true; options->push_ifconfig_local = local; options->push_ifconfig_remote_netmask = remote_netmask; -#ifdef ENABLE_CLIENT_NAT if (p[3 ]) options->push_ifconfig_local_alias =getaddr (GETADDR_HOST_ORDER |GETADDR_RESOLVE , p[3 ],0 ,NULL ,NULL ); -#endif }else {
src/openvpn/options.h +0 -7
@@ -71,10 +71,8 @@ struct options_pre_pullbool routes_ipv6_defined;struct route_ipv6_option_list *routes_ipv6; -#ifdef ENABLE_CLIENT_NAT bool client_nat_defined;struct client_nat_option_list *client_nat; -#endif int foreign_option_index; };
@@ -352,10 +350,7 @@ struct optionsbool route_nopull;bool route_gateway_via_dhcp;bool allow_pull_fqdn;/* as a client, allow server to push a FQDN for certain parameters */ - -#ifdef ENABLE_CLIENT_NAT struct client_nat_option_list *client_nat; -#endif #ifdef ENABLE_OCC /* Enable options consistency check between peers */
@@ -436,9 +431,7 @@ struct optionsbool push_ifconfig_defined;in_addr_t push_ifconfig_local;in_addr_t push_ifconfig_remote_netmask; -#ifdef ENABLE_CLIENT_NAT in_addr_t push_ifconfig_local_alias; -#endif bool push_ifconfig_constraint_defined;in_addr_t push_ifconfig_constraint_network;in_addr_t push_ifconfig_constraint_netmask;
src/openvpn/push.c +0 -2
@@ -294,10 +294,8 @@ send_push_reply (struct context *c)if (c->c2.push_ifconfig_defined && c->c2.push_ifconfig_local && c->c2.push_ifconfig_remote_netmask) {in_addr_t ifconfig_local = c->c2.push_ifconfig_local; -#ifdef ENABLE_CLIENT_NAT if (c->c2.push_ifconfig_local_alias) ifconfig_local = c->c2.push_ifconfig_local_alias; -#endif buf_printf (&buf,",ifconfig %s %s" ,print_in_addr_t (ifconfig_local,0 , &gc),print_in_addr_t (c->c2.push_ifconfig_remote_netmask,0 , &gc));
src/openvpn/syshead.h +0 -5
@@ -723,11 +723,6 @@ socket_defined (const socket_descriptor_t sd)#endif /* -* Do we support internal client-side NAT? -*/ -#define ENABLE_CLIENT_NAT - -/* * Compression support */ #if defined(ENABLE_SNAPPY) || defined(ENABLE_LZO) || defined(ENABLE_LZ4) || \
Signature · 1 line
1.8.5.2 (Apple Git-48)
Hi,
src/openvpn/forward.c process_ip_header (struct context *c, unsigned int flags, struct buffer *buf) · line 1025
Quoted 11 lines · Arne Schwabe
src/openvpn/forward.c +2
-0@@ -1018,6 +1018,8 @@ process_ip_header (struct context *c, unsigned int flags, struct buffer *buf)if (!c->options.passtos) flags &= ~PIPV4_PASSTOS ;#endif +if (!c->options.client_nat) + flags &= ~PIPV4_CLIENT_NAT ;if (!c->options.route_gateway_via_dhcp) flags &= ~PIPV4_EXTRACT_DHCP_ROUTER ;
This...
src/openvpn/forward.c process_ip_header (struct context *c, unsigned int flags, struct buffer *buf) · line 1054
Quoted 7 lines
src/openvpn/forward.c +0
-1@@ -1046,14 +1050,12 @@ process_ip_header (struct context *c, unsigned int flags, struct buffer *buf)if (flags &PIP_MSSFIX )mss_fixup_ipv4 (&ipbuf,MTU_TO_MSS (TUN_MTU_SIZE_DYNAMIC (&c->c2.frame))); -#ifdef ENABLE_CLIENT_NAT /* possibly do NAT on packet */ if ((flags &PIPV4_CLIENT_NAT ) && c->options.client_nat)
... sort of obsoletes this c->options.client_nat check, right?
(I'm not sure I understand why it was done the way it is, but if you do the first change, maybe just get rid of the second bit of the condition here...)
The rest is quite straightforward de-#ifdef-ing, which I like :)
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...Am 09.07.14 22:39, schrieb Gert Doering:
Quoted 25 lines
Hi,
src/openvpn/forward.c process_ip_header (struct context *c, unsigned int flags, struct buffer *buf) · line 1025
Quoted 11 lines · Arne Schwabe
src/openvpn/forward.c +2
-0@@ -1018,6 +1018,8 @@ process_ip_header (struct context *c, unsigned int flags, struct buffer *buf)if (!c->options.passtos) flags &= ~PIPV4_PASSTOS ;#endif +if (!c->options.client_nat) + flags &= ~PIPV4_CLIENT_NAT ;if (!c->options.route_gateway_via_dhcp) flags &= ~PIPV4_EXTRACT_DHCP_ROUTER ;This...
src/openvpn/forward.c process_ip_header (struct context *c, unsigned int flags, struct buffer *buf) · line 1054
Quoted 7 lines
src/openvpn/forward.c +0
-1@@ -1046,14 +1050,12 @@ process_ip_header (struct context *c, unsigned int flags, struct buffer *buf)if (flags &PIP_MSSFIX )mss_fixup_ipv4 (&ipbuf,MTU_TO_MSS (TUN_MTU_SIZE_DYNAMIC (&c->c2.frame))); -#ifdef ENABLE_CLIENT_NAT /* possibly do NAT on packet */ if ((flags &PIPV4_CLIENT_NAT ) && c->options.client_nat)... sort of obsoletes this
c->options.client_natcheck, right?
Quoted 7 lines
(I'm not sure I understand why it was done the way it is, but if you do the first change, maybe just get rid of the second bit of the condition here...)
The rest is quite straightforward de-#ifdef-ing, which I like :)
gert
That is actually a bugfix that "slipped" into the patch, but yes the second part is kind of duplicated.
See alos the discussion on
Message-ID: <[email protected]...>
and the mail before that. We probablly really should commit a fix for this stuff otherwise it pops up every 6 months or so.
Arne