Commit Graph

5123 Commits

Author SHA1 Message Date
Pablo Neira Ayuso 93ffbd0029 libmsc: send RP-ACK to MS after ESME sends SMPP DELIVER-SM-RESP
Hold on with the GSM 04.11 RP-ACK/RP-ERROR that we send to the MS until
we get a confirmation from the ESME, via SMPP DELIVER-SM-RESP, that we
can route this sms somewhere we can reach indeed.

After this change, the conversation looks like this:

    MS    GSM 03.40      SMSC   SMPP 3.4   ESME
     |                    |                 |
     |   SMS-SUBMIT       |                 |
     |------------------->|                 |
     |                    |    DELIVER-SM   |
     |                    |---------------->|
     |                    |                 |
     |                    | DELIVER-SM-RESP |
     |                    |<----------------|
     |  GSM 04.11 RP-ACK  |                 |
     |<-------------------|                 |
     |                    |                 |

Before this patch, the RP-ACK was sent back straight forward to the MS,
no matter if the sms can be route by the ESME or not. Thus, the user
ends up getting a misleading "message delivered" in their phone screen,
when the message may just be unroutable by the ESME hence silently
dropped.

If we get no reply from the ESME, there is a hardcoded timer that will
expire to send back an RP-ERROR to the MS indicating that network is
out-of-order. Currently this timer is arbitrarily set to 5 seconds. I
found no specific good default value on the SMPP 3.4 specs, section 7.2,
where the response_timer is described. There must be a place that
describes a better default value for this. We could also expose this
timer through VTY for configurability reasons, to be done later.

Given all this needs to happen asyncronously, ie. block the SMSC, this
patch extends the gsm_sms structure with two new fields to annotate
useful information to send the RP-ACK/RP-ERROR back to the MS of origin.
These new fields are:

* the GSM 04.07 transaction id, to look up for the gsm_trans object.

* the GSM 04.11 message reference so the MS of origin can correlate this
  response to its original request.

Tested here using python-libsmpp script that replies with
DELIVER_SM_RESP and status code 0x0b (Invalid Destination). I can see
here on my motorola C155 that message cannot be delivered. I have tested
with the success status code in the SMPP DELIVER_SM_RESP too.

Change-Id: I0d5bd5693fed6d4f4bd2951711c7888712507bfd
2017-05-08 17:15:12 +02:00
Pablo Neira Ayuso 638ad068e8 libmsc: use GSM411_RP_CAUSE_MO_NUM_UNASSIGNED as return value
Instead of hardcoded value of 1 plus comment of the right hand side of
the statement.

Change-Id: I865bdbd6da17a0389044a8e749deeeebcb9cae06
2017-05-08 14:45:17 +00:00
Max fd2c1f90ba Use libosmocore for SW Description parsing
Requires libosmocore with Ib63b6b5e83b8914864fc7edd789f8958cdc993cd.

Change-Id: Ib94db414e94a2a1f234ac6f1cb346dca1c7a8be3
2017-05-08 11:49:40 +00:00
Max 310b730798 Use ipa.py for ctrl tests
Remove duplicated code and make sure that python code is actively used
as part of test harness

Change-Id: I676390abe2f179df6004cdd33d0eaaf60e18df03
2017-05-08 08:31:09 +00:00
Max 7b5dbc2805 Gb: use textual representation for parse log
Use textual representation for message type and protocol descriminator
in case of Gb parsing errors.

Change-Id: Ida925258be119619d8705361730c554a130b75bc
Related: SYS#3610
2017-05-05 11:31:07 +00:00
Max 50eb66996d ctrl: remove boilerplate code
Define subscriber-list-active-v1 ctrl command as RO and remove
unnecessary functions.

Change-Id: I88fe905c22cf7563415d470b88cb43fca0d52a7f
2017-05-04 13:35:13 +00:00
Max 086067f0a1 Fix vty warnings for GEA0
Previously vty always used additional checks even for GEA0 (no
encryption) which resulted in misleading warnings. Fix this by
adding explicit check for GEA0.

Related: SYS#3610
Change-Id: I1ee468ab3298076d4cb5c7b1f6293c07e272417b
2017-05-02 13:43:13 +02:00
Max 7bb383a45c Make pcap dependency optional
Previously we required pcap.h unconditionally which causes embedded
build failure because it's not included in current version of out poky
toolchain. We can add it to toolchain but it's only necessary for
utils/osmo-meas-pcap2db which is not built for sysmobts anyway so it's
easier to just make this dependency optional and build osmo-meas-pcap2db
only if it's available - similar to the way we build osmo-meas-udp2db.

Related: SYS#3610
Change-Id: I77a5f7eafe0282abedacffad6a9bcb0a8f2b5caa
2017-05-02 13:43:06 +02:00
Max 6d8e5198ad Add gsm_bts_type_variant to gsm_bts struct
Previously it was only in gsm_bts_model which is not initialized on BTS
side. It's more convenient to have it in the struct which is available
to BTS as well.

Change-Id: I54fde8c4ccd5d994af08074f5864446e79a93a25
Related: OS#1614
2017-04-28 08:49:05 +00:00
Max 6f0e50c833 Prepare for extended SI2quater support
Supporting SI2quater as per 3GPP TS 44.018 will require chnages to the
way System Information is stored because it uses 1:n instead of 1:1
mapping between SI type and generated SI content. This should not affect
other SI types though. To facilitate this transition:

* convert the code to always use GSM_BTS_SI helper instead of accessing
  buffer directly
* make helper more robust by adding extra parenthesis
* add similar helper for gsm_lchan
* add function estimating number of SI2quater message to hold configured
  number of (U|E)ARFCNs
* add SI2q index/count fields and pass them to rest_octets generator
  explicitly
* internalize buffer access in generate_si* functions

Change-Id: I74e4e3cb86364cec869a1472a41b4a95af0d50dd
Related: RT#8792
2017-04-28 08:45:36 +00:00
Max a18001d506 Save PCU version reported by BTS
When BTS reports PCU disconnect - clear it.

Change-Id: Idb32c73036413ee912f633604150ee17b611cfa7
Related: OS#1615
2017-04-28 08:44:18 +00:00
Max 2b229ffaef gbproxy: add example .service
Change-Id: Ic8144777a77efce4bad44abf6c6abde12fc5149c
Related: SYS#3610
2017-04-26 16:21:43 +02:00
Max cb1e366094 Remove libs from openbsc.pc
OpenBSC does not produce any installable libraries, only header files so
this section is unnecessary.

Change-Id: I4c563d775a84f41f82404e0eaba1a25fdbaac1a5
2017-04-26 12:07:08 +02:00
Max 11e4e41ffc Fix MS TO measurement representation
* set proper flag when saving MS Timing Offset
* use gsm_subscriber's IMSI or lchan's name if bsc_subscriber is unknown
* add comments with spec reference
* store/display MS Timing Offset instead of raw Timing Offset field from
  RSL
* Compute MS Timing Offset [-63; 192] from Timing Offset field [0; 255],
  adjust structure gsm_meas_rep with proper type to store it

Change-Id: I7e003d23a6edb714c5f17688fd6a8edac131161d
Related: OS#1574
2017-04-26 08:25:22 +00:00
Pau Espin 7636c0833b nat: Fix initial buffer size parameter for getline
According to man, lineptr must be set to null AND n to 0.

Change-Id: I36683884106b97ef697264716de13813c00da9bc
2017-04-12 12:28:51 +00:00
Pau Espin dc9de23523 nat: Use equal func in bsc_sccp
It is defined in the file and used twice in there, so let's use it for
all of them which makes code smaller and more clear.

Change-Id: I9fac7cabedff74f8f6293ad8b54420229b80aa71
2017-04-12 12:24:49 +00:00
Max f9685c1461 gsm_bts: add version and variant details
* add version string to gsm_bts
* add PCU version string to gsm_bts
* rename GSM_BTS_TYPE_OSMO_SYSMO -> GSM_BTS_OSMOBTS to avoid confusion
  between BTS model and variant
* add variant enum to gsm_bts_model using enum with variants for each
  hw vendor of OsmoBTS
* show connected PCU version (if available) in vty via 'show bts'

This will come in handy when logging details regarding particular BTS
reported via OML, see:

Related: OS#1614

Change-Id: I6710d53115f34634a7b70969cc05fd5c72ff8ab2
2017-04-10 06:58:43 +00:00
Max 689e7e5562 abis: log known ACKs and unknown messages
Log expected ACK messages and unhandled messages to aid in
troubleshooting.

Change-Id: Id3afaaa76e24f63076ae0e6fd2322e4a7fa29b45
Related: OS#1614
2017-04-08 07:46:07 +00:00
Max 2d92162a6b python: fix Null logger
Change-Id: Ie120273eabbc670e9f19ba365508688a810a2773
Related: SYS#3028
2017-04-05 08:16:25 +00:00
Vadim Yanitskiy 7f3724e04d VTY: add the dyn_ts_allow_tch_f option
This option allows to enable or disable TCH/F allocation on the
TCH/F_TCH/H_PDCH timeslots. Until now, source code modification
was required to enable this feature.

Related: OS#1778

Change-Id: Id18cab25844dc854a66b4e2713e90c3f43afa712
2017-04-03 16:38:06 +00:00
Neels Hofmeyr 36891a7d9d LU counters: count completion and failure, not messages sent
From a human admin viewpoint it doesn't make sense to count the messages sent:

When we use TMSIs, we first send a LU Accept with a new TMSI, and then expect
the MS to respond with a TMSI Realloc Complete message. When that fails to come
through, the LU actually ends in failure, even though a LU Accept was sent.

If a conn breaks/vanishes during LU, we cancel the LU without sending any reply
at all, so the failed LU would not be counted.

Instead, count Location Updating results, i.e. completion and failures.

(With the new VLR developments, LU counters need to be triggered in completely
different places, and this patch prepares for that by providing sensible
counters.)

Change-Id: I03f14c6a2f7ec5e1d3ba401e32082476fc7b0cc6
2017-03-31 12:05:29 +00:00
Max b1e6b37493 Handle PCU version received via OML alert
Explicitly check for and log PCU version received from BTS via OML alert
message.

Change-Id: I3c88663d4e2887a4038b4c3f1387128295b8934e
Related: OS#1614
2017-03-23 11:09:22 +00:00
Max 9311881bb1 Add simple CTRL2SOAP proxy
Add python client which converts TRAP messages into SOAP requests and
perform corresponding actions.

It can be used as follows

./soap.py -d -w http://example.com/soapservice/htdocs/wsdl/test.wsdl

See ./soap.py -h for additional options.

Change-Id: I82844ec7a302bac30d6daee9ebca2188fd48ca46
Related: SYS#3028
2017-03-23 09:41:00 +00:00
Alexander Couzens 16dcf2ae22 libbsc: add rsl_ericsson_imm_assign_cmd() which reply with a confirmation message
ericsson can handle a reference at the end of a imm assign command which is used in
the confirm response. The confirm response is only sent if the trailer is present.

Change-Id: I88560291b5a3a3d7a0bac4d3c089b45f1f6b297f
2017-03-23 02:10:21 +01:00
Harald Welte baaf3e242e RBS2000 RSL: Support for sending RSL PAGING CMD for GPRS
Change-Id: I66541f9b20e7fd67fbec329283fc3c821c970a56
2017-03-23 02:10:21 +01:00
Harald Welte f7e9a349ef RBS2000: Add the P-GSL Timer IE to RSL CHAN ACT for PDCH
This seems to be mandatory when an Ericsson RBS2000 uses a SuperChannel
as back-haul.

Change-Id: I793e7d62df1ca9f9c38d39e22d3868064d446c8d
2017-03-23 02:10:21 +01:00
Alexander Couzens 3521af7f3a abis_om2k: protect MO FSMs by NULL check
Also set MO FSMs to NULL after freeing them.

Change-Id: I30df0b9ab8bc47ba9756c8388e977deed0e40200
2017-03-23 02:10:21 +01:00
Harald Welte ce49258a12 OM2000: Send ALTCRQ for SuperChannel after receiving IS Enable Req Ack
When the BTS is configured to use a SuperChannel and it is using a
unix domain socket based transport towards the L2TP daemon, then
we must instruct the L2TP daemon to instruct the SIU to change the Abis
Lower Transport Mode using the ALTCRQ / ALTCRP L2TP signalling.

Change-Id: I672bfaa09c42fbeb0c8459f24b2222b952de954b
2017-03-23 02:10:21 +01:00
Max dd22a30d75 twisted_ipa.py: make debug logging more robust
Do not print anything to stdout directly - use proper logger object
instead: either the one supplied by IPAFactory user or default to NO-OP
NullHandler logger.

Change-Id: Ic3417095a6e8848f0acabb46a9e64c0197b736e2
Related: SYS#3028
2017-03-21 14:06:50 +01:00
Max ca2778cd22 twisted_ipa.py: bump version properly
Adjust version string to comply with PEP8 and PEP386.

Change-Id: I44c8521f12e6432038998bfb1ac1bb37a1137787
Related: SYS#3028
2017-03-21 12:55:54 +00:00
Neels Hofmeyr 476c4bb7d1 python tests: allow running from separate build dir
The VTY tests assume that $top_builddir == $top_srcdir. Use the script's
location from sys.path[0] to find the correct locations of example configs even
when building in another directory.

Change-Id: I2731f361e3b72d0980968e6cf83594ea450db7c2
2017-03-20 13:33:15 +00:00
Neels Hofmeyr ca06e040cc bsc_/gprs_subscriber: fix: use osmo_strlcpy() to safely copy IMSI
Fixes: coverity scan CID 163918
Change-Id: I4b2760b006a0707928530b4390c6997b79b02981
2017-03-20 00:21:01 +00:00
Max 88d4fc70d5 Don't drop OML links for Get Attributes NACK
Previously any OML NACK message will result in BSC dropping OML link to
BTS which makes it impossible to use optional OML messages which might
be unsupported by BTS. Fix this for 3GPP TS 52.021 §8.11.1 Get
Attributes message. Also, log human-readable NACK name to see what
exactly causing OML link drop.

Change-Id: Ib8af2872c27abb793172ec59bdc145b8d54f83da
Related: OS#1614
2017-03-16 14:07:06 +01:00
Neels Hofmeyr 6dd0fc685b oap tests: fix after SQN scheme changes from libosmocore
In change-id Iadf43f21e0605e9e85f7e8026c40985f7ceff1a3, libosmocore changes
from incrementing SQN after tuple generation to incrementing SQN before tuple
generation. Thus we now need to pass desired_sqn - 1 to get the same tuples.

Change-Id: Ifeda71e713bb60dcd31ac651f461b714cfa39b5c
Related: OS#1968 OS#1969
2017-03-15 16:05:42 +01:00
Harald Welte c103c64e7d OM2000: Change the order of MO initialization
So far: CF-IS-CON-TF
Now: CF-TF-CON-IS

Change-Id: I8efd9bafdcf9504d2e5fc85c44c708fa53f4dff8
2017-03-15 13:36:31 +00:00
Philipp Maier 3d6cb338c6 gprs: fix T3186 encoding in Sysinfo 13
The timer T3186, which is described in 3GPP TS 44.060, is using 3
bits of the si13 mac block. This requires special encoding. In the
case of T3186, the value is encoded by the formula: bits = t/500-1.
Our implementation uses the formula bits=t/500, which is incorrect.

Change-Id: Ifd340c536cff2d1c4b1b3677a358ea95438801eb
2017-03-15 13:15:26 +00:00
Max e7379fe657 examples: remove logging level * everything
Option "logging level ... everything" is broken for quite some time and
might be deprecated in future. Replace it with "logging level ... debug"
in config examples.

Change-Id: I828ef7671b4fb38717526a18ff8e9a5428cd511e
Related: OS#71
2017-03-15 13:01:12 +00:00
Philipp Maier 99c9707d1c cosmetic: Add commandline option to display version
The -V option to display the Version and the copyright info
is missing.

Change-Id: I0c848fd42c13f473807caf3478d32c6ce5e43e31
2017-03-15 13:00:47 +00:00
Alexander Couzens 11368118c9 libbsc: add chreq type for CHREQ_T_PDCH_ONE_PHASE & CHREQ_T_PDCH_TWO_PHASE
When using a BSC located PCU the BSC must understand PDCH requests.

Change-Id: Ie7f4ed000cf1b40d269873cf0ddf5ff9f5bbc18a
2017-03-15 12:48:03 +00:00
Philipp Maier 2459f9fb5a cosmetic: add copyright header to bsc_control.py
bsc_control.py lacks a copyright header. This commit adds the
copyright header from ipa.py to bsc_control.py.

Change-Id: Ie70bf686ee9bb157198e02bf8d946abf56adc82a
2017-03-14 17:19:23 +00:00
Alexander Couzens 8a215c3d25 gprs_sgsn.c: initialize ptmsi with 0xdeadbeef
Fix uninitialized memory access warning.
"Conditional jump or move depends on uninitialised value"
Found by valgrind.

Change-Id: Ibc2d585c5db899e6af20104211e32faf3822633a
2017-03-14 12:00:03 +00:00
Neels Hofmeyr b3c7c79c04 python tests: vty and smpp: speed up >10 times
osmo-python-tests now includes code that retries connecting the VTY socket and
needs no external sleep()ing. This flies through most tests without any sleep()
at all.

See osmo-python-tests.git change-id Icc337f52a93d5fe31fc4ff235ccaf4e0fe75fa39

Change-Id: I42161d9716fe5bb0ef1c56e4bfb770bb99bbca7a
2017-03-14 03:18:26 +01:00
Alexander Couzens dfb138ff09 unixsocket: start sabm for UNIXSOCKET
openbsc only starts sabm messages for a subset of line drivers.
Add unixsocket to those subset.

Change-Id: If98c037119142cc33b46ab5c1bf02d4cda81c81e
2017-03-13 11:19:18 +00:00
Harald Welte 0722ffc743 OM2000: Add FIXME comments for missing resolving of RX/TX MO!
Change-Id: I45708df724c5fc3316eca6bd2ac2c0738b19a45b
2017-03-13 09:41:58 +01:00
Neels Hofmeyr 6d804b1a7e add struct bsc_subscr, separating libbsc from gsm_subscriber
In a future commit, gsm_subscriber will be replaced by vlr_subscr, and it will
not make sense to use vlr_subscr in libbsc. Thus we need a dedicated BSC
subscriber: struct bsc_subscr.

Add rf_policy arg to bsc_grace_paging_request() because the bsc_subscr will no
longer have a backpointer to gsm_network (used to be via subscr->group).

Create a separate logging filter for the new BSC subscriber. The implementation
of adjusting the filter context is added in libbsc to not introduce
bsc_subscr_get/_put() dependencies to libcommon.

During Paging Response, fetch a bsc_subscr from the mobile identity, like we do
for the gsm_subscriber. It looks like a duplication now, but will make sense
for the VLR as well as for future MSC split patches.

Naming: it was requested to not name the new struct bsc_sub, because 'sub' is
too ambiguous. At the same time it would be fine to have 'bsc_sub_' as function
prefix. Instead of struct bsc_subscriber and bsc_sub_ prefix, I decided to
match both up as struct bsc_subscr and bsc_subscr_ function prefix. It's fast
to type, relatively short, unambiguous, and the naming is consistent.

Add bsc_subscr unit test.

Related: OS#1592, OS#1594
Change-Id: Ia61cc00e8bb186b976939a4fc8f7cf9ce6aa3d8e
2017-03-08 01:01:43 +01:00
Max abf53d87b6 Add MS time. offset to gsm_lchan
Add MS TIMING OFFSET (3GPP TS 48.058 § 8.4.8) and P offset (3GPP TS
45.010 § 1.2) which can be used to compute MS TO from known TA.

This will be used by osmo-bts (see
I4dfe5c48834a083e757d5de3236a02e15a238b28) to provide MS TO as part of
RSL MEASUREMENT RESULT.

Change-Id: I8bda57c8d6c15bbb803eca708931556dae118a00
Related: OS#1574
2017-03-07 15:11:14 +01:00
Neels Hofmeyr 0b61932e7f vty tests: close msc socket after nat_msc_test
Change-Id: Ib64cf8690627803e1b4a8497ea63f1e766960478
2017-03-05 12:24:46 +00:00
Philipp Maier 6ee49d8416 sgsn: fix problem with leading-zero-IMSIs
When the IMSI ACL is maintained via the VTY, users may enter IMSIs
without leading zeros. Especially in test environments, where
MCC=001 and MNC=01 is common, it is likely that someone enters the
corresponding IMSI (001010000000001) without the two zeros at the
beginning.

This patch fixes the problem by sanitizing the IMSI, eventually
missing zeros in the beginning will be automatically added.

Change-Id: I56ba0da61978bbdce71d0e320166c52b20b42517
2017-03-05 12:24:25 +00:00
Neels Hofmeyr 3f8a8f7736 vty tests: allow picking specific tests to run by name
Depends: osmo-python-tests change-id I92f90c334169f31920c63dd5c5ac8dac215065e6
Change-Id: I849455e0423e1a63d6890aef7f9c6075ad53a920
2017-03-02 14:30:41 +00:00
Max 0436e42472 Fix potential segfault in sgsn_libgtp.c
* print pdp->address instead of mm->imsi if mm is NULL
* print mm->imsi in debug log (move it below NULL check)

Change-Id: I4fbf5a54019a46612fbc528d61120182738f9205
2017-03-02 13:28:52 +01:00
Neels Hofmeyr d3270a9c05 subscriber conn: add indicator for originating RAN
Add via_ran to gsm_subscriber_connection to indicate whether a conn is coming
in via 2G/GERAN/A-Interface or 3G/UTRAN/Iu-Interface. Prepares for Iu, but
also for libvlr to decide between GSM or UMTS Auth.

Until actual Iu support is merged to master, this indicator will aid VLR unit
testing.

At some point we may also add RAN_GERAN_IU; it's not on the agenda yet, but to
clearly distinguish the names if we want to add it, explicitly name the ones we
have RAN_GERAN_A and RAN_UTRAN_IU.

Change-Id: I93b870522f725170e4265a5543f6b680383d7465
2017-03-02 03:13:02 +01:00
Neels Hofmeyr 5616cdde3a fix: gprs_gmm, gprs_llc_vty: two unterminated value_string arrays
Change-Id: Icc4163ac4f962fe88bbebeb3310a557ba0834e84
2017-03-02 01:48:31 +00:00
Keith Whyte f01bd13ca1 meas_json: fix NEIGH: missing array braces
Make NEIGH an array of Javascript objects, otherwise the JSON is not parseable
when neighbours exist

Change-Id: I42029f40bf357adbb2f3c71cdcbafbc21090e348
2017-03-01 11:48:09 +00:00
Alexander Couzens f480b35893 libmsc/update_db_revision_3(): free memleaking db result
Found by ASAN

Change-Id: I2680c60e26b9876b428d4b75323f884f9ecd95b3
2017-02-28 18:36:35 +00:00
Philipp Maier e0d5caa916 silent_call: remove unfinished fuzzer interface
Remove the fuzzer interface that was partially implemented in
gsm_04_08.c and silent_call.c is causing problems when an
SMS is sent during an active silent call. The reason for this
is that gsm0408_dispatch() in gsm_04_08.c would decide to
rout all uplink traffic to silent_call_rx() in silent_call.c.
silent_call_rx() is a stub function that discards the data.

This patch removes the fuzzer interface code by placing ifdefs
around it, so that it can be re-activated by experimentators.

Change-Id: Id500197d58663b3f4b1756136343670388b0a4bc
2017-02-28 18:28:03 +00:00
Neels Hofmeyr acc6e8323a ctrl_test_runner: speed up more than 10 fold by sleeping less
Similar to a recent patch in osmo-python-tests for VTY based tests, but this is
for the Ctrl tests.

The TestCtrlBase tests gave a constant sleep(2) grace period for the process to
startup. This causes tests to take minutes for no reason at all.

Add code to TestCtrlBase to try and connect right away, retrying up to three
seconds in .1 second intervals. This flies through most tests without any
sleep() at all.

Change-Id: I06569767153838bd9cd3edac001df5f6c567874c
2017-02-28 18:26:49 +00:00
Neels Hofmeyr 534034580c vty test: nat_msc_test: setsockopt REUSE to avoid TIME_WAIT problems
When running the testBSCreload test in close succession, I get a "Connection
refused" error because the socket is still in TIME_WAIT state. Passing the
SO_REUSEADDR flag allows reusing the addr despite a TIME_WAIT socket.

Change-Id: I941851b062999ab4b962430f7b27c19935993e0a
2017-02-28 18:22:06 +00:00
Philipp Maier d015cbd65d XID: resend xid with pdp-ctx-ack messages
If a pdp context is created a xid request is sent right after
the pdp-context-ack message. The sending of the pdp-context-ack
and the xid message is triggered from the GGSN via the GTP
interface.

When the pdp-context-ack message is not received by the MS, it will
send the pdp-context-request again. A lost pdp-context-ack is resent
by the SGSN directly so that the mechanism described  above does
not work for pdp-context-ack resents.

This commit adds code to trigger the sending of xid messages also
for resent pdp-context-ack messages.

Change-Id: Ice66790803154310a61a70a54be76cec539c97a7
2017-02-27 18:07:29 +01:00
Neels Hofmeyr 27355c9c65 SGSN VTY: make missing GSUP server address+port fatal
On 'auth-policy remote', the SGSN requires GSUP server address and port. If it
was missing, the SGSN would print a VTY warning and run anyway. Make this error
more fatal: print an error (flattened a bit) to stderr and abort the program.

Move validation of the GSUP server data presence out of the VTY command itself
and into the config reading function. This way the GSUP server config can be
given anywhere, including below the auth-policy config (was required above).

Don't care about setting the auth-policy to remote with a telnet VTY, because
in that case the GSUP client won't be started anyway.

Change-Id: I4d8db910c32abd8579d3c9b9f0b2cb3a9a6dfe4c
2017-02-27 14:29:41 +00:00
Neels Hofmeyr 058cd573d8 SGSN: Integrate support for UMTS AKA
The general infrastructure for UMTS AKA is already in place:
* GSUP with capability to send us auth_vectors that contain
  either triplets or quintuples
* mm_context that holds such auth_vectors

Add:
* capability to send UMTS AUTN in GMM AUTH REQ
* parse extended UMTS RES
* on auth response, validate expected AKA with vector and received res/sres
* add Auth Failure message to receive resync AUTS token and
  * send to HLR
  * clear out-of-sync auth tuple
  * enter new state for when we're waiting for HLR to resync and send new
    tuples so that the next Auth Request will be handled

Original first half of this patch by: Harald Welte <laforge@gnumonks.org>

Full UMTS AKA procedure including AUTS resync tested to work against OsmoHLR
with R99 USIM and Milenage algorithm.

The sgsn_test.c needs adjustment because we're checking the vector's auth_types
now.

Depends: libosmocore change-ids
         I277fb3d407396dffa5c07a9c5454d87a415d393f
         If943731a78089f0aac3d55245de80596d01314a4
Related: OS#1956
Change-Id: Ie6a0cefba5e4e7f02cc2eaf6ec006ac07d5c1816
2017-02-27 14:29:41 +00:00
Neels Hofmeyr 44468ad531 smpp_test_runner.py: fix socket leak
Each running test would open up another socket without ever closing unused
ones. Close the sockets after each test is done.

Change-Id: I0a42caab3bb8c9c9d04b033e4de9efe0ca8fd2af
2017-02-25 17:04:45 +00:00
Neels Hofmeyr 577a125652 python tests: remove process 'Launch' message, now at osmoutil
Change-Id: Id8eb70ddfdc1d0d9f90aa5343a4ea522042c34ee
2017-02-25 17:04:08 +00:00
Neels Hofmeyr 8b24e9f203 vty_rest_runner.py: remove debug monitoring for TCP sockets
Change-Id: I7361bb0ce5302d00ccb18dc04eeb75ee1f6844a8
2017-02-25 17:04:08 +00:00
Alexander Chemeris c634063ea3 utils: 'meas_json' utility to convert measurement feed into a JSON feed.
Change-Id: I56631969384da245eed8ffc14845c76a5d4de8d4
2017-02-25 05:23:22 +00:00
Neels Hofmeyr 0e5d807297 add struct gprs_subscr, separating gprs from gsm_subscriber
Prepare for replacing gsm_subscriber with vlr_subscriber. vlr_subscriber will
not make sense to be used in gprs, so have a dedicated GPRS subscriber struct.
(Could change if the gprs code were to use libvlr; is currently independent).

Related: OS#1592
Change-Id: Ia8b391ee009c8545763cba04505be3947835120e
2017-02-25 01:25:22 +00:00
Neels Hofmeyr a369e24cb9 cosmetic: rename struct osmo_msc_data to bsc_msc_data
With the OsmoMSC program coming up, the name osmo_msc_data becomes even
more confusing than it already is. Clearly indicate it as libbsc's data of
a remote MSC by prefixing with bsc_.

Also, the Osmocom community has in the meantime agreed to have the osmo_
prefix only in libosmocore, to avoid naming conflicts in case things are
moved there. So while renaming anyway, also drop the osmo_ prefix.

Change-Id: I0dfbcb7d1a579211180f71319982820d8700afab
2017-02-24 21:01:55 +01:00
Neels Hofmeyr a42855f09f cosmetic: rename osmo_msc_data.h to bsc_msc_data.h
With the OsmoMSC program coming up, the name osmo_msc_data becomes even
more confusing than it already is. Clearly indicate it as libbsc's data of
a remote MSC by prefixing with bsc_.

Also, the Osmocom community has in the meantime agreed to have the osmo_
prefix only in libosmocore, to avoid naming conflicts in case things are
moved there. So while renaming anyway, also drop the osmo_ prefix.

Change-Id: I13554563ce9289de126ba0d4cf329bafcda35607
2017-02-24 21:01:55 +01:00
Neels Hofmeyr 9762b4c579 cosmetic: clarify BSC's remote MSC data vs. OsmoMSC
Change-Id: I74dd2b3f935d39b8caa718e2c8a51cc81bddf1b9
2017-02-24 21:01:55 +01:00
Neels Hofmeyr fe291de36b cosmetic: gsm_data.h, README: rename CSCN to MSC
We're discarding the name OsmoCSCN for the benefit of OsmoMSC. But "CSCN" has
already crept into the master branch in two places; apply the rename.

See OS#1958

Change-Id: Ib4274eb3c172ada1fe7f05746740b456370bc93d
2017-02-24 21:01:55 +01:00
Neels Hofmeyr d2b3399c04 vty: fix subscr ref count leak in 'subscriber name' cmd
Change-Id: I3d19518c94a7f302bf108f2ad945983cdc8db0b1
2017-02-24 19:58:07 +00:00
Neels Hofmeyr 40a91b38ec vty_test_runner.py: fix socket leak
Each running test would open up another socket without ever closing unused
ones. Close the sockets after each test is done.

Change-Id: Ie433c8560de54f9a9d05fa07c44bae3126d19b30
2017-02-24 17:54:24 +01:00
Neels Hofmeyr 7a250cc9d9 cosmetic: remove unused scall_signal_data.subscr
Doesn't make sense to switch this to struct vlr_subscr when it isn't used at
all. So let's remove it.

Change-Id: Ifa5901f8bf1aed3981841d24d4ec8d659f3de7a9
2017-02-23 23:44:05 +00:00
Neels Hofmeyr 89a8e722ed logging fixup: shorter names for LOGGING_FILTER_* and LOGGING_CTX_*
In libosmocore, my patch was merged to master a bit too soon. To accomodate the
request for naming that matches the general "LOG" prefix instead of "LOGGING",
a fixup was committed to libosmocore. Adjust for that.

Original patch: change-id I5c343630020f4b108099696fd96c2111614c8067
The fixup: change-id I424fe3f12ea620338902b2bb8230544bde3f1a93

Change-Id: Ib2ec5e4884aa90f48051ee2f832af557aa525991
2017-02-23 18:11:57 +01:00
Neels Hofmeyr 94f49a4f08 debug.h/c: remove unused cruft / cosmetic tweaks
Change-Id: I9601d478763569933bcc46bf4eaaff70a9843be9
2017-02-22 17:28:49 +01:00
Neels Hofmeyr f13b3c968f logging: use central filter and ctx consts from libosmocore
The LCHAN and BTS filter contexts are actually never used, so drop them until
someone adds them properly.

For now use only LOGGING_{FILTER,CTX}_VLR_SUBSCR. Some of these will change to
_BSC_SUBSCR once struct bsc_subscriber is introduced, and later on, struct
gsm_subscriber will be replaced by vlr_subscriber so that the names will match.

Depends: libosmocore change-id I5c343630020f4b108099696fd96c2111614c8067
Change-Id: Ifa82f6a461ad4c0eeddb8a38fb3833460432d16b
2017-02-22 17:24:54 +01:00
Max a66d8cfcb5 Handle DSD from HLR
Handle Delete Subscriber Data GSUP message from HLR to disable Packet
Services for a given IMSI.

Change-Id: I6b9b494fa58bcb95bd550c49f8204f00f8fdf628
Related: OS#1645
2017-02-21 16:24:37 +00:00
Neels Hofmeyr a1613695d1 subscr_update_expire_lu(): fix (obscure) segfault
To be paranoid, catch a NULL subscriber and/or bts in
subscr_update_expire_lu(): print an error log and avoid segfault.
(I'm not sure this would really happen in a normal situation.)

During aggressive testing of Paging timeout, I came across this segfault in
msc_release_connection() when conn->expire_timer_stopped is set but
conn->subscr is NULL, at the subscr dereference after:

        if (conn->expire_timer_stopped)
                subscr_update_expire_lu(conn->subscr, conn->bts);

I brought this situation about by a fabricated Paging fault, i.e. in
gsm48_rx_rr_pag_resp() return 0 and don't call gsm48_handle_paging_resp() at
all. Thus conn->subscr is still NULL when expire_timer_stopped is 1.

When looking at CM Service Request handling, the conn->subscr is set before
setting expire_timer_stopped = 1, which is a saner thing to do. But without my
mad 'return 0', there is in fact no way to have a NULL subscriber there.

It looks like all other code paths already do the same, but it's not that
obvious (e.g. _gsm48_rx_mm_serv_req_sec_cb()). So rather catch this case of
NULL conn->subscr, and while at it catch NULL bts as well.

Change-Id: I430dd952b2b928bea7f8360f1e01bb3cccb0a395
2017-02-19 13:48:31 +00:00
Max 2c16beeb64 Add support for extended SI2q parameters
* add vty command to set E-UTRAN_PRIORITY, THRESH_E-UTRAN_low and
  E-UTRAN_QRXLEVMIN according to 3GPP TS 44.018 Table 10.5.2.33b.1
* remove old command which does not support those parameters

Change-Id: I36dcc79f7b7a02036e74720923d0df1a2a2db504
Fixes: RT#8792
2017-02-19 08:53:57 +00:00
Neels Hofmeyr 87bfed259d remove compiler warning: unused rc in vty_interface_layer3
Change-Id: I3dc94dc4bddc5a887ce196071327a6dddfe5b280
2017-02-18 23:11:04 +01:00
Max b726c2c72b Remove duplicating define
Use GSM_MACBLOCK_LEN consistently throughout abis_rsl.c

Change-Id: I96aec02748a0be0100dee2117f124ff32d5ee3f5
2017-02-09 19:23:38 +01:00
Max 8dc8f23c07 Expand chan allocation logging
Log more data related to channel allocation:
- channel type
- number of paging attempts
- timers fired

Change-Id: Ib417a9c942c17b902dd80ff555cd9da5f91bff48
2017-02-09 19:13:02 +01:00
Max db0e380558 vty: remove ignored logging parameters
Since ce9fec3e896571835ac5bfd2980d6836f2b29f0d libosmocore ignores
parameters to log_vty_command_* functions. Hence parameter of
logging_vty_add_cmds() is ignored too. As we depend on much later
libosmocore version anyway, we can simplify code somewhat by removing
parameters which will be ignored anyway.

Change-Id: I62f752fd88f1d8fefa563648f9864c7c31f87991
2017-02-08 09:37:38 +00:00
Alexander Couzens 5ba6fb3ef4 gprs/sgsn_vty: fix typo in comment
Change-Id: I63225b7ba6d666eddf00b1deb893e79dc9ec842b
2017-02-07 00:41:48 +00:00
Alexander Couzens 1013550218 gprs/sgsn_mm_ctx_alloc(): initialize MM state to IDLE
Previous the state was only set in Iu mode.

Change-Id: I99a6aec1090cad9b9d38d134cc9b34ef292062df
2017-02-07 00:41:32 +00:00
Alexander Couzens 17a29ef311 gprs/gprs_mm: add value_strings for PMM & MM states
Change-Id: I4e34dcd5e48c4dd73d63c6f865298ee7d9c864be
2017-02-07 00:41:32 +00:00
Alexander Couzens 2b5fb8ed66 gprs/sgsn: rename sgsn_mm_ctx_alloc() -> sgsn_mm_ctx_alloc_gb()
Postfix the ran type to clarify the purpose.
Because of the new support of the Iu ran type, there are 2 functions to allocate a mm ctx.
For Iu it's sgsn_mm_ctx_alloc_iu(). For gb it should be named in the same way.

Change-Id: Ic49009e8c20c12308855e1409c09004698c79b95
2017-02-07 00:41:32 +00:00
Alexander Couzens 4f8da6dfd5 gprs/sgsn: rename gprs->mm_state -> gmm_state
GMM is the right term. MM state is already occupied.

Change-Id: I9cfdcf921e4ebd14a5e7ce7489ec4ce5d1f5515f
2017-02-07 00:41:31 +00:00
Neels Hofmeyr bcfee2a0a6 vty tests: more attempts to resolve 'Broken Pipe' error
Change-Id: I4251a24eb7a57a354aa76de711547c3e76ebb846
2017-02-07 00:41:06 +00:00
Max d09b26d487 Attempt to fix nightly builds
The fix introduced in dac5867af5 did not
work because autotools in our OE are too old. Use alternative way to
include custom m4 macros to fix it.

Change-Id: I5fe6d1180c2624cfe1d3673314f6846527a43464
2017-02-07 00:40:02 +00:00
Harald Welte 89837d422e VTY: Print 3G auth tuples, not just 2G auth tuples
Change-Id: I277e4347ee1486a39e6dc4e2363a593f328f9e3b
Related: OS#1592
2017-02-06 15:08:11 +01:00
Neels Hofmeyr 22a735bfd4 gsm_04_08: implement parsing of UMTS Auth responses
Parse the longer UMTS res from the extended Auth Response Parameter IE.
Parse the R99 Authentication Failure and AUTS in case of cause
GSM_REJECT_SYNCH_FAILURE which indicates a SQN re-sync request.

Both still end in 'not implemented' error logs, which are the places where the
upcoming VLR that supports UMTS AKA will integrate.

Depends on recently added constants in libosmocore in
commit 55a43b801385e07a484217925ecf2379b9f54fcf
aka change-id I745061ce8eb88aa23080dadcdbfe2d703c362a30

Change-Id: I4868bbeedc32fa7b8d03b9e3c66db618543d38ec
2017-02-06 15:08:11 +01:00
Philipp Maier e1f8b9244a om2000: add VTY command to delete CON groups
The currently unused function abis_om2000_vty.c:con_group_del()
allows deleting OM 2000 connection groups. This commit adds a
matching VTY command to make use of it.

Change-Id: I39a90b06e19356c536cacd1c923e195dd305ab80
2017-02-03 17:05:14 +01:00
Neels Hofmeyr e02e1e782f Revert "vty tests: more attempts to resolve sporadic 'Broken Pipe' error"
'self' will not be accessible in that context, so this patch isn't
useful.

This reverts commit b39053ad6d.

Change-Id: Ic1a9ba5fdfd7bdc6c5cf0974e8c637ae23b81ece
2017-02-03 05:56:50 +01:00
Neels Hofmeyr d675515bd4 gsm48_tx_mm_auth_req(): support UMTS AUTN
To be able to do R99 UMTS authentication, we need to send along AUTN bytes in
the Authentication Request. Add autn parameter to gsm48_tx_mm_auth_req() and
conditionally append the R99 AUTN TLV to the Authentication Request message.

Change-Id: I0d644559088706aa06b42b9bfe1f8c21ca6fa4da
2017-02-03 05:35:25 +01:00
Neels Hofmeyr ba1468e4c6 vty tests: testBSCreload: ipa_handle_small: ensure rx of 4 bytes
Change-Id: I995b7aba9d0b51b0861a4281dbbca888f36e9e00
2017-02-03 04:48:27 +01:00
Neels Hofmeyr b39053ad6d vty tests: more attempts to resolve sporadic 'Broken Pipe' error
Change-Id: I3d833ddf8c62845fe68d1e5503332541a4a04a2d
2017-02-03 04:17:49 +01:00
Neels Hofmeyr 7d17c3ef61 vty tests: attempt to get at sporadic 'Broken Pipe' error
Add verbose logging as well as three retries around the place that often
fails on our build server with a 'Broken Pipe' error.

Change-Id: I8851b76b2d7b87dd500ae40f47e6bea716ef3fc4
2017-02-02 23:38:46 +00:00
Neels Hofmeyr 35706ddd80 gsm0408_rcv_cc: guard against NULL subscriber
Check conn->subscr against NULL.

gsm0408_rcv_cc() dereferences many conn members without checking presence: the
bts and lchan members may be expected to be NULL in the ongoing MSC split and
3G developments.

But the conn->subscr is initially NULL, so an MS sending a CC message before
something like a LU or CM Service Request will result in a segfault. Prevent
that.

Note: the upcoming VLR will be more restrictive on what messages are processed,
this is a "backport" to the situation on current master.

Change-Id: If067db7cc0dd3210d9eb1da15be6b637795a3ecf
2017-02-03 00:34:02 +01:00
Neels Hofmeyr 26adfd099b compiler warning: bsc_vty: remove two unused vars
Added in recent commit 42def7205b
"Implement VTY configuration to control Early Classmark Sending"

Change-Id: Iaf640fa6e1f234f594fb8dc06f716d3d3e95eb2a
2017-02-02 20:04:56 +00:00
Neels Hofmeyr a5c71bf39a paging.h: use '<>' include, not '""'
Also separate openbsc includes from osmocom/core includes.

Change-Id: I4da0cb32476202d06902531d07faed8004f689f9
2017-02-02 04:26:36 +01:00