Commit Graph

17 Commits

Author SHA1 Message Date
Harald Welte 32acace879 gsup_server: Add "priv" pointer and make it point to 'struct hlr'
Change-Id: Iada68996b7f4cbdcca92b254ddaf6b88b962e6f1
2018-06-16 20:21:45 +02:00
Stefan Sperling f83432c25c move creation of insert subscriber data messages to a common function
Move code to create an Insert Subscriber Data message into a common
function which can be shared by hlr.c and luop.c.

As a consequence, we always encode gsup.cn_domain in the corresponding
msgb and must adjust expected output of the 'gsup' test accordingly.

Change-Id: I6a92ca34cdaadca9eacc774bb1ca386c325ba865
Requested-by: neels
Related: OS#2785
2018-05-18 12:18:32 +02:00
Neels Hofmeyr 1b8a1dc00a add error handling to osmo_gsup_configure_wildcard_apn()
Follow-up to I83d9ef2868bbb01e3f1ddb7920fe735aca172b15 as requested in code review.

Change-Id: Ifcee1e0d275741c1172b208600851861adb13238
2018-05-04 16:48:26 +02:00
Neels Hofmeyr 5aeb438194 fix luop crash: use buffer for APN that remains valid
In osmo_gsup_configure_wildcard_apn(), do not compose APN into a local buffer
that becomes invalid as soon as the function exits. Instead, use a caller
provided buf.

Fixes OS#3231 crash:

  ==20030==ERROR: AddressSanitizer: stack-buffer-underflow on address 0x7fffffffd9c0 at pc 0x7ffff6e9b6c2 bp 0x7fffffffd900 sp 0x7fffffffd0b0
  READ of size 2 at 0x7fffffffd9c0 thread T0
      #0 0x7ffff6e9b6c1  (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x766c1)
      #1 0x7ffff6314419 in tlv_put ../../../../src/libosmocore/include/osmocom/gsm/tlv.h:107
      #2 0x7ffff6314419 in msgb_tlv_put ../../../../src/libosmocore/include/osmocom/gsm/tlv.h:299
      #3 0x7ffff6314419 in encode_pdp_info ../../../../src/libosmocore/src/gsm/gsup.c:419
      #4 0x7ffff6314419 in osmo_gsup_encode ../../../../src/libosmocore/src/gsm/gsup.c:535
      #5 0x555555580016 in _luop_tx_gsup ../../../src/osmo-hlr/src/luop.c:54
      #6 0x5555555809d8 in lu_op_tx_insert_subscr_data ../../../src/osmo-hlr/src/luop.c:264
      #7 0x55555558b356 in rx_upd_loc_req ../../../src/osmo-hlr/src/hlr.c:306
      #8 0x55555558b356 in read_cb ../../../src/osmo-hlr/src/hlr.c:365
      #9 0x555555586671 in osmo_gsup_server_read_cb ../../../src/osmo-hlr/src/gsup_server.c:105
      #10 0x7ffff5b35911 in ipa_server_conn_read ../../../src/libosmo-abis/src/input/ipa.c:356
      #11 0x7ffff5b35911 in ipa_server_conn_cb ../../../src/libosmo-abis/src/input/ipa.c:387
      #12 0x7ffff5e5541f in osmo_fd_disp_fds ../../../src/libosmocore/src/select.c:216
      #13 0x7ffff5e5541f in osmo_select_main ../../../src/libosmocore/src/select.c:256
      #14 0x5555555791b6 in main ../../../src/osmo-hlr/src/hlr.c:600
      #15 0x7ffff4707a86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21a86)
      #16 0x555555579679 in _start (/usr/local/bin/osmo-hlr+0x25679)

  Address 0x7fffffffd9c0 is located in stack of thread T0 at offset 16 in frame
      #0 0x7ffff63131ff in osmo_gsup_encode ../../../../src/libosmocore/src/gsm/gsup.c:481

    This frame has 1 object(s):
      [32, 64) 'bcd_buf' <== Memory access at offset 16 underflows this variable

Related: OS#3231
Change-Id: I83d9ef2868bbb01e3f1ddb7920fe735aca172b15
2018-05-04 16:02:46 +02:00
Stefan Sperling 93c5b10310 rewrite subscriber_update_notify() without calls into luop
This function relied on implementation details of the luop code.
Port what is necessary for an independent Insert Subscriber Data
Tx operation from the luop code into this function.

A next possible step would be to try to merge both of these
into a common implementation. This will be addressed in a
follow-up change as soon as this change is merged.

The TTCN3 test TC_vty_msisdn_isd is still passing (it currently
triggers the "circuit switched domain" case because it does not
advertise itself as an SGSN in the IPA unit name).

Change-Id: I06c43ece2b48dc63d599000eb6d6d51e08963067
Related: OS#2785
2018-05-02 13:34:38 +02:00
Neels Hofmeyr cab2fcd5b5 UMTS AKA: implement SQN increment according to SEQ and IND
Add ind_bitlen column to auc_3g to record each USIM's IND size according to
3GPP TS 33.102 -- default is 5 bits, as suggested by the spec.

Introduce auc_3g_ind to each connecting GSUP client to use as IND index for
generating auth tuples sent to this client.

With osmo_gsup_server_add_conn(), implement a scheme where clients receive
fixed auc_3g_ind indexes based on the order in which they connect; each new
connection takes the lowest unused auc_3g_ind, so in case one of the clients
restarts, it will most likely receive the same auc_3g_ind, and if one client
disconnects, no other clients' auc_3g_ind are affected.

Add gsup_server_test.c to test the auc_3g_ind index distribution scheme.

Depends: libosmocore I4eac5be0c0b2cede04464c4c3a0873102d952453 for llist_first
Related: OS#1969
Change-Id: If4501ed4ff8e923fa6fe8b80c44c5ad647a8ed60
2017-03-16 05:51:11 +01:00
Neels Hofmeyr 5ecdc56ad4 fix: properly handle error rc by osmo_gsup_conn_ccm_get()
Change-Id: I70e4a5e75dd596052e61df9a6ad52b7f56fb6b26
2017-03-07 23:23:16 +00:00
Max 9cacb6f74b CTRL: add enable/disable packet service cmds
Add commands to enable/disable Packet Service for a given IMSI. Changes
are synced to DB and propagated at runtime to SGSN (in case of disable
command).

Change-Id: I23163ce8667292443ed61cb15c928357dba4b4be
Related: OS#1645
2017-03-06 13:58:04 +01:00
Neels Hofmeyr ec1b959496 fix various compiler warnings
Change-Id: I3bf3b351535843bde9c0c1d955315615bb7c30b2
2016-12-11 01:22:45 +01:00
Neels Hofmeyr 6eed322063 fix build on FreeBSD: eliminate implicitly declared functions
Change-Id: I4f7222f19e4d7129a5cef828a28dd12a40824a59
2016-12-11 01:22:45 +01:00
Harald Welte 936f6724ec add copyright statements to all files 2016-05-03 18:51:18 +02:00
Harald Welte e687be5f2d Major update; Code now supports SAI, LU and ISD transactions
We also introduce a 'gsup_router' which enables us to route
a transaction to a given VLR.  It works based on the SERIAL attribute
communicated at time of the IPA multiplex setup as part of the CCM
sub-protocol.
2016-05-03 18:49:27 +02:00
Harald Welte a7617e9126 Fix memory leakage in gsup_server
Once a remote IPA client is gone, we need to remove the associated
osmo_gsup_conn object.
2016-04-28 12:57:10 +02:00
Harald Welte 5341b5d972 ensure we release memory for all received msgb. 2016-04-28 12:48:39 +02:00
Harald Welte f2d96dad3b more verbose error handling in osmo_gsup_server_read_cb() 2016-04-28 11:13:15 +02:00
Harald Welte 173afdbdbf gsup_server: Implement IPA CCM handling using new libosmo-abis function 2016-04-28 11:13:04 +02:00
Harald Welte e72cf55347 initial import of osmo-gsup-hlr code so far 2016-04-28 07:18:49 +02:00