path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2017-07-21Add support for generating IPIP to osmo-pcap-clientlaforge/ipipHarald Welte2-20/+118
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
2017-07-21client: Move to osmo_sock_init2_ofd()Harald Welte1-12/+3
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
2017-07-21Use libosmocore osmo_sock_init2() instead of local implementationHarald Welte1-134/+2
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
2017-07-21Rename osmo_pcap_{client_server} executables to osmo-pcap-{client,server}Harald Welte1-1/+1
This naming is more in line with what all the other osmocom programs are doing (e.g. osmo-pcu, osmo-bts-sysmo, osmo-bsc, ...). We don't generally use osmo_ anywhere else, so I suggest to change it for more uniformity. Change-Id: If1e3ce76f93266e0f01c801204769432b571fdb1
2017-07-21Use TCP port numbers for VTY that don't overlap with other Osmocom SoftwareHarald Welte2-2/+2
osmo-pcap for historical reasons uses the same port numbers as OsmoPCU and OsmoBTS. This leads to problems when wanting to run related software together on one system. Let's break the historical assumptions and start with non-overlapping port numbers that are allocated/assigned from https://osmocom.org/projects/cellular-infrastructure/wiki/Port_Numbers Change-Id: I638ac0534517931d0987ce9f72f5db4f5b6c16b7
2017-07-21sock_src_init(): Don't freeaddrinfo() undefined src_resultHarald Welte1-1/+2
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
2017-01-17client: Allow to bind to a specific source_ipHolger Hans Peter Freyther2-1/+155
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
2016-11-09client: Tolerate an invalid pcap_handleHolger Hans Peter Freyther1-0/+6
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
2016-11-09client: disconnect before connecting the connectionHolger Hans Peter Freyther1-0/+2
With the VTY a user can write connect, connect, connect and this would lead to leaking fds. Always close the connection. Change-Id: Iab94dc2fd28496bf5fd8ceb5611f9e6505ccae1b
2016-11-09client: Allow to stop and remove a connectionHolger Hans Peter Freyther3-8/+64
Change-Id: I2118723345caf6a68f03de74a4182506e7bf105c
2016-11-09client: Do not connect default connection if no ip/port presentHolger Hans Peter Freyther1-1/+2
Ignore the default connection if no srv_port and has been specified. Change-Id: I6a3a9a0af73a9183a6b233937af3357d15a07f25
2016-11-09client: Allow to configure and connect multiple serversHolger Hans Peter Freyther5-71/+230
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
2016-11-09client: Enable a non-blocking connect to the PCAP serverHolger Hans Peter Freyther1-18/+38
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
2016-11-09client: Prepare to work with a list of serversHolger Hans Peter Freyther2-0/+7
There is no VTY code yet and no servers in the list but it looks good client this. Change-Id: Ic35748f1a95a880a9fa49dd18361592d8ac941ba
2016-11-09client: Finish renaming client to conn in other places of the codeHolger Hans Peter Freyther2-29/+29
Change-Id: I3c7c499c921b03752cbbcdda3eac8ca360323a22
2016-11-09client: Prepare to have multiple server connectionsHolger Hans Peter Freyther5-101/+103
Take out various fields into a new connection class. We will have the option to connect to multiple servers. Change-Id: I820176d133fbdb0240a16eb4e1a6d505e5c080c6
2016-09-08server: Add vty interface for the TLS configurationHolger Hans Peter Freyther4-15/+369
Make the priority configurable, load DH params, allow to specify certificates or anonymous operations. Change-Id: I8ec3c0f8e1ee2089e1b7dacd9de842260930032f
2016-09-08server: Allow to enable tls for the pcap serverHolger Hans Peter Freyther1-10/+42
Add simple vty command to enable tls per client or not. We still need a lot more tls commands for the server. Change-Id: I583b7d5c999ed01c135882895fb2a8f04739ad00
2016-09-08server: Introduce tls mode for the serverHolger Hans Peter Freyther4-7/+190
Using tls priority of NORMAL:+ANON-ECDH:+ANON-DH already allows a client to connect to a server and protect the data using tls. Generate the dh params on load (and do that for the client right now as well) but that will go away soon. Change-Id: Ifa2ad24c0a631573c259a3bf94b91a946ad9ec9d
2016-09-08server: Re-factor the read dispatch and connection closeHolger Hans Peter Freyther1-28/+39
In preparation of TLS let's not call close_connection from within the dispatch but return an error and then close the connection from the outside. Change-Id: I607fed0191907cfbc8887d749c88f7f4ffb87166
2016-09-08server: Add API function to close a connectionHolger Hans Peter Freyther1-0/+5
Change-Id: I4295854c749d86ca8c34a979c877363d9f48e176
2016-09-08server: Move to a write_queue for the conn socketHolger Hans Peter Freyther1-12/+14
We are only reading from the socket and never write but the osmo_tls code is integrated with it. We will never write and the queue size is set to 0. Simplify the read_cb. Change-Id: I32335b1f7b7ed06b92c6222516c185301ce13781
2016-09-08server: Update copyright after zmq changesHolger Hans Peter Freyther1-1/+1
Change-Id: I8861acaaec5465de620637b7fdf3341517133c4f
2016-09-08client: Initial support for TLS in the clientHolger Hans Peter Freyther6-6/+592
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
2016-09-08client: Add API function to close and re-connect network connectionHolger Hans Peter Freyther1-0/+5
Change-Id: Ib4e17948ffa84e73c1c81734e6002a73251d744b
2016-08-19client: Use pcap_stats and export them as statisticsHolger Hans Peter Freyther2-0/+58
Attempt to write code that detects the wrap and is doing the right thing when it happens. Change-Id: I501ebc49d3e86b0605ec1fbe2f62aee3f362aa36
2016-08-19server: Add global and per client counters and begin to countHolger Hans Peter Freyther2-2/+95
Add the basics for getting a picture what a client and the server is doing. We need to create unique descriptions as the code is working with names and not numbers for clients. Change-Id: I4a9be5bdd815d280cccf0199efc2ca79fc77d393
2016-08-19client: Additional counters for the statisticsHolger Hans Peter Freyther3-2/+8
Add more counters and start counting them when reading from the PCAP library and when trying to write to the socket. Change-Id: I52d3064a265b402ac849d8578a14f718156c0805
2016-08-18client: First round of statistics in the pcap clientHolger Hans Peter Freyther2-1/+32
Count certain events that can help to understand what is going on. This includes OOM, failure to queues. Change-Id: I4a2dad32afb577822c7181d2813ea5a7e693c704
2016-08-18server: Fail if the telnet interface can not be boundHolger Hans Peter Freyther1-2/+6
Change-Id: Ibd14da3e7f62065f5d28d4a90d2b55eed609b64f
2016-08-18client: Fail to start if it can't bind the telnet interfaceHolger Hans Peter Freyther1-2/+6
Change-Id: Ic628dd348f8fce978691aaa331b0e67ee13f10c6
2016-08-13stats: Initialize the stats(d) backend in the client/serverHolger Hans Peter Freyther2-0/+8
Initialize the stats backend allowing key performance indicators to be pushed out of the system. Change-Id: Id652b60d230f705b927e49d81cd3731432156c7e
2016-08-13misc: Address compiler warning about deprecated headerHolger Hans Peter Freyther1-1/+0
In file included from osmo_client_main.c:27:0: /home/ich/install/openbsc/include/osmocom/core/process.h:1:2: warning: #warning "Update from osmocom/core/process.h to osmocom/core/application.h" [-Wcpp] #warning "Update from osmocom/core/process.h to osmocom/core/application.h" Change-Id: Id60cf90ebb7255d79f8e3bdb81f099f1362d538b
2016-08-13vty: Fix compiler warning about type changesHolger Hans Peter Freyther1-1/+1
osmo_client_main.c:57:2: warning: initialization from incompatible pointer type .go_parent_cb = osmopcap_go_parent, ^ osmo_client_main.c:57:2: warning: (near initialization for ‘vty_info.go_parent_cb’) CCLD osmo_pcap_client CC osmo_server_main.o osmo_server_main.c:56:2: warning: initialization from incompatible pointer type .go_parent_cb = osmopcap_go_parent, ^ osmo_server_main.c:56:2: warning: (near initialization for ‘vty_info.go_parent_cb’) Change-Id: If73c85a64789ef4bff63dcfe008e918e650b428f
2016-08-05server: Add zmq based event and data interface to the serverHolger Hans Peter Freyther2-20/+101
To allow easily extracting or streaming the data to an external analysis system, zeromq can be configured (and reconfigured). The system works as fire and forget and no loss detection is present. A simple go based client application is provided to subscribe to the publisher. Change-Id: I4f3e6d675023a81b7d2ee19bf1f44a2be0ca003c
2016-08-04server: Add zmq interface for publishing eventsHolger Hans Peter Freyther2-1/+93
Change-Id: I383558bb9aad3cb149f35e13910a1d6aa79afc84
2016-08-04server: Add a config knob to not store the pcap streamHolger Hans Peter Freyther2-6/+31
We might only want to centralize the data streams but handle the data differently. This will be combined with an upcoming ZeroMQ publisher feature to broadcast all events out. Change-Id: I12c6bf16310820d882fa28c6930931650475e0bb
2016-05-03freebsd: Another fix for the next fileHolger Hans Peter Freyther1-0/+1
Change-Id: I509e44c48d7983b305bc5fbcd9360ead74ef8d68
2016-05-03freebsd: Include netinet/in.h and hopefully fix the buildHolger Hans Peter Freyther1-0/+1
Fixes: /usr/include/netinet/ip.h:69:17: error: field has incomplete type 'struct in_addr' struct in_addr ip_src,ip_dst; /* source and dest address */ Change-Id: I446f67b85122363de66c86ddb25c8392ffa61a4f
2015-12-03client: Deal with external representation for pcap filesHolger Hans Peter Freyther1-3/+6
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?
2015-12-03client: Allow receiving jumbo frames on the client as wellHolger Hans Peter Freyther2-3/+10
Check the caplen and see if it is bigger than our assumed maximum. Make sure we have enough space for data+hdr+hdr.
2015-12-03server: Deal with jumbo frames on the wireHolger Hans Peter Freyther1-1/+1
The 2000 as a number is too small. Modern networks can have a higher MTU (up to 9000). Take this number and assume there is a big header in front of it.
2015-12-03server: Fix the language and refer to the received data lengthHolger Hans Peter Freyther1-1/+1
2015-11-19gprs: Do not collect BVC FLOW CONTROL / ACK messagesHolger Hans Peter Freyther1-0/+5
These generate a high amount of traffic. They are good to debug ip.access nanoBTS GPRS crashes/service outage but in general cause too much traffic.
2015-09-10gprs: Remove left over for counting llc frames0. Hans Peter Freyther1-3/+0
These variables were used to verify how many LLC frames were seen.
2015-09-10gprs: Add a custom GPRS filterHolger Hans Peter Freyther3-1/+143
Allow to inspect UDP messages and check for GPRS, NS, BSSGP and then filter LLC frames. Parsing the vL datastructure with the libpcap syntax is a pain. It could be done using BPF but we do not want to use bpf asm to specify the entire ruleset. I looked into using libepan/libwireshark but this has memory issues and is painful too. So let's parse UDP, NS, BSSGP using the info we already have. I tried a bit of editcap to generate a bit of broken data. The length check might still be bad. I used my crash_20100602.pcap file to count the LLC frames we detect and compare that to wireshark it ended with the right number. pcap add-filter gprs can be used to enable the new filtering option after the OS has received the packet. Fixes: ONW#1314
2014-12-22build: Replace deprecated INCLUDES with AM_CPPFLAGSSylvain Munaut1-1/+1
Thanks to mnhauke Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2012-11-06build: Properly link and package the example configurations0.0.3Holger Hans Peter Freyther1-2/+2
2011-07-19smatch: Check the client->device variableHolger Hans Peter Freyther1-1/+1
This is fixing: src/osmo_client_core.c +105 osmo_client_capture(8) warn: variable dereferenced before check 'client'
2011-07-19misc: Remove process.h include, osmo_daemonize is in application.h nowHolger Hans Peter Freyther1-1/+0