Commit Graph

4375 Commits

Author SHA1 Message Date
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 93de8b2591 sms: Address the TODO and schedule the next SMS for an active subscriber
When one SMS has been delivered check if a second SMS can be scheduled
to that subscriber. If nothing can be scheduled kick the normal SMS queue
as one slot has become free now. Otherwise send the SMS and create a
pending entry.
2014-02-24 16:13:04 +01:00
Holger Hans Peter Freyther 024dc77de2 sms: Do not interfere with the SMS queue from within gsm_04_11
It was possible that two SMS would be delivered at the same time
which violates GSM 04.11. We should solely rely on the sms queue
to schedule more SMS to the subscriber.
2014-02-24 14:31:39 +01:00
Holger Hans Peter Freyther 98258dbbc6 bsc: Add vty command to send location trap through VTY
I have manually tested this by entering the VTY command and
observing the CTRL interface using wireshark.

Ticket: OW#1129
2014-02-22 10:36:14 +01:00
Harald Welte 7e40be3949 SMPP: UCS2 data_coding is 0x08, not 0x80!
As can clearly be seen from SMPP Spec v3.4 Chapter 5.2.19,
a SUBMIT-SM with data_coding == 0x08 is UCS2, not with 0x80.

Thanks to ciaby@rhizomatica.org for reporting the bug.
2014-02-21 13:21:03 +01:00
Holger Hans Peter Freyther ca114432be sms: Increment the RP Message Reference for each transaction
Each RP-DATA should have a unique msg reference. Currently 42 is
used for all of these. Remember the last reference we used and
increment it on the next SMS. Do not track if the reference is
still in use a clash is a lot less likely now. First unless SMPP
is used only one SMS is delivered at a time, second the transaction
space is a lot smaller than the one for the reference.
2014-02-20 11:35:56 +01:00
Holger Hans Peter Freyther 6ab5d4f861 trau: Fix compiler warning about decoded_trau_frame
In file included from bsc_api.c:34:0:
../../include/openbsc/trau_mux.h:62:15: warning: ‘struct decoded_trau_frame’ declared inside parameter list [enabled by default]
  const struct decoded_trau_frame *tf);
               ^
../../include/openbsc/trau_mux.h:62:15: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
../../include/openbsc/trau_mux.h:64:15: warning: ‘struct decoded_trau_frame’ declared inside parameter list [enabled by default]
  const struct decoded_trau_frame *tf);
               ^
../../include/openbsc/trau_mux.h:66:2: warning: ‘struct decoded_trau_frame’ declared inside parameter list [enabled by default]
  const unsigned char *data);
  ^
../../include/openbsc/trau_mux.h:68:2: warning: ‘struct decoded_trau_frame’ declared inside parameter list [enabled by default]
  const unsigned char *data);
2014-02-20 11:19:32 +01:00
Holger Hans Peter Freyther 34235294d7 tests: Remove unused file 2014-02-20 11:19:32 +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
Holger Hans Peter Freyther 8cedb11350 ctrl: Make it possible to re-use the string get and set routine
This can be used for the description field that requires some
special handling for newlines.
2014-02-04 19:35:32 +01:00
Holger Hans Peter Freyther 2c7032e4eb ctrl: Make the int range set, get and verify methods available
For the max power reduction we will need to have a different range
method. It will need to check if the value is even. Make the set,
get and verify methods available through a macro.
2014-02-04 19:35:16 +01:00
Holger Hans Peter Freyther cdfc2061bb mgcp: Round the frame time otherwise we have porting issues
With the current multiplication we might end up with 19999 as
time on i386. When we round it ends up as 20000 on i386 and
should work the same on AMD64.
2014-02-03 13:32:34 +01:00
Holger Hans Peter Freyther ba41978b97 mgcp: transit is a signed variable and should be printed like this
On AMD64 we had a difference in the test result most likely due
the bigger size of integers.
2014-02-03 09:20:06 +01:00
Holger Hans Peter Freyther 757971ade8 mgcp: Use the length modifier for the size_t in the printf
Should fix on AMD64:
mgcp_test.c: In function ‘sendto’:
mgcp_test.c:318:10: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t’ [-Wformat]
2014-02-03 09:18:51 +01:00
Jacob Erlbeck b281e4e6f4 mgcp/rtp: Base jitter calculation on input timestamps
So far, the jitter computation has been based on output timestamps.

This patch uses the input timestamps instead and resets jitter
computation on SSRC changes.

Sponsored-by: On-Waves ehf
2014-01-31 11:45:25 +01:00
Jacob Erlbeck eacc9b92a1 mgcp/rtp: Compute delta timestamp based on wallclock
Currently, when the SSRC changes within a stream and SSRC fixing is
enabled, the RTP timestamp between the last packet that has been
received with the old SSRC and the first packet of the new SSRC
is always incremented by one packet duration.
This can lead to audio muting (at least with the nanoBTS) when the
wallclock interval between these packets is too large (> 1s).

This patch changes the implementation to base the RTP timestamp offset
on the wallclock interval that has passed between these two packets.

Ticket: OW#466
Sponsored-by: On-Waves ehf
2014-01-31 11:44:16 +01:00
Jacob Erlbeck 303b54a2a4 mgcp/rtp: Fix transit computation units
Currently micro-secs and RTP rate get mixed when the transit value is
computed in mgcp_patch_and_count().

This patch changes get_current_ts() to accept the desired rate as
argument and to use it for the time conversion instead of always
converting to microseconds. If microseconds are needed,
get_current_ts(1000) can be used.
The arrival_time is now measured in 1/rtp_end->rate seconds so that
it can be directly compared to RTP timestamps as required by RFC3550
(section 6.4.1, see definition of 'interarrival jitter').

Sponsored-by: On-Waves ehf
2014-01-31 11:18:25 +01:00
Jacob Erlbeck e763f3e73e mgcp/test: Fake wallclock for RTP timing/stats tests
Currently the stats (jitter, transit) cannot be checked properly,
since they depend on the wallclock time.

This patch fakes clock_gettime (CLOCK_MONOTONIC) to reflect the
scheduling time of the RTP packets. In addition, the RTP statistical
value are written to stdout.
A RTP test case with a SSRC change along with a reference time delay
has been added.

Sponsored-by: On-Waves ehf
2014-01-31 11:18:25 +01:00
Jacob Erlbeck cf577c3492 mgcp/test: Only include conn_mode into test output
Currently the conn_mode and the output_enabled flags are printed to
stdout.

This patch modifies this to print the output_enabled flags to stderr
instead. The bits in conn_mode are shown as RECV, SEND, and LOOP.
This does not reduce the significance of the test, since there is an
assertion already that verifies the values of the output_enabled
flags with respect to the conn_mode.

Sponsored-by: On-Waves ehf
2014-01-31 11:18:25 +01:00
Jacob Erlbeck 8e68b56fe5 sms/dtap: Add log messages to analyse SMS message loss
Incoming DTAP messages from MS are discarded during silent calls,
which leads to the repeated delivery of SMS since the ACKs are not
being processed.

This patch adds some log messages that have been helpful to track
this down.

Sponsored-by: On-Waves ehf
2014-01-31 11:17:44 +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
Andreas Eversberg 88012b6e87 Use 'defines' for length and duration of RTP payload 2014-01-26 08:49:35 +01:00
Holger Hans Peter Freyther 6419018e68 nat: Make the access-list deny cause configurable
Add two optional arguments to the imsi-deny rule
for the reject cause and verify that it is saved
out.
2014-01-20 10:14:05 +01:00
Holger Hans Peter Freyther 415cd2eebb nat: Introduce reject cause to bsc_nat_acc_lst_entry
The filtering architecture already allowed to specify a reject
reason but this has not been used for the access-lists. Extend
the access-list to include a reject reason and extend the test
case to honor it.
2014-01-20 10:13:36 +01:00
Jacob Erlbeck ead0529e07 mgcp/test: Don't reset conn_mode between messages
Currently, the conn_mode field is reset after it has been checked.

This patch disables this behaviour and only adds a mark (bit) to
detect modifications.

Sponsored-by: On-Waves ehf
2014-01-20 08:27:03 +01:00
Jacob Erlbeck e35fd13697 mgcp: Synchronize conn mode bits and output enabled flags
This patch changes implementation and the mgcp_connection_mode enum
in a way that net_end.output_enabled (bts_end.output_enabled) flag
always matches the MGCP_CONN_SEND_ONLY (MGCP_CONN_RECV_ONLY) bit of
conn_mode.

Based on this, the conn_mode bits are then used instead of the
output_enabled fields within mgcp_protocol.c.

Sponsored-by: On-Waves ehf
2014-01-20 08:27:03 +01:00
Jacob Erlbeck 8857c90e36 mgcp: Disable output enabled on initialisation
Currently RTP output_enabled is set to 1 on initialisation, which
does not semantically match the initial value of conn_mode
(MGCP_CONN_NONE).

This patch changes this initial value to 0.

Sponsored-by: On-Waves ehf
2014-01-20 08:27:03 +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 1dc022cb62 openbsc: Fix coverity issues
This patch (hopefully) fixes the new defects reported by coverity.

Addresses:
** CID 1156986:  Negative array index read  (NEGATIVE_RETURNS)
/tests/gsm0408/gsm0408_test.c: 419 in test_si_range_helpers()
/tests/gsm0408/gsm0408_test.c: 423 in test_si_range_helpers()
/tests/gsm0408/gsm0408_test.c: 427 in test_si_range_helpers()

** CID 1156987:  Unchecked return value from library
(CHECKED_RETURN)
/src/libmgcp/mgcp_protocol.c: 1150 in mgcp_keepalive_timer_cb()

** CID 1156988:  Unchecked return value from library
(CHECKED_RETURN)
/src/libmgcp/mgcp_protocol.c: 983 in handle_modify_con()

Sponsored-by: On-Waves ehf
2014-01-17 14:36:51 +01:00
Andreas Eversberg caae10b71f Remove obsolete check of conn and lchan pointers not beeing NULL
The check is removed from gsm48_cc_rx_setup() and gsm48_cc_rx_call_conf().
Receiving a layer 3 message implies that the transaction has a subscriber
connection and a logical channel.

This patch fixes the Coverity issues with CID 115311 and CID 1155312.
2014-01-16 20:49:07 +01:00
Holger Hans Peter Freyther fbb1c8f6fe Merge branch 'jerlbeck/features/mgcp-rtp-keep-alive' 2014-01-16 14:08:16 +01:00
Jacob Erlbeck 075a9ebdcc mgcp: Send RTP keepalive dummy packets to net
So far, a single dummy packet has been sent immediately after the
reception of a MDCX message. There is no dedicated keep alive
mechanism (it just worked because the audio from the MS has always
been forwarded to the NAT until the 'mgcp: Set output_enabled flags
based on the MGCP mode' patch).

This patch adds explicit, timer based keep alive handling that can be
enable per trunk. A VTY command 'rtp keep-alive' command is added for
configuration which can be used to set the interval in seconds, to
send a single packet after the reception of a CRCX/MDCX when RTP data
from the net is expected ('once'), or to disable the feature
completely ('no rtp keep-alive'). In 'send-recv' connections, only
the initial packet is sent if enabled (even when an interval has been
configured). The default is 'once'.

Note that this removes the mgcp_change_cb() from mgcp_main.c.

Sponsored-by: On-Waves ehf
2014-01-16 13:20:51 +01:00
Jacob Erlbeck 34bdc9f8fe mgcp/rtp: Send dummy packet to the RTCP destination, too
Currently a dummy packet is only sent to the RTP port. This is not
enough if RTCP must also cross the SNAT.

This patch sends an additional dummy packet to the RTCP net
destination if omit_rtcp is not set.

Sponsored-by: On-Waves ehf
2014-01-16 13:20:49 +01:00
Jacob Erlbeck 785e3c95d7 mgcp/rtp: Make offset computation understandable
Rename the timestamp variable to make in clear, that the input
timestamp is meant. Add a helper variable to illustrate the offset
computation.

Sponsored-by: On-Waves ehf
2014-01-16 13:20:47 +01:00
Jacob Erlbeck 2645c9e7fc mgcp: Set output_enabled flags based on the MGCP mode
This patch enhances parse_conn_mode() to set the output_enabled flags
of each end based on the MGCP mode.

Ticket: OW#1044
Sponsored-by: On-Waves ehf
2014-01-16 13:20:44 +01:00
Jacob Erlbeck 84dfba1579 mgcp/test: Show the number of dummy packets sent
This patch extends the test_messages test to show the number of dummy
packets that has been passed to sendto(). This way, dummy packets are
even being counted when sendto() itself failes (e.g. due to the fd
being -1).

Sponsored-by: On-Waves ehf
2014-01-16 13:20:37 +01:00
Jacob Erlbeck 68c74f59a4 mgcp/test: Reset pkt_period_* after each test
Currently these value may leak into the next test.

This patch will reset them after each message has been processed.

Sponsored-by: On-Waves ehf
2014-01-16 12:17:24 +01:00
Jacob Erlbeck 1b653af283 mgcp/test: Test the connection mode parser
This modifies the test MGCP messages to include M:recvonly (CRCX),
M:sendrecv (MDCX) and M:sendonly (MDCX) outputs the resulting
output_enabled flags and the conn_mode after processing the message.

Sponsored-by: On-Waves ehf
2014-01-16 12:17:24 +01:00
Jacob Erlbeck 0970bab2a3 mgcp/rtp: Add flag to disable RTP output
This patch make it possible to have a valid endpoint that drops all
outgoing RTP packets. The number of dropped packets is shown by the
VTY 'show mgcp' command. By default, this feature is disabled. To
enable packet dropping, the corresponding output_enabled field must
be set to 0.

Ticket: OW#1044
Sponsored-by: On-Waves ehf
2014-01-16 12:17:24 +01:00
Jacob Erlbeck b830008020 mgcp/rtp: Refactor mgcp_send to avoid code duplication
Currently there are two symmetric code paths which are selected by
the packet destination (NET or BTS).

This patch introduces 3 variables that take the different values
and unifies both code paths into one.

Sponsored-by: On-Waves ehf
2014-01-16 12:17:24 +01:00
Holger Hans Peter Freyther d9c1d31a6a Merge remote-tracking branch 'origin/jerlbeck/features/range-encode' 2014-01-16 12:06:41 +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