Commit Graph

6173 Commits

Author SHA1 Message Date
Neels Hofmeyr bc10664484 vty: absorb command explanations from osmo-gsm-manuals
The osmo-gsm-manuals/vty/sgsn_vty_additions.xml contained many command
explanations that are redundant with the VTY online doc. Some however are more
verbose / easier to understand. Absorb these into the online VTY doc here.

This matches the removal in osmo-gsm-manuals change-id
I71863e5056ad369d2055e9882a52a00fa999ab04.

Change-Id: I35984014424412e91437b7ed71576aef3819cb1e
2018-03-06 16:16:34 +01:00
Neels Hofmeyr 3ab28a2f05 sgsn_test: guard against struct gprs_ra_id changing
sgsn_test initializes various struct gprs_ra_id without naming the actual
members, which is vulnerable to struct member re-ordering. Name the members
explicitly.

An upcoming ABI change in libosmocore would cause test failures here without
this patch.

Change-Id: I517ed9edf77fac37d9de7a39df24c419a8a65d96
2018-02-21 18:32:10 +01:00
Harald Welte f8f65b1819 Add talloc context introspection via VTY
This requires libosmocore with Change-Id
I43fc42880b22294d83c565ae600ac65e4f38b30d or later.

Change-Id: I50eb1c5a28efbe4542e177ce3d0a236e75eecdd0
2018-02-14 00:55:36 +00:00
Pau Espin 4182625eaf sgsn_libgtp.c: Fix typos and whitespace
Change-Id: Ic223cf378a83051603f58dacf087cc59d9f03890
2018-02-13 22:22:28 +01:00
Pau Espin 9ea4037a0a .gitignore: Add m4 files
Existing m4/ax_check_compile_flag.m4 is skipped from the list of ignored
files.

Change-Id: I7ad810e720ee8a02a28c601aa966ddde04023819
2018-02-13 22:22:00 +01:00
Alexander Couzens 79663b3dbd mandatory depend on libc-ares and libgtp
Both library are required to build osmo-sgsn.
The optional dependency was correct when osmo-sgsn
was part of openbsc.

Change-Id: Id608165ae490cb6c84aac1fe70412b2cb2b2587b
2018-02-08 09:42:39 +00:00
Max 6ba7047062 gtphub: check for gsn_addr_from_sockaddr() error
Change-Id: I2d80b5a488e7daa0bc8f57ea304e0e1f10f6c1f5
Fixes: CID182472
2018-01-30 10:09:00 +01:00
Max efb2654fd4 gtphub: check for gsn_addr_from_sockaddr() errors
Previously the return value was ignored. Check it and log error message.

Change-Id: If6babdad650dc6a84e6a784fc8d3c5abe146ecc1
2018-01-27 17:05:27 +00:00
Pau Espin cec01d30a7 configure.ac: Enable Wall in CFLAGS
Change-Id: I042b4918bc74955cc5162fad8c16d989402c29a1
2018-01-23 16:17:21 +01:00
Max 9f13b1401e Use gsm48_encode_ra() for RAI encoding
It has stricter type signature which increase the chance of spotting
misuse either via compiler warning or with automated scan. This also
paves the way for gsm48_construct_ra() deprecation in libosmocore.

Change-Id: I2c0f082dc7214ed57a40dad0788e34b838dfac97
Related: OS#1640
2018-01-19 15:11:00 +00:00
Neels Hofmeyr 95253c7bdb fix build: missing LIBGTP_CFLAGS in sgsn_test
Change-Id: I250cadecaf90238df1afa6997e5d165fb9eee8b6
2018-01-16 14:09:24 +01:00
Max 62e150b165 Remove unused bsc_version.c
Change-Id: Ib3f52c3e4cbd08b28f99d613aa18c6b00c71ead9
2018-01-12 16:48:22 +00:00
Max 8bd4bbaeaa gtphub: make rate_ctr unique
* compute unique rate counter index when allocating new gtphub tunnel
* propagate rate counter allocation error to upper layers
* log and gracefully handle tunnel allocation error

Change-Id: I0e07f95c36de369bcd0691b8d0fd47c844abe5da
Related: OS#2757
2018-01-12 16:50:40 +01:00
Neels Hofmeyr d3e4e51317 gprs_llc: tx dl ud: make mismatching LLE not crash osmo-sgsn
On 34c3, osmo-sgsn keeps restarting. At least once, it hits the assertion that
this patch replaces with an error message, to not disrupt operation.

Change-Id: I07a40960920dbc594192530c3a145f9a5d2a9c81
2018-01-11 11:05:32 +00:00
Max fabf06a3e3 Fix RAI construction
The gsm48_construct_ra() expect 6-byte buffer while ra_id.digits is
3-byte buffer. The function fills in LAC and RAC as well so we should
pass entire struct, not just 'digits' part which only store MCC/MNC.

Related: OS#1640
Change-Id: I3bfda930012c792452f9fd695ed7acf46365f1df
Fixes: CID57877, CID57876
2018-01-08 13:01:38 +00:00
Pau Espin e15e8d728e gprs_gmm: Convert warning message to pragma message
This way we can enable -Werror in builds to disallow new compilation
warnings being introduced.

Change-Id: If2b9a618f4219df9e013095beff52c20aacbc79e
2018-01-07 18:16:09 +01:00
Pau Espin 98449d1b38 cosmetic: gprs_gmm: Remove trailing whitespace
Change-Id: Ie2466268fbc4699a366856d467660b17e3f7e307
2018-01-07 18:14:12 +01:00
Pau Espin dc7dd4e7cf gprs_gmm: Remove unused variable
Fixes following compilation warning:
osmo-sgsn/src/gprs/gprs_gmm.c: In function ‘gsm48_rx_gmm_service_req’:
osmo-sgsn/src/gprs/gprs_gmm.c:1786:10: warning: variable ‘ciph_seq_nr’ set but not used [-Wunused-but-set-variable]
  uint8_t ciph_seq_nr, service_type, mi_len, mi_type;
          ^~~~~~~~~~~

Change-Id: If0819026a99f45df96ee6de26a71c16128e79cb8
2018-01-07 18:13:12 +01:00
Pau Espin 964dcb2493 cosmetic: tests: sgsn_test: Use proper formatting and remove uneeded semicolons
Change-Id: I144175b89f8058f6f8dedfa931c6768d9c43b70e
2018-01-07 18:07:17 +01:00
Pau Espin d17d621386 tests: sgsn_test: Define wrap APIs with correct parameters
Fixes following compilation warnings:

osmo-sgsn/tests/sgsn/sgsn_test.c: In function ‘test_gmm_attach_subscr’:
osmo-sgsn/tests/sgsn/sgsn_test.c:1110:30: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
  subscr_request_auth_info_cb = my_subscr_request_auth_info;
                              ^
osmo-sgsn/tests/sgsn/sgsn_test.c: In function ‘test_gmm_attach_subscr_fake_auth’:
osmo-sgsn/tests/sgsn/sgsn_test.c:1144:30: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
  subscr_request_auth_info_cb = my_subscr_request_auth_info_fake_auth;
                              ^
osmo-sgsn/tests/sgsn/sgsn_test.c: In function ‘test_gmm_attach_subscr_gsup_auth’:
osmo-sgsn/tests/sgsn/sgsn_test.c:1275:30: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
  subscr_request_auth_info_cb = my_subscr_request_auth_info_gsup_auth;
                              ^

Change-Id: I5fcb3d460d8becb4cc917fc8d27bfc7e49d50b90
2018-01-07 18:05:25 +01:00
Max 6a922c529f Remove obsolete ./configure option
The '--enable-vty-tests' is just alias to '--enable-external-tests'
anyway.

Change-Id: I6230cfcf10247b601e16e7b872305499815520a9
2017-12-28 13:00:51 +01:00
Max ca7be8a5c2 Migrate from OpenSSL to osmo_get_rand_id()
This avoids potential licensing incompatibility and makes integration of
Debian packaging patches easier.

The libosmocore version requirements are fine already but for jenkins
tests to pass we have to have Ic77866ce65acf524b768882c751a4f9c0635740b
merged into libosmocore master.

Related: OS#1694
Change-Id: I2b687b7f07ef05bbd861b8479cad5a958a3dde92
2017-12-27 11:10:42 +00:00
Max d367aab6a0 Use connection id when allocating rate counters
Due to recent libosmocore's change we can't allocate rate counters with
the same name and index which are already allocated. This causes
sgsn_mm_ctx_alloc_iu() failure for multiple subscribers.

Fix this by using conn_id parameter from ranap_ue_conn_ctx.

Change-Id: I1062ffdcac96c82269cab6f4e7ae50e28dc3aa44
Related: OS#2757
2017-12-26 22:22:10 +00:00
Max 7daa1a84af cosmetic: use macro for gtphub plane iteration
Change-Id: If82fcd9f6509da60e6f0d916fe107de1b38bfd18
2017-12-26 21:27:55 +00:00
Max 8ea1387641 Enable sanitize for CI tests
While at it, also remove unsupported ./configure options remaining since
before repo split.

Change-Id: I77b3375fd680be269fd2df7db61ece6c5d1754ba
2017-12-21 17:15:07 +01:00
Max ab716e5481 Remove dead code
Get rid of ifdefs around old unused code to improve readability.

Change-Id: Ia80cf845b624d520d67143b61c9de3d49074cb8c
2017-12-20 16:52:03 +00:00
Max e2cd67771a Replace '.' in counter names with ':'
The '.' is illegal character in counter names, as they are exported
via CTRL interface, where '.' has a special meaning that cannot be
used by strings comprising the variable name.

Change-Id: I4eb6851d3577f5942ae1a9ab28d3b3ca7ab8e208
2017-12-20 16:52:03 +00:00
Neels Hofmeyr c1cfde5e47 gsm48_rx_gmm_att_req: fix error handling: don't clean up NULL llme
Change-Id: I78903d0846568d4e98b6e43e62bbe3c329b5bc68
2017-12-20 16:01:54 +00:00
Alexander Couzens 52262f72ae .service: remove OpenBSC from service desription
Change-Id: I555939235437a0b3253a1236a918e1f491ed9d3a
2017-12-20 15:47:07 +00:00
Neels Hofmeyr a9efff76fc gprs_gmm: segfault: gracefully handle failure to alloc context
This counter allocation error I hit uncovers a segfault when allocating an MM
context fails in the GSM_MI_TYPE_TMSI case:

  DRANAP <001a> ../../../src/osmo-iuh/src/iu_client.c:509 handle_co_initial(dir=1, proc=19)
  DRANAP <001a> ../../../src/osmo-iuh/src/iu_client.c:229 RNC 23: new LAC 24358 RAC 22
  DMM <0002> ../../../../src/osmo-sgsn/src/gprs/gprs_gmm.c:1271 MM(---/ffffffff) -> GMM ATTACH REQUEST MI(3427325924) type="GPRS attach"
  DLGLOBAL <001d> ../../../src/libosmocore/src/rate_ctr.c:195 counter group 'sgsn:mmctx' already exists for index 0
  DMM <0002> ../../../../src/osmo-sgsn/src/gprs/gprs_sgsn.c:272 MM(/00000000) Cannot allocate counter group

  Program received signal SIGSEGV, Segmentation fault.
  gsm48_rx_gmm_att_req (llme=0x0, msg=0x555555886950, ctx=0x0) at ../../../../src/osmo-sgsn/src/gprs/gprs_gmm.c:1375
  1375				ctx->p_tmsi = tmsi;

Fix it with a bit of code already present for the GSM_MI_TYPE_IMSI case just
above the segfault.

Change-Id: I49aa95b610f2faec52dede2e4816da47ca1dfb14
2017-12-20 00:41:29 +01:00
Max 8a58bcdaad 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 SGSN-specific: leftovers from repository split which are now
available in osmo-python-tests as well.

Change-Id: I3ef4ca790878921a5846f64942a8de8a6ff9c11c
2017-12-19 18:21:13 +01:00
Alexander Couzens 6a5f21c2aa configure.ac: remove unused libcdk check
libcdk isn't used

Change-Id: Iea2d61b34e9242bf59a1eb242c5cf1d82f625f2e
2017-12-16 20:31:17 +01:00
Alexander Couzens 404bc49cbb configure.ac: remove pcap check
libpcap isn't used in osmo-sgsn

Change-Id: I47880dba1f6855f31b5b6481eeb1027abc2a2671
2017-12-16 20:31:17 +01:00
Alexander Couzens 3137330720 .gitignore: remove non-existent /src/utils exludes
Change-Id: I674da025df4b5d6bcf585a0c764ff186c9281121
2017-12-16 20:31:17 +01:00
Max 90e07905c1 Show GTP version for PDP context in vty
Change-Id: Id1692e99ae0d2b78e9473f6139e6e430fcd6a607
2017-12-05 17:54:42 +01:00
Max 4de3eebdb5 Fix display of GTP addresses
Previously we've tried to convert addresses manually which lead to
wrongly displayed GTP addresses (e. g. '4.0.0.0' instead of
'127.0.0.2'). Use libgtp function for conversion to fix it.

Change-Id: I695a9c9497d675564a088b002299096e0dcd267d
2017-12-05 17:49:17 +01:00
Pau Espin 134fc6a95b Add vty cmd 'cdr trap' to send CDR through CTRL iface
Default behavior is to have them disabled, and can be explicitly
disabled too by using 'no cdr trap' cmd.

Tested with osmo_ctrl.py that messages are send successfully:
TRAP 0 cdr-v1 20171129125950222,901700000015254,357737055592090,555,0,5,,pdp-periodic,2731,127.0.0.2,127.0.0.1,internet,176.16.222.3,20793,10045,1

Related: OS#2360

Change-Id: I1d144d87effd934d991257a65e19cf046a938907
2017-11-29 14:05:09 +01:00
Pau Espin 136c1c12c4 sgsn_cdr: Split log formatting into a snprintf function
This function is going to be re-used to send TRAP messages over CTRL
interface.

Related: OS#2360

Change-Id: I0d87df578db1d8c220fd63376e03866895d2aa0d
2017-11-29 12:50:13 +01:00
Pau Espin 266b61abc6 tests: Fix selection of python version
According to documentation (and personal experience), AM_PATH_PYTHON
selects the highest version of python, no matter if major version is
different, which means if both python2 and 3 are available, 3 will be
chosen an PYTHON will point to "/.../python" which is python3. Apparently,
the macro cannot be easily used to pick highest python2 version.

As {vty,ctrl}_test_runner.py require python2 and are incompatible with
python3, let's instead rely on the system having a "python2" binary
available, which is the case in most distros.

Change-Id: If8e57924ed2c8da7ab7692f58a4bb5c5a970484f
2017-11-28 20:08:19 +01:00
Pau Espin 871f3d7a8c Replace '.' in counter names with ':'
'.' is an illegal character in counter names, as they are exported
via CTRL interface, where '.' has a special meaning that cannot be
used by strings comprising the variable name.

Change-Id: Ie7734cc42151581897d220b445984448ceb57aed
2017-11-28 19:40:37 +01:00
Neels Hofmeyr 8c879b0b35 use default point-code as listed on Point_Codes wiki page
see https://osmocom.org/projects/cellular-infrastructure/wiki/Point_Codes

Change-Id: Ie11f1dfcdd5889d44fefe6cc10472ef1a794cc64
2017-11-24 04:33:08 +01:00
Harald Welte 7547a3fb16 Replace '.' in counter names with ':'
'.' is an illegal character in counter names, as they are exported
via CTRL interface, where '.' has a special meaning that cannot be
used by strings comprising the variable name.

Change-Id: Iec382ec4ee54beb2937431f5a9d8d1171224eebb
2017-11-21 08:51:47 +01:00
Neels Hofmeyr 4984c497fd add --enable-sanitize config option
Change-Id: I3be01e0682b479a71c545f718b68c441a1011b0f
2017-11-18 10:16:52 +00:00
Alexander Couzens 5c4646461f debian: remove doublicated project name in example files
For example:
/usr/share/doc/osmo-sgsn/examples/osmo-sgsn/osmo-sgsn.cfg -> /usr/share/doc/osmo-sgsn/examples/osmo-sgsn.cfg

Change-Id: I77f9665e78e3e55910efb30cb50cefdb138e19f7
2017-11-15 23:32:02 +01:00
Alexander Couzens 2184b24e28 tests/ctrl_test_runner.py: remove BSC/NAT TestRunner
SGSN was splitted out of OpenBSC.

Change-Id: Ie4e44e49e5c904929869b47fc4d608aab1aab75e
2017-11-15 22:03:15 +01:00
Alexander Couzens 4ebb548a96 .gitignore: remove unneeded ignores of bsc/msc/nitb files
sgsn was splitted out of the openbsc repository

Change-Id: I66905432c411291630f66579fa4177936c8f2bcf
2017-11-15 22:02:20 +01:00
Neels Hofmeyr 4a65685e5c vty: skip installing cmds now always installed by default
vty_install_default() and install_default() will soon be deprecated.

Depends: I5021c64a787b63314e0f2f1cba0b8fc7bff4f09b
Change-Id: Iee1b582a62921cb3205de01ff87d94881e8d411b
2017-11-01 00:52:12 +01:00
Neels Hofmeyr 77806e7aee change default config filename to osmo-sgsn.cfg, not osmo_sgsn.cfg
All other Osmocom programs I know of have a default config file using a dash.
Comply.

Be backwards compatible: when a legacy osmo_sgsn.cfg exists but no
osmo-sgsn.cfg, use the old config file instead. (Verified to work by manual
tests.)

Change-Id: If804da17a7481e79e000fe40ae0d9c4be9722e61
2017-11-01 00:11:30 +01:00
Neels Hofmeyr 000cfe5a19 drop osmo_sgsn.cfg from src/gprs dir
There is a semantically identical config in doc/examples/osmo-sgsn.

Change-Id: I9b9c502afbddcfc02ea70aa8317e0d2f37276c38
2017-10-31 01:58:59 +01:00
Harald Welte 5641e9d41f Tag/Release Version 1.2.0
Change-Id: I44bee346fd698bd51ef305813084afdce0099907
2017-10-28 19:08:27 +02:00