Commit Graph

6183 Commits

Author SHA1 Message Date
Pau Espin 54936e9899 Bump version: 1.2.0.58-85ca87-dirty → 1.3.0
Change-Id: I466089b40fed02153e2850cb4a748ee6568b130b
2018-05-03 19:01:44 +02:00
Alexander Couzens c78e0e3f38 GMM: dont reply to GMM_DETACH_REQ with POWER OFF when MS is unknown
Change-Id: I1d1cf64500f1295ab58d157d4d4dab16fcddbbf3
2018-05-02 18:17:34 +02:00
Neels Hofmeyr 4a8d501137 GERAN: allow GSM SRES on UMTS AKA challenge
Store the established security context type (GSM or UMTS) instead of the
boolean flag is_authenticated. Provide the previous boolean query with thin
sgsn_mm_ctx_is_authenticated() function.

Knowing which security context was established will be necessary for OS#3224,
i.e. using the proper ciphering key, which is not yet tested properly, and
probably not correct at this stage.

This change will make new SGSN_Tests.TC_attach_umts_aka_gsm_sres pass.

Related: OS#3193 OS#3224
Change-Id: I36807bad3bc55c0030d4f09cb2c369714f24bec7
2018-05-01 01:32:13 +02:00
Neels Hofmeyr f8bd2f69f5 log two RA Update Request failure causes
Change-Id: Ic9c8a492abf5a707b37d9c8888c59be6e51541b8
2018-04-30 22:09:13 +02:00
Neels Hofmeyr e0a540f644 auth+ciph: log is_r99 and auth types
Change-Id: I9679b7c174df186e05171a059a6b4d870a6f16e6
2018-04-30 22:09:13 +02:00
Neels Hofmeyr 8de6b8677d use osmo_init_logging2(), fix regression test memleaks
Particularly gbproxy_test.c had various mem leaks, which (will) show up with
gcc (Debian 7.3.0-15) 7.3.0 address sanitizer. Fix those leaks to verify that
we don't have memleaks in the production code.

Change-Id: Ia4204c8b3d895b42c103edecb61b99d3d22bd36f
2018-04-16 01:03:48 +02:00
Neels Hofmeyr 20370aaf30 compiler warnings: use enum ranap_nsap_addr_enc, constify local var
Use the proper enum ranap_nsap_addr_enc instead of int, and properly exclude
that member when we're building without Iu support:

sgsn_vty.c:1323:31: error: passing argument 2 of ‘ranap_iu_vty_init’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  ranap_iu_vty_init(SGSN_NODE, &g_cfg->iu.rab_assign_addr_enc);

Add const to a local var to silence compiler warning retrieving TLVP_VAL:

gprs_gmm.c:1657:18: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
    uint8_t *mi = TLVP_VAL(&tp, GSM48_IE_GMM_ALLOC_PTMSI);
                  ^~~~~~~~

Change-Id: I1168ce6425c31db3f6c3bf1f3682ae96b028c59b
2018-03-16 09:16:19 +00:00
Neels Hofmeyr 009d15971a osmo-gbproxy: use 'osmo-gbproxy.cfg' as default config name
Like we did in osmo-sgsn in If804da17a7481e79e000fe40ae0d9c4be9722e61, move
from 'osmo_gbproxy.cfg' to 'osmo-gbproxy.cfg' as default config file name.
Still look for the legacy file name to not break old setups.

Change-Id: I9448908d94a23001f04b6334a78739a839b91313
2018-03-15 18:32:08 +00:00
Neels Hofmeyr 6179f0ca36 implement support for 3-digit MNC with leading zeros
Add 3-digit flags and use the new RAI and LAI API from libosmocore throughout
the code base to be able to handle an MNC < 100 that has three digits (leading
zeros).

Note that in gbproxy_test.ok, 0-0 changes to 000-000 instead of 000-00, because
the parsed ra buffer is 000000 which results in 000-000, while 00f000 would
result in 000-00. IOW this is expected.

Change-Id: I7437dfaa586689e2bef0d4be6537e5577a8f6c26
2018-03-15 19:18:14 +01:00
Neels Hofmeyr f1474f5fc8 configure: add --enable-werror
Provide a sane means of adding the -Werror compiler flag.

Currently, some of our jenkins.sh add -Werror by passing 'CFLAGS="-Werror"',
but that actually *overwrites* all the other CFLAGS we might want to have set.

Maintain these exceptions from -Werror:
a) deprecation (allow upstream to mark deprecation without breaking builds);
b) "#warning" pragmas (allow to remind ourselves of errors without breaking
   builds)

As a last configure step before generating the output files, print the complete
CFLAGS and CPPFLAGS by means of AC_MSG_RESULT.

Change-Id: Ifea235feb073a276302436936e908d9125c77a82
2018-03-13 00:03:52 +00:00
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