This allows the user to change the configuration between either using
a) the classic OsmoPCAP protocol (over TCP with or without TLS)
which is used when you want to talk to an osmo-pcap-server
b) the (new) IPIP encapsulation, which will simply take the IP
packet (without Ethernet or pcap header) and transmit it inside IPIP
to the specified server IP address. This is useful for gettin
real-time streaming into wireshark.
Change-Id: I8056fc163ac2f15adcb964d867dd5e51df4e4710
We can simplify the code even further by using the osmo_fd version
of osmo_sock_init2() called osmo_sock_init2_ofd(), which takes care
of filling the osmo_fd.fd member and registering the socket in the
select loop.
Change-Id: Ibf1480e7dee287db77a19bb9f0254edddf7706ab
A related function for "create a socket, bind it locally and connect
remotely" has meanwhile been introduced in libosmocore, so the local
implementation can go.
Change-Id: Ieda77ad8b3f7b89faa09882c0037562ce4d0fc89
src_result is only valid "if (src)", so we cannot unconditionally
free it:
(gdb) bt
host=0x52 <error: Cannot access memory at address 0x52>, src=0x0)
at /usr/src/debug/osmo-pcap/0.0.6+gitrAUTOINC+4776b2972e-r1d/git/src/osmo_client_network.c:165
Change-Id: I3b6778d9110583ecb1daec59ef2c86465d5818b9
Modify the osmo_sock_init (code clone to be integrated upstream)
to allow binding to a specific source ip and source port. Allow
the source ip to be configured but allow the kernel to pick a
random port for us.
This is necessary for systems with multiple interfaces where the
default route is not necessarily the right one to connect to the
pcap server.
Change-Id: I84e728b0752213d28f970fcbbfd6565c441ccfeb
When not running as root the opening might fail and then we would
crash when sending the link information. Do not crash. This could
have crashed before the re-factoring but due the async connect it
seems more likely we hit it now.
Change-Id: I26a10c401a9a8998acc50a4bd4432d2ac7fceaeb
With the VTY a user can write connect, connect, connect and this
would lead to leaking fds. Always close the connection.
Change-Id: Iab94dc2fd28496bf5fd8ceb5611f9e6505ccae1b
Allow to configure multiple servers and connect. Introduce a new VTY
node to allow multiple servers. Add an explicit connect. Do not put
the main connection into the same list but assume it exists.
Change-Id: I9448ad4a005dd7c7eb1c615d03e57d6cb058ae4d
If we want to have multiple servers we should not block when trying to
connect to one of them. Enable non blocking mode and handle the fd
specially until it is connected. E.g. on failed connect the read will
become readable but fail, otherwise it becomes writable.
Clear the write queue to make sure that the link data is sent first.
We might be able to introduce a osmo_wqueue_prepend.
Change-Id: Iae2bc264d15aa8598beefc194e3b8c4ebe87320a
Take out various fields into a new connection class. We will have the
option to connect to multiple servers.
Change-Id: I820176d133fbdb0240a16eb4e1a6d505e5c080c6
Use GNUtls because it is GPL compatible and instead of mbedTLS seems
to have a working non-blocking I/O integration. GNUtls has various
issues that could not be resolved easily:
* Pick spdy as sub protocol
* gmt_time not randomized
* private key loaded to RAM (but not verified)
This is the beginning and not the end. Client support might need more
work with actual tls verification. Maybe more manual x509 cert
verification is needed and maybe client certs don't work at all. I try
to ignore renegotiation as I threw away the key.
Reload x509 creds and keys as they might have changed from one
connection to another.
Change-Id: I9128e14084da1fc2705f858393f98b8133996172
Add more counters and start counting them when reading from the
PCAP library and when trying to write to the socket.
Change-Id: I52d3064a265b402ac849d8578a14f718156c0805
Count certain events that can help to understand what is going on.
This includes OOM, failure to queues.
Change-Id: I4a2dad32afb577822c7181d2813ea5a7e693c704
We need to convert the 64bit timeval on a 64bit userspace (or on
OpenBSD) into a 32bit truncated value for being able to write the
file. This means we have 2038 issue here?
The connect0_bind1 parameter has been replaced by a generic flag
parameter. With this patch osmo-pcap works (only) with versions of
libosmocore 0.3.2 or newer - configure.ac changed to reflects that.