aboutsummaryrefslogtreecommitdiffstats
path: root/src/gprs
AgeCommit message (Collapse)AuthorFilesLines
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
2019-06-06osmo-sgsn: add VTY parameter to toggle authenticationVadim Yanitskiy1-1/+36
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-06sgsn_libgtp: Use new per-GSN libgtp API instead of deprecated APIPau Espin Pedrol1-1/+1
Depends: osmo-ggsn.git I653cbdc185165592d985e3efab6e3f1add97877b Related: OS#2873 Change-Id: Iaaffe0ec4d9590309c62b62c446677c6f6732f2a
2019-05-29sgsn: Fix echo timer not started upon first pdp ctx createdPau Espin Pedrol1-7/+9
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-28Document max retransmit times for T3395Pau Espin Pedrol1-2/+5
Spec also states same value is used for T3390, which we don't yet implement. Change-Id: I1a2276bd42d1ea5706cf9cc26d3e44baa6fbf066
2019-05-27sgsn: vty: Improve log warning content with spec sectionPau Espin Pedrol1-1/+1
Change-Id: I68e87f29711a282a97a43b175f13b3c70112ab60
2019-05-12Fix IMSI padding in imsi-aclMax1-1/+4
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-11gprs_gmm: send Service Reject when no PDP ctxs are available.efistokl1-1/+25
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-02Echo zero byte XID-Field of Type L3_PARKeith1-0/+8
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-04-30gbproxy: parse dtap GSM48_MT_GSM_DEACT_PDP_REQ|ACKAlexander Couzens1-0/+8
Fix a warning "Unhandled GSM 04.08 message type ...". Fixes: OS#3466 Change-Id: I20bf4db8da746e0b994bfe3f8178188831b67ed3
2019-04-27gprs_sndcp_comp_free: Replace ifelse with switch and better handling of errorPau Espin Pedrol1-2/+9
gprs_sndcp_dcomp_term asserts if compclass is not SNDCP_XID_DATA_COMPRESSION, so this way by checking in the caller too we easily now if the unexpected value is in compclass or in algo.dcomp. Change-Id: I4600e6a137f42f20fdf69637e4a9048b265c1748
2019-04-24gb_proxy: cosmetic: Use 'bool' in data structures where applicableHarald Welte4-25/+25
If we ever only use 0/1 in an 'int', we should have used 'bool'. Change-Id: I63876f52d5de87e4c99d92669270fd1f487e217c
2019-04-24LLC: Store the XID inside the LLC Entity, not LLC Mgmg EntityHarald Welte2-19/+18
For every logical session between a MS and the SGSN, there is one LLME (LLC Management Entity) and a set of LLEs (Logical Link Entities): One for each SAPI. The XID procedure used to establish LLC configuration values such as N201 (MTU) parameters happens on each LLE separately. The negotiated parameters only affect that one LLE (SAPI) and are not global. Still, the OsmoSGSN LLC code has the "struct llist_head *xid" member as part of the gprs_llc_llme, and not as part of the gprs_llc_lle. This list is a cache of the XID fields we have sent with the last XID request, which is used in processing the response from the MS. If two XID handshakes were to occur concurrently on two LLEs, the state between them would get messed up. It must be maintained separately for each LLE. Closes: OS#3955 Change-Id: Iaeb54ca5ac58391be45e56c2e721f531969f3a9e
2019-04-24gprs_llc: Correctly refuse any ABM command (SABM, DISC) with DMHarald Welte1-0/+22
According to Section 6.4.1.4 of 3GPP TS 04.64 The DM unnumbered response shall be used by an LLE to report to its peer that the LLE is in a state such that ABM operation cannot be performed. An LLE shall transmit a DM response to any valid command received that it cannot action. Closes: OS#3953 Change-Id: Ie8b8e16d5a68f19f21dc4fdb5703c8a794e0173c
2019-04-23LLC: Avoid NOTICE message on LLC NULLHarald Welte1-0/+3
A MS sending LLC NULL frames on cell change is a perfectly normal event, and we shouldn't log any cryptic NOTICE messages about it. Change-Id: I6be0b9c8813dfb40a7955422fd8e7cebf94d189c
2019-04-23LLC: Don't blindly assume all LLC frames have data payloadHarald Welte1-3/+8
In reality, only UI, I, SABM, UA and XID frames carry payload. All other frames will have llhp.data == NULL. Let's therefore not do any msgb adjustments unless we actually know there is a user payload field. Change-Id: I51bbd0f2c618d477a037af343ff41de1c8a5a3ae Closes: OS#3952
2019-04-23LLC XID: Fix string representation of N201_UHarald Welte1-1/+1
Change-Id: I8799e3a3c47377aeeb9923d9d73f5d0b73cd8d0b
2019-04-16gprs_gmm: reintroduce calling gsm48_gmm_authorize when not handling GMM ↵Alexander Couzens1-1/+6
Attach Requests A security command is part of multiple procedures to ensure integrity (optional also encryption) between MS and RNC. It should be used for all Iu connections once. With the rewrite of the GMM Attach FSM the use of the security command procedure was broken for all procedures e.g. Service Request except GMM Attach Request. Relates: OS#3920 Change-Id: I50e8e316f06ae1a6171a6b07e4e2f0761322b779
2019-04-08gsm0408_rcv_gmm: send Iu-ReleaseCommand upon receiving Attach Complete.efistokl1-0/+7
UE expects to receive Iu-ReleaseCommand after Attach Complete. If it doesn't receive it, then it sends Iu-ReleaseRequest after a timeout which makes the "PS Activation" process long. Change-Id: Ib5053e3cd655d08ff3fd0fefa48325fabb1797c8 Related: OS#3908
2019-02-14GMM: permit VLR_ANSWERED event in attach FSMMax1-1/+7
This fixes following error: DMM gprs_gmm.c:1126 GMM_ATTACH_REQ_FSM(gb_gmm_req)[0x5589e78dded0]{WaitAttachComplete}: Event VLR answered not permitted There seems to be a race condition in FSM when MS establishes MM context which isn't immediately followed up by PDP context (for example when no APN is configured in MS). This does not affect actual functionality because in this case MS won't be able to use GPRS anyway but it's still nice to get our FSM fixed even in this corner case. Change-Id: I14d234632224e20faf865d2273c83cfff31abf61
2019-02-13Improve 'show subscriber cache' vty commandMax1-10/+13
* don't use spaces when printing hex data like RAND, SRES etc to increase the chance that it'll fit onto single line which will improve readability * don't print non-existent QoS value Change-Id: I0a09063f30c1116803994117f49df9d02bcc9181
2018-12-20make gsup ipa name configurable in osmo-sgsn.cfgStefan Sperling2-2/+30
Add a 'gsup ipa-name' VTY command which overrides the default IPA name used by the SGSN on the GSUP link towards the HLR. This is required for GSUP routing in multi-SGSN networks. The 'gsup ipa-name' option can only be set via the config file because changing the IPA name at run-time conflicts with active GSUP connections and routes configured in the HLR. The osmo-sgsn program must be restarted if its IPA name needs to change. Related: OS#3356 Change-Id: Ib2f65fed9f56b9718e8a9647e3f01dce69870c1f
2018-12-12remove pointless declaration of struct gsm_networkStefan Sperling2-8/+2
We were passing a NULL pointer of type struct gsm_network * to ctrl_interface_setup_dynip(). Remove the pointless declaration of this struct. Also, replace the sgsn_controlif_setup() helper function with a direct call to ctrl_interface_setup_dynip(). The helper fnuction was just a thin wrapper around the latter. Change-Id: Ib4151afa5bff01e63b462cca517fb60ac0503759 Related: OS#3356
2018-12-11Use explicit parameter for sgsn_auth_init()Max2-2/+2
This is necessary to properly test ACLs in follow-up patches. Change-Id: Ibeba371234680f33ad35afbfffce9dca185228c1
2018-12-10Use explicit length checkMax1-3/+1
Use OSMO_MIN macro to check for MSISDN length. This makes the code cleaner and will, hopefully, aid static analysis tools. Change-Id: Ic0fbeb8d248c74e54bfb51ba2cdea55c4f386ac7 Fixes: CID57879
2018-12-10Constify sgsn_acl_lookup() parameterMax1-1/+1
This requires I414e67a3de733fab407161b3264d3b89070ba537 in libosmocore to avoid warning about discarded const. Change-Id: Ie92637dd900b0f9eba891d5aad0b4ba0ee69c08c
2018-12-10Remove misleading commentMax1-1/+0
The code which has been used for 4 years is hardly temporary. Change-Id: Ibe9c62e0beb89eecced941b8831d49ca266c7330
2018-11-26gbproxy: flush_stored_messages: Get rid of msg paramPau Espin Pedrol1-7/+5
Log line actually makes more sense out of the function where IMSI acq is resolved. We can then get rid of msg param which may cause confusion and add complexitiy to code for no good reason. Change-Id: I6716a260e12a3cf36af0501ce611c6c1e608f537
2018-11-26gbproxy: flush_stored_messages: Log and route using stored_msg infoPau Espin Pedrol1-2/+2
It makes no sense to print every stored_msg with BVCI from msg, same for routing. This will allow getting rid of "msg" completelly in next commit. Change-Id: I95eafbf41012be3e02c68fc996773dd02b174fe6
2018-11-26gbproxy: flush_stored_messages: Move comment to func descriptionPau Espin Pedrol1-2/+2
Change-Id: I14a90d1957a2cbd8fd53002b035fe481ab3abbbf
2018-11-26gbproxy: Remove unneeded parse_ctx paramPau Espin Pedrol1-6/+4
The only use inside the function is only to log information which should actually be provided by tmp_parse_ctx of each stored msg. Change-Id: Ic186b92fa9bd0a2b853a0cf525c6f6feb9493897
2018-11-26gbproxy: Fix abort during APN patchPau Espin Pedrol1-1/+1
gbproxy process was aborted with following message during APN patching: <000e> gb_proxy_patch.c:129 Patching ACT_PDP_REQ to SGSN: Replacing APN 'foo' -> 'bar' msgb(0x5555558797d0): Sub area is not fully contained in the msg data During osmo-sgsn 107fb59e84b12bbf6bdfdd4fc241dbcda7332706 old copy of gprs_msgb_resize_area was replaced by more modern libosmocore version called msgb_resize_area. They are mostly identical but the later has some extra verification asserts. One of this asserts was triggering the process abort, but the bug has always been there as far as I could see in git history. The assert triggers because the bssgp buffer and parse_ctx point to "stored_msg", while the data buffer comes from a different msbg "msg", which is clearly wrong behavior. In the modified line, "msg" (the one which provided the imsi now already stored in link_info through gbproxy_update_link_state_ul()->gbproxy_assign_imsi()) is really not needed anymore, and we want to patch the stored msg going to be forwarded. Related: SYS#4397 Change-Id: I7226fc5bcfbf58c349431d0a39cdb904fefd9e9c
2018-11-25Revert "gbproxy: fix formatting in gbproxy-state command"Max1-1/+1
In case of multiple bts peers we use '\n' as individual entries separator. This reverts commit fffd6cb0d8011442bb69974675f86ad087b7d8db. Change-Id: I1ea17919ec3ed7e26044df8b5f8324717ee9e32c
2018-11-22gbproxy: flag gbproxy_assign_imsi as staticPau Espin Pedrol1-1/+1
It's currently only used in the same file. Change-Id: I08b51f36263e58f52ef9af2a63a7fcbf06a767c4
2018-11-22gbproxy: add number-of-peers ctrl commandMax1-0/+13
Return number of BTS peers. This is especially useful when no peers are available because "gbproxy-state" command returns empty sstring in this case. Change-Id: I29b0664e60f7c81c3c7b495c1c8f2700e3f7e033 Related: SYS#2655
2018-11-22gbproxy: fix formatting in gbproxy-state commandMax1-1/+1
In ctrl protocol we don't need any explicit formatting as it might interfere with client processing our response. Let's drop trailing '\n'. Change-Id: I3f32e01dd50a53991c292aeee57a78d81cdc5429 Related: SYS#2655
2018-11-22consistently check the result of osmo_shift_v_fixed()Stefan Sperling1-5/+10
Coverity points out we forgot to check the return value of osmo_shift_v_fixed() in some places. Add checks which verify the expected length of data which is skipped by the parser. Change-Id: I20406f411810e966443d6fd5a4620b9a66cd9809 Related: CID#135160
2018-11-19Use safer functions for IMSI ACLMax1-6/+8
Avoid explicit memset which confuses coverity, use strnlen() and osmo_strlcpy() to handle strings. Change-Id: I73fd54ad3a4ab8be5aff0fee5c722597ad766e9d Fixes: CID163626
2018-11-15use enums consistently instead of falling back to intStefan Sperling5-65/+151
The two existing enums defined in gprs_sndcp_xid.h, for protocol and data compression algorithm numbers respectively, were assigned to 'int' variables when their values were copied to other structures. This prevented the compiler from checking the enum value coverage during switch statements and also tripped up Coverity scans looking for enum value mismatch problems. So instead of copying enums to ints, make use of the enums throughout. Structures which can contain values from both enums now use a union of both, forcing us to be very explicit about which set of values we are dealing with. Change-Id: I3771a5c59f4e6fee24083b3c914965baf192cbd7 Depends: If6f3598cd6da4643ff2214e21c0d21f6eff0eb67 Depends: I8444c1ed052707c76a979fb06cb018ac678defa7 Related: CID#149102
2018-11-12fix bogus error check in gprs_sndcp_comp_create()Stefan Sperling1-3/+4
The function gprs_sndcp_get_compression_class() returns -EINVAL upon error, not -1, so an existing assertion would never trigger. Instead, check for the values we want first (PROTOCOL_COMP or DATA_COMP) and assert(false) in case the returned value doesn't match either of these. Found by: Neels Change-Id: I8444c1ed052707c76a979fb06cb018ac678defa7
2018-11-12fix bogus assertion in encode_comp_field()Stefan Sperling1-1/+1
Fix an obvious logic bug in an assertion in encode_comp_field(). Found by: Neels Change-Id: If6f3598cd6da4643ff2214e21c0d21f6eff0eb67
2018-10-30Remove local libgsupclient; Use libosmo-gsup-client from osmo-hlrHarald Welte4-363/+10
osmo-hlr has recently (as of Change-Id Iad227bb477d64da30dd6bfbbe1bd0c0a55be9474) a working shared library implementation of libosmo-gsup-client. We can remove the local implementation in osmo-sgsn and use the system-installed shared library instead. Change-Id: I6f542945403cf2e3ddac419186b09ec0e2d43b69
2018-10-30Allocate sgsn_instance with tallocPau Espin Pedrol2-23/+26
Change-Id: I4a83c5799f0dbd5eb762039c6cfba671f6e465be
2018-10-30Update wrong references to bsc in sgsn codePau Espin Pedrol13-52/+52
Change-Id: I93f0dc721c2eff8a87fb9248882f24768f708713
2018-10-21gtphub: Add --version cmdline optionOliver Smith1-1/+7
Related: OS#3576 Change-Id: Icdb2bd9ec90511b51428800d17f8ce81f6804670
2018-10-06fix build: remove unused variableNeels Hofmeyr1-1/+0
fix: "src/gprs/gprs_gmm_attach.c:240:6: error: unused variable ‘rc’" introduced by "gprs_gmm: Fix missing Security Command for 3G when attaching" Change Id I1e12b0a32e58c6f78dba7b548f7d7016567229db Change-Id: I4837c10fed915c558a5374d448af813219087f36