Commit Graph

286 Commits

Author SHA1 Message Date
Holger Hans Peter Freyther 5dd295ff44 bsc: Timers are in seconds, clarify that in the online help 2014-04-11 19:30:53 +02:00
Holger Hans Peter Freyther 686191a1c9 oml: Fix compiler warning about aliasing
Make the fill_fom_hdr return the header and use it throughout.

  CC       abis_nm.o
In file included from ../../include/openbsc/debug.h:8:0,
                 from abis_nm.c:38:
abis_nm.c: In function ‘abis_nm_opstart’:
abis_nm.c:1763:34: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  abis_nm_debugp_foh(DNM, (struct abis_om_fom_hdr *) oh->data);
                                  ^
/home/ich/install/openbsc/include/osmocom/core/logging.h:23:74: note: in definition of macro ‘DEBUGP’
 #define DEBUGP(ss, fmt, args...) logp(ss, __FILE__, __LINE__, 0, fmt, ## args)
                                                                          ^
abis_nm.c:1763:2: note: in expansion of macro ‘abis_nm_debugp_foh’
  abis_nm_debugp_foh(DNM, (struct abis_om_fom_hdr *) oh->data);
  ^
abis_nm.c:1763:34: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  abis_nm_debugp_foh(DNM, (struct abis_om_fom_hdr *) oh->data);
                                  ^
/home/ich/install/openbsc/include/osmocom/core/logging.h:23:74: note: in definition of macro ‘DEBUGP’
 #define DEBUGP(ss, fmt, args...) logp(ss, __FILE__, __LINE__, 0, fmt, ## args)
                                                                          ^
abis_nm.c:1763:2: note: in expansion of macro ‘abis_nm_debugp_foh’
  abis_nm_debugp_foh(DNM, (struct abis_om_fom_hdr *) oh->data);
  ^
abis_nm.c:1763:34: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  abis_nm_debugp_foh(DNM, (struct abis_om_fom_hdr *) oh->data);
                                  ^
/home/ich/install/openbsc/include/osmocom/core/logging.h:23:74: note: in definition of macro ‘DEBUGP’
 #define DEBUGP(ss, fmt, args...) logp(ss, __FILE__, __LINE__, 0, fmt, ## args)
                                                                          ^
abis_nm.c:1763:2: note: in expansion of macro ‘abis_nm_debugp_foh’
  abis_nm_debugp_foh(DNM, (struct abis_om_fom_hdr *) oh->data);
  ^
abis_nm.c:1763:34: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  abis_nm_debugp_foh(DNM, (struct abis_om_fom_hdr *) oh->data);
                                  ^
/home/ich/install/openbsc/include/osmocom/core/logging.h:23:74: note: in definition of macro ‘DEBUGP’
 #define DEBUGP(ss, fmt, args...) logp(ss, __FILE__, __LINE__, 0, fmt, ## args)
                                                                          ^
abis_nm.c:1763:2: note: in expansion of macro ‘abis_nm_debugp_foh’
  abis_nm_debugp_foh(DNM, (struct abis_om_fom_hdr *) oh->data);
  ^
abis_nm.c:1763:34: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  abis_nm_debugp_foh(DNM, (struct abis_om_fom_hdr *) oh->data);
                                  ^
/home/ich/install/openbsc/include/osmocom/core/logging.h:23:74: note: in definition of macro ‘DEBUGP’
 #define DEBUGP(ss, fmt, args...) logp(ss, __FILE__, __LINE__, 0, fmt, ## args)
                                                                          ^
abis_nm.c:1763:2: note: in expansion of macro ‘abis_nm_debugp_foh’
  abis_nm_debugp_foh(DNM, (struct abis_om_fom_hdr *) oh->data);
2014-04-04 12:56:34 +02:00
Holger Hans Peter Freyther 4766524d17 rsl: Add missing breaks in the code
Given that the method is only called for a traffic channels the
missing breaks didn't hurt.

Fixes: Coverity CID 1040731, CID 1040732, CID 1040733,
       CID 1040734
2014-04-04 12:17:28 +02:00
Holger Hans Peter Freyther bd30cd3e1f bsc/msc: Extension can never be NULL use strlen instead
Fixes: Coverity CID 1040717
2014-04-04 11:53:18 +02:00
Holger Hans Peter Freyther 8a080be4ad abis: Check for failure of ftell
In case ftell -1 will be returned. Coverity complained that the
pos we pass to fseek might be negative. In case the ftell fails
we are at the last line for sure.

Fixes: Coverity CID 1040721
2014-04-04 11:49:45 +02:00
Jacob Erlbeck e827812051 ipa: Use enhanced ipa_msg_recv_buffered() to cope with partioned IPA messages
The old ipa_msg_recv() implementation didn't support partial receive,
so IPA connections got disconnected when this happened.

This patch adds the handling of the temporary message buffers and uses
ipa_msg_recv_buffered().

It has been successfully tested by jerlbeck with osmo-nitb and
osmo-bsc.

Ticket: OW#768
Sponsored-by: On-Waves ehf
2014-04-01 13:40:59 +02:00
Holger Hans Peter Freyther 8a158bb1ea ctrl/abis: When the max_power_reduction changes, send it to the BTS
In case the max_power_reduction changes, issue a new Set Radio
Carrier Attributes command. OML 12.21 allows to not include the
ARFCN list and the semantic I picked/understand is that a partial
update is possible.

Fixes: SYS#267
2014-03-26 18:08:22 +01:00
Holger Hans Peter Freyther 49f9e5b6b4 ctrl: Move the lookup into a separate file in preparation for GPRS
For GPRS the look-up via bts/trx does not make any sense and would
introduce bad depdencies for the SGSN. Move the look-up code to a
new file and introduce new setup methods.
2014-03-23 16:25:16 +01:00
Holger Hans Peter Freyther d092f48648 nitb/ctrl: Add ctrl command to set the TRX max_power_reduction
In case the BTS is connected the new attribute should be set
through OML. This is left as a todo item.

Addresses: SYS#267
2014-03-23 14:05:22 +01:00
Holger Hans Peter Freyther 3adb772853 libbsc: Add command to set MNC/MCC and apply it if something changed
Change the splitting of the ctrl_test_runner.py. Make sure that
we get one element and all the rest.
2014-03-04 20:38:49 +01:00
Holger Hans Peter Freyther 6ca9f4f5c3 libbsc: Add ctrl command to apply the configuration
Right now this only works for IP based BTS like the sysmoBTS and
by dropping the OML link.
2014-03-04 14:45:48 +01:00
Holger Hans Peter Freyther f8c42191de libbsc: Add ctrl command for MNC, MCC, short-name and long-name
Add the framework for adding more setting commands.
2014-03-04 14:45:48 +01:00
Holger Hans Peter Freyther a9fae1ae66 bsc: rf_ctrl will always be created, remove the NULL checks 2014-02-08 12:47:39 +01:00
Holger Hans Peter Freyther 362d10f20a libbsc: Create the RF interface all the time
The interface can be accessed through CTRL and a socket. But currently
it is only available when the socket interface has been configured.
Create the interface all the time but only listen on the socket when
a path has been specified.
2014-02-08 12:47:32 +01:00
Andreas Eversberg dcf38e1c96 Add function to update TRAU muxer after assignment or handover
E1 based BTS use TRAU muxer to decode TRAU frames. After changing
channel from one timeslot to another (due to handover or assignment),
the TRAU muxer must be updated. The call reference of the call is
disconnected from the old channel and connected to the new channel.
2014-01-27 14:39:06 +01:00
Harald Welte 94bc1e0b5e Fix more hidden TSC bugs for Ericsson BTS
It seems that also the Ericsson RBS2000 code was assuming that
we always use the bts-global TSC, rather than the possibly different
TS-specific TSC.
2014-01-19 17:32:59 +01:00
Harald Welte 1fe2412949 TSC: Add new gsm_ts_tsc() function to resolve TSC of TS
We don't want every caller to check for ts->tsc == -1 and then
using ts->trx->bts->tsc instead.  Rather, introduce a new inline
function to retrieve the correct value.
2014-01-19 17:32:59 +01:00
Harald Welte 903aaea668 Do not expect all BTSs support TSC != BCC
We introduce a new feature indicating if the given BTS model
supports a TSC that is different from the BCC (lower 3 bits of BSIC).
2014-01-19 17:32:56 +01:00
Harald Welte cd4e74df95 Make gsm48_lchan2chan_desc() reflect a ts-specific TSC
If the TS has a specific, different TSC than the BTS (beacon),
we should use that with preference over the TSC of the BTS.
2014-01-19 16:55:16 +01:00
Jacob Erlbeck 64277e6514 si: Implement range 128, 256, 1024 encoding
This commit adds the implementation of these range formats to the
encoder. In addition, the work-around that tried range 512 first is
removed, so that the selection is primarily based on the max distance
between frequencies.

Ticket: OW#1061
Sponsored-by: On-Waves ehf
2014-01-16 12:04:30 +01:00
Jacob Erlbeck f8f72e23ca si: Add generic range w(k) encoder
Currently the encoding of the chan_list is done by a hard-coded
sequence of macros that closely resembles figure 10.5.16 in
3GPP TS 04.08.

This patch replaces this by an algorithmic solution that can be used
for all range encodings and is based on the property

    W(2^i) to W(2^(i+1)-1) are on w1_len-i bits when present

(see section 10.5.2.13 in TS 04.08).

Ticket: OW#1061
Sponsored-by: On-Waves ehf
2014-01-16 12:04:30 +01:00
Jacob Erlbeck 45014a0cad si: Fix range1024 encoding
f0 is currently set to arfcns[0] in range_enc_determine_range(),
while GSM 04.08 requires f0 to be ARFCN 0 in range1024 encoding.

This patch modifies range_enc_determine_range() to force f0 to be 0
if this encoding is used. This way the case distinction in
range_enc_filter_arfcns() is not longer necessary.

Sponsored-by: On-Waves ehf
2014-01-16 12:04:30 +01:00
Jacob Erlbeck 131406c86d si: Fix range512 encoding
This patch fixes a bug in the range encoder that leads to wrong
encoding when 17 or more ARFCNs are encoded.

Sponsored-by: On-Waves ehf
2014-01-16 12:04:30 +01:00
Jacob Erlbeck 65d114fe43 si: Add a config option to disable SI2ter/SI2bis/SI5ter/SI5bis messages
The iPhone5 (US) appears to have some issues with the SIs generated,
or the nanoBTS is not sending them correctly.

Add a configurable hack to put all bands into the SI2/SI5 message.
It is enabled by the bts VTY command 'force-combined-si'.

This is a quick change without much reflection and watching for side
effects. I have verfied that a network with ARFCN 134 and neighbors
ARFCN 130 and 512 do not get generate the SI2ter and announce everything
inside the SI2.

This patch is conceptually based on 'si: Add a hack to disable
SI2ter/SI2bis/SI5ter/SI5bis messages' (692daaf2d2).

Ticket: OW#1062
Sponsored-by: On-Waves ehf
2014-01-16 12:04:22 +01:00
Andreas Eversberg a83d511b61 Each BTS can be configured for speech support (other than GSM full rate)
Speech codings which are not supported by BTS will be removed from the
bearer capability information element after parsing. This way it is not
required for the MNCC application to consider support of each BTS.

Only GSM full rate is supported by default.
2014-01-14 17:37:02 +01:00
Andreas Eversberg 7d8fa3418f Add VTY option for Nokia BTS that does not send RELease CONFirm message
This option is a workarround for a bug found in Nokia InSite BTS firmware
version 3.0.0. There is no RELease CONFirm message for local end release.
Nokia MetroSite with firmware version 4.178.16 is not affected.

TS 04.06 Chapter 5.4.4.4 "Local end release procedure" states that a
confirm must be sent by layer 2 when receiving a local end release
request.

In order to correctly switch a channel (handover or assignment), local
end release is required.
2014-01-09 08:12:14 +01:00
Holger Hans Peter Freyther b1d71d4267 bsc: Reduce the RLL timeout to be smaller than TC1/max_retr+1
Sylvain pointed out that the RLL and the SMC timeout is the same.
This can lead to have a SMC re-transmission before the first RLL
Establish Request has timed out. Reduce the RLL timeout. GSM 08.58
does not specify a timeout so right now I just reduce it to seven
seconds.
2013-12-27 19:21:58 +01:00
Andreas Eversberg b6f9516193 Fix: Nokia requires VTY's "oml e1" parameters also
When writing config file, OML configuration must be written for all
E1 based BTS, which includes Nokia *Site BTS.
2013-12-18 16:23:39 +01:00
Holger Hans Peter Freyther 27a788ddb9 si: Make sure to not overwrite orig_arfcn_hi in the range encoding
Andreas highlighted that the doubel assignment is not needed and
wrong. Change the code to assign chan_list[0] before writing the
base frequency to the header. Update the testcase to make the highest
bit set and update the test result.
2013-12-12 17:00:57 +01:00
Holger Hans Peter Freyther 7f180e83c3 vty: Address coverity issue with subscr->name never being NULL
Coverity points out that subscr->name is an array and never NULL.
Use strlen instead in this check.

Fixes: Coverity CID 1040717
2013-12-12 16:20:12 +01:00
Holger Hans Peter Freyther a5ddf489e1 subscriber: Address coverity warning and truncate the IMSI
The IMSI can only be 15 characters in length, our define gives
us a length of 17. This means we have place for two NULs. Use
strncpy and make sure it is null-terminated.

Fixes: Coverity CID 1040707
2013-12-12 16:20:07 +01:00
Holger Hans Peter Freyther ec37bb2956 bsc: Add a VTY command to show the paging group for a BSC/IMSI 2013-11-22 16:00:00 +01:00
Jacob Erlbeck 24d3b91d46 bsc: Move gsm48_tx_mm_serv_ack/rej to gsm_04_08_utils.c
These functions are currently located in libmsc/gsm_04_08.c together
with other symbols that (transitively) depend on many external
symbols (and thus libraries) that aren't otherwise needed by e.g.
osmo-bsc.

Since gsm48_tx_mm_serv_ack() will be needed by osmo-bsc, these
functions are moved to avoid the dependency on gsm_04_08.o.

Sponsored-by: On-Waves ehf
2013-11-01 17:12:37 +01:00
Jacob Erlbeck 36722e13da vty: Use vty_install_default() instead of bsc_install_default()
Remove ournode_exit_cmd, ournode_end_cmd, and bsc_install_default()
since this functionality is provided by the current libosmocore.

Replace calls to bsc_install_default() by call to
vty_install_default() with the following semantic patch:

    @rule1@
    expression N;
    @@
    - bsc_install_default(N);
    + vty_install_default(N);

Ticket: OW#952
Sponsored-by: On-Waves ehf
2013-10-30 15:19:00 +01:00
Alexander Chemeris 0c48fc7c62 abis: Consistent usage of LOGP/DEBUGP for "RSL CONNECT NACK" 2013-10-08 11:29:44 +02:00
Jacob Erlbeck 946d1415c2 bsc/mminfo: Patch timezone and DST in MM Info messages
This adds in-place patching of the time information in the
MM INFORMATION message. The timezone in the 'Local time zone' and
the 'Universal time and local time zone' information elements
and the offset in the 'Network Daylight Saving Time' information
element are optionally set.

The new values are determined by the 'timezone' vty command in the
config_net_bts node. That command is extended by an optional
DST offset parameter.

Tests are provided for the vty part and for the plain
bsc_scan_msc_msg() function.

Sponsored-by: On-Waves ehf
Ticket: OW#978
2013-09-19 10:57:13 +02:00
Ivan Kluchnikov 6792059d50 bsc: Add vty command for setting Access control classes. 2013-09-18 16:14:44 +02:00
Holger Hans Peter Freyther cd40fb4dea vty: Cosmetic change to the writing of the bts->model
Based on the feedback of Peter from the mailinglist, move the
writing code to a new method and return early if there is no
bts->model.
2013-09-16 14:03:43 +02:00
Jacob Erlbeck 779a72819d ctrl: Remember last 'rf_locked' control command
This stores the last SET rf_locked control command along with a
timestamp. The 'show network' vty command is extended to show
this information.

Ticket: OW#659
2013-09-11 20:27:08 +02:00
Jacob Erlbeck 733bec8626 vty: Hide unconfigured BTS on 'write'
This prevents the application from crashing when there is a half
configured BTS (e.g. by using the command 'bts 1' when there isn't
a BTS 1) and the 'write' command is used.
2013-09-11 20:20:33 +02:00
Holger Hans Peter Freyther 3ffd9bc0a4 bsc_msc: Fix possible null pointer dereference
In case the allocation of con is failing, do not attempt to
print con->name as this will be a null pointer dereference.

Fixes: Coverity CID 1076318
2013-09-04 08:45:48 +02:00
Holger Hans Peter Freyther 33eb5873d9 bsc_msc: Stop the re-connect timer in case the msc is lost
It was possible to cause a crash by enabling and disabling the
MSC connection. The enabling lead to scheduling a connection
and the second call was not stopping the timer.
2013-09-03 15:04:17 +02:00
Holger Hans Peter Freyther c1a8687cb8 bsc_msc: Add a name field to the MSC Connection to differentiate links
Assign a static name to a MSC Connection and use it. In case there
are multiple connections we can now more easily identify them.

This is only used for the NAT right now, the BSC could start to
name the various MSC connections too.
2013-09-03 15:02:46 +02:00
Jacob Erlbeck 0ae92a950a vty: Use generic 'end' and 'exit' commands
Add bsc_install_default() and replace all install_default()

This patch adds bsc_install_default() which calls install_default()
and add 'exit' and 'end'. All other calls to install_default() are
replaced by calls to bsc_install_default().

Since 'exit' and 'end' are now added automatically to each node, the
explicit registrations of these commands are removed by this patch,
too.

The related tests succeed now without work-arounds (except for the
'config' node itself which is part of libosmocore).
2013-09-02 20:25:35 +02:00
Holger Hans Peter Freyther 9303df22bd nanobts: Fix initialization of two concurrent BTS.
It was possible that the wrong NSEI information was sent to the
BTS. This is because patch_nm_tables is not called before sending
the data to the BTS. This will break when two BTS connect more or
less at the same time.

Stop using the arrays directly and instead introduce a method
that will patch the table and return the data and length. This
makes sure that all users patch the table before we send the
data to the BTS.

I bootstrapped a sysmoBTS and I can bring up rsl. The device is
running with a dummy load so I couldn't do more verification.
2013-09-02 10:20:14 +02:00
Holger Hans Peter Freyther c63f6f1f32 expiration: Allow to disable the periodic location updating procedure
Disable the periodic LU using "no periodic location update" VTY
command. In that case set the expire_lu to 0 which will then be
translated to a NULL in the database layer. This leads to a bit of
copy and paste in the db_sync_subscriber method but I don't see
how we could easily use 'datetime(%i, 'unixepoch')' and 'NULL'
at the same time.

Change the query to find expired queries to check for NOT NULL
and the time being in the past. This means if there are still
old subscribers in the database they might not be expired. One
would need to execute a query like "UPATE Subscriber SET expire_lu
= 0 WHERE expire_lu is null". The same applies when disabling the
periodic LU. One would need to update the database by hand.

Manual tests executed/passed:

1.) periodic LU enabled:

  * use gst LUTest.st to do a LU
  * UPDATE Subscriber SET expire_lu=datetime('now');
  * observe the subscriber being expired (it was)

2.) periodic LU disabled:

  * use gst LUTest.st to do a LU
  * verify that the expire_lu is NULL in the database
2013-07-27 22:02:24 +02:00
Holger Hans Peter Freyther 5ecbc93656 misc: Fix compilation warnings
bsc_api.c:417:3: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 7 has type ‘unsigned int’ [-Wformat]
bsc_api.c: In function ‘handle_ass_fail’:
bsc_api.c:458:3: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 7 has type ‘unsigned int’ [-Wformat]

db.c: In function ‘db_sync_subscriber’:
db.c:785:3: warning: format ‘%i’ expects argument of type ‘int’, but argument 8 has type ‘time_t’ [-Wformat]

osmo_msc.c: In function ‘msc_release_connection’:
osmo_msc.c:145:20: warning: unused variable ‘trans’ [-Wunused-variable]

smpp_smsc.c: In function ‘link_accept_cb’:
smpp_smsc.c:891:24: warning: assignment from incompatible pointer type [enabled by default]

smpp_smsc.c:271:1: warning: ‘esme_by_system_id’ defined but not used [-Wunused-function]

smpp_openbsc.c: In function ‘smpp_openbsc_init’:
smpp_openbsc.c:545:2: warning: implicit declaration of function ‘smpp_vty_init’ [-Wimplicit-function-declaration]

osmo_bsc_ctrl.c: In function ‘verify_bts_loc’:
osmo_bsc_ctrl.c:340:19: warning: variable ‘height’ set but not used [-Wunused-but-set-variable

smpp_mirror.c: In function ‘main’:
smpp_mirror.c:297:2: warning: implicit declaration of function ‘osmo_init_logging’ [-Wimplicit-function-declaration]
2013-07-27 20:03:08 +02:00
Holger Hans Peter Freyther 5ccd015371 nitb: The subscr->imsi is an array will never be NULL
Array compared against 0 (NO_EFFECT)
array_null: Comparing an array to null is not useful: "subscr->imsi"

Fixes: Coverity CID 1040716
2013-07-14 09:04:50 +02:00
Holger Hans Peter Freyther f0167ddfc2 hsl: Remove the support for the HSL bts from OpenBSC
The support has been implemented for an old model, we were told that
newer versions would be made incompatible with OpenBSC. Ther are
various warnings in the code and coverity has found some new ones.

Just remove the code as we don't know of anyone using this code.
2013-07-03 16:19:41 +02:00
Holger Hans Peter Freyther 8bb0720ebb nanobts: Do not crash on an invalid TRX number
In case the specified trx number is not configured, do not crash
but return NULL from the function. The libosmo-abis library should
close the connection for us then.
2013-06-30 20:11:46 +02:00