Commit Graph

7407 Commits

Author SHA1 Message Date
Vadim Yanitskiy a88fa1f12f RSL/BSSAP: fix: properly convert between RSL Link ID and DLCI
Data Link Connection Identifier (DLCI) is defined in 3GPP TS 48.006,
section 9.3.2, and coded as follows:

  .... .SSS - SAPI value used on the radio link;
  CC.. .... - control channel identification:
    00.. .... - indicates that the control channel is not further specified,
    10.. .... - represents the FACCH or the SDCCH,
    11.. .... - represents the SACCH,
    other values are reserved.

RSL Link Identifier is defined in 3GPP TS 3GPP TS 48.058,
section 9.3.2, and coded as follows:

  .... .SSS - SAPI value used on the radio link;
  ...P P... - priority for SAPI0 messages;
  CC.. .... - control channel identification:
    00.. .... - main signalling channel (FACCH or SDCCH),
    01.. .... - SACCH,
    other values are reserved.

As can be seen, CC bits in both DLCI and RSL Link Identifier
are coded differently.  Therefore, we cannot just assign
one identifier to another, we need to do conversion.

I noticed that osmo-bsc indicates DLCI '01000011'B for SMS
messages sent over SACCH/F (SAPI3), and this is wrong because
'01'B is reserved.  Let's fix this.

P.S. Interesting coincidence: section 9.3.2 in both documents.

Change-Id: If4d479a54cad467f53b49065c1c435a4471ac7d2
Related: Ica69ae95b47a67ba99ba9cc36629b6bd210d11e4
Related: OS#3716
2020-10-08 07:15:01 +00:00
Neels Hofmeyr 1ae1826245 LCS: implement re-use of existing A-interface conn
Location Services brings a new scenario to OsmoBSC: the MSC may create an
A-interface conn for a subscriber without an lchan being established (N-CONNECT
from MSC to BSC, so far only for an incoming inter-BSC handover).

If an MS becomes active while an A-interface conn is already established,
associate with an existing conn.

Change-Id: I42290f519a419ed7e8dd02a5ed0a5261b30a51e6
2020-10-07 11:40:12 +00:00
Neels Hofmeyr d1e7d3908b cosmetic: fix naming of GSCON_EV_A_CONN_REQ -> GSCON_EV_MO_COMPL_L3
The N-CONNECT.req on the A interface is a possible *consequence* of the event
being handled, namely the incoming RSL ESTablish INDication containing the
Complete Layer 3 message: dispatched by bsc_compl_l3().

If an (LCS related) connection is already present on the A-interface when the
lchan is established, there will be no N-CONNECT but an N-DATA sending the
Complete Layer 3. See BSC_Tests.TC_cm_service_during_lcs_loc_req().

Change-Id: Ic43aabeb0d3c58ac62249ad9d3718363d32508f9
2020-10-07 11:40:12 +00:00
Neels Hofmeyr 7d9b9437f8 bsc_subscr_name: print both IMSI and TMSI
Always use a format containing only osmo_identifier_valid() characters.

Change-Id: I6cdbaad2f0d0552f697440bf9a75bef36d59a597
2020-10-07 11:40:12 +00:00
Neels Hofmeyr 86a1dca5c7 introduce osmo_use_count for bsc_subscr
During LCS development, I'm getting use count bugs and would like to see use
token strings to figure it out.

Change-Id: I29bf60059d4cf7bb99a00753e6cdc149baf95f94
2020-10-07 11:40:12 +00:00
Neels Hofmeyr d4946b22f7 LCS: add paging reason, return in paging_request_stop()
To distinguish between the CN requiring a Complete Layer 3 response, or just
the BSC requiring a TA, allow recording a separate for-LCS paging reason.

Change-Id: Ib28d1599ae4e483727398859d07de4490fbc31f0
2020-10-07 11:40:12 +00:00
Neels Hofmeyr 4c5fd38b3b refactor paging: add bsc_subscr to bsc_paging_params
Get a bsub once at start of paging.

Change-Id: I13621cd51d934846ff6556e1f2f8839da73a5dbb
2020-10-07 11:40:12 +00:00
Neels Hofmeyr 86ce105038 refactor paging: introduce bsc_paging_start()
Allow starting a paging from elsewhere than a BSSMAP Paging Request. For
upcoming Location Services (LCS), a BSSLAP TA Request from the SMLC may require
triggering a Paging.

Change-Id: Iaff91584699d163bd1963927280ff3a8ddd43073
2020-10-07 11:40:12 +00:00
Neels Hofmeyr 766f59096e refactor paging: introduce bsc_paging_params
For LCS, I would like to add an enum indicating the paging reason. Instead of
modifying extremely many function signatures to pass the reason across all
levels of paging, introduce a struct combining these.

Change-Id: I27ca78fc6ff8ef1101554c0a8429e34945ca6f3c
2020-10-07 10:21:12 +00:00
Neels Hofmeyr 24f7071936 compl l3: move all message parsing out of bsc_find_msc()
I lost count of how many times the gsm48_hdr got parsed from the msg in the
same compl l3 code path. Here is one less.

Change-Id: I9f15b3e5e7352ef90b4598dadf2ebc0d2665f069
2020-10-07 10:19:58 +00:00
Neels Hofmeyr 65a13b4d98 compl l3: move Paging Response handling out of bsc_find_msc()
Instead of iterating the llist of gsm_paging_requests first to find an MSC, and
then again right away to mark the paging as served, do both in the same step.

Change-Id: I447e61afc9934f3a5a82f6076e41c155d3328041
2020-10-07 10:19:58 +00:00
Neels Hofmeyr 90391fcfcd compl l3: populate conn's bsc subscr from MI
Set conn->bsub as indicated by the Mobile Identity. Now the
'log_set_context(LOG_CTX_BSC_SUBSCR, conn->bsub);' becomes useful.

Upcoming patch to support Perform Location Request will use the subscriber to
retrieve an already established conn via the bsub.

Drop fixme in gscon_fsm_init(), MI now extracted and id updated.

Change-Id: I00d4c7e8284b745368a432a7ec176aa99f79db47
2020-10-07 10:19:58 +00:00
Neels Hofmeyr 2001dd6cb5 compl l3: allocate conn in gsm_08_08.c, not gsm_04_08_rr.c
Move conn allocation to bsc_compl_l3(), from gsm0408_rcvmsg().

Drop dispatch of GSCON_EV_A_DISC_IND, because a) we did not receive such
DISC.IND, and b) the lchan release will discard the conn in the regular
fashion.

In upcoming LCS patch, bsc_compl_l3() will decide whether to allocate a new
conn or whether a conn from a Perform Location Request already exists for the
subscriber.

In this patch, it becomes clear that the conn->bsub is always NULL in
bsc_compl_l3(), and that the 'log_set_context(LOG_CTX_BSC_SUBSCR, conn->bsub);'
never has the intended effect. An upcoming patch will change that.

Change-Id: I92af0f0d54c4282d782f2b29d524a64006c3b674
2020-10-07 10:19:58 +00:00
Neels Hofmeyr e828988144 compl l3: cosmetics around Create Layer 3
Move getting the CGI closer to where it is used.
Use a use_scl pointer to remove a bit of code dup.

Drop logging for tx Compl L3, there is plenty logging later in
osmo_bsc_sigtran_open_conn().

This cosmetically prepares future changes for LCS handling.

Change-Id: If7a7d0fe857797d569968e694bf20818d7472bcd
2020-10-07 10:19:58 +00:00
Neels Hofmeyr ca2759b4ce compl l3: parse Mobile Identity once
Move two calls of osmo_mobile_identity_decode_from_l3() from bsc_find_msc() and
handle_page_resp() out into a single call in bsc_compl_l3().

Prepares cosmetically for upcoming LCS patch.

Change-Id: I26950b63621417da0ed3125d0dc0b06cf015cb4a
2020-10-07 10:19:58 +00:00
Neels Hofmeyr a4e71a6f9c compl l3: separate paging handling from bsc_scan_bts_msg()
bsc_scan_bts_msg() essentially updates the MS power class for LU and CM
Service, and also stops the paging and counts the response for a Paging
Response. Separate that.

Reduce code dup by one common parse_power_cap() function for both LU and CM
Service.

Call handle_page_resp() separately.

(Upcoming patches will add more reasons to read the gsm48_hdr's pdisc and mtype
in bsc_compl_l3().)

Change-Id: If14284494c74a396fabebd79da8079342e65dcc2
2020-10-07 10:19:58 +00:00
Neels Hofmeyr c065ea01d1 gscon_bssmap_clear(): guard against NULL msc
Change-Id: I95b16cebb6ff78649f72a09b5d6c7c7e403233fa
2020-10-07 10:19:58 +00:00
Alexander Couzens c58a384c75 bsc_vty: parse the return code to make coverity happy
The missing return code isn't a problem atm because remote.af is checked
and remote.af is only set when osmo_Sockaddr_str_from_sockaddr() returns success.
However check the return code to be safe also in the future.

Found-by: Coverity
Fixes: CID#214863
Change-Id: I621360cab1e12c22248e33d62a9929995053ce04
2020-10-07 00:58:54 +02:00
Alexander Couzens c47d80a89b bsc_vty: cfg_bts_gprs_nsvc_rip: add missing breaks
Found-by: Coverity
Fixes: CID#214862
Change-Id: I0966bfd3948fef4dd2a4465aae0927bff6437e43
2020-10-07 00:58:45 +02:00
Alexander Couzens 62af292f38 pcuif_proto: version 10: add support for IPv6 NSVCs
Introduce a address_type in the NSVC configuration pass the given
protocol. The remote_ip is network byte order, the default
encoding for in_addr and in6_addr.

Related: Iae854875a45dbc29cd46a267ccaf60f1f2ac2973
Related: SYS#4915
Change-Id: I740be0a401612bb5ed4e8ccd7f4be8176b936449
2020-10-05 14:06:26 +00:00
Alexander Couzens 97d3978dd0 pcuif_proto: version 10: add frequency hopping parameters
Related: SYS#4868, OS#4546, OS#4547
Change-Id: I5540fae66a116cbb25ec75b35145c36137146ffd
2020-10-05 14:06:26 +00:00
Alexander Couzens 2f9df96eba oml: encode IPv6 NSVC using the new OML attribute NM_ATT_OSMO_NS_LINK_CFG
The old IE NM_ATT_IPACC_NS_LINK_CFG didn't support IPv6 NSVC.

Depends: Ic261bc43a07fa741b97a9c6ec5a9ed6f5ecae588 (libosmocore)
Depends: I9e279bb20940c66eea5196f281184cb4f8a5cc5f (libosmocore)
Change-Id: I6529876a3c1116a79dd624312243d8ae48a41fe2
2020-10-05 14:06:26 +00:00
Pau Espin 37474b2b38 ipa oml: tx OPSTART after unlocking, not before
According to TS 12.21, when adminsitratively Locking an object, in
general it should go into operative state Disabled. We don't really
implement it this way right now, but keep it this way consistent in all
objects.
Furthermore, TS 12.21. Figure 2 describes vaguely that unlock procedure
is done around same time where object attributes are set, which is
before OPSTART.

Change-Id: Icd4b3bb467f23c9ddfa56f6b6f8a55da1e574ab8
2020-10-05 08:47:20 +00:00
Alexander Couzens 5fa725314d pcuif_proto: protocol 9: add missing fields
The protocol 9 was extended (compatible) with
* app info request
* suspend request (ETWS)
* rach indition (add fields ts / trx)

Only copy the relevant parts but no implementation.

Related: OS#4766, OS#4767, OS#4768
Change-Id: Ia81310326b093a8e473b6c69045304667b3b60f1
2020-10-03 18:42:05 +00:00
Alexander Couzens 9bdc6e4d7a pcu_sock: use tn as variable name to improve readability
Same as used in osmo-bts

Change-Id: I5c8cf0e2d29fa4999983293401294ee0a94bfa30
2020-10-03 18:24:17 +00:00
Neels Hofmeyr d712451d5d remove unused signature gsm48_handle_paging_resp()
Change-Id: Ib221e34afe08d87e43ac7ddc73d6894bbe36dc4b
2020-10-03 07:38:41 +00:00
Neels Hofmeyr 71def15b05 log MSC nr for opening new A conn
Change-Id: Ie2df767197947b2d5ffeb882dc0827914975df88
2020-10-03 07:38:41 +00:00
Neels Hofmeyr 1559b129ee tests: add missing *.vty to EXTRA_DIST
Change-Id: If29eb737040826d387b6a1aaa246cd867ad97cdd
2020-10-03 07:38:41 +00:00
Pau Espin f875783b8d cosmetic: tests/ctrl_test_runner.py: Fix trailing whitespace
Change-Id: Id4b0ddc72e6f0e080ac7deeba30aa9acf25a0fc0
2020-10-02 19:31:43 +02:00
Pau Espin 946d679ca3 abis_nm: Remove duplicated log line
Change-Id: I52ff3c7457ca9985bb4936a6ec48abe0aee07e71
2020-10-02 19:31:43 +02:00
Pau Espin beac3d2c98 abis_nm: Log no state change detected
Change-Id: I15695b18ad7b31c2f9579813b76ecee36cce4ede
2020-10-02 19:31:43 +02:00
Pau Espin d2313548e7 abis_nm: Log Rx Change Administrative State ACK
Change-Id: I165138634b1fdb982197afdac6d2d00a4d1e4074
2020-09-30 12:44:33 +02:00
Vadim Yanitskiy f680938279 vty: fix unreacheable code / wrong check in lchan_act_all_trx()
Change-Id: If7d8a108a147980d26b71836343d20b1b0b95579
Fixes: CID#214277
2020-09-28 11:47:11 +07:00
Pau Espin 68fc19f5da bssap: Use new DTAP DLCI helper fields from libosmocore
This is the only place where the entire dtap header is passed, where
the split between SAPI and CHAN is done. Other places in osmo-bsc pass
around a link_id integer containing everything, so leaving that out of
the scope for this patch.

The gsm0406_dlci_sapi_name() API was introduced in libosmocore 1.3.0,
and osmo-bsc currently requires libosmocore 1.4.0, so it means we are
not further restricting libosmocore dependency here by using it.

Change-Id: Ib72e2bda46e39d1075e4270ac5fa51df2f418164
2020-09-23 13:50:25 +02:00
Alexander Couzens 9a701d7e70 abis_nm: abis_nm_perform_test: fix a potential null deref
gcc 10.2.0 warns msgb can be a deref because nm_msgb_alloc() can fail with null.

Change-Id: I4b0e4cd15046272e026cd74c14cbf2972ef6a070
2020-09-21 18:41:58 +02:00
Pau Espin 1a7e3ccef1 oml: Fix premature Opstart to Radio Carrier
During the A-bis/OML bootstrapping, osmo-bsc sends Opstart to the
Radio Carrier MO twice.  The first Opstart is triggered by the
State Changed Event Report, originated by the Radio Carrier itself.
The second is triggered by Software Activated Report.

According to 3GPP TS 12.21, figure 2, we shall send it only once,
after the "Attribute setting" step.  Therefore, the first Opstart
is premature, and we shall not send it.

Related: SYS#5063, OS#4755
Change-Id: If69393551117266ecb726d8961153560b2b3cc59
2020-09-20 09:56:49 +00:00
Philipp Maier 77189b535b bsc_vty: fix wrong else-if statement
Related: CID#214331
Change-Id: I1b0f324a66757278f7c95d25a5192d4234432a6b
2020-09-18 16:05:18 +02:00
Oliver Smith 3b3a6ba6eb lchan_fsm, lchan_rtp_fsm: make all timers configurable
Choose saner timer numbers before exposing to the user config.

Related: SYS#4897
Change-Id: I637fcdde93c11158de46157d494c060bb36bdcfb
2020-09-18 08:47:49 +00:00
Neels Hofmeyr 638eb99286 clean up timer definitions: introduce groups, move some T to X
Backwards compatibly, introduce timer groups in OsmoBSC, and move some
non-specified T timers to new X timers:

T993111 -> X3111
T993210 -> X3210
T999 -> X4

Why X4? because there already is an X3 used elsewhere in Osmocom, and I find
it less confusing if X-numbers don't repeat across programs. See
https://osmocom.org/projects/cellular-infrastructure/wiki/List_of_Timer_numbers

Drop unused timers from g_mgw_tdefs. Only X2427 has an actual effect.
(libosmo-mgcp-client recently moved T2427001 to X2427.)

Put libosmo-mgcp-client related timers to the 'mgw' group, like in osmo-msc.
This makes the MGCP timeout configurable for the first time.

Keep previous timer commands as DEFUN_HIDDEN, and also translate the moved T
timers to X timers on-the-fly. All previous VTY commands still work, and new
'timer [(net|mgw)] ...' commands are added. timer.vty shows this.

Remove the "_OPTIONAL" from the legacy "timer" and "show timer" commands, so
that they don't ambiguously overload the new "timer [(net|mgw)] ..." commands.

Related: OS#4539
Related: If097f52701fd81f29bcca1d252f4fb4fca8a04f7 (osmo-mgw)
Change-Id: I4beec47502afa193dee343869c4be55dc6a4b536
2020-09-18 08:47:49 +00:00
Philipp Maier 9d71f9619a bsc_vty: fix manual channel activation
The manual channel activation work in a very hackish way by sending the
CHANNAL ACTIVATION message manually using rsl_tx_chan_activ(). This
means the channel activation is not under FSM control. Also switchover
of dynamic channels does not work.

The lchan_fsm supports an activ_for in its activation info struct. The
header files define a "FOR_VTY" enum value there. However, the lchan_fsm
is not yet prepared to handle this. Lets update the lchan_fsm so that
FOR_VTY is supported and change bsc_vty to use lchan_activate() instead
of calling rsl_tx_chan_activ() directly. This will give us real channel
activation under FSM control.

Change-Id: Iffc57b7a5b7bdde06d392267791fd908e80bbb5d
Related: SYS#4910
2020-09-17 23:07:55 +00:00
Alexander Couzens e62f6a7e9d osmo-bsc: fix a crash when receiving a RACH LOAD IND with 0
Change-Id: Ia395d4ec70107688856ef0cd5daa6124a7da834b
2020-09-17 15:36:52 +00:00
Vadim Yanitskiy 127aeddab9 generate_ma_for_ts(): simplify MA bit-mask computation
Instead of maintaining two variables and re-calculating the bit
position on each iteration, let's use the existing field of the
bit-vector: set it to the first LSB and decrement in the loop.

Change-Id: I1b226a2d5867434c33ae04a0b971dbfd16c4688f
Related: SYS#4868, OS#4545
2020-09-17 15:28:34 +00:00
Vadim Yanitskiy c221b3b7b6 abis_nm: improve logging message in abis_nm_get_attr()
Change-Id: I10ef08e7d01ed27e05ef30c0bb876c0197a30500
2020-09-17 10:32:21 +00:00
Vadim Yanitskiy d3a7eb16b1 abis_nm: use LOGPFOH()/DEBUGPFOH() in parse_attr_resp_info_unreported()
Change-Id: Ib0c95c6c52122de06fa164f7a5fcb09ec7ad384a
2020-09-17 10:32:21 +00:00
Neels Hofmeyr 1eaa821e3e add timer.vty
Before transitioning some unspecified T timers to X timers, and to introduce
timer groups, first add this timer VTY test. Changes here will illustrate that
the legacy commands will still work and redirect to new timer definitions.

Related: OS#4539
Change-Id: Ie1bc635e16dc9a4040d063e1d9a51cdc76d9d1f2
2020-09-16 21:56:08 +00:00
Neels Hofmeyr 689b0e4e61 drop unused Tdef for 992427
Change-Id: I22a18662392545ba69f48e7fd8474c7c06d529cb
2020-09-16 21:56:08 +00:00
Neels Hofmeyr aa826cdcd7 drop bsc_subscr.lac
It does not make sense to set the bsc_subscr's LAC from a Paging Request,
especially since the paging code has loops that possibly kick off several
pagings.

At this point, there remains no code setting bsub->lac anywhere. We could set
it during rx of Complete Layer 3, but since there is no use for it besides a
vty dump, let's just drop the bsub->lac completely, and the vty dump of it.

Change-Id: Id017bd494d329b6fc254d7135b4074ac2b224d66
2020-09-16 21:54:52 +00:00
Neels Hofmeyr e60254118c dissolve bsc_grace_paging_request()
RF-locking: simply ask bsc_grace_allow_new_connection() at the start of
page_subscriber(). Before this patch, we would log an INFO of "Paging request
failed" when RF-locked, for each BTS. Instead log "RF-locked". (An upcoming
patch will introduce a LOG_PAGING() macro that will trivially add more log
context there, so not bothering now.)

Drop LAC condition: since Stefan introduced page_subscriber() starting 2018
Ic3c62ff0fccea586794ea4b3c275a0685cc9326e, matching a requested LAC to a
specific BTS is done *before* calling page_subscriber().

BTW: the msc->core_lac (config 'core-location-area-code') has not had an effect
on Paging maybe ever. I opened OS#4751.

Change-Id: Ic8696414a1db8f4b1be502d6434599f684746ed6
2020-09-16 21:54:52 +00:00
Vadim Yanitskiy f072fbad3e abis_nm: use DEBUGPFOH() in abis_nm_rx_sw_act_req()
Change-Id: Ib148a451edee88350f09895a85a9d1bc03f3ac00
2020-09-15 20:42:17 +00:00
Vadim Yanitskiy 1df9f5bba8 abis_nm: use btstype2str() in abis_nm_rcvmsg_manuf()
Change-Id: I6858480fb8343a4862601ef48ff1778c4e4b0275
2020-09-15 20:42:17 +00:00