Commit Graph

5320 Commits

Author SHA1 Message Date
Holger Hans Peter Freyther e9f420d487 msc: Remove oversimplified todo entry and add a comment
Add a comment of why we want to accept this connection anyway.
2016-02-10 10:42:20 +01:00
Holger Hans Peter Freyther 8239e063b9 gsm0408: Provide unique strings for the gsm 04.08 message
At Rhizomatica we see that some GSM 04.08 messages are leaked and
have no other indication if that is Call Control, SMS or something
else.
2016-01-30 09:57:49 +01:00
Neels Hofmeyr 1da0a7e229 openbsc/README: some fixes, add CSCN and Iu*
OsmoNITB stated to include BTS, should be BSC. Reword some outdated
statements. Add OsmoCSCN and mention IuCS and IuPS interfaces.
2016-01-28 13:36:07 +01:00
Neels Hofmeyr 6d575cbe57 Add README.vty-tests 2016-01-28 13:36:07 +01:00
Neels Hofmeyr 34cf923704 remove src/libgb/Makefile.am
libgb has been obsolete for years, but the Makefile.am is still there.
src/Makefile.am does not list it as a subdir, so it's just dangling legacy.
2016-01-28 11:51:21 +01:00
Neels Hofmeyr 9c4f1d6fd0 fix bsc_vty out: timeslot indented too deeply.
In 'show running-config', timeslot appears as a sub-element of rsl, but it is a
direct child of trx. Fix the timeslot section in vty_out by removing one space
of idention.

Adjust various config examples.

Rationale: it's not relevant for function, but confuses human operators. Fixing
it will save the next hacker some time.
2016-01-28 11:45:51 +01:00
Alexander Huemer 1bf8617610 gprs: use libgtp cflags 2016-01-26 11:05:14 +01:00
Holger Hans Peter Freyther de76661cf3 gtphub: Fix use after free on failure
Even if fclose fails the stream is inaccessible and the second fclose
might cause memory violation.

Linux manpage says:
Upon  successful  completion 0 is returned.  Otherwise, EOF is returned
and errno is set to indicate the error.  In either case any further
access (including another call to fclose()) to the stream results in
undefined behavior.

Fixes: CID#57958
2016-01-23 10:28:09 +01:00
Holger Hans Peter Freyther f9f44901a2 db: Avoid undefined behavior when copying cm2/cm3 from the db
memcpy has both the source and destination marked as non-null and
we were still passing NULL (with a zero size) to it. While this
makes sense it violates the constraints of the function. Add the
check to see if these values are NULL or not.

+db.c:583:2: runtime error: null pointer passed as argument 2, which is declared to never be null
+    #0 0x40d7f7 in get_equipment_by_subscr (/home/builder/jenkins/workspace/Osmocom_Sanitizer/source/openbsc/openbsc/tests/db/db_test+0x40d7f7)
+    #1 0x40f6d2 in db_get_subscriber (/home/builder/jenkins/workspace/Osmocom_Sanitizer/source/openbsc/openbsc/tests/db/db_test+0x40f6d2)
+    #2 0x40bfaa in sms_from_result_v3 (/home/builder/jenkins/workspace/Osmocom_Sanitizer/source/openbsc/openbsc/tests/db/db_test+0x40bfaa)
+    #3 0x40c847 in update_db_revision_3 (/home/builder/jenkins/workspace/Osmocom_Sanitizer/source/openbsc/openbsc/tests/db/db_test+0x40c847)
+    #4 0x40cbc3 in check_db_revision (/home/builder/jenkins/workspace/Osmocom_Sanitizer/source/openbsc/openbsc/tests/db/db_test+0x40cbc3)
+    #5 0x40cf85 in db_prepare (/home/builder/jenkins/workspace/Osmocom_Sanitizer/source/openbsc/openbsc/tests/db/db_test+0x40cf85)
+    #6 0x406f18 in main /home/builder/jenkins/workspace/Osmocom_Sanitizer/source/openbsc/openbsc/tests/db/db_test.c:179
+    #7 0x7fd625638a3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x20a3f)
+    #8 0x405598 in _start (/home/builder/jenkins/workspace/Osmocom_Sanitizer/source/openbsc/openbsc/tests/db/db_test+0x405598)
+
+db.c:590:2: runtime error: null pointer passed as argument 2, which is declared to never be null
+    #0 0x40da23 in get_equipment_by_subscr (/home/builder/jenkins/workspace/Osmocom_Sanitizer/source/openbsc/openbsc/tests/db/db_test+0x40da23)
+    #1 0x40f6d2 in db_get_subscriber (/home/builder/jenkins/workspace/Osmocom_Sanitizer/source/openbsc/openbsc/tests/db/db_test+0x40f6d2)
+    #2 0x40bfaa in sms_from_result_v3 (/home/builder/jenkins/workspace/Osmocom_Sanitizer/source/openbsc/openbsc/tests/db/db_test+0x40bfaa)
+    #3 0x40c847 in update_db_revision_3 (/home/builder/jenkins/workspace/Osmocom_Sanitizer/source/openbsc/openbsc/tests/db/db_test+0x40c847)
+    #4 0x40cbc3 in check_db_revision (/home/builder/jenkins/workspace/Osmocom_Sanitizer/source/openbsc/openbsc/tests/db/db_test+0x40cbc3)
+    #5 0x40cf85 in db_prepare (/home/builder/jenkins/workspace/Osmocom_Sanitizer/source/openbsc/openbsc/tests/db/db_test+0x40cf85)
+    #6 0x406f18 in main /home/builder/jenkins/workspace/Osmocom_Sanitizer/source/openbsc/openbsc/tests/db/db_test.c:179
+    #7 0x7fd625638a3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x20a3f)
+    #8 0x405598 in _start (/home/builder/jenkins/workspace/Osmocom_Sanitizer/source/openbsc/openbsc/tests/db/db_test+0x405598)
2016-01-23 09:21:04 +01:00
Holger Hans Peter Freyther fec29ab4e9 gtphub: Make the two setter static as well
Same as with the previous gtphub commit. Make these static to deal
with the new semantic of inline in gcc5.
2016-01-22 23:36:22 +01:00
Holger Hans Peter Freyther 7ba088bdf0 dahdi: The driver has moved to libosmo-abis
We can remove this check from openbsc as the handling is done
in libosmo-abis.
2016-01-22 23:35:21 +01:00
Holger Hans Peter Freyther 91e0e1b038 gtphub: Fix compilation using gcc5
The semantic of inline has changed and we need to make it static
to not end up with undefined references.
2016-01-22 23:32:36 +01:00
Alexander Huemer 22a7142129 tests/abis: fix format specifiers 2016-01-15 15:41:19 +01:00
Alexander Huemer 6cacc56d8e tests/oap: depend on libgtp
exclude logic copied from src/gprs/Makefile.am
2016-01-15 15:06:03 +01:00
Holger Hans Peter Freyther 5cb480a4c0 bsc/vty: Provide a hint of available input 2016-01-15 15:05:42 +01:00
Neels Hofmeyr cdc548cb0a gtphub VTY: add newlines to some VTY docs' final lines 2015-12-14 16:11:47 +01:00
Neels Hofmeyr 69a720f3be gtphub VTY: fix doc strings for show cmds 2015-12-14 15:52:01 +01:00
Holger Hans Peter Freyther da5359f1b6 gtphub: Fix the VTY prompt to make the tests move forward 2015-12-14 15:24:50 +01:00
Neels Hofmeyr 720372e4e8 gtphub VTY test: use only 127.0.0.1.
Add a second example config file for gtphub so that the VTY test can use
nonstandard ports.
2015-12-14 11:29:55 +01:00
Neels Hofmeyr 4adca4e8af osmoappdesc.py: fix wrong index introduced by gtphub.
vty_app should reference osmo-nitb, but by adding gtphub, apps[-1] has
changed. Use index 5, which won't change when adding further items.
2015-12-13 15:22:01 +01:00
Harald Welte 0a8cf32a48 indicate the GSM 04.08 channel mode in 'show lchan' 2015-12-12 21:43:16 +01:00
Harald Welte 53d51f501c mncc: introduce 'struct gsm_mncc_bridge' for MNCC_BRIDGE
When a MNCC handler wants to issue the MNCC_BRIDGE primitive
overt the MNCC interface, this was not possible so far via the
MNCC socket.   This primitive was so far only available from the
internal MNCC handler, more or less by accident I suppose.  The reason
for this is in the way the array of two call references had been passed
into mncc_tx_to_cc().
2015-12-12 21:43:16 +01:00
Harald Welte da8a19fec0 mncc.c: Convert mncc_names[] to 'struct value_string' 2015-12-12 21:43:16 +01:00
Neels Hofmeyr 36948bf7c7 gtphub: log: limit length of hex dumps.
The debug log prints the received/sent bytes in hex. When this data surpasses
the buffer size available for the log string (4096), the log is truncated
and lacks a newline character. Limit the amount of dumped bytes to 1000.

Sponsored-by: On-Waves ehi
2015-12-08 12:21:15 +01:00
Neels Hofmeyr 4d2b3ff6a2 gtphub: add VTY show for peers and peer stats.
Sponsored-by: On-Waves ehi
2015-12-07 13:37:28 +01:00
Neels Hofmeyr d010c49407 gtphub: improve handling of restarted peer.
Handle peer restart earlier, so that all the tunnels are deleted by the restart
code path, instead of the first one being deleted due to reused TEI. That
caused confusing logging messages.

Also, when receiving Delete confirmations from the peer that didn't restart,
don't complain about unknown peer, but acknowledge and remove the half
invalidated tunnel. This means that the pending delete entry from the restart
code path is not needed / not used, so don't bother to add pending delete
entries upon peer restart.

The test test_peer_restarted_reusing_tei() hits the situation where a tunnel is
removed because of a reused TEI rather than the restart counter. Adjust the
test to expect the "out-of-band" delete request earlier on, and to still see
the half invalidated tunnel around. Enhance the test by adding the delete
response from the peer that didn't restart, and add a final tunnels_are()
verification.

Sponsored-by: On-Waves ehi
2015-12-07 13:37:15 +01:00
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