Commit Graph

5444 Commits

Author SHA1 Message Date
Neels Hofmeyr bee75969cc gtphub: log most common message type names.
Sponsored-by: On-Waves ehi
2015-12-07 13:37:13 +01:00
Neels Hofmeyr ee07e4f75d gtphub: simplify/fix: one TEI mapping per tunnel.
Because the sender is known, one unique TEI per tunnel suffices to map the TEIs
that the peers are sending to gtphub, instead of previously 4 (SGSN<->GGSN
interaction on User and Ctrl plane, where each had an own unique TEI).

Also, previously, a tunnel's endpoints should also have been checked against
each other for TEI reuse, not only against the endpoints of other tunnels. This
simplification fixes that problem for free.

Thus simplify TEI reuse detection and improve VTY show readability and
debugging.

Adjust log and VTY output for tunnels.
Adjust tests accordingly.

Suggested-by: Holger Hans Peter Freyther <holger@moiji-mobile.com>
Sponsored-by: On-Waves ehi
2015-12-07 13:37:11 +01:00
Neels Hofmeyr f6e4d08219 gtphub: fix: when checking TEIs, skip 0.
Sponsored-by: On-Waves ehi
2015-12-07 13:37:10 +01:00
Neels Hofmeyr 328d2f78c1 gtphub: log: add TEI reuse msg, fix another TEI msg.
Sponsored-by: On-Waves ehi
2015-12-07 13:37:09 +01:00
Neels Hofmeyr 23d09cc904 gtphub_test: add test_parallel_context_creation()
Sponsored-by: On-Waves ehi
2015-12-07 13:37:08 +01:00
Neels Hofmeyr ee1e5d758e gtphub: log: add side str to msg for reused TEI
Sponsored-by: On-Waves ehi
2015-12-07 13:37:06 +01:00
Neels Hofmeyr e38fb66f4b gtphub: add more detailed I/O rate counters.
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-07 13:37:05 +01:00
Neels Hofmeyr 956d856b61 gtphub: be strict about unknown cmdline args
Sponsored-by: On-Waves ehi
2015-12-07 13:37:04 +01:00
Neels Hofmeyr ba0525e3d8 gtphub: tweak logging.
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-07 13:37:03 +01:00
Neels Hofmeyr 28a70f20cd gtphub: logging: have one newline per log.
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-07 13:37:01 +01:00
Neels Hofmeyr 9d8f506f7f gtphub: fix missing newline in log output
Sponsored-by: On-Waves ehi
2015-12-07 13:36:57 +01:00
Neels Hofmeyr 5d5c31a367 gtphub: enhance gtphub-example.txt 2015-12-07 11:07:22 +01:00
Neels Hofmeyr 5c7dcf9665 gtphub: add gtphub-example.txt 2015-12-07 10:58:11 +01:00
Harald Welte 3f015f04b1 bring the README into the 21st century 2015-12-05 23:13:49 +01:00
Harald Welte c14574b567 AUTHORS: Add Jacob and Neels 2015-12-05 23:04:11 +01:00
Harald Welte d8352d75b6 remove old obsolete linux kernel and wireshark patches
Those were relevant in 2008/2009, but not today...

Also, move hlrsync to the contrib directory
2015-12-05 22:59:41 +01:00
Harald Welte c696cc28d8 gsm_data_shared: compute/sprintf the lchan name only once
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-05 16:19:21 +01:00
Neels Hofmeyr e1ba781f7b gtphub: tweak startup log for sgsn_use_sender 2015-12-03 14:48:27 +01:00
Neels Hofmeyr f8c701008b gtphub: add test for SGSN behind NAT 2015-12-03 14:29:48 +01:00
Neels Hofmeyr 1ae3ebd68b gtphub_test: tweak test_user_data(): no seq routing.
Don't route User message back by sequence number, rather test that a
completely unrelated User message is routed back properly.

Sponsored-by: On-Waves ehi
2015-12-03 14:19:10 +01:00
Neels Hofmeyr ca2361c237 gtphub: implement sgsn_use_sender for NAT.
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-03 14:14:43 +01:00
Neels Hofmeyr d53c6046bc gtphub: prepare: keep tunnel ref in gtp_packet_desc.
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-03 13:59:50 +01:00
Neels Hofmeyr e5a0798c9c gtphub: tweak an error log message 2015-12-03 13:47:05 +01:00
Neels Hofmeyr 8c5b073072 gtphub: Del PDP: replace unnecessary lookup with asserts. 2015-12-03 13:45:15 +01:00
Neels Hofmeyr 8defadbdd2 tests: fix condition to run sgsn, oap, gtphub tests
Sponsored-by: On-Waves ehi
2015-12-03 11:47:34 +01:00
Neels Hofmeyr 59c1b645e2 gtphub: check TEI presence in Create PDP Ctx Response
Sponsored-by: On-Waves ehi
2015-12-03 11:47:30 +01:00
Neels Hofmeyr 87c83d0b89 gtphub: improve logging for invalid packet
Sponsored-by: On-Waves ehi
2015-12-03 11:47:25 +01:00
Neels Hofmeyr d8660ef090 gtphub: cosmetic
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-03 11:47:19 +01:00
Neels Hofmeyr c6d51f5fb4 gtphub: fix restart cleanup peer matching.
Adjust test expectations accordingly.

Sponsored-by: On-Waves ehi
2015-12-03 11:47:16 +01:00
Neels Hofmeyr 996ec1d731 gtphub: wrap gtphub_write() for test suite.
Sponsored-by: On-Waves ehi
2015-12-03 11:47:12 +01:00
Neels Hofmeyr 18d3049612 gtphub: fix use after free.
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-03 11:47:08 +01:00
Neels Hofmeyr 237fee649e gtphub: add restart counter test
Sponsored-by: On-Waves ehi
2015-12-03 11:46:57 +01:00
Neels Hofmeyr 936b890f71 gtphub: Add a debug log
Sponsored-by: On-Waves ehi
2015-12-03 11:46:29 +01:00
Neels Hofmeyr be4bebaad0 gtphub: add test for reused TEI.
Sponsored-by: On-Waves ehi
2015-12-03 11:46:25 +01:00
Neels Hofmeyr 4573ca8834 gtphub: fix: add a missing NULL check
Sponsored-by: On-Waves ehi
2015-12-03 11:46:19 +01:00
Neels Hofmeyr 52c0bd3025 gtphub: cosmetic: early continue for less indent
Sponsored-by: On-Waves ehi
2015-12-03 11:44:39 +01:00
Neels Hofmeyr bc44330671 gtphub: monitor GSNs' restart counters.
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-03 11:44:37 +01:00
Neels Hofmeyr 3fdba2ed5a gtphub: cosmetic
Move the SGSN read callback next to the GGSN read callback.

Comments.

Tweak an initialization to NULL.

Sponsored-by: On-Waves ehi
2015-12-03 11:44:28 +01:00
Neels Hofmeyr 7559910e8c gtphub_test: add test for Del PDP from GGSN side.
Sponsored-by: On-Waves ehi
2015-12-03 11:44:25 +01:00
Neels Hofmeyr 99a50b3529 gtphub_test: add some cleanup asserts.
Sponsored-by: On-Waves ehi
2015-12-03 11:44:21 +01:00
Neels Hofmeyr 10fc024472 gtphub: handle Delete PDP Context.
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-03 11:44:19 +01:00
Neels Hofmeyr 2f67125c32 gtphub: remove obsolete todo comment
Sponsored-by: On-Waves ehi
2015-12-03 11:44:13 +01:00
Neels Hofmeyr 800126b1f3 gtphub: fix segfault when empty config.
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-03 11:44:08 +01:00
Neels Hofmeyr cd865d62f0 gtphub: be more fatal about not finding an unused TEI.
Sponsored-by: On-Waves ehi
2015-12-03 11:44:03 +01:00
Neels Hofmeyr 085500807c gtphub: fix some style complaints from cppcheck
Sponsored-by: On-Waves ehi
2015-12-03 11:43:57 +01:00
Neels Hofmeyr ff4b630de9 gtphub: add two stubs for Delete PDP msgs
Sponsored-by: On-Waves ehi
2015-12-03 11:43:49 +01:00
Neels Hofmeyr 817bc32696 gtphub: vty: add missing SGSN-proxy output.
Sponsored-by: On-Waves ehi
2015-12-03 11:43:40 +01:00
Neels Hofmeyr a9905a51f9 gtphub: refactor: use side_idx everywhere.
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-03 11:43:25 +01:00
Neels Hofmeyr 7174b169e0 gtphub: make sure mapped TEIs aren't occupied (incomplete).
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-03 11:40:24 +01:00
Neels Hofmeyr d121ea6124 gtphub: use a single TEI pool across planes.
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-03 11:40:22 +01:00