This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Max gerrit-no-reply at lists.osmocom.orgMax has submitted this change and it was merged. ( https://gerrit.osmocom.org/12989 ) Change subject: OpenVPN: track interface disconnect ...................................................................... OpenVPN: track interface disconnect Setup disconnection callback and use it to properly track management interface availability. Change-Id: I11b8bc71c1e9cbbf992ee3b7c1c9aae6e6f697e0 Requires: libosmo-netif I905adb2d6191216551a3bcdcd1aec1f96f01612a Related: SYS#2655 --- M src/client.h M src/osysmon_openvpn.c 2 files changed, 17 insertions(+), 3 deletions(-) Approvals: osmith: Looks good to me, but someone else must approve Pau Espin Pedrol: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/client.h b/src/client.h index d878450..a14019e 100644 --- a/src/client.h +++ b/src/client.h @@ -15,7 +15,7 @@ /* name of this client */ const char *name; /* remote host/IP */ - const char *remote_host; + char *remote_host; /* remote port */ uint16_t remote_port; }; diff --git a/src/osysmon_openvpn.c b/src/osysmon_openvpn.c index 135a532..148e3b8 100644 --- a/src/osysmon_openvpn.c +++ b/src/osysmon_openvpn.c @@ -113,12 +113,26 @@ return NULL; } +static int disconnect_cb(struct osmo_stream_cli *conn) +{ + struct openvpn_client *vpn = osmo_stream_cli_get_data(conn); + + update_name(vpn->rem_cfg, "management interface unavailable"); + vpn->connected = false; + talloc_free(vpn->tun_ip); + talloc_free(vpn->rem_cfg->remote_host); + vpn->tun_ip = NULL; + vpn->rem_cfg->remote_host = NULL; + + return 0; +} + static int connect_cb(struct osmo_stream_cli *conn) { struct openvpn_client *vpn = osmo_stream_cli_get_data(conn); update_name(vpn->rem_cfg, "management interface incompatible"); - vpn->connected = true; /* FIXME: there's no callback for lost connection to drop this flag */ + vpn->connected = true; return 0; } @@ -174,6 +188,7 @@ osmo_stream_cli_set_reconnect_timeout(vpn->mgmt, 60); osmo_stream_cli_set_read_cb(vpn->mgmt, read_cb); osmo_stream_cli_set_connect_cb(vpn->mgmt, connect_cb); + osmo_stream_cli_set_disconnect_cb(vpn->mgmt, disconnect_cb); if (osmo_stream_cli_open(vpn->mgmt) < 0) { OVPN_LOG(vpn->rem_cfg, vpn, "failed to connect to management interface\n"); @@ -261,7 +276,6 @@ if (remote) value_node_add(vn_host, "remote", remote); - /* FIXME: there's no way to check client state so this might be triggered even while it's reconnecting */ if (vpn->connected) { /* re-trigger state command */ msgb_printf(msg, "state\n"); osmo_stream_cli_send(vpn->mgmt, msg); -- To view, visit https://gerrit.osmocom.org/12989 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sysmon Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: I11b8bc71c1e9cbbf992ee3b7c1c9aae6e6f697e0 Gerrit-Change-Number: 12989 Gerrit-PatchSet: 1 Gerrit-Owner: Max <msuraev at sysmocom.de> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Jenkins Builder (1000002) Gerrit-Reviewer: Max <msuraev at sysmocom.de> Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de> Gerrit-Reviewer: daniel <dwillmann at sysmocom.de> Gerrit-Reviewer: osmith <osmith at sysmocom.de> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190221/d6d4b4f6/attachment.htm>