Commit Graph

6368 Commits

Author SHA1 Message Date
Pau Espin 0480c89ae9 examples: Add osmo-sgsn_custom-sccp.cfg
Change-Id: Id3a3ccbf168fbbc28153cbf7f0249294eee34d3d
2019-08-21 09:08:19 +00:00
Pau Espin ce869133b9 gprs_gmm.c: Use osmo_rai_name() in log line
Change-Id: Ieab9b7696c93de9a5d3d42f614072a6f2181e37d
2019-08-20 17:48:47 +02:00
Alexander Couzens 4ad741eef4 gprs/gprs_gmm: implement T3314. Timeout to reset MM state READY->STANDBY
When a MS MM state is READY its exact location is known (PCU).
On Gb, T3314 (aka TS 23.060 "READY timer") sets the MM state from
READY to STANDBY, where only the RA is known.

Introduce a second set of timer variables, because state timer
can run while another packet state timer is timing out.

Related: OS#1941
Change-Id: I4ce23ebe50d141076c20c9c56990b7103cd25e55
2019-08-20 17:48:47 +02:00
Pau Espin 4330ea9630 tests: Introduce vty-transcript-test tests
Add a few commands to make sure it's working fine, and print all
available timers with default values.

Change-Id: Ifd092b9561d49be1f62769d95ba49f6e4aeb4066
2019-08-20 17:48:47 +02:00
Pau Espin 1b8364d0b5 Replace own timer infra with libosmocore osmo_tdef
VTY command "show timer" is also available now.

Change-Id: Ia0cf5f0a49737fbc419e2ccc86312d01c6e0056e
2019-08-20 17:48:31 +02:00
Pau Espin 089d2c1194 tests: Verify that timers can be set over VTY
Change-Id: I486fc2a56e235a539836894d2042c1ca6e514ab9
2019-08-20 10:34:29 +00:00
Pau Espin a9af5dbee2 gprs_gmm: Avoid spaces in fsm events and enum strings
FSM doesn't expect receiving event names containing spaces (log lines
generated are confusing).

Similar for enums, it's better using code names to match easily and make
log lines more clear.

Change-Id: I16ede8bf8352b09bc772fd7b43fad2c2274b3ec1
2019-08-20 10:34:29 +00:00
Pau Espin ace7e04df1 Introduce and use log macros when no mm ctx available
Change-Id: Iba22060d8646bc8ec6227684ccb91d98cb4c7be2
2019-08-20 10:34:29 +00:00
Pau Espin 3be213af50 gprs_gmm.c: Call mmctx_set_(p)mm_state only on related ran_type
For new readers it's very confusing why PMM states and MM states are in
the same enum, but handled with different functions, and sometimes
called one right after the other with different enums. Calling them when
on a different ran_type makes the function early return, so let's better
conditionally call the function to make it clear in the flow when the
function is expected to do something.

Change-Id: I65ad9e180177bc9fc7c4a037cd85cfe33b161f73
2019-08-20 10:34:29 +00:00
Pau Espin 1ad0de05e2 gprs_gmm.c: Fix typo in log message
Change-Id: I357f0af89f5d14d304c3e889a49a5f6c23b7fb7a
2019-08-19 17:29:38 +00:00
Pau Espin 7c113d3bee sgsn: use sccp_simple_client API to setup ss7 id 0 instead of 1
Implementation of osmo_sccp_simple_client() API internally uses ss7 id
1, which is confusing since there's no 0 in use in osmo-sgsn. Let's
explicitly use the 0 one so it is configured by "cs7 instance 0" in the
VTY.

Related: OS#4157
Change-Id: I0e23a6a76ebcba0b1b424e3d3b20d06c1da44cbe
2019-08-19 17:57:16 +02:00
Pau Espin e88da83fdf gprs_gmm.c: Flag mmctx_set_(p)mm_state() functions static
Change-Id: I061144b6994ee40d5b32eb321dd4f3d3786d028d
2019-08-15 13:15:48 +02:00
Pau Espin d18942b6e1 gprs_sgsn.h: Flag MM_CTX_T_GERAN_Iu as not supported
Change-Id: I3b53a530ab25434e2b2f4d80ad70a8a5f22bfcac
2019-08-15 13:15:21 +02:00
Pau Espin b516f7392d gprs_gmm.c: Use correct function to set MM_IDLE state during cleanup
Change-Id: Ic6912269d0d69c86f19e57f3271ebda1328e968f
2019-08-15 13:12:36 +02:00
Pau Espin 6b87d8e9f7 gprs_gmm: Introduce assert to guard against unexpected condition
This may well be the culprit of OS#3957, were already freed llme is accessed from
mmctx context later on, upon some timer is triggered in mmctx.

Related: OS#3957

Change-Id: I8e1eaeb9b3ebee8e45704b4fe007190c7db609e4
2019-08-15 13:12:11 +02:00
Pau Espin 057048c7fe gprs_sgsn.c: Remove recently introduced assert
Recent commit added an assert to make sure unexpected conditions were
happening in sgsn_mm_ctx_cleanup_free(). Old code was passing
mm->gb.tlli to gprs_llgmm_assign with "new tlli" being all-1's (aka
unassign mm->gb.tlli).
The commit changed the code to use gprs_llgmm_unassign, which uses
llme->tlli instead of mm->gb.tlli, and the assert was used to make sure
no behavior change occured with the commit.
It seems TTCN3 test TC_attach_auth_id_timeout triggers that assert, and
after closer debug it seems mm->gb.tlli == llme->old_tlli, which makes
sense since there's a mm->gb.tlli_new which is expected to be
llme->tlli.
When TLLI changes in GMM (Attach Request or RA Update), it is stored
into mm->gb.tlli_new and assigned on the LLC layer using gprs_llgm_assign(),
and upon completion signalling from MS, (after handling response to initial request)
it is assigned to mm->gb.tlli (and value kept in mm->gb.tlli_new).
So mm->gb.tlli and mm->gb.tlli_new usually contain the same value unless
a new TLLI is allocated, and during the span of
Request->Response->Complete it is kept different, the LLC layer having assigned
the value of mm->gb.tlli_new.
So, old code (before the commit adding the assert) was wrongly using
mm->gb.tlli instead of mm->gb.tlli_new at the moment of unassigning (but
not really problematic in practice since behavior is the same as long as
"old TLLI" value is not all-1's.
So we are fine and correct using gprs_llgm_unassign() (which passes llme->tlli
as "old TLLI") instead of what used to be done before.
In any case, the expected behavior is to free the llme object and get
rid of everything...

Fixes: 788863cda53298c24110d0fe0f8cd3309cdec747
Change-Id: I482acdbdf05ce0cb0a5804206672512854067f5b
2019-08-13 20:58:17 +02:00
Pau Espin c6f4747cfc gprs_gmm: Clarify comment during TLLI assignment
TS 04.64 sec 7.2.1.1 LLGMM-ASSIGN specifies:
"""
If TLLI Old  all 1's and TLLI New  all 1's then TLLI Old and TLLI New are assigned, and TLLI New shall
be used when (re-)transmitting LLC frames. Both TLLI Old and TLLI New shall be accepted when received
from the peer. It shall be treated as a TLLI change according to subclause 8.3.2.
"""

Change-Id: I3a17715bf2dba7b03c1335ad106307eb4d5f564a
2019-08-13 20:23:08 +02:00
Pau Espin 44e66b2562 gprs_sgsn.c: Warn upon llme free unexpected scenarios
May be useful to detect unexpected conditions which could end up in
memory leaks.

Related: OS#3957
Change-Id: I0d175501083ce458ff1c07ad38761d2cbf4ea470
2019-08-12 18:33:39 +02:00
Pau Espin b06917dc15 Introduce define TLLI_UNASSIGNED
Change-Id: Ib8be5af2a5e92a7403505b73ce4c1751832de40d
2019-08-12 17:50:00 +02:00
Pau Espin 1aae58c2a2 gprs_gmm.c: Drop unneeded brackets
Change-Id: Ie8ba2b9da695de8730834abb591df64295bb6172
2019-08-12 17:43:35 +02:00
Pau Espin f696c4af89 gprs_gmm.c: Improve doc on nullable parameters
Change-Id: Iefb9b6dc34d87b4088c7535ef0a246103fe3f7e9
2019-08-12 16:43:58 +02:00
Pau Espin 9e3fee983b gprs_llc.h: Improve documentation of some structs
Change-Id: I1b45f45addc87c74f3ae109e544143a1335180de
2019-08-12 16:23:04 +02:00
Pau Espin be49cebe8a gprs_gmm: Introduce macros to access msgb's associated IU UE ctx
Change-Id: I4d1d47af332d4557e8a3a70c1055bcc172166016
2019-08-12 16:06:49 +02:00
Pau Espin eab9d387c7 Bump version: 1.4.1 → 1.5.0
Change-Id: Ife43559f395b9602f0b131a672f8d87d6ee48ea2
2019-08-08 16:46:31 +02:00
Pau Espin d91102f53a Require newer versions of dependencies
New APIs only available since libgtp 1.4.0 are needed, and in turn that
libgtp version requires newer libosmocore 1.1.0.

osmo-sgsn itself requires libosmocore 1.2.0 since it uses GSM23003_TMSI_SGSN_MASK.

Change-Id: I1c67d3e7dda093b4869756c7a63dc7a4549084ae
2019-08-08 16:44:05 +02:00
Pau Espin 9a9c8cbbe8 Remove undefined param passed to {logging,osmo_stats}_vty_add_cmds
Since March 15th 2017, libosmocore API logging_vty_add_cmds() had its
parameter removed (c65c5b4ea075ef6cef11fff9442ae0b15c1d6af7). However,
definition in C file doesn't contain "(void)", which means number of
parameters is undefined and thus compiler doesn't complain. Let's remove
parameters from all callers before enforcing "(void)" on it.
API osmo_stats_vty_add_cmds never had a param list but has seem problem
(no "void"), so some users decided to pass a parameter to it.

Change-Id: Ic4af704958819e6f65ac01be33ef5b3d69628ad0
Related: OS#4138
2019-08-05 16:03:39 +02:00
Daniel Willmann c1ccf66e41 configuration.adoc: Add a section about encryption
Change-Id: I3a2b84d386f55447e9eed35e59fdc0272e5147d1
Related: OS#1720
2019-07-30 09:02:27 +02:00
Daniel Willmann d2badb32aa configuration.adoc: Small fixes
Fix some typos, correct data compression command, add example to turn
off compression.

Change-Id: I6beff8c66eacf12f1081d51dd6b124bdd4478558
Related: OS#1720
2019-07-30 08:59:39 +02:00
Oliver Smith 7918e6a4a7 osmo-gbproxy.cfg: fix conflict with osmo-sgsn.cfg
Listen on 127.0.0.100 by default, so there is no conflict on
127.0.0.1:23000. This allows starting both services with their default
configuration, like we are doing it in the Osmocom-Debian-install-*
jenkins jobs.

Related: OS#3369
Change-Id: I6e3053de8885a7954296d820c6a069d06276e4df
2019-07-29 08:26:37 +00:00
Daniel Willmann 33ab444b20 osmo-sgsn: Fix outdated information in usermanual
Quite a few features that are listed as not-implemented in the overview
section are actually implemented now.

Change-Id: I8d499a25293b69babc2aebb2d697438f8ba8141f
Related: OS#1720
2019-07-26 12:05:12 +02:00
Daniel Willmann 57cef23400 Add/fix help string for version option
osmo-sgsn was missing the help text of the -V option
gb_proxy still thought of itself as OpenBSC
Omit the name of the program in the help text to avoid such issues in
the future.

Related: OS#1720
Change-Id: Ib57694b6bff7c98a269dc4b4dbb7173349a57b81
2019-07-26 11:59:00 +02:00
Oliver Smith e03b33e8aa osmo-gtphub.cfg: fix conflict with osmo-sgsn.cfg
Change bind-to-sgsns from 127.0.0.1 to 127.0.0.10, so osmo-gtphub's
default config does not conflict with the osmo-sgsn default config. The
value of bind-to-ggsns does not clash with osmo-ggsn's config, so it was
left unchanged.

Related: OS#3369
Change-Id: Id892e1f4ab2daabbe9824b819b5fed985373b97a
2019-07-24 19:32:05 +00:00
Daniel Willmann 9a6cb5096f manuals: Update vty/counter documentation
Change-Id: Id7245eb1011d1f04d5dfa1503a96d100bc98344c
Related: OS#1700
2019-07-24 10:41:28 +02:00
Eric Wild d855b30f07 turn -Werror=null-dereference into a warning
There is unfortunately no way to suppres this witha pragma,
and gcc 9 uncovers quite a few new instaces with enabled LTO that can't/won't be fixed
"error: potential null pointer dereference"

Related: OS#4123
Change-Id: I4d1219bf84d3b8dcaf925a60cf54abe733fba263
2019-07-22 19:57:02 +00:00
Vadim Yanitskiy 3d8b009b0f sgsn_mm_ctx_find_ggsn_ctx(): fix: always set gsm_cause
GCC 9 complains that variable 'gsm_cause' in do_act_pdp_req() may
be uninitialized. This may happen if sgsn_mm_ctx_find_ggsn_ctx()
would return NULL due to no static GGSN configured.

Change-Id: I09c608045dd35b9898b82e236a306ab9a6c2c0b9
2019-07-18 15:05:04 +07:00
Ruben Undheim 5d3cab7ec2 Spelling fixes
Change-Id: Id1511c5022a239db5d0b44ec7adf048cca307751
2019-07-17 10:59:24 +00:00
Oliver Smith 5413865711 contrib/jenkins.sh: run "make maintainer-clean"
Related: OS#3047
Change-Id: Ic887518bd149f325a92c3517ee90c655b1368fd8
2019-07-10 13:24:35 +02:00
Daniel Willmann e7a5764f1a manuals: Add script to regenerate vty/counter documentation
Change-Id: I8ee63a3da532285def8de7fe5e90873152adb21e
Related: OS#1700
2019-06-19 14:24:13 +02:00
Eric Wild 1fd8a7e887 replace magic tmsi constant with define
Depends: libosmocore I52b9f6b5f3e96d85a390ba2af21d7814df8aaeec
Change-Id: Icf9f466efce520779c926b47b6e6d6c9815120eb
2019-06-17 13:50:13 +02:00
Pau Espin 52ddbdea1f sgsn: Have authentication required on by default
Previous commit introduced command "authentication (optional|required)",
which is only meaningful if auth-policy is remote. Upon adding the cmd,
it changed the default logic for remote policy to not require
authentication, which broke TTCN3 tests because sgsn no longer tries to
authenticate the users.

Since it's actually good to enable authentication by default where
possible, let's enable it by default when on auth-policy remote.

In order to do so, let's simply not care about the value of variable
require_authentication if auth_policy is not REMOTE. As a result, we
drop parts of the previous patch and remove unneeded checks (which are
only partially useful based on order of commands during VTY read).

Fixes: 794f446a284ed1ac6d31eb79a8f4c874d66fc34e
Change-Id: Ic707a95af178b44f08809df3d3bc8354bf34273c
2019-06-13 19:23:36 +02:00
Vadim Yanitskiy 9afe43502d osmo-sgsn: add VTY parameter to toggle authentication
It may be useful to have 'remote' authorization policy, but do not
require authentication in GERAN at the same time, e.g. in combination
with 'subscriber-create-on-demand' feature of OsmoHLR.

This change introduces a new VTY parameter similar to the one
that we already have in OsmoMSC:

  authentication (optional|required)

Please note that 'required' only applies if 'auth-policy' is 'remote'.

Change-Id: I9909145e7e0af587c28827e16301a61b13eedaa9
2019-06-06 19:45:34 +00:00
Pau Espin 81bcdc301d sgsn_libgtp: Use new per-GSN libgtp API instead of deprecated API
Depends: osmo-ggsn.git I653cbdc185165592d985e3efab6e3f1add97877b
Related: OS#2873
Change-Id: Iaaffe0ec4d9590309c62b62c446677c6f6732f2a
2019-06-06 15:30:47 +00:00
Vadim Yanitskiy 5c78d386d4 doc/manuals/vty: regenerate sgsn_vty_reference.xml
Change-Id: I3dfe3598055457cc9724a371590e676f1920652b
2019-06-05 01:31:57 +07:00
Oliver Smith dde4050cef debian: create -doc subpackage with pdf manuals
I have verified, that the resulting debian packages build in my own OBS
namespace (see the -doc packages):
https://download.opensuse.org/repositories/home:/osmith42/Debian_9.0/all/
https://build.opensuse.org/project/show/home:osmith42

Depends: Ib7251cca9116151e473798879375cd5eb48ff3ad (osmo-ci)
Related: OS#3899
Change-Id: I9c09a0cb5c65fa2e2cd9817edb4656b2a1a35bb9
2019-05-29 12:14:20 +02:00
Pau Espin 226b4bc58a sgsn: Fix echo timer not started upon first pdp ctx created
Commit 176a4d2f33865a5c0433f8679f5e68f209d7b874 moved echo timer related
code to its own function but did some mistakes when moving the logic
from several places into its own function. As a result, echo timer was
only enabled after the 2nd pdp ctx was created, instead of the expected
1st.
First, let's be consistent and always call the function *after* changing
state, since that's what the function expects. This fixes the issue.

Finally make the logic in the function more intuitive by checking in the
if clause the only case where actually the echo timer should be enabled:
Only if policy specifies so and we have at least 1 pdp ctx against that ggsn.

Fixes: 176a4d2f33865a5c0433f8679f5e68f209d7b874
Change-Id: I826030978edb61ea5a172c2b72f63758206a6246
2019-05-29 08:45:43 +00:00
Pau Espin a8459de1ef Document max retransmit times for T3395
Spec also states same value is used for T3390, which we don't yet
implement.

Change-Id: I1a2276bd42d1ea5706cf9cc26d3e44baa6fbf066
2019-05-28 21:27:56 +02:00
Pau Espin ca4756bf4f sgsn: vty: Improve log warning content with spec section
Change-Id: I68e87f29711a282a97a43b175f13b3c70112ab60
2019-05-27 17:35:32 +02:00
Max 4ce2791691 Fix IMSI padding in imsi-acl
In I73fd54ad3a4ab8be5aff0fee5c722597ad766e9d incorrect fix was added
which only initialize first element of array. Fix this by using explicit
index to initialize entire array.

Change-Id: I26e4aa44f159d1b5b91dda4a586fd4e809711245
2019-05-12 10:35:40 +00:00
efistokl b842c03818 gprs_gmm: send Service Reject when no PDP ctxs are available.
Look at PDP Context Status IE: if there are any PDP contexts which are
ACTIVE on MS side and there are no PDP contexts which are ACTIVE on the
network side, then send Service Reject with the cause "NO PDP
ACTIVATED". This forces MS to reactivate the PDP contexts.

3GPP TS 24.008 Section 4.7.13.4 Service request procedure not accepted
by the network. Cause # 40.

Fixes: OS#3937
Change-Id: If610cbef17c25ec44e65d4f1b2340d102c560437
2019-05-11 05:28:49 +00:00
Keith Whyte 745636586f Echo zero byte XID-Field of Type L3_PAR
After Activate PDP Context request, Motorola KRZR
sends a zero length XID-Field of Type L3 Parameters

If this is not echoed back, the phone will send
Deactivate PDP Context request with SM Cause:
LLC or SNDCP failure(A/Gb only) (25)

Closes: OS#3426

Change-Id: Ibd75f7b943c84ed7264481fa2e4bc3cb2f6745d4
2019-05-02 09:38:28 +00:00