aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src
AgeCommit message (Collapse)AuthorFilesLines
2015-12-07gtphub: log: add TEI reuse msg, fix another TEI msg.Neels Hofmeyr1-2/+5
Sponsored-by: On-Waves ehi
2015-12-07gtphub: log: add side str to msg for reused TEINeels Hofmeyr1-1/+2
Sponsored-by: On-Waves ehi
2015-12-07gtphub: add more detailed I/O rate counters.Neels Hofmeyr2-16/+80
Count bytes and packets per peer port, as well es per tunnel enpoint, which adds two more levels of detail. Sponsored-by: On-Waves ehi
2015-12-07gtphub: be strict about unknown cmdline argsNeels Hofmeyr1-1/+2
Sponsored-by: On-Waves ehi
2015-12-07gtphub: tweak logging.Neels Hofmeyr2-16/+14
Less spaces in tunnel strings, adjust tests accordingly. Use side_idx to remove code dup in rate counter output. Sponsored-by: On-Waves ehi
2015-12-07gtphub: logging: have one newline per log.Neels Hofmeyr2-18/+12
Some logging was multiline to ease human reading of debug output. However, in the VTY output, these newlines lack a CR motion. Split multiline logs into separate lines. Also add one missing space. Sponsored-by: On-Waves ehi
2015-12-07gtphub: fix missing newline in log outputNeels Hofmeyr1-1/+1
Sponsored-by: On-Waves ehi
2015-12-05gsm_data_shared: compute/sprintf the lchan name only onceHarald Welte1-1/+4
We now store the pre-printed lchan name in lchan->name to avoid having to call sprintf every time there is a debug statement somewhere, particularly as most of those debug statements are going to be inactive most of the time.
2015-12-03gtphub: tweak startup log for sgsn_use_senderNeels Hofmeyr1-0/+3
2015-12-03gtphub: implement sgsn_use_sender for NAT.Neels Hofmeyr2-2/+49
If an SGSN is behind NAT, we cannot rely on the default ports. Specifically, if a GGSN sends a message, the forwarding to the SGSN should go to whichever port the SGSN last sent from (whether sequence nr is known or not). Add sgsn_use_sender config and VTY command, and store the sender instead of the GSN Address IE and default port if set. Sponsored-by: On-Waves ehi
2015-12-03gtphub: prepare: keep tunnel ref in gtp_packet_desc.Neels Hofmeyr1-25/+38
Rather than passing a tunnel pointer as function arguments, keep it in the gtp_packet_desc struct passed around anyway. Reason: in the next commit (will add sgsn_use_sender), I need the tunnel to be passed back out to gtphub_handle_buf(), and besides simplifying existing code, this also makes passing the tunnel back out trivial. Sponsored-by: On-Waves ehi
2015-12-03gtphub: tweak an error log messageNeels Hofmeyr1-2/+4
2015-12-03gtphub: Del PDP: replace unnecessary lookup with asserts.Neels Hofmeyr1-33/+6
2015-12-03gtphub: check TEI presence in Create PDP Ctx ResponseNeels Hofmeyr1-0/+10
Sponsored-by: On-Waves ehi
2015-12-03gtphub: improve logging for invalid packetNeels Hofmeyr1-4/+7
Sponsored-by: On-Waves ehi
2015-12-03gtphub: cosmeticNeels Hofmeyr1-9/+4
During the peer review session with Holger, these things were deemed fixable. No need to have a static gtp_packet_desc in gtphub_handle_buf. No need to memcpy, direct assignment does the job. Remove obsolete comments. Fix a stray space. Sponsored-by: On-Waves ehi
2015-12-03gtphub: fix restart cleanup peer matching.Neels Hofmeyr1-1/+5
Adjust test expectations accordingly. Sponsored-by: On-Waves ehi
2015-12-03gtphub: wrap gtphub_write() for test suite.Neels Hofmeyr3-26/+60
Sponsored-by: On-Waves ehi
2015-12-03gtphub: fix use after free.Neels Hofmeyr1-27/+37
A tunnel pointer was still being checked after deleting by a call to expiring_item_del(). 'continue' to the next tun. Sponsored-by: On-Waves ehi
2015-12-03gtphub: Add a debug logNeels Hofmeyr1-0/+6
Sponsored-by: On-Waves ehi
2015-12-03gtphub: fix: add a missing NULL checkNeels Hofmeyr1-0/+2
Sponsored-by: On-Waves ehi
2015-12-03gtphub: cosmetic: early continue for less indentNeels Hofmeyr1-21/+22
Sponsored-by: On-Waves ehi
2015-12-03gtphub: monitor GSNs' restart counters.Neels Hofmeyr1-18/+118
If a GSN indicates that it has reset, tear down each known tunnel for that GSN individually (don't send the GSNs on the other side a different restart counter, because they represent more than just this GSN). Sponsored-by: On-Waves ehi
2015-12-03gtphub: cosmeticNeels Hofmeyr1-50/+50
Move the SGSN read callback next to the GGSN read callback. Comments. Tweak an initialization to NULL. Sponsored-by: On-Waves ehi
2015-12-03gtphub: handle Delete PDP Context.Neels Hofmeyr1-15/+154
During resolution of the header TEI, also return the tunnel struct that resolved the TEI, so the Delete PDP Ctx code does not need to look it up again. Upon Delete PDP Ctx Request, remember the IEs and that a request was made. Upon Delete PDP Ctx Response, find the pending delete and remove the corresponding tunnel, iff the response indicates success. Add a context deletion to regression tests, rename the test appropriately. Sponsored-by: On-Waves ehi
2015-12-03gtphub: remove obsolete todo commentNeels Hofmeyr1-2/+0
Sponsored-by: On-Waves ehi
2015-12-03gtphub: fix segfault when empty config.Neels Hofmeyr1-2/+12
gsn_addr_from_str(): return error upon NULL string. Add some debug logging. With an empty config, no bind addresses were set, and the address parser did not check for a NULL pointer, resulting in a segfault. Sponsored-by: On-Waves ehi
2015-12-03gtphub: be more fatal about not finding an unused TEI.Neels Hofmeyr1-2/+10
Sponsored-by: On-Waves ehi
2015-12-03gtphub: fix some style complaints from cppcheckNeels Hofmeyr2-12/+5
Sponsored-by: On-Waves ehi
2015-12-03gtphub: add two stubs for Delete PDP msgsNeels Hofmeyr1-0/+29
Sponsored-by: On-Waves ehi
2015-12-03gtphub: vty: add missing SGSN-proxy output.Neels Hofmeyr1-0/+6
Sponsored-by: On-Waves ehi
2015-12-03gtphub: refactor: use side_idx everywhere.Neels Hofmeyr3-349/+238
This is a mostly cosmetic change. Instead of separate buffer handling functions, reduce some code duplication by using a side_idx just like the plane_idx, with arrays. Sponsored-by: On-Waves ehi
2015-12-03gtphub: make sure mapped TEIs aren't occupied (incomplete).Neels Hofmeyr1-33/+88
This could be done way better, discussion is pending/ongoing. It is indeed quite unlikely that any user will ever hit this situation, so there is no strong drive to invest effort in a more comprehensive implementation. Sponsored-by: On-Waves ehi
2015-12-03gtphub: use a single TEI pool across planes.Neels Hofmeyr1-3/+3
There's no need to keep two separate number pools when both can be fed from the same pool. User and Ctrl plane TEIs can technically overlap without colliding, but it doesn't hurt if they don't overlap, either. Sponsored-by: On-Waves ehi
2015-12-03gtphub: cosmetic: for_each_side,_plane macros.Neels Hofmeyr2-24/+20
Simplify looping over sides and planes. I'm tired of typing the same for loops all the time. Sponsored-by: On-Waves ehi
2015-12-03gtphub: implement restart counter properly.Neels Hofmeyr2-9/+93
Force passing a restart counter, by adding such arg to gtphub_start() (test suite is not affected by this). In gtphub_main.c, add -r,--restart-file <path> and next_restart_count() to maintain the counter file. While at it, tweak the cmdline help to unify the formatting (mostly commas and a missing line break). Send gtphub's own restart counter. So far, the sender's restart counter was copied through, which would break as soon as more than one GSN would talk to the same peer with differing restart counters. Also fix the in-mem restart counter data type (one octet, not two). Sponsored-by: On-Waves ehi
2015-12-03gtphub: complain about excess cmdline args.Neels Hofmeyr1-1/+8
Sponsored-by: On-Waves ehi
2015-12-03gtphub: fix a conditional for log outputNeels Hofmeyr1-1/+1
Sponsored-by: On-Waves ehi
2015-12-03gtphub: avoid segfault for incomplete tunnels.Neels Hofmeyr1-0/+1
Sponsored-by: On-Waves ehi
2015-12-03gtphub: track tunnels explicitly.Neels Hofmeyr3-142/+367
So far, gtphub worked perfectly by only tracking single TEIs ... for probably most uses. But a Ctrl plane tunnel may have expired despite a still active corresponding User plane tunnel. The User plane would continue to work indefinitely, but if any Ctrl messages followed after more than six hours of Ctrl silence, they would have been dropped due to an expired TEI mapping. We want to - combine expiry of a user TEI with its ctrl TEI. (done in this patch) - upon delete PDP context, remove both user and ctrl TEI mappings. (future) - when a peer indicates a restart counter bump, invalidate its tunnels. (future) To facilitate these, track tunnels, complete with both SGSN's and GGSN's address, original and replaced TEIs, all for both user and ctrl plane, in a single struct. A single expiry entry handles the entire tunnel, instead of previously four separate expiries for each endpoint identifier. Add the concept of a "side", being either GGSN or SGSN, to index tunnel endpoint structs, and so on. Track the originating side in the gtp_packet_desc. Add header_tei_rx: set_tei() overwrites header_tei, but the originally received header TEI is still needed to match a Create PDP Context Response up with its Request (and for logging). Adjust the test suite to expect tunnel listing strings instead of TEI mappings, with a bonus of making it a lot easier to grok, and including the IP addresses. Add regression test for refreshing tunnel expiry upon use. Note: the current implementation is as slow as can possibly be, iterating all the tunnels all the time. Optimizations are kept for a future commit, on purpose. BTW, the sequence number mapping/unmapping structures remain unchanged. Sponsored-by: On-Waves ehi
2015-12-03gtphub: cosmetic/prepare: rename expiry queues.Neels Hofmeyr1-10/+9
The expiry queues are already used for resolved GGSN addresses, and will soon enlist tunnel structs. Hence the naming should be more general. Sponsored-by: On-Waves ehi
2015-12-03gtphub: add assertion to ensure expiry ordering.Neels Hofmeyr1-0/+8
Make 100% sure the user adds expiring_items in chronological order by asserting that a newly added expiry is >= the last expiry in the queue. Add llist_last() to facilitate. Sponsored-by: On-Waves ehi
2015-12-03gtphub: cosmetic/prepare: add nr_map_refresh().Neels Hofmeyr1-7/+11
Sponsored-by: On-Waves ehi
2015-12-03gtphub: move timestamp into packet struct.Neels Hofmeyr1-13/+14
Instead of passing the current time around in function arguments ('now'), rather store the current time once upon decoding a GTP packet in the gtp_packet_desc passed around anyway ('p->timestamp'). Sponsored-by: On-Waves ehi
2015-12-03gtphub: first vty show commands.Neels Hofmeyr3-21/+203
Start adding VTY commands to show rate counters / statistics / cache dumps. Sponsored-by: On-Waves ehi
2015-12-03gtphub: add first rate countersNeels Hofmeyr1-0/+51
Sponsored-by: On-Waves ehi
2015-12-03gtphub: cosmetic: clarify bind pointer naming.Neels Hofmeyr1-18/+26
Some gtphub_bind pointers point to an array of binds, some point directly at instances. Make the distinction between the two more obvious by adding an '_arr' suffix to the array ones. Partly in preparation for upcoming rate counters. Sponsored-by: On-Waves ehi
2015-12-03gtphub: add explicit cleanup handles.Neels Hofmeyr1-0/+57
Clean up functionality is added for the test suite only, to be able to clean out all allocations and test against memory leaks. So far, it was sufficient to expire everything to free a gtphub. In preparation for the upcoming rate counters, which will need to be freed explicitly, add gtphub functions to clean up everything. As added bonus, also close the sockets explicitly -- not really needed upon program exit, neither by the test suite, but *if* we have a cleanup function, it should clean up everything properly. Closing the sockets is however kept separate, for the test suite. gtphub_start() and gtphub_stop() are for normal use (published in gtphub.h), and gtphub_init() and gtphub_free() are for the test suite, without sockets. (gtphub_stop() will probably never be called by anyone, but its existence completes the picture.) In gtphub_test.c, have a function to clean up the testing gtphub struct. First, expire everything by timeout, assert emptiness, then call the cleanup function. Call from each test in the end. Sponsored-by: On-Waves ehi
2015-12-03gtphub: ensure cleanup of peer addresses.Neels Hofmeyr1-0/+1
Upon calling gtphub_peer_del(), all addresses and ports should already have expired (by force). Make sure the code heeds that with a so far missing assertion. Sponsored-by: On-Waves ehi
2015-12-03gtphub: ares vty and initNeels Hofmeyr3-3/+40
From sgsn_vty.c, copy the cfg_grx_ggsn_cmd to add an ares server to the static sgsn_instance. This is sort of preliminary. As described in comments, the sgsn_ares functions should actually be separated from the static sgsn structure. gtphub keeps such an sgsn structure just for the sgsn_ares functions. Sponsored-by: On-Waves ehi