aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmsc
AgeCommit message (Collapse)AuthorFilesLines
2016-05-04msc: fix: two missing security operation releasesNeels Hofmeyr1-0/+1
When receiving authentication response or security mode complete messages, actually release the security operation stored with the subscriber conn.
2016-05-04msc: ignore cb retval on auth/sec mode rxNeels Hofmeyr1-4/+4
Just return 0 regardless of the security callback's return value when receiving authentication response or security mode complete messages.
2016-05-04IuCS: properly clean up conn on releaseNeels Hofmeyr1-2/+2
Don't call msc_subscr_con_free() directly, instead use gsm0408_clear_request(), which properly cleans up all pending operations before freeing the connection.
2016-05-04gsm0408_clear_request(): actually free the released connNeels Hofmeyr1-0/+2
By having conn->in_release == 1, calling msc_release_connection() has no effect and thus never frees the conn. So, after all pending requests have been discarded, also discard and free the unused connection.
2016-05-04gsm04_08_clear_request(): release loc with arg release=0Neels Hofmeyr1-1/+1
In gsm04_08_clear_request(), in_release == 1 anyway and msc_release_connection() would exit immediately without any effect. Don't confuse the reader by passing release=1 arg.
2016-05-04cosmetic: move subscr_conn alloc&free to gsm_04_08.cNeels Hofmeyr2-27/+27
Subscriber conn stuff doesn't really belong in gsm_subscriber.c. (I moved because I thought it would call some static functions in gsm_04_08.c, which ended up not being the case; anyway, it makes more sense to stay in gsm_04_08.c.)
2016-05-04msc subscr: add paging timeoutNeels Hofmeyr1-0/+28
In NITB, the paging timeout would be handled from the BSC side. In IuCS, we need to invalidate the paging request from libmsc alone, so add a paging timer to gsm_subscriber. Possibly, the HNB-GW should respond with a paging failure and libmsc could trigger on that, nevertheless libmsc should not rely on a failure message to expire pending pagings.
2016-05-04subscr_paging_dispatch(): add assertionsNeels Hofmeyr1-0/+5
Make sure that subscr and conn are valid: * a subscr must always be present. * on success, a conn must be present and the subscr must match the conn's subscr. Also check the hooknum.
2016-05-04comment tweakNeels Hofmeyr1-1/+1
2016-05-04debug log for SMSNeels Hofmeyr2-1/+9
2016-05-04debug log tweaks for pagingNeels Hofmeyr2-3/+4
2016-05-04Revert "subscr_paging_dispatch(): use conn->subscr instead of separate param"Neels Hofmeyr1-3/+3
This reverts commit 6f4e83beb05b7e4fd615504a7bf6a71afe15064d, but note: this is not a 1:1 revert since the subscr_paging_sec_cb() semantics have changed. In subscr_paging_dispatch(), the separate subscr parameter is needed in cases where paging expired and there is no conn available. For subscr_paging_sec_cb(), a conn must always be available. Hence it avoids any duplicity by only passing the conn and deriving the subscr from that. Callers of subscr_paging_sec_cb() pass NULL as param, so pass conn->subscr when calling subscr_paging_dispatch() from subscr_paging_sec_cb().
2016-05-02cosmetic: IuCS loggingNeels Hofmeyr1-0/+2
2016-05-02comments and debug log for paging responseNeels Hofmeyr1-1/+18
2016-05-02msc_paging_request(): remove unused parametersNeels Hofmeyr1-4/+2
The network is known from subscr; the type is not applicable after MSCSPLIT; cbfn and data are obsoleted by explicit subscr_rx_paging_response().
2016-05-02msc_paging_request(): make staticNeels Hofmeyr1-1/+1
it is never called outside of gsm_subscriber.c
2016-05-02msc: paging: use gsm_subscriber API to add Integrity Protection for IuCSNeels Hofmeyr1-22/+1
During peliminary paging response testing, I introduced some code duplication. Remove that and instead call the code that was there before 63b99ced83773d923 ("add preliminary paging response handling, incomplete"). By calling the gsm_subscriber API, the connection is also secured and hence Integrity Protection is enabled for IuCS.
2016-05-02cosmetic: msc: handle_paging_resp() tweaksNeels Hofmeyr1-7/+7
Tweak debug logging, use paging category DPAG. Change the order of arguments to make more sense in the causal relationship.
2016-05-02paging: actually verify subscriber authorizationNeels Hofmeyr1-1/+8
Before this, any paging response would be accepted by the CN, without checking the database whether the subscriber is in fact authorized. The probability that a subscriber would be able to take unauthorized action is slim, nevertheless checking authorization status with the database should happen before we accept a connection.
2016-05-02paging: change subscr_paging_cb() into subscr_rx_paging_response()Neels Hofmeyr1-10/+5
Remove one layer of callback indirection in paging. When a paging response arrives, we always want to first secure the connection, thus a fixed subscr_rx_paging_response() function is more appropriate and avoids having to store a cbfn. The actual actions to be taken upon successful paging are of course still in callback functions stored with each subscriber.
2016-05-02Allow paging even though is_paging is falseNeels Hofmeyr1-2/+5
It doesn't really hurt to see whether we have paging responses queued for a given subscriber. Possibly a subscriber replied with a paging response later than we assumed the paging to be valid.
2016-05-02cosmetic: subscr_paging_dispatch() comments/indentNeels Hofmeyr1-9/+0
2016-05-02subscr_paging_dispatch(): use conn->subscr instead of separate paramNeels Hofmeyr1-3/+3
2016-05-02cosmetic: subscr_paging_dispatch() comments/indentNeels Hofmeyr1-7/+2
2016-05-02add comments on MSCSPLIT and pagingNeels Hofmeyr1-0/+3
2016-05-02gsm_04_08 mscsplit: subscr_request_channel() -> subscr_request_conn()Neels Hofmeyr4-7/+6
Rename subscr_request_channel() to _conn() and remove the channel_type arg. The "channel" is a term from closely tied MSC+BSC code, after separation we shall call it a "connection", i.e. over IuCS or A. The channel_type arg is already unused from a previous MSCSPLIT commit.
2016-05-02gsm_04_08: factor out subscr authorization checkNeels Hofmeyr2-27/+32
Add function subscr_authorized(), absorbing the guts of static authorize_subscriber() from gsm_04_08.c, except the parts specific to Location Updating. subscr_authorized() is a check that is to be added to validation of a paging response.
2016-04-27debug log for paging: add/tweakNeels Hofmeyr1-5/+2
2016-04-25paging_signal_data: remove unused lac memberNeels Hofmeyr1-1/+0
2016-04-25paging response: remove extraneous null check, assert conn and msg further upNeels Hofmeyr1-1/+4
In handle_paging_response(), don't check conn against NULL after using it all the time anyway. To ensure beyond doubt that it is actually never NULL, assert conn further up in the call stack, i.e. in gsm0408_dispatch(), the main entry point for receiving data from the BSC/RNC level. Also assert msg while at it. Fixes: CID#93769
2016-04-20add preliminary paging response handling, incompleteNeels Hofmeyr2-19/+45
In gsm_04_08.c, add a static handle_paging_resp() to take over from the libbsc function gsm48_handle_paging_resp(). Use the subscr->requests listing to handle a Paging Response and call the pending cbfn. In NITB, this used to be done via BTS, and I haven't entirely resolved yet how exactly to rewire this in standalone libmsc. So far, this "works for me", but is worth another visit. Still missing: enable Integrity Protection.
2016-04-20gsm_04_08.c: fix security mode cmd: use auth tuple from MM authNeels Hofmeyr1-12/+2
2016-04-20cosmetic: auth tuple memcpy: rather use target's sizeof()Neels Hofmeyr1-3/+3
2016-04-20tweak tmp_rand[] type to avoid compiler warningsNeels Hofmeyr1-2/+2
2016-04-20IuCS auth: generate auth tuples, factor outNeels Hofmeyr1-11/+32
Factor out hardcoded-Ki and auth tuple creation into a static function. Add generation of fresh random bytes and generate a valid auth tuple so that the authentication token is different for every MM Auth.
2016-04-20cscn: enable 'subscriber' vty commands for libmscNeels Hofmeyr1-1/+0
This involves removing the openbsc_vty_print_statistics() from vty_interface_layer3.c, as this would link across the MSC/BSC border.
2016-04-20cosmetic: debug and error logging, comment tweaksNeels Hofmeyr3-1/+12
2016-04-20Add Iu pagingNeels Hofmeyr1-3/+10
Add iu_page_cs() and iu_page_ps() API, also add to libiudummy for linking in tests. Implement msc_paging_request() by calling iu_page_cs().
2016-04-19libmsc: Pass KeyStatus to iu_tx_sec_mode_cmdDaniel Willmann1-1/+1
2016-04-11cscn: record and use LAC on incoming InitialUE msgNeels Hofmeyr1-6/+30
Add lac argument to gsm0408_rcvmsg_iucs(), to record the LAC in newly allocated gsm_subscriber_connections. In effect, fix the LAC sent to UE during Location Updating Accept message. Before, 0 was stored as LAC and sent to the UE, regardless of the actual LAC in use.
2016-04-05vty l3 help: fix typo 'comamnds'; fix english s/his//Neels Hofmeyr1-5/+5
2016-03-31cosmetic: comments, debug log, msgb alloc nameNeels Hofmeyr1-3/+3
2016-03-31mscsplit: rewire MSC gsm0808_submit_dtap() to msc_tx_dtap()Neels Hofmeyr4-19/+15
2016-03-31Merge branch 'master' into sysmocom/iuNeels Hofmeyr1-7/+26
Conflicts: openbsc/src/libmsc/auth.c openbsc/src/libmsc/gsm_04_08.c openbsc/src/osmo-bsc/osmo_bsc_vty.c openbsc/tests/Makefile.am
2016-03-31Fix MM Auth: zero-initialize auth tuple before first useNeels Hofmeyr1-1/+10
Make sure a new auth tuple is initialized after db_get_lastauthtuple_for_subscr() returns an error, i.e. if no tuple is present for the subscriber yet. Before this patch, the first key_seq depended on the typically uninitialized value that was present in auth tuple's key_seq upon calling auth_get_tuple_for_subscr(). The very first key_seq used for a new subscriber will now always be 0. Before, it used to be mostly 1 ("(0 + 1) % 7"), but depended on whether the key_seq was indeed initialized with 0, actually by random.
2016-03-31Fix MM Auth: disallow key_seq mismatchNeels Hofmeyr1-0/+1
In auth_get_tuple_for_subscr(), add missing condition to match incoming key_seq with stored key_seq, so that re-authentication is requested for mismatching key_seqs. Add test for this issue.
2016-03-31MM Auth: return AUTH_NOT_AVAIL instead of hardcoded zeroNeels Hofmeyr1-4/+4
AUTH_NOT_AVAIL == 0, so this is no functional change.
2016-03-31MM Auth: introduce AUTH_ERROR constant.Neels Hofmeyr1-3/+3
Instead of using hardcoded -1 for errors, include -1 in the enum auth_action type; apply its use. In the mm_auth test, the string output changes from '(internal error)' to 'AUTH_ERROR', since now the proper enum value is used in auth_action_names[].
2016-03-31Add MM Auth test; add auth_action_str() functionNeels Hofmeyr1-0/+9
Add basic MM Authentication test setup, with fake DB access and RAND_bytes(). So far implement simple tests for IO error during DB access and missing auth entry. To print the auth action during tests, add struct auth_action_names and auth_action_str() inline function in auth.[hc].
2016-03-22comments about incomplete MM cipheringNeels Hofmeyr1-0/+5