Add OpenVPN probe
This adds support for OpenVPN status probe which uses OpenVPN's
management interface (configured via 'management 127.0.0.1 1234' in
OpenVPN's config).
The output looks as follows:
...
OpenVPN
127.0.0.1:1234
status: CONNECTED
tunnel: 10.8.0.15
remote: 144.76.43.77:1194
localhost:4242
status: management interface incompatible
127.0.0.1:4444
status: management interface unavailable
...
We show tunnel's IP (if available) as well as remote (OpenVPN server
itself) address/port in addition to general connection status. If
management interface is unavailable it's reported as such. If we've
managed to establish connection with a given management interface but
are unable to obtain expected information than we report this
incompatibility as well.
Related: SYS#2655
Change-Id: I4493e19b9a09dcebd289457eacd1719f7f8cc31c
diff --git a/src/client.c b/src/client.c
index 6b37fc6..758884d 100644
--- a/src/client.c
+++ b/src/client.c
@@ -27,6 +27,7 @@
#include <talloc.h>
#include <osmocom/core/utils.h>
+#include <osmocom/netif/stream.h>
#include "client.h"
@@ -71,3 +72,24 @@
return talloc_asprintf(ctx, "%s:%u", cfg->remote_host, cfg->remote_port);
}
+
+struct osmo_stream_cli *make_tcp_client(struct host_cfg *cfg)
+{
+ struct osmo_stream_cli *cl = osmo_stream_cli_create(cfg);
+ if (cl) {
+ osmo_stream_cli_set_addr(cl, cfg->remote_host);
+ osmo_stream_cli_set_port(cl, cfg->remote_port);
+ }
+
+ return cl;
+}
+
+void update_name(struct host_cfg *cfg, const char *new_name)
+{
+ osmo_talloc_replace_string(cfg, (char **)&cfg->name, new_name);
+}
+
+void update_host(struct host_cfg *cfg, const char *new_host)
+{
+ osmo_talloc_replace_string(cfg, (char **)&cfg->remote_host, new_host);
+}