Commit Graph

6176 Commits

Author SHA1 Message Date
Alexander Huemer f6d6a574e2 Add missing CFLAGS
Change-Id: I67b5d797a80b55e01dcdbb8c782748b049cf9199
2017-12-05 19:16:32 +00:00
Philipp Maier c4e7bd3749 mncc: remove deprecated commandline option.
The commandline option -m has already been deprecated before the
split. Use the split as an opportunity to get rid of this option.

Change-Id: Ie23d492a839aae85470e39b0d0ad8f57b0d38f7e
2017-12-05 19:15:21 +00:00
Philipp Maier fe6acd6189 mncc: re-add lchan members to structs
The lchan related struct members do not serve any useful purpose
in the msc code, since the lchan concept is not in the scope of
osmo-msc. However, if removed te struct size will change which
will lead into shortened protocol messages as well. This is
is detected by osmo-sip-connector and eventually leads into
a reject ofthe shortended protocol messages.

Re add the missing struct members in order to maintain
compatibility

This commit reverts the changes made to mncc.h by commit:
e2f24d53e4

Change-Id: Ia02373a36df7605507ee3de49173a9fd6547b726
2017-12-05 18:42:48 +00:00
Max 60383a1f7f Remove unneeded .py scripts
The ipa.py has been moved to osmo-python-tests as osmo_ipa - use it for
vty and ctrl tests instead of local copy. The soap.py and twisted_ipa.py
are not MSC-specific: leftovers from repository split which are now
available in osmo-python-tests as well.

Change-Id: Ia3ab77846c9beae7eca32a81079a4a9bfa4dcc75
2017-12-03 21:14:10 +00:00
Philipp Maier b8acdcdf2e cosmetic: remove duplicate logging
The log output of the reset FSM duplicates lots of the built in
FSM log output.

Remove duplicate logging, use more expressive log messages where
needed.

Change-Id: Ie031d947a5b8097bd656c0271081af215605ba02
2017-12-01 12:01:59 +00:00
Max 5f1de85fab Remove obsolete ./configure option
The '--enable-vty-tests' is just alias to '--enable-external-tests'
anyway.

Change-Id: I8ab3ac3d9becee6b4e989b4e71d34598ea012f47
2017-11-29 14:24:54 +00:00
Max abb24a2725 Add basic CTRL test
All the CTRL tests were skipped automatically because they were
inherited from before repo split time. This means that MSC CTRL
interface was not tested at all. Add trivial test which uses generic
rate counter introspection so we at least check that MSC's CTRL
interface is not completely broken.

Change-Id: I784feece666b00752a81f2c126e6f255505445be
2017-11-29 15:11:59 +01:00
Neels Hofmeyr 82be67de2b fix use after free: missing conn_get on CC paging response
Adjust test expectations accordingly.

The error was:

  ==16084==ERROR: AddressSanitizer: heap-use-after-free on address 0x61500000f5f4 at pc 0x561be639ac2b bp 0x7ffc0aabbe40 sp 0x7ffc0aabbe38
  READ of size 4 at 0x61500000f5f4 thread T0
      #0 0x561be639ac2a in _msc_subscr_conn_put ../../../../src/osmo-msc/src/libmsc/osmo_msc.c:384
      #1 0x561be636070b in rx_from_ms ../../../../src/osmo-msc/tests/msc_vlr/msc_vlr_tests.c:204
      #2 0x561be6360b21 in ms_sends_msg ../../../../src/osmo-msc/tests/msc_vlr/msc_vlr_tests.c:217
      #3 0x561be635b40a in test_call_mt ../../../../src/osmo-msc/tests/msc_vlr/msc_vlr_test_call.c:328
      #4 0x561be6363bb7 in run_tests ../../../../src/osmo-msc/tests/msc_vlr/msc_vlr_tests.c:802
      #5 0x561be63524ea in main ../../../../src/osmo-msc/tests/msc_vlr/msc_vlr_tests.c:849
      #6 0x7f6eebb3e2b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)
      #7 0x561be6352fb9 in _start (/n/s/osmo/make-3G/osmo-msc/tests/msc_vlr/msc_vlr_test_call+0xdafb9)

Related: OS#2672
Change-Id: If0659a878deb383ed0300217e2c41c8c79b2b6a5
2017-11-27 15:40:01 +01:00
Neels Hofmeyr a99b42709a add msc_vlr_test_call to reproduce a sanitizer error
On MT call, there is a bug in CC conn use which leads to an early free and
use-after-free.

Add msc_vlr_test_call to show both MO and MT call legs separately and reproduce
the failure. It is visible in a sanitizer build (on debian 9).

A subsequent patch will fix the bug: If0659a878deb383ed0300217e2c41c8c79b2b6a5

Related: OS#2672
Change-Id: I6c3ca0c660388b1e2c82df17ec540c846201b0c7
2017-11-27 15:40:01 +01:00
Neels Hofmeyr 785fadc0d9 cosmetic: log error when using a conn that's in release
If a conn is attempted to be used when in release, log an error, but don't skip
tracking.

No current code path apparently hits this, according to msc_vlr_tests. Just
making sure that we will prominently see such errors when we introduce any.

Change-Id: I8dd20ee56ce5ad7a90fcd03a06604c383e5eed54
2017-11-27 15:40:01 +01:00
Neels Hofmeyr 6166f29412 subscr_conn: introduce usage tokens for ref error tracking
When hunting a conn use count bug, it was very hard to figure out who's (not)
using the conn. To ease tracking down this bug and future bugs, explicitly name
what a conn is being reserved for, and track in a bit mask.

Show in the DREF logs what uses and un-uses a conn. See the test expectation
updates, which nicely show how that clarifies the state of the conn in the
logs.

On errors, log them, but don't fail hard: if one conn use/un-use fails, we
don't want to crash the entire MSC before we have to.

Change-Id: I259aa0eec41efebb4c8221275219433eafaa549b
2017-11-27 15:40:01 +01:00
Philipp Maier 2f108b09a9 cosmetic: add missing spaces
call to msc_call_connect() lacks spaces in parameter list

Change-Id: I4c11abaeff62749cbc365dfef671c4e15a85fc95
2017-11-27 09:58:43 +00:00
Neels Hofmeyr c875f84b1e use only 0.23.1 as point code for both A and Iu
We usually have both A and IuCS on 0.23.1, using differing SSNs.

0.23.2 was used only if there was a separate cs7 instance for Iu, which is not
practical, and even if used does not conflict with 0.23.1 (since it would be on
a different STP).

Just use 0.23.1 for all SCCP clients.

This needs adjustment of
https://osmocom.org/projects/cellular-infrastructure/wiki/Point_Codes

Change-Id: I3d5466eff5680cb5aa95a76a9e179fdf88ce8aa0
2017-11-24 14:05:31 +00:00
Max d11d5f1b6d Use osmo-ggsn instead of openggsn in jenkins tests
Change-Id: Ib70360feb82fb9f871461f94982634c11d58f772
2017-11-23 16:48:24 +01:00
Neels Hofmeyr 8a656eb3a5 msc_vlr_tests: set a valid lac for fake conns
Change-Id: Ie647d93a54aefad5bde8a9411d983cd60714b83d
2017-11-22 14:40:37 +01:00
Neels Hofmeyr 9c848b5d82 msc_vlr_tests: fix test nr arg: clear errno before strtol()
Change-Id: I8e9376f20a44f6348bcb85f0ff27a429dc90e1b8
2017-11-22 02:57:08 +01:00
Neels Hofmeyr 7bbac1651c cosmetic: debug log: mncc: detached subscr: show subscriber
Change-Id: I477984d5e3bee8aea32419482d6bc48b1e74e6c2
2017-11-22 02:57:07 +01:00
Neels Hofmeyr d1ec1113ac cosmetic: log: CC trans_alloc: log trans_id and subscr, not memory addrs
Change-Id: I5f8b45d6580d42b00de847c8100023b414771939
2017-11-22 02:57:07 +01:00
Neels Hofmeyr fef670b76d cosmetic: log: CC state transition: log trans id and subscr
Change-Id: I11c5213b90de27dc2606f73c686f263008b6522f
2017-11-22 02:57:07 +01:00
Neels Hofmeyr 0442ea22b8 sms_queue_test: sanitize: clean up talloc contexts when done
To avoid sanitizer build failures, ensure that the talloc contexts are empty
when done and free them.

Separate the msgb context from the overall talloc context for clarity: if
nested, the outer one would contain two blocks.

Change the "sms_queue_test" context from 1 byte to 0 in order to get a size of
zero in the end.

Change-Id: If08ba48ab9c28bf3c2db4014837c1304cec04aaf
2017-11-22 02:57:07 +01:00
Alexander Couzens 5900c84bd3 libmsc/vty: don't access old bsc rate counters
The BSC rate counters are a leftover from the nitb split.
Accessing them would result into a null-pointer exception,
because the struct isn't initialized.

Change-Id: I8c72ab8bf781d3f9a436eb1a27ac4d13df5e656b
2017-11-21 17:33:52 +01:00
Neels Hofmeyr 2c46e04ccc cosmetic: msc_vlr_tests: add comment to show expected tallocs
If something changed the talloc landscape, it is hard to find out what the test
actually expected when it was written. Add the expectations in an inline
comment.

Change-Id: If92a18bb3dc24c2cf6498aa2da29266267488240
2017-11-20 13:49:32 +00:00
Neels Hofmeyr 3bae836310 vlr_subscr_conn_timeout(): don't fire events to discarded fi
Terminating one of the FSM instances may effect termination and deallocation of
the others, as well as the vlr_subscr itself. So, reserve the vlr_subscr
locally, and then dispatch events to exactly those FSM instances that exist.

The changes in expected output in the msc_vlr_tests shows that the subscriber
was deallocated from the first FSM termination, and now sticks around until
we've checked both FSMs are gone.

Change-Id: I56551ecc10f5295fe75944bdde4b583b1b621811
2017-11-20 13:49:32 +00:00
Neels Hofmeyr 3ddd7422ea subscr_conn: don't close after conn timeout
If dispatching a conn timeout, the conn fsm will already have been discarded,
and we cannot fire any more events to it.

The expected test output changes illustrate that we are now omitting event
dispatches that happen *after* the same FSM was already deallocated.

Change-Id: I25af3e5a1b04e3a5c9f41956cbcbbdd8439c6457
2017-11-20 13:49:32 +00:00
Neels Hofmeyr b3fa355321 vlr_gsupc_read_cb: fix use after free of GSUP msgb
osmo_gsup_decode() doesn't actually decode everything, it does leave quite a
number of pointers into the original msgb. Hence we must not deallocate the
gsup msgb before dispatching GSUP events.

Move msgb_free() to the bottom of vlr_gsupc_read_cb() and use rc and gotos to
early-exit if needed.

Change-Id: I16fc92dcf84e29fcf34712a2e8b0464ef08425ad
2017-11-20 13:49:32 +00:00
Neels Hofmeyr 1a5bcd5c3b sub_pres_vlr_fsm_start: fix heap use after free
When sub_pres_vlr_fsm_start() is called, it dispatches an event which may in
some cases already cause tear down and free of the parent FSM instance, after
which storing the returned instance pointer in that parent's metadata will use
freed memory. Instead, pass the target pointer to remember the instance at to
sub_pres_vlr_fsm_start() and assign the pointer *before* firing the event.

Explain so in a new comment.

I haven't checked whether that pointer is actually used at all -- this is the
easiest way to fix the use-after-free without getting sucked into semantic
questions.

Change-Id: Ibdc0b64cd12ba3e2b9737e3517d8484e67abcf04
2017-11-20 13:49:32 +00:00
Neels Hofmeyr c6bf27466c rate_ctr: don't use . as separator
Use ':' as separator, so that no mangled rate_ctr descriptions are allocated.

When '.' is used, the rate_ctr mangling code creates tallocs of mangled counter
descriptors, and hence affects the amount of expected talloc contexts in
msc_vlr_tests.c.

Change-Id: Ib1db8e3dc6c833174f1b0b1ca051b0861f477408
2017-11-20 13:49:32 +00:00
Philipp Maier e4db08a8b5 cosmetic: move log message to else branch
The log message after the nullpointer check for conn tricks Coverity
Scan into detecting a nullpointer deref.

Include the log message into else branch to state the program flow
more clearly

Fixes: Coverity CID#178656

Change-Id: If6e962f4033c955ecd3539a719031a83c9b6205a
2017-11-20 09:23:55 +00:00
Philipp Maier 8ae3c924ef reset: remove name variable from reset context
The reset context contains a string buffer to allow for setting
a human readable name, that is then displayed in the logs. Since
OSMO-FSMs already have such a feature there is no need for an
extra name variable.

Use LOGPFSML and the name parameter of osmo_fsm_inst_alloc()
to display the name of the FSM

Fixes: Coverity CID#178664

Change-Id: I5b051606791c5e085ca6bb1be20592127d48ceb5
2017-11-20 09:22:33 +00:00
Neels Hofmeyr 7cec38852a add --enable-sanitize config option
Change-Id: I6c0c91abc0d3fa737dbe3db1e6473358da64c2a5
2017-11-18 10:16:46 +00:00
Alexander Couzens f1521a14df debian/rules: remove doublicated project name in example files
For example:
/usr/share/doc/osmo-msc/examples/osmo-msc/osmo-msc.cfg -> /usr/share/doc/osmo-msc/examples/osmo-msc.cfg

Change-Id: I702cd963d5c3a2f4085ebce5e0dfa1a8a27ea89f
2017-11-16 00:12:45 +01:00
Harald Welte 0f2555e06f sms_route_mt_sms: Don't return uninitialized variable
Wen there's no SMPP support compiled in, and routing was successful,
we shouldn't return an uninitialized value.

Change-Id: I4abbbb5ab336a7e8da08d682f396baec3b56fa3a
Fixes: Coverity CID#174176
2017-11-14 15:09:18 +09:00
Neels Hofmeyr c698ab9a82 vlr: auth_fsm_start: check return value of fsm alloc
Fixes: coverity CID#178663
Change-Id: I7d1c15b546377b1afa38f7f40c5421b743e21605
2017-11-12 14:20:05 +00:00
Neels Hofmeyr 48ba1be752 examples: apply mgcp_client vty rename from 'mgcpgw' to 'mgw'
osmo-mgw.git is changing the mgcp_client_vty API to use 'mgw' instead of
'mgcpgw'. Fix example configs after that patch is merged.

Depends: I1d43d42929dc9162e57640499526fb7cadbcfbe6
Change-Id: Ib4c5ec1046a3c7a916ecfb7e5aa83dfe2f5ea8bf
2017-11-08 03:24:13 +00:00
Neels Hofmeyr 84ad185713 vty: skip installing cmds now always installed by default
vty_install_default() and install_default() will soon be deprecated.

Depends: I5021c64a787b63314e0f2f1cba0b8fc7bff4f09b
Change-Id: I34708c73d8084db4e6c83a39be8fdaeaa492d743
2017-11-01 00:51:21 +01:00
Neels Hofmeyr 0b8dec70a2 defaults: assign TMSI by default
When using ciphering, the TMSI is an important part of the ciphering. To guard
against users forgetting to set 'assign tmsi' in the config and compromising
their ciphering unknowingly, the default should be to use a TMSI.

To optimize in an unencrypted network, 'no assign tmsi' config can still switch
off TMSI use.

Change-Id: If115e95bebc314bedb50faf3993b52071fee5c1e
2017-10-31 02:02:44 +01:00
Neels Hofmeyr 26a3e2560d vty: drop deprecated 'logging level sms...'
No need to drag legacy VTY from osmo-nitb to osmo-msc.

Change-Id: I38ba8b9414de383bf497526d97bf7a039e41fd35
2017-10-31 02:02:44 +01:00
Neels Hofmeyr 97ce015f58 vty: make auth tuple reuse configurable
Change-Id: Iba6253d9bf8d4a9d9f6f26ba045e6c7f0dc7f8f2
2017-10-31 02:02:44 +01:00
Neels Hofmeyr 7b1418e6fc tests: add msc_vlr_test_authen_reuse
Change-Id: I185a2cbff6241a27722f1c37ae609f0fcc59a71e
2017-10-31 02:02:43 +01:00
Neels Hofmeyr 33f534136c cosmetic: vlr: rename auth_tuple_max_use_count to _reuse_
The name auth_tuple_max_use_count suggests that if I want to use each auth
tuple exactly once, I need to set it to 1. Curiously, so far you need to set
to intended uses - 1.

Reflect this in its name by renaming to auth_tuple_max_reuse_count.

I first considered to not rename but change the if-conditions so that == 1
means each tuple is used once, and upon struct vlr allocation, set the default
to 1. That would also logically entail that setting to 0 means to re-use
vectors infinitely often, like now a value < 0 does. That means, when
allocating a vlr struct zeroed out, we would by default have the most
dangerous/unsafe configuration. It's no problem to set a default to 1 upon
allocation, but by renaming the variable instead, we get safer alloc-zero
behavior and don't need to change any conditionals in the code (even though the
patch ends up considerably larger from all the renaming).

Change-Id: I0b036cae1536d5d6fb2304f837ed1a6c3713be55
2017-10-31 02:02:43 +01:00
Neels Hofmeyr 96748ca790 msc_vlr_tests: fix rebuild: rebuild when src/ libs were rebuilt
Before this, a code change in libvlr or libmsc would not cause a rebuild of the
tests.

You'd have thought 'AM_LDADD' were the right name for the variable, but
apparently it is just 'LDADD' instead. Tested that it works as intended.

Change-Id: Icbdedc1581fa23abe9ed99cef3918592b25f30b3
2017-10-30 08:45:15 +00:00
Harald Welte 9a5b4747ac Bump version: 1.1.1.2-633e5 → 1.1.2
Change-Id: Id3ddab71f98046c3ce26ea240313b0ffef8ddf09
2017-10-29 09:01:31 +01:00
Harald Welte 633e58a196 Debian: require minimum versions of packages we depend on
I'm using the dame version as in configure.ac to avoid build failures
against older versions of certain packages, such as older libsmpp34.

Change-Id: I83c617fa4e83e2e3d2613e454f517d6031814f21
2017-10-29 08:49:12 +01:00
Harald Welte 6a9d9baef5 Depend on both libosmo-sigtran-dev and libosmo-sccp-dev
libmsc/a_iface.c and libmsc/a_iface_bssap.c still include
osmocom/sccp/sccp_types.h to get access to enums defining SCCP
cause values.  Until that is resolved, we have to keep the build
dependency to libosmo-sccp-dev

Change-Id: I957dcb2bcce216d0fd81a58bfe869aca0e4624a8
Related: OS#2601
2017-10-28 23:53:23 +02:00
Harald Welte aaa858069a Bump version: 1.1.0.1-6299 → 1.1.1
Change-Id: I0143cbf462d8685bb7388024dddbc0eb9b3883dc
2017-10-28 19:58:11 +00:00
Harald Welte f45c34ddab Debian: Depend on libosmo-sigtran-dev, not libsomo-sccp-dev!
Change-Id: I478e28ba5f7e39cecea8912183e288ecb2f03337
2017-10-28 19:58:11 +00:00
Neels Hofmeyr 7f5ab9e0fa jenkins: use osmo-clean-workspace.sh before and after build
See osmo-ci change I2409b2928b4d7ebbd6c005097d4ad7337307dd93 for rationale.

Depends: I2409b2928b4d7ebbd6c005097d4ad7337307dd93
Change-Id: I6ae80147b2624079b5c364dbce08194215cc4e95
2017-10-28 15:08:24 +00:00
Harald Welte 6a01568351 Tag/Release Version 1.1.0
[ Alexander Couzens ]
  * debian/rules: show testsuite.log when tests are failing

  [ Neels Hofmeyr ]
  * build: check for -lgsm
  * am: msc_vlr_tests: use AM_LDFLAGS instead of COMMON vars
  * jenkins: fix build: osmo-mgw from master, not pre_release
  * jenkins: drop unused build matrix vars, always --enable-smpp
  * configure.ac: fix to "AC_INIT[osmo-msc]"
  * rewrite README
  * rename openbsc.pc to osmo-msc.pc
  * debian: fix web and VCS links, tweak osmo-msc.install
  * drop files unrelated to osmo-msc
  * rename include/openbsc to include/osmocom/msc
  * doc/examples: add detailed cs7 config examples
  * use separated libosmo-mgcp-client, apply rename to mgcp_client_*
  * ctrl: subscriber-list-active: list only attached subscribers
  * debian: fix dependency to mgcp library
  * main: remove cmdline args no longer available for osmo-msc
  * vty: fix: missing default cmds at hlr node
  * ctrl: remove unimplemented cmds subscriber-{modify,delete}
  * fix build: remove obsolete header legacy_mgcp/mgcp.h
  * fix debian: fix erratic doc/examples install path
  * fix memory leak: vlr: vlr_gsupc_read_cb() must msgb_free()
  * fix vty tests: long timeout due to unreachable STP address
  * cosmetic: vlr: declare a struct in .h; drop unused header
  * add ';' after OSMO_ASSERT()

  [ Philipp Maier ]
  * a_iface: fix memory leaks
  * a_iface: fix typo

  [ Max ]
  * Remove rest_octets.h
  * Remove SI-related code
  * Remove BTS-specific attributes
  * Remove unused osmo_bsc_rf.h header
  * Remove pkg-config file

  [ Harald Welte ]
  * Update .gitignore for post-nitb-split
  * remove further files and autotest/autoconf bits irrelevant to osmo-msc
  * Rename osmo_fsm to avoid illegal space in name + more meaningful name
  * Debian: remove obsolete Dependencies
  * configure.ac: Depend on latest tagged/released libosmo-* versions
  * Debian: Build with enabled SMPP support
  * osmo-msc: Don't link against libasn1c
  * Debian: Include systemd.service in package
  * Debian: include all (not just one) example config files

Change-Id: Ic24d937658e5b467c6643ae3cd54e5b6d9db3175
2017-10-28 15:17:53 +02:00
Harald Welte 9588450f92 Debian: Add proper description for packages.
Change-Id: I6cf4a6d84048e68abd7323387766acb674fd345c
2017-10-28 15:17:53 +02:00
Harald Welte e0c728fd39 Debian: include all (not just one) example config files
Change-Id: I19ac23898e9543081a1407da9af63ed643791d6e
2017-10-28 15:17:53 +02:00