#endif
-#if MANAGEMENT_QUERY_REMOTE
-
static bool
management_callback_remote_cmd (void *arg, const char **p)
{
return ret;
}
-#endif
-
/*
* Initialize and possibly randomize connection list.
*/
static void
init_connection_list (struct context *c)
{
-#ifdef ENABLE_CONNECTION
struct connection_list *l = c->options.connection_list;
if (l)
{
}
}
}
-#endif
}
#if 0 /* fixme -- disable for production */
static void
next_connection_entry (struct context *c)
{
-#ifdef ENABLE_CONNECTION
struct connection_list *l = c->options.connection_list;
if (l)
{
c->options.ce = *ce;
-#if MANAGEMENT_QUERY_REMOTE
if (ce_defined && management && management_query_remote_enabled(management))
{
/* allow management interface to override connection entry details */
if (IS_SIG (c))
break;
} else
-#endif
if (remote_ip_hint)
c->options.ce.remote = remote_ip_hint;
#endif
} while (!ce_defined);
}
-#endif
update_options_ce_post (&c->options);
}
#if HTTP_PROXY_FALLBACK
cb.http_proxy_fallback_cmd = management_callback_http_proxy_fallback_cmd;
#endif
-#if MANAGEMENT_QUERY_REMOTE
cb.remote_cmd = management_callback_remote_cmd;
-#endif
management_set_callback (management, &cb);
}
#endif
msg (M_CLIENT, " where action is reply string.");
msg (M_CLIENT, "net : (Windows only) Show network info and routing table.");
msg (M_CLIENT, "password type p : Enter password p for a queried OpenVPN password.");
-#if MANAGEMENT_QUERY_REMOTE
msg (M_CLIENT, "remote type [host port] : Override remote directive, type=ACCEPT|MOD|SKIP.");
-#endif
msg (M_CLIENT, "pid : Show process ID of the current OpenVPN process.");
#ifdef ENABLE_PKCS11
msg (M_CLIENT, "pkcs11-id-count : Get number of available PKCS#11 identities.");
#endif
-#if MANAGEMENT_QUERY_REMOTE
-
static void
man_remote (struct management *man, const char **p)
{
}
}
-#endif
-
static void
man_dispatch_command (struct management *man, struct status_output *so, const char **p, const int nparms)
{
man_http_proxy_fallback (man, NULL, NULL, NULL);
}
#endif
-#if MANAGEMENT_QUERY_REMOTE
else if (streq (p[0], "remote"))
{
if (man_need (man, p, 1, MN_AT_LEAST))
man_remote (man, p);
}
-#endif
#if 1
else if (streq (p[0], "test"))
{
#if HTTP_PROXY_FALLBACK
bool (*http_proxy_fallback_cmd) (void *arg, const char *server, const char *port, const char *flags);
#endif
-#if MANAGEMENT_QUERY_REMOTE
bool (*remote_cmd) (void *arg, const char **p);
-#endif
};
/*
# define MF_EXTERNAL_KEY (1<<9)
#endif
#define MF_UP_DOWN (1<<10)
-#if MANAGEMENT_QUERY_REMOTE
#define MF_QUERY_REMOTE (1<<11)
-#endif
bool management_open (struct management *man,
const char *addr,
return BOOL_CAST(man->settings.flags & MF_QUERY_PASSWORDS);
}
-#if MANAGEMENT_QUERY_REMOTE
static inline bool
management_query_remote_enabled (const struct management *man)
{
return BOOL_CAST(man->settings.flags & MF_QUERY_REMOTE);
}
-#endif
#ifdef MANAGEMENT_PF
static inline bool
" ip/port rather than listen as a TCP server.\n"
"--management-query-passwords : Query management channel for private key\n"
" and auth-user-pass passwords.\n"
-#if MANAGEMENT_QUERY_REMOTE
"--management-query-remote : Query management channel for --remote directive.\n"
-#endif
"--management-hold : Start " PACKAGE_NAME " in a hibernating state, until a client\n"
" of the management interface explicitly starts it.\n"
"--management-signal : Issue SIGUSR1 when management disconnect event occurs.\n"
setenv_unsigned (es, "daemon_start_time", time(NULL));
setenv_int (es, "daemon_pid", platform_getpid());
-#ifdef ENABLE_CONNECTION
if (o->connection_list)
{
int i;
setenv_connection_entry (es, o->connection_list->array[i], i+1);
}
else
-#endif
setenv_connection_entry (es, &o->ce, 1);
}
{
msg (D_SHOW_PARMS, "Connection profiles [default]:");
show_connection_entry (&o->ce);
-#ifdef ENABLE_CONNECTION
if (o->connection_list)
{
const struct connection_list *l = o->connection_list;
show_connection_entry (l->array[i]);
}
}
-#endif
msg (D_SHOW_PARMS, "Connection profiles END");
}
#endif
-#if ENABLE_CONNECTION
-
static struct connection_list *
alloc_connection_list_if_undef (struct options *options)
{
return e;
}
-#endif
-
void
connection_entry_load_re (struct connection_entry *ce, const struct remote_entry *re)
{
if (ce->socks_proxy_server)
msg (M_USAGE, "--socks-proxy cannot be used with --mode server");
#endif
-#ifdef ENABLE_CONNECTION
if (options->connection_list)
msg (M_USAGE, "<connection> cannot be used with --mode server");
-#endif
#if 0
if (options->tun_ipv6)
msg (M_USAGE, "--tun-ipv6 cannot be used with --mode server");
static void
options_postprocess_verify (const struct options *o)
{
-#ifdef ENABLE_CONNECTION
if (o->connection_list)
{
int i;
options_postprocess_verify_ce (o, o->connection_list->array[i]);
}
else
-#endif
options_postprocess_verify_ce (o, &o->ce);
}
options_postprocess_mutate_invariant (o);
-#ifdef ENABLE_CONNECTION
if (o->remote_list && !o->connection_list)
{
/*
#endif
}
else
-#endif
options_postprocess_mutate_ce (o, &o->ce);
#if P2MP
VERIFY_PERMISSION (OPT_P_GENERAL);
options->management_flags |= MF_QUERY_PASSWORDS;
}
-#if MANAGEMENT_QUERY_REMOTE
else if (streq (p[0], "management-query-remote"))
{
VERIFY_PERMISSION (OPT_P_GENERAL);
options->management_flags |= MF_QUERY_REMOTE;
}
-#endif
else if (streq (p[0], "management-hold"))
{
VERIFY_PERMISSION (OPT_P_GENERAL);
VERIFY_PERMISSION (OPT_P_GENERAL);
options->remote_random = true;
}
-#if ENABLE_CONNECTION
else if (streq (p[0], "connection") && p[1])
{
VERIFY_PERMISSION (OPT_P_GENERAL);
uninit_options (&sub);
}
}
-#endif
-#ifdef ENABLE_CONNECTION
else if (streq (p[0], "remote-ip-hint") && p[1])
{
VERIFY_PERMISSION (OPT_P_GENERAL);
options->remote_ip_hint = p[1];
}
-#endif
#if HTTP_PROXY_FALLBACK
else if (streq (p[0], "http-proxy-fallback"))
{
re.proto = proto;
}
}
-#ifdef ENABLE_CONNECTION
if (permission_mask & OPT_P_GENERAL)
{
struct remote_entry *e = alloc_remote_entry (options, msglevel);
*e = re;
}
else if (permission_mask & OPT_P_CONNECTION)
-#endif
{
connection_entry_load_re (&options->ce, &re);
}
# define CE_HTTP_PROXY_FALLBACK (1<<1)
time_t ce_http_proxy_fallback_timestamp; /* time when fallback http_proxy_options was last updated */
#endif
-#if MANAGEMENT_QUERY_REMOTE
# define CE_MAN_QUERY_REMOTE_UNDEF 0
# define CE_MAN_QUERY_REMOTE_QUERY 1
# define CE_MAN_QUERY_REMOTE_ACCEPT 2
# define CE_MAN_QUERY_REMOTE_SKIP 4
# define CE_MAN_QUERY_REMOTE_MASK (0x07)
# define CE_MAN_QUERY_REMOTE_SHIFT (2)
-#endif
unsigned int flags;
};
int proto;
};
-#ifdef ENABLE_CONNECTION
-
#define CONNECTION_LIST_SIZE 64
struct connection_list
struct remote_entry *array[CONNECTION_LIST_SIZE];
};
-#endif
-
#if HTTP_PROXY_FALLBACK
struct hpo_store
{
};
#endif
-#if MANAGEMENT_QUERY_REMOTE
struct remote_host_store
{
# define RH_HOST_LEN 80
char host[RH_HOST_LEN];
};
-#endif
/* Command line options */
struct options
/* Networking parms */
struct connection_entry ce;
-
-#ifdef ENABLE_CONNECTION
char *remote_ip_hint;
struct connection_list *connection_list;
struct remote_list *remote_list;
bool force_connection_list;
-#endif
#if HTTP_PROXY_FALLBACK
bool http_proxy_fallback;
struct hpo_store *hpo_store; /* used to store dynamic proxy info given by management interface */
#endif
-#if MANAGEMENT_QUERY_REMOTE
struct remote_host_store *rh_store;
-#endif
bool remote_random;
const char *ipchange;
static inline bool
connection_list_defined (const struct options *o)
{
-#ifdef ENABLE_CONNECTION
return o->connection_list != NULL;
-#else
- return false;
-#endif
}
static inline void
connection_list_set_no_advance (struct options *o)
{
-#ifdef ENABLE_CONNECTION
if (o->connection_list)
o->connection_list->no_advance = true;
-#endif
}
#if HTTP_PROXY_FALLBACK
#define EPOLL 0
#endif
-/*
- * Support "connection" directive
- */
-#define ENABLE_CONNECTION 1
-
/*
* Should we include http proxy fallback functionality
*/
-#if defined(ENABLE_CONNECTION) && defined(ENABLE_MANAGEMENT) && defined(ENABLE_HTTP_PROXY)
+#if defined(ENABLE_MANAGEMENT) && defined(ENABLE_HTTP_PROXY)
#define HTTP_PROXY_FALLBACK 1
#else
#define HTTP_PROXY_FALLBACK 0
#endif
-/*
- * Should we include --management-query-remote functionality
- */
-#if defined(ENABLE_CONNECTION) && defined(ENABLE_MANAGEMENT)
-#define MANAGEMENT_QUERY_REMOTE 1
-#else
-#define MANAGEMENT_QUERY_REMOTE 0
-#endif
-
/*
* Reduce sensitivity to system clock instability
* and backtracks.