Commit Graph

6415 Commits

Author SHA1 Message Date
Max ff3fad1aa8 vty: fix OML link state printing
Always print newline regardless of BTS uptime availability.

Change-Id: Ib80049fe66de17bc7acfbb774a30075f40a44dee
2018-01-08 13:02:37 +00:00
Max 94059b00a5 RSL: print link state per-TRX
Change-Id: Ie6fad70b4b11d0bb4927b22e32e842422658ba53
Fixes: OS#2715
2018-01-08 13:02:37 +00:00
Max 6e4f18455f cosmetic: remove duplicated code
Change-Id: I16c446ef7dc66769826f6e8ae118d8b07bbf6930
2018-01-08 13:02:37 +00:00
Neels Hofmeyr ff8ab0ada9 abisip-find: add --interval option
Change-Id: I9540054bdda185b2585209289cee565f61f33dcf
2018-01-08 12:56:12 +00:00
Pau Espin 3b7a31d327 osmo_bsc_bssap.c: Fix discard of const qualifier in assignment
Fixes following compilation warning:
osmo-bsc/src/osmo-bsc/osmo_bsc_bssap.c:442:10: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  enc_key = &data[1];
          ^

Change-Id: Ieeab5a822d50ac1267362f57196b80073a7901f9
2018-01-07 18:36:38 +01:00
Stefan Sperling 607f8c41bc Fix "CTRL GET msc_connection_status" response.
Since 39f62bbcbf the msc_connection_status
variable in osmo_bsc_ctrl.c is no longer updated. Query the connection's
status from the is_connected flag in struct bsc_msc_connection instead.

Makes test BSC_Tests.TC_ctrl_msc_connection_status in ttcn3-bsc-test pass.

However, we only query the connection status of the first MSC. Adapting
the control command to work with mulitple MSCs is left for future work.

Change-Id: I8ab8aac83ef6b7831b6136f7e9e3eddfbb43ecaa
Related: OS#2729
2018-01-05 10:10:56 +00:00
Harald Welte ed23c1d83d Reduce T3109 default from 19s to 5s
T3109 is started when the BSS sends a RR CHAN REL to the MS and stops
downlink SACCH generation. Stopped when the MS successfully releases the
LAPDm link. After stop or timeout, the radio channel is released using
RSL RF CHAN REL.

Recommended values in literature are 1-2s + RadioLinkTimeout*0.48s or
5s, while we had the absurdly high 19s timeout.  This means we occupy
the radio channel way longer than needed in situations where the MS is
no longer able to properly release Layer2 (LAPDm DISC) due to loss of
signal or the like.

See also: https://osmocom.org/projects/osmobsc/wiki/Timers

Change-Id: I7416b4118e5b73c6ffb98e3546bc62a36c7a967a
Closes: OS#2734
2018-01-04 11:13:41 +00:00
Max f93b31a5a7 Remove obsolete ./configure option
The '--enable-vty-tests' is just alias to '--enable-external-tests'
anyway.

Change-Id: I9492d8e988b464aa41f572611cbf2461bb8be3eb
2018-01-02 12:53:11 +01:00
Max 82d25f6ea5 Check and handle SMS encoding failure
The SMS address encoding can fail due to gsm48_encode_bcd_number() which
was not checked for because wrong type was used. Fix this by using
correct type, checking for error and propagating it to the caller.

Change-Id: I9fc16e24f7df5ebad6f4f1b389b2c5e861be95d7
Fixes: CID57882
2017-12-31 11:02:42 +00:00
Max ec54daba5c Fix .deb builds
The code triggers following error:
abisip-find.c:317:3: error: format not a string literal and no format
arguments [-Werror=format-security]

The error was introduced in 5bf1e15c55.

Change-Id: I613781495edbc53916ca70ff7b78d28ffabd3f5d
2017-12-29 14:12:06 +01:00
Max 0bd729f3ad Add optional profiling support
This facilitates the use of programs like uftrace. It's disabled by
default due to associated overhead.

Change-Id: Ia5a48a38962fc99446887a34008c40efd8344d9b
2017-12-28 14:33:53 +01:00
Max ad1e3cdd6c Migrate from OpenSSL to osmo_get_rand_id()
This avoids potential licensing incompatibility and makes integration of
Debian packaging patches easier.

The libosmocore version requirements are fine already but for jenkins
tests to pass we have to have Ic77866ce65acf524b768882c751a4f9c0635740b
merged into libosmocore master.

Change-Id: Ia57bf1300525cf3c247284fe966b1c415c2d53e2
Related: OS#1694
2017-12-27 11:10:59 +00:00
Neels Hofmeyr 77a9d4e6ce abisip-find: add timeout option
Change-Id: I3b30e2b9cac9c70ba8d272022eee596de39d7b82
2017-12-25 19:24:00 +01:00
Neels Hofmeyr 89ade632be abisip-find: update copyright
Change-Id: Ibb72fa16cc1a8b6809d0510211bfc61a170d1250
2017-12-25 19:24:00 +01:00
Neels Hofmeyr 5bf1e15c55 abisip-find: add -l to list base stations instead of streaming replies
To get an overview of what base stations are present in a network, particularly
with many base stations being present, it is particularly useful to get a list
of connected base stations instead of just output of received replies.

Keep a sorted list of known base stations, which time out after 10 seconds.
Print additions and removals, and total amount of replies received. On each
change, print the entire list.

Output a running total of replies received, to provide comfort to the reader
that something is still happening, and to confirm that the shown listing is
still up-to-date (updated on the same line by means of '\r').

It looks like:

  ----- Mon Dec 25 18:59:43 2017

    0: MAC_Address='00:02:95:07:dc:bd'  IP_Address='192.168.0.124'  Unit_ID='1/1/1'  Location_1='Unknown'  Location_2='3GAP'  Equipment_Version='237B015_C'  Software_Version='unknown'  Unit_Name='Unknown'  Serial_Number='000295-0000152614'
    1: MAC_Address='00:02:95:07:dd:57'  IP_Address='192.168.0.15'  Unit_ID='1/1/1'  Location_1='Unknown'  Location_2='3GAP'  Equipment_Version='237B015_C'  Software_Version='unknown'  Unit_Name='Unknown'  Serial_Number='000295-0000154153'

  Total: 2
  RX: 11

  ----- Mon Dec 25 19:00:12 2017

  LOST:
  MAC_Address='00:02:95:07:dd:57'  IP_Address='192.168.0.15'  Unit_ID='1/1/1'  Location_1='Unknown'  Location_2='3GAP'  Equipment_Version='237B015_C'  Software_Version='unknown'  Unit_Name='Unknown'  Serial_Number='000295-0000154153'

  ----- Mon Dec 25 19:00:12 2017

    0: MAC_Address='00:02:95:07:dc:bd'  IP_Address='192.168.0.124'  Unit_ID='1/1/1'  Location_1='Unknown'  Location_2='3GAP'  Equipment_Version='237B015_C'  Software_Version='unknown'  Unit_Name='Unknown'  Serial_Number='000295-0000152614'

  Total: 1
  RX: 15

  ----- Mon Dec 25 19:00:28 2017

  New:
  MAC_Address='00:02:95:07:dd:57'  IP_Address='192.168.0.15'  Unit_ID='1/1/1'  Location_1='Unknown'  Location_2='3GAP'  Equipment_Version='237B015_C'  Software_Version='unknown'  Unit_Name='Unknown'  Serial_Number='000295-0000154153'

  ----- Mon Dec 25 19:00:28 2017

    0: MAC_Address='00:02:95:07:dc:bd'  IP_Address='192.168.0.124'  Unit_ID='1/1/1'  Location_1='Unknown'  Location_2='3GAP'  Equipment_Version='237B015_C'  Software_Version='unknown'  Unit_Name='Unknown'  Serial_Number='000295-0000152614'
    1: MAC_Address='00:02:95:07:dd:57'  IP_Address='192.168.0.15'  Unit_ID='1/1/1'  Location_1='Unknown'  Location_2='3GAP'  Equipment_Version='237B015_C'  Software_Version='unknown'  Unit_Name='Unknown'  Serial_Number='000295-0000154153'
  RX: 18

Change-Id: I4201876431029b303dbd10e46492228379c9782a
2017-12-25 19:23:49 +01:00
Neels Hofmeyr 2a9ac19863 abisip-find: add getopt option parsing in preparation for a new option
Subsequent patch I4201876431029b303dbd10e46492228379c9782a will add the -l
cmdline option. Add getopt in a separate step here to keep the patch lean.

Change-Id: Idba1a89753510fe6d409277b20c2db86c1b8f7f8
2017-12-25 19:22:37 +01:00
Harald Welte 148ee361b3 cosmetic: Hide all accesses to conn->bts behind conn_get_bts()
This is a new inline function that hides all accesses to conn->bts.

A follow-up patch will then point this to conn->lchan->ts->trx->bts
to get rid of the bts field.

Change-Id: Ib6cf7097ced34eebe80441c29ab1534f21956a33
2017-12-23 00:23:08 +01:00
Harald Welte 9f7b1955d1 bsc_test.c: Use proper network/bts/lchan structures
don't mock them, simply call the respective functions to get
a gsm_network and a gsm_bts with all its subordinate members.

Change-Id: I8bdf009d3c7e2473dd42da02762039a19430d6ce
2017-12-23 00:14:53 +01:00
Harald Welte a8d896954d BSC: Fix bsc_subsc leak on paging
The OsmoBSC code contained a refcount leak on bsc_subscr in the paging
code.  For every PAGING command received from the MSC we consistently
leaked one refcount, resulting in a resulting memory leak.

Change-Id: I3d0fb406ca2a1042c6c3424e0dd263c1933b0d50
Closes: OS#2780
2017-12-22 22:15:08 +01:00
Harald Welte 7c29b094d5 BSC: Add "show subscriber all" command
This command lists the currently-active bsc_subscr and their contents,
the format looks like this:

OsmoBSC> show subscriber all
 IMSI             TMSI      LAC    Use
 001010123456789  ffffffff  65534  3
 001010100000001  a1b2c301  65534  1

Change-Id: Ib9c0c31a0a5a91b42fd832fa0df3460b1a440733
2017-12-22 21:48:55 +01:00
Max 09653a0a19 Enable sanitize for CI tests
Change-Id: I86f8f29dbe13869fa4a0ac1f55ff697a8975525b
2017-12-21 17:19:45 +01:00
Philipp Maier 57d4fe7157 mgcp: validate rtp connection data in MGW response (ip/port)
Currently the pasing results from the RTP ip/port are fed into
inet_addr without checking the results.

Check the return code of inet_addr to be sure that the IP-Address
got properly decoded.

Change-Id: I1d0aa7e9b8480e1bef57269e3904399cb99815bb
2017-12-20 11:57:19 +01:00
Philipp Maier 75f2c8d47f mgcp: cancel transactions on timeout
when a transaction to the MGW times out, then the context
information is freed. Unfortunately the client is not informed
about this and will try to execute the callback anyway.

explicitly cancel the transaction in order to prevent access
to already freed data structures.

Change-Id: I40794dff7d10e2b6a96863a2da7e9fbd5662a1bf
2017-12-20 11:48:18 +01:00
Harald Welte 472275c301 remove unused 'lac' member of 'struct gsm_subscriber_connection'
This field was used in write-pnly mode, i.e. set but never read.

Change-Id: I319945538fd3e3bc5cf3b9d82533641cb8ba5256
2017-12-19 18:58:51 +01:00
Harald Welte 4a8ebc8394 gsm_data.h: Document all fields of gsm_subscriber_connection
Change-Id: I429fe7817f075d0794645d37f5ea11b104102ba0
2017-12-19 18:58:51 +01:00
Harald Welte ea0c3203db osmo-bsc: Move user plane/voice related bits into sub-structure
This clarifies which members of the struct are for what.

Change-Id: I618822e6f2d48adce25f9df5c25acbce7c858412
2017-12-19 18:58:51 +01:00
Harald Welte ca494f385e osmo_bsc.h: document every field in 'struct osmo_bsc_sccp_con'
Change-Id: I674ed61a22fad5cc09c45128dbc73474893aefb6
2017-12-19 18:58:51 +01:00
Harald Welte 95464c78fd Remove unused struct osmo_bsc_sccp_con member sccp_queue_size
Change-Id: Ibc4b8f3776c35df7e81252efb78ec740a371de7f
2017-12-19 18:58:22 +01:00
Harald Welte 45f3eccaba osmo_bsc_bssap.c: Spelling fixes in comment
Change-Id: I32b2d08bf25cd2d343755ac8491e4f5f758ccee6
2017-12-19 17:53:14 +00:00
Harald Welte e94d7d1bdf remove libosmo-sccp dependency for osmo-bsc
libosmo-sccp is the old sccp-lite-focused SCCP implementation that we
used before libosmo-sigtran was created.  The new osmo-bsc in this
repository is using libosmo-sigtran and shouldn't be using parts of
libosmo-sccp anymore.

We only keep it around in configure.ac and Makefile.am for osmo-bsc_nat,
which is not even built in this repository anymore (or 'again yet'?)

Change-Id: I8f274be7d196cd7a5b1ec9ada949130fb06e984d
2017-12-19 17:53:14 +00:00
Harald Welte 3edbd0e065 Remove some more dead code
Change-Id: I919bffe88babd90227c89abd4434322965c32ebb
2017-12-19 17:53:14 +00:00
Harald Welte 8311a81bae Remove bogus MM INFO configuration
The network name and other MM INFO is controlled by the MSC, not the BSC.

Change-Id: I1cbf72fc50cff29e7c1633ba752cbf15b4b84c58
2017-12-19 17:53:14 +00:00
Harald Welte c499e5c62e Remove bogus vty config for LU reject cause
The LU reject cause (like anything MM related) is under control of
OsmoMSC, not BSC.

Change-Id: I559ae31d67726845c9699c8b6127e21c6f63ace6
2017-12-19 17:53:14 +00:00
Harald Welte faacb090f6 Remove unused RRLP options/codec
RRLP is handled in OsmoMSC after the split from NITB, so let's remove
any bogus VTY commands left over in the BSC.

Change-Id: Ib626f43a3a3ca69dfc127afe5832eb58f7fb6a38
2017-12-19 17:53:14 +00:00
Harald Welte d9956d91ba Remove dead code left over from NITB split
There still is a lot of dead code that we inherited from the NITB
days, let's remove more of it.

libtrau will be re-introduced as part of osmo-mgw later.

Change-Id: I8e0af56a158f25a4f1384d667c03eb20e72df5b8
2017-12-19 17:53:13 +00:00
Max f8dc526207 Remove unneeded .py scripts
The ipa.py has been moved to osmo-python-tests as osmo_ipa - use it for
vty and ctrl tests instead of local copy. The soap.py and twisted_ipa.py
are not BSC-specific: leftovers from repository split which are now
available in osmo-python-tests as well.

Change-Id: Ia4285b18b152b070c148228604d1e61a8adedba1
2017-12-19 18:08:46 +01:00
Max 4ab7268a90 Fix tests after rate_ctr change
Recent change lin libosmocore disallow registering rate_ctr with the
same name and indexing multiple times. To accommodate to this:

* allocate network struct once and use it for all tests
* deregister rate_ctr group after each test
* free bts struct after each test

Related: OS#2757
Change-Id: Ie1537a1ee9ee812eaaf9f58dc4bc86d4add8c31f
2017-12-18 22:13:36 +01:00
Neels Hofmeyr 7abe7ae2d0 fix bssmap_handle_cipher_mode()'s encryption decision
Properly match up any A5/N with the MSC's list of permitted algos.

Properly set the reject cause in case of mismatching algorithm choices.

Actually allow choosing A5/1 thru 3 as configured on the VTY, by passing
a5_encryption through to gsm0808_cipher_mode() (instead of a hardcoded 1).

Properly handle failure rc of gsm0808_cipher_mode() by sending a reject
message.

Cosmetically clarify which GSM0808_IE_ENCRYPTION_INFORMATION bits mean what by
means of local variables; add some comments on expected encryption formats; add
comment that the BSC should be able to have more than one a5_encryption.

Related: OS#2745 OS#2755
Change-Id: Ide8a615905555e35be4584b458d4d40345686175
2017-12-14 21:39:49 +01:00
Neels Hofmeyr 8c6301cf0d debug log: log Cipher Mode info upon sending down RSL/A-bis
Change-Id: I7f7ec44887f6b40fdce8d348e9e9bd200fe0b689
2017-12-14 21:39:49 +01:00
Neels Hofmeyr 64c2920620 log typo fix in gsm0808_cipher_mode()
Change-Id: I3f6d138df9ddc9c6560d04e2e8baa1f3a50a164f
2017-12-14 21:39:44 +01:00
Harald Welte 00d64fd5ec Add new "chan:mode_modify_nack" counter to count RSL MODE MODIFY NACK
Those NACKs shouldn't happen in production, and if they do, you probably
want to have a more persistent figure than a line in the log file about
it.  Having counters allows the user to monitor this efficiently.

Change-Id: Ic82c6baaf4cb88d07bc5cdc200f8279cf130f396
2017-12-14 15:03:43 +01:00
Harald Welte 581398afab Add a new counter "rsl:ipa_nack" to count number of IPA related NACKs
Those NACKs (CRCX/MDCX/PDCH_ACT) shouldn't happen in production, and
if they do, you probably want to have a more persistent figure than
a line in the log file about it.  Having counters allows the user
to monitor this efficiently.

Change-Id: I5edf979c9a2b4c9a5a60eef9f66c26da54f2bddf
2017-12-14 15:03:43 +01:00
Harald Welte 62d9cb0529 Add new per-BTS "rsl:unknown" counter to count unknown RSL messages
Change-Id: I268f222140fa5783e1d19f81fbd45614aaa4b8c4
2017-12-14 15:03:43 +01:00
Harald Welte 4f59892ce6 Add per-BTS rate_ctr for total + failed number of RSL CHAN_ACT
Change-Id: I471b598af194dee78ebaa3414b6290c72d9bbcff
2017-12-14 15:03:43 +01:00
Harald Welte 6e59ced031 Reduce T3113 default from 60s to 10s
Our T3113 timer default of 60s was set early in the development of
OpenBSC, where we didn't really know what values to use and used
excessively large/safe values. Paging the same MS for 60 seconds (even
if there's no paging response) will however create a lot of PCH load for
no good reason.

It seems there's no clear guidance as to what the value should be. Other
implementations use something in the order of 10 seconds (OpenBTS,
yateBTS), which seems more realistic. THe Siemens BS-11 has a default of
5 seconds.

Let's be conservative and go to 10s as a default, which is already 6
times less potential PCH usage than our default so far...

Closes: OS#2756
Change-Id: If9c8441939c6fdcf6e2b9ede8cc576eb86296209
2017-12-14 13:06:33 +01:00
Harald Welte cf9d431e89 libbsc: paging: more reasonable (and detailed) paging statistics
Counting the number of T3113 expirations (one per subscriber per BTS)
vs the number of paging attempts (Bsc global) is a ueseless figure,
as you cannot relate each other.

We count on the BSC level:
	* how many PAGING we received from the MSC (total)
	* how many of those were for cells/LACs we don't serve
	* how many of those resulted in PAGING RESPONSE

We count on the BTS leve:
	* how many PAGING CMD we sent to the BTS (total)
	* how many of those we ignored as we were already paging
	* how many of those resulted in PAGING RESPONSE
	* how many were expired due to T3113 expiring

Change-Id: I410bbcbb2621f95f11238f7a5da01ab438f5fee1
2017-12-14 13:06:33 +01:00
Harald Welte 2ed22c83df Fix per-BTS counter group index
I discovered that the per-BTS counter group could only be requested
for BTS 0 but didn't work for any further BTSs.

This is a bug introduced in Change-Id I5bd9e6e333b1c396beae46630986b17e7f8b82ef
where we introudce the per-BTS counters,t but allocate all of them with
index '0'.

Change-Id: I1b56f8d7b47597ed263e6808074483edca0895de
2017-12-14 13:06:33 +01:00
Philipp Maier 66d2ef81b6 cosmetic: osmo_bsc_mgcp: improve comments
Make the comments for struct mgcp_ctx more expressive

Change-Id: Ie80b4915055e3f944ff1870c38e3609197ab72b2
2017-12-13 20:20:15 +00:00
Philipp Maier 256d09d1f2 paging: paging_flush_bts: be sure pending_requests is initalized
The BSSMAP reset causes the paging requests to be flushed. When
this happens right after startup then calling paging_flush_bts()
may be called when the list bts->paging.pending_requests is not
yet initalized, which causes a segfault.

Call paging_init_if_needed() to be sure that the list is
inizalized (like the other functions also do)

Change-Id: I42ddbfdec6f9d74d858ad13cc38b5b64061d08dc
2017-12-13 20:19:52 +00:00
Neels Hofmeyr 719322693c fix segfault upon release paging on BSSMAP Reset: init llist
Initialize the llist head gsm_bts->paging.pending_requests at the time gsm_bts
is allocated, not only at paging_init_if_needed().

The gsm_bts->paging sub-struct is invalid as long as gsm_bts->paging.bts
doesn't point back to bts. Hence the recently added iteration of
gsm_bts->paging.pending_requests should have checked whether bts is NULL. The
llist_head pending_requests is not initialized unless paging_init_if_needed()
has been called (and paging.bts is hence set). However, this fix is a safer way
to prevent errors like this in general.

The segfault was introduced by d382bf63e2 /
If3f53d3bb66ad2dc02db823cb813590c6b59c700

Related: OS#2747
Change-Id: Idfafac4e2c0e0a241a62aecbbdc22be71febf840
2017-12-13 19:13:44 +01:00