Last strtok() returns chunk from last "," until end of strig. Since
openvpn sends a trailing new line + "END" string, that was being copied
into the remote port.
Change-Id: Ie24fed9c64bc482fd5af8bc9d03d37937c6471bf
Useful specially during RECONNECTING and EXITING to show reason of the
disconnect according to openvpn documentation.
Change-Id: I9f47f5d843bb550a4ce7956c89d31f06394201cf
wireshark shows strings returned by OpenVPN management interface as an
aswer to "state" cmd contain no null character at the end. As a
consequence, osmo_strlcpy cannot be used since it calls strlen() on the
source.
Probably previous implementation was harmless because we zero-fill msgb
buffers prior to filling them.
Change-Id: I4356dc08324a6d877c9e8112306570aabbf6e777
It's a connection towards localhost, so it doesn't hurt reconnecting in
a timely fashion, otherwise upon openvpn restart user needed to wait for
1 minute to see changes.
Change-Id: Ie9638120d1ce5bfa43bc7c15f05cf81de37624c5
New strings are far more comprehensive to understand the current status
during (re)connect to openvpn management socket.
Change-Id: Ifd0f821ed2d237740b6d3381a7190ad7058ce889
Among other possibles issue, it should avoid sporadic print loop hanging if no events are fired in osmocom main loop.
Change-Id: Ie2f0983eaf75826483b5b70f58b4d4acb842d6ea
Setup disconnection callback and use it to properly track management
interface availability.
Change-Id: I11b8bc71c1e9cbbf992ee3b7c1c9aae6e6f697e0
Requires: libosmo-netif I905adb2d6191216551a3bcdcd1aec1f96f01612a
Related: SYS#2655
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
Add generic host config struct and related helpers for TCP-based probes
and use them for ctrl probe.
This will be used in follow-up patch for OpenVPN probe as well.
Change-Id: Ie321655a92cdbefbfaa056ac0d583397c83beccb
In case of multiple ctrl-client entries in .cfg file it's impossible to
see which one is causing particular ctrl error. Fix this by introducing
macro wrapper for stderr logging which always show host:port relevant to
the error.
Change-Id: I788d51359965a66c54075a3971aa7824c3bfb0bf
Related: SYS#2655
Use liboping (new dependency) to add 'ping XXX' entries support in .cfg
file, where XXX can be either IP address or FQDN.
Sample output:
...
ping
ya.ru
IP: 2a02:6b8::2:242
dropped: 3/3
8.8.8.8
IP: 8.8.8.8
dropped: 0/3
latency: 20.4 ms
TTL: 120
...
N. B: to gather actual ping statistic we have to be able to send ICMP
requests (have enough privileges to work with RAW sockets).
Related: SYS#2655
Change-Id: Ife32540b532fb54368f63c78fb7837b84d4e8c76
The simple_ctrl.c is used by 2 independent binaries. Let's build it as a
convenience libtool library [1] to make it easier to add further
external dependencies in future.
While at it, also move osmo-sysmon dependencies to program-specific
_CFLAGS from generic one.
[1] https://www.gnu.org/software/automake/manual/html_node/Libtool-Convenience-Libraries.html
Change-Id: Idfaba17b54983709278e1c24bf55edbbb4abd961
Moving configuration data from anonymous struct into shared header as a
preparation for ctrl logging improvements in follow-up patches.
Change-Id: I3520e14ca6e1b8e270dbd4b1bf2378fe486991ce
Related: SYS#2655
Same files are available in other osmocom projects, otherwise configure
fails with "Please install autoconf-archive; re-run 'autoreconf -fi' for
it to take effect.".
Change-Id: Iabe3207fff8f076a3f4ddc81720bb7fdc671a46c
Don't forget to close the file which was opened at the
beginning of this function's scope. Found by Coverity.
Change-Id: Ie1b5734748438c6d785cd96dfa9af6303cd102da
Related: CID#189756
This check is not in all our repos that use git-version-gen. Indeed it
seems to be a leftover of openbsc where I think it wanted to ensure
being called in the openbsc subfolder or something? libosmocore e.g.
doesn't have it.
In any case .git being a directory is not always true (if using git
worktree) so remove this check.
Change-Id: I414111b27db9951314e6bc7eff8bc1f10775b3ff