aboutsummaryrefslogtreecommitdiffstats
path: root/src/gprs
AgeCommit message (Collapse)AuthorFilesLines
2019-09-02Move out sgsn to its own subdirPau Espin Pedrol26-16798/+0
Change-Id: I16fccc0eadf588599b9e5578d0f4dbaf9df81737
2019-09-02Move out gtphub to its own subdirPau Espin Pedrol6-4275/+0
Change-Id: I707d5e9b775179e732d281ce3d245de83d648eea
2019-09-02Move out gbproxy to its own subdirPau Espin Pedrol8-4315/+0
Change-Id: I2cc98d3a276d953609bbbbaa9782a0112687791e
2019-09-02src/gprs/Makefile.am: Move build of shared .c files to an internal libPau Espin Pedrol1-10/+22
Build files shared by osmo-sgsn, osmo-gbpy and osmo-gtphub into a .la library, so we can later split each application into its own subdir and clearly identify what's used by who. Due to a dependency error with .Po files, I cannot depend on the specific .o files directly in LDADD for each binary, but it works fine on follow up commits when binaries are splitted into different makefiles, so it will be done later. Change-Id: Ib7665c530c086a5f3135c395bb8bf19ed4a882b6
2019-09-02vty: Print MM state and RAN type in show mm-contextPau Espin Pedrol2-1/+15
Value presviosuly printed as MM state is actually usually refereed as GMM state, so rename it. Change-Id: Ia06c53f0cd2a6348237ed3abeb9367d965745aba
2019-09-02Introduce FSM mm_state_iu_fsmPau Espin Pedrol5-55/+138
Implement TS 23.060 6.1.2 Mobility Management States (Iu mode) using osmocom FSM and drop old implementation. Most of the logic on each state is still kept in gprs_gmm.c, will be inserted into the FSM later. Change-Id: I4c9cf8c27194817c56e8949af0205e1cc14af317
2019-09-02Introduce FSM mm_state_gb_fsmPau Espin Pedrol5-113/+125
Implement TS 23.060 6.1.1 Mobility Management States (A/Gb mode) using osmocom FSM and drop old implementation. Most of the logic on each state is still kept in gprs_gmm.c, will be inserted into the FSM later. Change-Id: I04004423e993107374d5a3549b8a93ac169251dd
2019-09-02sgsn_vty: Print correct Iu mmctx id in 'show mm-context'Pau Espin Pedrol1-1/+14
Change-Id: I79333bef4a4bf743fcad07812c9a213b368ff2b6
2019-09-02sgsn_vty: Fix mmctx rate_ctr output indentationPau Espin Pedrol1-1/+1
Change-Id: I1b89c179e1ba08b65e31727fdce90c7b578f4d6d
2019-09-02sgsn_cdr.c: Fix ip addr string buffer sizePau Espin Pedrol1-3/+3
INET(6)_ADDRSTRLEN already contains the required extra null byte at the end, no need to add +1 to it. Change-Id: I5a16659e007c6883fe21582cce5dac544e6d4bb9
2019-09-02gprs_gmm.c: Replace inet_ntoa with inet_ntopPau Espin Pedrol1-3/+8
inet_ntop manual states: "inet_ntoa(3) is now considered to be deprecated in favor of inet_ntop()". Change-Id: I0c708d047122f349acf46797a9e5973040e7ae04
2019-09-02Merge common allocation steps for Gb and Iu ctxPau Espin Pedrol1-30/+27
This way it's easier to add new common functionalitites without forgetting to add it on both sides, and simplifies the code. Change-Id: Ib6c0427ac7b35295cf1caf2f28cb2a5c155b9d9c
2019-09-02Split enum gprs_pmm_state into Iu and Gb counterpartsPau Espin Pedrol4-26/+27
Those two state sets are not part of the same state machine, and are used in different scenarios, so let's split them and handle them in Gb and Iu specific parts of struct sgsn_mm_ctx. This is required in order to improve related code (for instance, use osmocom fsm). Change-Id: I6100d607da316da0595886c6968704dd9ccfbde9
2019-09-02Move llc->MM/SM Gb specific glue code to its own filePau Espin Pedrol3-62/+95
Now that we have RANAP/Iu handling specificities in its own file, let's have also Gb specific glue code for messages coming from llc up to MM/SM layer in its own file. This way same entry points in gprs_gmm.c are used by Gb and Iu: gsm0408_rcv_gmm() (for MM) and gsm0408_rcv_gsm() (for SM). Change-Id: Iaf57922a0970c1d03f6f1d6337d27ae3d4aaf32c
2019-09-02Move lots of Iu/ranap specific code into its own filePau Espin Pedrol6-233/+240
RANAP related functionalities were splitted among several files (gprs_gmm.c, gprs_sgsn.c and sgsn_libgtp.c). Let's move it into its own file to shrink complexity/size of existing files. It also allows to keep a lot of conditionally enabled code (BUILD_IU) and its dependencies (osmo-iuh) together. Change-Id: I549042aaff045a378de77d657cc396ee08f22f33
2019-09-02sgsn: gtp: Drop related pdp contexts on echo timeout against GGSNPau Espin Pedrol2-7/+15
Change-Id: I7e97bac1c13a2c26203eb64e590fd75d77eb44bd
2019-09-02Introduce log helper LOGGGSN and log category DGTPPau Espin Pedrol1-1/+6
It will be used in forthcoming commits. Change-Id: I30f46f44af1d0eee324b1a995c1dad2e1315af7c
2019-09-02gprs_gmm: gsm48_rx_gmm_att_req(): refactor duplicated codeAlexander Couzens1-10/+6
Change-Id: I709f847802a975e1a75d0b87ac5125240cfd0854
2019-09-02gprs_gmm: clarify comment of Iu follow-on requestAlexander Couzens1-2/+10
Change-Id: Ib6b3a1b250de373656310a3c8f88d1d39bdcee60
2019-09-02gprs_gmm: only update gb/iu cell information when Iu/Gb presentAlexander Couzens1-9/+15
This function should not do the transistion of Iu/Gb. Only copy simple data Change-Id: Id52761f3ea655a2d0cc663a950154c6b7c1b5f7a
2019-08-30gtp: cb_delete_context(): Clarify why pdp->lib is set to NULLPau Espin Pedrol1-2/+3
Change-Id: I02c46062d6dc9802d9cae057587e66a68a65436c
2019-08-28gtp: make echo_interval unsignedPau Espin Pedrol2-5/+4
There's no real need to use -1 to indicate echo timer as disabled, since 0 can also be used (it doesn't make sense to have a timer timeout of 0). This way code is simplified. Change-Id: I689034887188a53590eddeffda781629694eb5ed
2019-08-21gprs_gmm.c: Add spec document to function documentationPau Espin Pedrol1-16/+16
Change-Id: Ibb89499e9c1ab588336df34fde26faf3fbf2c72c
2019-08-21gprs_gmm.c: Print value_string of reject causePau Espin Pedrol1-1/+2
Change-Id: I71d9abcf7e3a836c475b7adbb95a82580e41ae6d
2019-08-21vty: Introduce cs7-instance-iuPau Espin Pedrol2-1/+17
Similar to what we already have in osmo-msc. Change-Id: Iaa9e1d06dd0430848ef4f7498a3c15d13f899904
2019-08-20gprs_gmm.c: Use osmo_rai_name() in log linePau Espin Pedrol1-3/+2
Change-Id: Ieab9b7696c93de9a5d3d42f614072a6f2181e37d
2019-08-20gprs/gprs_gmm: implement T3314. Timeout to reset MM state READY->STANDBYAlexander Couzens3-1/+93
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-20Replace own timer infra with libosmocore osmo_tdefPau Espin Pedrol3-111/+122
VTY command "show timer" is also available now. Change-Id: Ia0cf5f0a49737fbc419e2ccc86312d01c6e0056e
2019-08-20gprs_gmm: Avoid spaces in fsm events and enum stringsPau Espin Pedrol2-17/+17
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-20Introduce and use log macros when no mm ctx availablePau Espin Pedrol2-14/+23
Change-Id: Iba22060d8646bc8ec6227684ccb91d98cb4c7be2
2019-08-20gprs_gmm.c: Call mmctx_set_(p)mm_state only on related ran_typePau Espin Pedrol1-14/+27
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-19gprs_gmm.c: Fix typo in log messagePau Espin Pedrol1-1/+1
Change-Id: I357f0af89f5d14d304c3e889a49a5f6c23b7fb7a
2019-08-19sgsn: use sccp_simple_client API to setup ss7 id 0 instead of 1Pau Espin Pedrol1-5/+5
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-15gprs_gmm.c: Flag mmctx_set_(p)mm_state() functions staticPau Espin Pedrol1-2/+2
Change-Id: I061144b6994ee40d5b32eb321dd4f3d3786d028d
2019-08-15gprs_sgsn.h: Flag MM_CTX_T_GERAN_Iu as not supportedPau Espin Pedrol1-0/+2
Change-Id: I3b53a530ab25434e2b2f4d80ad70a8a5f22bfcac
2019-08-15gprs_gmm.c: Use correct function to set MM_IDLE state during cleanupPau Espin Pedrol1-1/+1
Change-Id: Ic6912269d0d69c86f19e57f3271ebda1328e968f
2019-08-15gprs_gmm: Introduce assert to guard against unexpected conditionPau Espin Pedrol1-0/+5
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-13gprs_sgsn.c: Remove recently introduced assertPau Espin Pedrol1-2/+0
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-13gprs_gmm: Clarify comment during TLLI assignmentPau Espin Pedrol1-1/+1
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-12gprs_sgsn.c: Warn upon llme free unexpected scenariosPau Espin Pedrol1-1/+3
May be useful to detect unexpected conditions which could end up in memory leaks. Related: OS#3957 Change-Id: I0d175501083ce458ff1c07ad38761d2cbf4ea470
2019-08-12Introduce define TLLI_UNASSIGNEDPau Espin Pedrol3-15/+15
Change-Id: Ib8be5af2a5e92a7403505b73ce4c1751832de40d
2019-08-12gprs_gmm.c: Drop unneeded bracketsPau Espin Pedrol1-4/+2
Change-Id: Ie8ba2b9da695de8730834abb591df64295bb6172
2019-08-12gprs_gmm.c: Improve doc on nullable parametersPau Espin Pedrol1-2/+1
Change-Id: Iefb9b6dc34d87b4088c7535ef0a246103fe3f7e9
2019-08-12gprs_gmm: Introduce macros to access msgb's associated IU UE ctxPau Espin Pedrol1-22/+20
Change-Id: I4d1d47af332d4557e8a3a70c1055bcc172166016
2019-08-05Remove undefined param passed to {logging,osmo_stats}_vty_add_cmdsPau Espin Pedrol3-5/+5
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-07-26Add/fix help string for version optionDaniel Willmann3-2/+3
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-18sgsn_mm_ctx_find_ggsn_ctx(): fix: always set gsm_causeVadim Yanitskiy1-1/+2
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-17Spelling fixesRuben Undheim6-11/+11
Change-Id: Id1511c5022a239db5d0b44ec7adf048cca307751
2019-06-17replace magic tmsi constant with defineEric Wild2-3/+3
Depends: libosmocore I52b9f6b5f3e96d85a390ba2af21d7814df8aaeec Change-Id: Icf9f466efce520779c926b47b6e6d6c9815120eb
2019-06-13sgsn: Have authentication required on by defaultPau Espin Pedrol2-17/+6
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