Commit Graph

6470 Commits

Author SHA1 Message Date
Alexander Couzens 016a68bb1e gtphub_test: fix compilation error on gcc 10.2.0
Ensure dump && hex can't be zero.

gtphub_test.c: In function ‘_reply_is.constprop’:
gtphub_test.c:535:3: error: ‘%s’ directive argument is null [-Werror=format-overflow=]

Change-Id: Id27bf46855a228935fe706584f9b27cf3facf623
2020-10-02 20:44:34 +00:00
Philipp Maier 76059b8179 gprs_sndcp: fix use after free
When compression is turned on, an extra buffer "expnd" is allocated in
the context of msg. This means that when msg is freed, expnd is freed as
well and there is no need for freein it explcicitly, which, when it is
done after freeng msg, causes talloc to abort.

Change-Id: I8959b75e241ffabf9fa34c4cf014721584372b26
2020-10-02 17:38:12 +02:00
Daniel Willmann 376aa9edaa gbproxy-usermanual: Explain BSSGP/BVC handling
Related: SYS#5005
Change-Id: I383fcd3864a94177f13909c6b8c15648900d3201
2020-09-25 09:54:26 +02:00
Keith Whyte 3ab0ad854a Fix Radio Priority in MM Attach and PDP Context Activation
3GPP TS 24.008 Section 10.5.7.2 Radio Priority states that the Radio Priority IE is
3 bits as follows:

--------------------------------------------
0 0 1   priority level 1 (highest)
0 1 0   priority level 2
0 1 1   priority level 3
1 0 0   priority level 4 (lowest)

All other values are interpreted as priority
 level 4 by this version of the protocol.
--------------------------------------------

However at least the MediaTek MT6753 and MT6592 have been
observed to interpret a value of 0 0 0 in an undetermined way
resulting in lack of access to RACH in the cell.

Fixes: OS#4506
Change-Id: I810cd541eb5764ee3f2c238bcd3a10836228d0b5
2020-09-21 00:18:48 +02:00
Alexander Couzens e600786a31 gmm: on invalid RA id reject the MS with an implicit detach
As long the SGSN doesn't support PS handover treat unknown RA as invalid
and do an implicit detach.

Fixes ttcn3 crash when an RAU happen within an Attach Request

Change-Id: I6a0b335d51f58c26349f7e0a62b2107d7d351d07
2020-09-20 09:52:24 +00:00
Alexander Couzens f1f6b76515 gprs_llc: _bssgp_tx_dl_ud: ensure the LLME is valid before using it
In rare cases the LLME is NULL even when the mmctx is valid.
Ensure not accessing a NULL pointer.

Change-Id: Id9fdfb0d88264671546f8dfc4655032ff27bf43e
2020-09-18 18:32:04 +02:00
Pau Espin 9bfbe2c302 Change default SCTP conn NULL->127.0.0.1 to localhost->localhost
"127.0.0.1" is changed to "localhost" to let local NSS decide whether to
use IPv4 or IPv6. In newish systems, IPv6 ::1 will be selected since
IPv6 takes precedence over IPv4.

Similarly, the default source addr needs to be changed from NULL to "localhost"
since for some yet unknwon reason, getaddrinfo(AF_UNSPEC, NULL) returns
first IPv4 "0.0.0.0" and later "::", which is inconsistent with
getaddrinfo("localhost") result, resulting in src=IPv4(0.0.0.0) and
dst=IPv6(::1), which is incompatible and will fail. In any case, since
the default remote address is a local one and it's the client side,
there's no real logical change since the kernel would anyway should have
taken a local address anyway.

Change-Id: I2f599e1aa449d44136ef20ba5f516ca9b61f3223
2020-08-21 18:07:11 +02:00
Pau Espin e77e5bc8a9 Support setting rt-prio and cpu-affinity mask through VTY
Change-Id: I1af1b154d14de6d6d6fba08f15f167f4b2ed9aa2
Depends: libosmocore.git Change-Id If76a4bd2cc7b3c7adf5d84790a944d78be70e10a
Depends: osmo-gsm-masnuals.git Change-Id Icd75769ef630c3fa985fc5e2154d5521689cdd3c
Related: SYS#4986
2020-08-18 13:50:00 +02:00
Pau Espin 0b1a81ed13 doc: Update VTY reference xml file
Change-Id: I787bbc254ef10766fe8d480ffd93a16d9926a50e
2020-08-18 13:46:17 +02:00
Pau Espin 570c407567 configure.ac: Fix trailing whitespace
Change-Id: I5abdce5daef43dad772bf52576b47c0867d65c98
2020-08-18 13:45:09 +02:00
Vadim Yanitskiy 74a2504c43 debian/control: change maintainer to the Osmocom team / mailing list
Change-Id: Ic6956c4d5cc9913c06b9e293dc5bb156f6510285
2020-08-13 16:09:03 +07:00
Harald Welte e717f0b61e Send a BVC-RESET to all persistent Gb interfaces at start-up
3GPP TS 48.018 Section 8.4:

> After any failure affecting the NSE, the party (BSS or SGSN) where
> the failure resided shall reset the signalling BVC. After sending or
> receiving a BVC-RESET PDU for the signalling BVC, the BSS shall stop all
> traffic and initiate the BVC-RESET procedure for all BVCs corresponding
> to PTP functional entities of the underlying network service entity. The
> BSS must complete the BVC-RESET procedure for signalling BVC before
> starting PTP BVC-RESET procedures.

TODO: We should not just trigger a single outbound BVC-RESET message,
but we should re-transmit them until we get a response.   This would
likely entail adding FSMs to libosmogb, which we will leave for a later
point - it's anticipated that the NS + BSSGP code is undergoing quite
some changes in the coming months anyway, so leave it for then.

Change-Id: I0b46035b40709c38bb9ab9493c11031a577e3ee0
Closes: OS#4629
Depends: libosmocore.git I353adc1aa72377f7d4b3336d2ff47791fb73d62c
2020-07-27 14:43:36 +00:00
Alexander Couzens 323aaf64f0 gtphub: rename sgsn's oww osmo_sockaddr into sgsn_sockaddr
The osmo_ prefix should be only used for official struct/apis of libosmocore.
This commit was done via `sed -i 's/osmo_sockaddr/sgsn_sockaddr/g'`.

In prepartion of introducing a different api of osmo_sockaddr to
libosmocore.

Change-Id: Ibb1ddce9ff1ffe7494de5cdb8ea1843c45fe4566
2020-07-18 21:43:49 +00:00
Pau Espin 750bfb0051 sgsn_libgtp: Avoid ps-paging MS on GMM Suspended state
The MS notifies movement to GMM SUSPEND state because it is for instance
handling a call and cannot use PDCH anymore. Once it releases the TCH it
will ASAP move to either dedicated mode or trigger RAU, which means it
will get out of SUSPEND state. So it doesn't make sense to try paging
the MS when in that state.

This change makes test TC_suspend_nopaging pass.

Related: OS#4616
Change-Id: Ia245899eb9f16c7f839785def4ceb721a1c3a11b
2020-06-26 12:20:57 +02:00
Pau Espin cc8d1a1b22 gprs_gmm_fsm.c: Add missing license header
The file was created by myself on September 2019,
31c4657c971e40407163034526aafeb9b5a83460.

Change-Id: I94299b9ccf760ad13429e149067f06ed60d37de3
2020-06-26 12:07:12 +02:00
Harald Welte 7dd85f4fc0 *.spec.in: Use %config(noreplace) to retain current config file
Change-Id: I4e7f0a44d5e2d132b24ca0f38dc6f520b59112da
2020-06-22 15:20:33 +02:00
Pau Espin bee65e09b7 sgsn_libgtp: Improve ps-paging logging
Change-Id: I0c3d48d54295824c3ba5b0fa9e3c035983556326
2020-06-18 11:39:13 +00:00
Neels Hofmeyr 7facc86304 use new osmo_mobile_identity API everywhere
Depends: If4f7be606e54cfa1c59084cf169785b1cbda5cf5 (libosmocore)
Change-Id: I4cacb10bac419633ca0c14f244f9903f7f517b49
2020-06-18 11:23:35 +00:00
Neels Hofmeyr 17d6134a3c gbproxy_test.c: fix mobile identity test data
Fix the final nibble of all IMSI BCD digits to 0xf, since it is a filler digit.

The encoded IMSI has an even amount of digits (14) and must contain a 0xf
filler nibble at the end. The test data looked correct due to repeated '1'
digits.

wrong hex: 11 12 13 14 15 16 17 18
correct:   11 12 13 14 15 16 17 f8
order:     1T 32 54 76 98 ba dc Xe  T = type, X = filler, 1..e = 14 digits

This error was found when applying the new osmo_mobile_identity API.

Change-Id: Ia006a3da6779ad1984f642e8ea29790a4daeb8b9
2020-06-18 11:23:35 +00:00
Harald Welte 6a32db9460 Treat RAU as implicit RESUME if GMM is suspended
We so far only resumed from suspend upon receiving an explicit BSSGP
RESUME message from the BSS.  The latter is only possible in
BSC-colocated PCU, where the BSC can trigger the message when releasing
the dedicated channel.  In BTS-colocated PCUs, this is not possible,
and we have to rely on the MS resuming by RAU.

See 3GPP TS 23.060 section 16.2.1.1.1 clause 6:

The MS shall resume GPRS services by sending a Routeing Area Update Request message to the SGSN:
* if the BSS did not successfully request the SGSN to resume GPRS services,
* if the RR Channel Release message was not received before the MS left dedicated mode,
* if the MS locally determines that the conditions for the GPRS suspension have disappeared

Without this patch, the GMM state would forever be stuck in SUSPEND,
which in turn causes the SGSN to page the MS all the time.

Change-Id: I3c09187a27483d95fa0070bbb467f94a2ea3978f
Related: OS4616
2020-06-17 21:09:03 +00:00
Harald Welte e36ef1f94b Fix memory leak when SNDCP de-fragmentation is used
As msgb ownership is not passed along, we need to free the message
buffer memory we allocate in defrag_segments() after calling
sgsn_rx_sndcp_ud_ind().

Change-Id: I1185b1aa99bb167d616eb469e5445e4ed5ad949d
Closes: OS#4603
2020-06-08 20:46:53 +02:00
Oliver Smith aea9d6fff6 Makefile.am: EXTRA_DIST: debian, contrib/*.spec.in
Change-Id: I15d4c9ca2c7ed0467b44f57bbaa1a2177feff154
2020-05-22 13:45:48 +02:00
Oliver Smith a40ccf6b3c contrib: integrate RPM spec
Remove OpenSUSE bug report link, set version to @VERSION@, make it build
with CentOS 8 etc.

Related: OS#4550
Change-Id: I824b67f2d590ac2aa9f2e4fa4387a5283cf22521
2020-05-19 16:49:33 +02:00
Oliver Smith 1465babce9 contrib: import RPM spec
Copy the RPM spec file from:
https://build.opensuse.org/project/show/home:mnhauke:osmocom:nightly

Related: OS#4550
Change-Id: Ia18f44f1b6dc259c3d0474b88b33f4657d96fd7a
2020-05-14 11:52:28 +02:00
Neels Hofmeyr 0a650e60a3 gsup: send RAT type on LU
At 36c3, osmo-hlr was run with a patch that records the RAN type of attached
subscribers. Even though this is not in osmo-hlr master, it is nice information
to send along.

Change-Id: I5dbe610738aed7ea1edf6b33543b1c03818cc274
2020-05-12 13:52:24 +02:00
Neels Hofmeyr 8581cc0eb8 fix nullpointer: in gsm48_rx_gmm_ra_upd_req()
This caused frequent crashes at 36c3. The "proper" fix is probably elsewhere
(lynxis mentions an unfinished patch), but at least this prevented some crashes
during active operation.

Once this is merged, we can (re)enable SGSN_Tests_Iu.TC_geran_attach_iu_rau,
which tests exactly for this scenario:  A Subscriber / MM context that is so
far attached via GERAN, but now receives a RAU via UTRAN/Iu.

Closes: OS#4339
Change-Id: Ifde15dc4151d84748f0e67b32c9c260cb2d9d8fc
2020-05-10 22:33:27 +00:00
Pau Espin b657808731 Use OSMO_FD_* instead of deprecated BSC_FD_*
New define is available since libosmocore 1.1.0, and we already require
1.2.0, so no need to update dependenices.
Let's change it to avoid people re-using old BSC_FD_* symbols when
copy-pasting somewhere else.

Change-Id: Iaebd049e383b02204a12f39cc6c932a53d25fd72
2020-05-09 19:21:15 +02:00
Harald Welte 2a968316ed gtphub_test: Fix compilation with gcc-10
/usr/bin/ld: ../../src/gtphub/gtphub.o:/home/laforge/projects/git/osmo-sgsn/src/gtphub/gtphub.c:50: multiple definition of `osmo_gtphub_ctx'; gtphub_test.o:/home/laforge/projects/git/osmo-sgsn/tests/gtphub/gtphub_test.c:57: first defined here
collect2: error: ld returned 1 exit status

See also https://alioth-lists.debian.net/pipermail/debian-mobcom-maintainers/Week-of-Mon-20200413/000653.html

Change-Id: I19c1eef6649d2747f0b624f5292d7ae47c4ca839
2020-04-20 19:47:19 +02:00
Eric Wild 9a69cf3685 configure.ac: fix libtool issue with clang and sanitizer
As pointed out at https://github.com/libexpat/libexpat/issues/312
libtool does not play nice with clang sanitizer builds at all.
For those builds LD shoud be set to clang too (and LDFLAGS needs the
sanitizer flags as well), because the clang compiler driver knows how
linking to the sanitizer libs works, but then at a later stage libtool
fails to actually produce the shared libraries and the build fails. This
is fixed by this patch.

Addtionally LD_LIBRARY_PATH has no effect on conftest runs during
configure time, so the rpath needs to be set to the asan library path to
ensure the configure run does not fail due to a missing asan library,
i.e.:

SANS='-fsanitize=memory -fsanitize-recover=all -shared-libsan'
export CC=clang-10
ASANPATH=$(dirname `$CC -print-file-name=libclang_rt.asan-x86_64.so`)
export LDFLAGS="-Wl,-rpath,$ASANPATH $SANS $LDFLAGS"

Change-Id: I7402b019c191304f639806a3c29e6bb698b398ed
2020-04-11 01:04:28 +02:00
Eric Wild a9a289fbd0 tests: dlopen does not imply availability of dlsym..
Check for both.

Change-Id: If41a20bf499f791432f5f207e40688e97fb6e9f7
2020-04-11 01:04:08 +02:00
Neels Hofmeyr 56254aaf70 manual: explain IuPS, add SCCP/M3UA section from common chapters
Add 'cs7' default configuration, link to the
osmo-gsm-manuals/common/cs7-config.adoc chapter to fully explain the 'cs7'
client configuration.

Related: OS#2767
Depends: Ia2508d4c7b0fef9cdc57e7e122799a480e340bf7 (osmo-gsm-manuals)
Change-Id: If0f7c8fc4b94eb40b62570cf90999d5074dc00ee
2020-03-23 20:06:12 +01:00
Alexander Couzens cd14b56f51 gprs_gmm_fsm.c: Implement RAT change between 2g and 3g
Related: OS#2737
Change-Id: I3fc614da6ba137e871ee0fe86ca22b6a4a354dd2
2020-02-04 10:21:12 +01:00
Daniel Willmann 33f97551c4 gprs_gmm: Check for RAT change and ensure this only happens for RAU/ATT
Change-Id: I38cb31907eddeade5350cdb648df179408d908d2
Related: OS#3727
2020-02-04 09:27:20 +01:00
Pau Espin 379e75aac2 Bump version: 1.5.0.91-5997-dirty → 1.6.0
Change-Id: I99e6950db3f54c6291dd259bed9b5c46cc26c465
2020-01-03 19:17:56 +01:00
Oliver Smith 14ec634afa osmoappdesc.py, tests: switch to python 3
Make build and external tests work with python3, so we can drop
the python2 dependency.

This should be merged shortly after osmo-python-tests was migrated to
python3, and the jenkins build slaves were (automatically) updated to
have the new osmo-python-tests installed.

Related: OS#2819
Depends: osmo-python-tests I3ffc3519bf6c22536a49dad7a966188ddad351a7
Change-Id: I8c07d99c1bc9f0383e4bce17544e0998998cc54d
2019-12-11 09:41:27 +01:00
Harald Welte 92726d9ec0 exit(2) on unsupported positional arguments on command line
Change-Id: I4f2d70d0b0f1b7bdb8604c930aba8fbb53d8bd54
2019-12-03 22:28:19 +01:00
Oliver Smith def05d3f2e regen_doc.sh: support gbproxy, run without docker
Do not only update the VTY reference and counters of osmo-sgsn, but also
the VTY reference of gbproxy.

This was not possible with the old code path of calling "regen_doc.sh"
inside docker-playground.git, as it expects the program to be updated to
have the same name as the docker image. Using the docker-playground
script also has the disadvantage, that one must push the development
branch to git.osmocom.org before updating the VTY reference/counters,
because that script would build a new docker container with a freshly
cloned repository, check out the same commit that we have already
locally, build that and then finally regenerate the docs.

So instead of adding another parameter for the docker image to the
script in docker-playground.git and calling it twice, simplify the
process by rewriting the regen_doc.sh script in osmo-sgsn.git. Make it
start the locally installed osmo-sgsn and osmo-gbproxy binaries and
call osmo_interact_vty.py on them.

Related: OS#4292
Change-Id: I8b5bd5347ea34266ad650383372630f2a84d5cce
2019-12-03 11:41:21 +01:00
Oliver Smith 149a95cf6f doc: add OsmoGbProxy VTY reference
Depends: (osmo-gsm-manuals) I4dea3e07b88175b2a88e577129360af7ec5f87e1
Related: OS#4292
Change-Id: I24c3ca2fc2446673edceefb797c7d800c3a1a5d2
2019-12-03 11:39:26 +01:00
Oliver Smith 7ca0e60c64 gitignore: fix paths to binaries
Change-Id: Ia968bbc5de34e9068d4b414e5a701b958ae517e5
2019-12-02 14:40:31 +01:00
Harald Welte 5c0ba71609 manual: Fix copy+paste error
Change-Id: I5753ded676951998a1fd76e4d2c2bf3311213f53
2019-12-01 14:31:16 +01:00
Harald Welte 9389097dd5 check for osmo_ss7_init() error return value
Change-Id: Ic228273aa6fb197b78c70c467a4a99af317e8098
2019-12-01 12:43:17 +00:00
Harald Welte f305728847 check for osmo_fsm_register() error return values
Change-Id: I2028c82ac1b0421101c3f5d04fd999b65abdbf08
2019-12-01 12:43:17 +00:00
Harald Welte a5ad7a41c4 Initial OsmoGbPROXY user manual
This adds a very basic manual consisting of nothing more than
the common chapters and a high-level description of what it is
all about.

Change-Id: I80d4ea016376c59995ccfcd8685c7c0e86745bd2
2019-12-01 12:42:58 +00:00
Harald Welte d334be24fa LLC: Don't use hard-coded N201-U / N201-I values in XID
The N201 values are negotiated per SAPI, and there are default values
per each SAPI.  Let's use those rather than hard-coded values.

Closes: OS#3954
Change-Id: I447a3c6dd85311772a6e219c62dc820d2726857f
2019-11-30 18:50:50 +00:00
Max 1ad2e0b881 Use libosmocore constant for IMSI length in ACL entry
Presumably the length is chosen to match that of imsi in
osmo_gsup_message.

Change-Id: I138aea409aab0c748c75546e628797fc7498bf40
2019-11-23 19:12:45 +07:00
Pau Espin 4a0cd05b8e gprs_gmm.c: Send XID reset with received TLLI
Otherwise lower layers will end up using a TLLI from PTMSI which was not
yet announced to the MS if it is still not in GMM attached state, as
showcased by SGSN_Tests.TC_attach_req_id_req_ra_update.

Related: OS#3957, OS#4245
Change-Id: Ide51726abb82f5784eca4ab8d62b2ad8512be843
2019-11-21 16:39:23 +01:00
Pau Espin ba6ab0160e gprs_llc.c: Use enum instead of hardcoded value
Change-Id: I89815f44f615a188f46a13f3785b3f7484f73bb3
2019-11-21 16:15:52 +01:00
Pau Espin 1a406ea90d Improve logging in gprs_llc.c code
Change-Id: Id89cc6760179fb9b1709a30b5d1af41d466b280b
2019-11-21 14:15:10 +01:00
Pau Espin 35e6c21ef6 gmm: Fix assertion hit during RA UPD REQ before completting gmm attach
Output:
20191107021548500 DMM <0002> gprs_gb.c:40 MM_STATE_Gb(2596296189)[0x6120000084a0]{Idle}: Received Event E_MM_PDU_RECEPTION
20191107021548500 DMM <0002> gprs_gmm.c:1531 MM(/d4b6d7af) -> GMM RA UPDATE REQUEST type="RA updating"
20191107021548501 DMM <0002> gprs_gmm.c:1615 MM(/d4b6d7af) The MM context cannot be used, RA: 901-70-2758-208
Assert failed mmctx->gb.llme == NULL gprs_gmm.c:1620

Scenario reproducing the crash can be triggered with TTCN3
SGSN_Tests.TC_attach_req_id_req_ra_update.

Basically, SGSN first receives an ATTACH REQ with a given RA ID, then
SGSN switches to state CommonProcedureInitiated and sends GMM ID REQ,
and MS/PCU answers immediatelly with a RA Update instead with a new RA
ID.

Related: OS#3957, OS#4245
Change-Id: I64fa5cf1b427d3abb99e553e584897261a827ce6
2019-11-08 18:50:29 +01:00
Pau Espin c1a64fa5c1 sgsn_libgtp.c: Drop use of deprecated libgtp APIs gtp_retrans*()
Since osmo-ggsn.git c94837c6a401bf0f80791b619a9b4cfbe9160afd, those
APIs are a no-op since timers are tracked internally through osmocom
APIs (and at the same time, new implementation fixes some timing related
bugs).

As a result, osmo-sgsn depends now on at least that libgtp commit. Since
it's not yet avaiable on latest libgtp release, let's track it down in
TODO-RELESE to not forget to update libgtp requirements during osmo-sgsn
release.

Related: OS#4178
Change-Id: Ia9a93d4a6ed63cd0c736f9a99d81d730b958d82e
2019-10-21 08:31:31 +00:00