Commit Graph

179 Commits

Author SHA1 Message Date
Holger Hans Peter Freyther bce5675e5f abis: Create a routine that can parse all SW Descriptions of a SW Config
Be able to parse the entire SW Config IE. Parse the SW Descruption
into a struct provided by the caller.
2012-12-19 16:37:55 +01:00
Holger Hans Peter Freyther ce55361e93 mgcp: Test and implement re-transmission handling
MGCP is used over UDP and a response might be lost. The MGCP RFC
asks for keeping a list of responses and then using the previous
response to answer a duplicate request. I tried to conserve memory
and just wanted to remember the last transaction identifier and
result-code and re-generate the result from that. This made the
code look bad and this is why the entire response will now be stored.
It sadly increases the memory usage but can not be avoided at this
time.

Remove the msg->l3h pointer for the RQNT callback as strtok has
modified the content of it.
2012-12-10 14:46:00 +01:00
Holger Hans Peter Freyther cf2f158caa mgcp: Add testdata for MDCX handling 2012-12-10 13:35:53 +01:00
Holger Hans Peter Freyther d267f4d685 mgcp: Test the second CRCX as a CRCX and not as a re-transmission
The second CRCX would be mostly ignored and be handled by the
retransmission layer of MGCP.
2012-12-10 12:16:23 +01:00
Holger Hans Peter Freyther 8d0be259cb mgcp: Begin handling of the RQNT message as needed for DTMF
Introduce a callback for the request and forward the signalrequest
to the callback. This is not a full implementation of MGCP RQNT.
2012-11-29 19:56:22 +01:00
Harald Welte c6483683eb tests: Fix build of 'db' test after smpp merge 2012-11-24 11:11:59 +01:00
Holger Hans Peter Freyther cb306a689e mgcp: Send the jitter statistics at the end of the call 2012-11-12 10:45:09 +01:00
Holger Hans Peter Freyther 38e02c5125 mgcp: Calculate the packet loss as of Appendix A of RFC 3550
Calculate the expected packages and packet loss as of RFC 3550.
The values should be clamped but our packet loss counter is 32
bits and not 24 and we should clamp at other values but I am
waiting for some issues first before dealing with that.
2012-11-12 10:44:58 +01:00
Holger Hans Peter Freyther 0bf15a8187 mgcp: Include statistics at the end of a connection
Follow the MGCP specification and send the collected statistics
at the end of a call. Right now this does not include jitter, packet
loss and delay.
2012-11-12 10:42:05 +01:00
Holger Hans Peter Freyther e2f34d588c nat: Inject a a=fmtp:%d to force the right AMR code
This assumes that AMR is used and/or the mode-set is ignored for other
codecs by the remote end.
2012-11-07 13:34:43 +01:00
Holger Hans Peter Freyther 511f9c3e4a si: Partially implement the range encoding for the SI.
I saw the old copy of the "Appendix J" code too late and I have
discovered some quirks and I am more familar with my implementation.
Most noticable 'w' only needs to be as big as the input arfcn but
requires the 'w' to be initialized. The power_of_2 implementation
differs as well (mine matches the output of wirehsark).

The f0 could be chosen in a better way but right now picking
the lower bound is the easiest. It is not clear if to use
modulo if the range is chosen in the middle. This can be improved
in the future. Right now I have no bit fiddling for range128, 256
and 1024 as I was running out of time.
2012-10-22 15:23:58 +02:00
Holger Hans Peter Freyther 8936d00587 tests: Remove the debug/logging test as it is in libosmocore now 2012-10-04 10:55:58 +02:00
Holger Hans Peter Freyther 09db1a44bc nat: Add another test case for TP-SRR clearing and number rewrite 2012-03-26 16:22:08 +02:00
Harald Welte ae1997248c mgcp: implement a more tolerant parser based on strtok_r()
Instead of building complex manual byte-wise parsers, we simply use two
strtok_r loops:  one iterating over all the lines, the next one
iterating over the invididual space-separated elements in the first line.

The benefit is that we now accept \r, \n or \r\n, or any multiple of
them as line ending.  This works around incompliant MGCP implementations
like that of Zynetix MSC.

Addition: mgcp_analyze_header returns 0 when all out parameters have
been set.

Signed-off-by: Holger Hans Peter Freyther <zecke@selfish.org>
2012-03-16 10:24:18 +01:00
Holger Hans Peter Freyther d77023b1c2 mgcp_test: Add wrong messages as input and check what happens
Test parsing some invalid messages and see if we start to crash.
2012-03-16 10:21:29 +01:00
Holger Hans Peter Freyther 5563e6c268 mgcp_test: Rename method as it now operates on an array of messages
This code was cleaned up, catch up and rename the method.
2012-03-16 10:06:39 +01:00
Harald Welte 27fa7901bb MGCP: Add CRCX test cases
The second test case (CRCX_ZYN) fails as the message is not compliant
with the spec.  However, our parer should be more tolerant, just in
case...
2012-01-27 00:37:23 +01:00
Harald Welte f74da14c01 further generalize mgcp testing code
use a data-structure driven approach
2012-01-27 00:36:56 +01:00
Harald Welte 8819d8289d mgcp_test: remove duplicate code 2012-01-27 00:00:44 +01:00
Holger Hans Peter Freyther 47b144b002 nat: Internationalize the TP-DA if it starts with a 00
Internationalize the number like we do it for Call Control. Update
the test result to match this new behavior.
2012-01-18 20:15:29 +01:00
Holger Hans Peter Freyther 8e60f629e2 nat: Prepare to rewrite the TP-DA number of a SMS submit.
Introduce number rewriting of SMS-SUBMIT. Introduce a new list,
move code around to help with finding a new number, somehow the
number encoding for TP-DA is borked, 03.40 references 04.11 but
the length appears to be strlen(number) without taken the type
field into account.
2012-01-18 20:14:58 +01:00
Holger Hans Peter Freyther be53012f9c nat: Print the sizes and the offending data in case of a failure 2012-01-18 17:20:23 +01:00
Holger Hans Peter Freyther aa433d2d84 nat: Add the bsc_data.c file to the EXTRA_DIST 2012-01-15 17:55:50 +01:00
Holger Hans Peter Freyther 794e8f2649 abis: gsm_data_shared.h includes libosmo-abis header, add abis to cflags
gsm_data_shared.h includes e1_input.h of libosmo-abis, add the
LIBOSMOABIS_CFLAGS to Makefile.am, remove AM_LDFLAGS at the same
time as we only build .a archives.
2012-01-15 17:52:02 +01:00
Holger Hans Peter Freyther 68368dd99a nat: Implement clearing of TP-SRR flags from TPDUs
Match IMSI and destination address against a set of entries, if it
is matching the header will be modified and no sender report will be
requested. Change the test case to request the sender report and then
verify that this bit is reset to 0.
2012-01-10 22:45:24 +01:00
Holger Hans Peter Freyther 50be1a9d7f nat: Reduce copy and paste in the test, create a verify_msg 2012-01-10 22:31:39 +01:00
Holger Hans Peter Freyther 951f34b885 nat: Use the link_id from the original message in the new DTAP message
SMS went from SAPI=3 to SAPI=0 and nobody notices on the NAT->MSC direction.
2012-01-10 22:29:35 +01:00
Holger Hans Peter Freyther 93ef33edb6 tests: Use atlocal/atlocal.in to enable/disable the NAT test
Kill the hacking, use atlocal to remember if the NAT test should
be enabled and then skip the test (exit with 77).
2012-01-09 22:53:04 +01:00
Holger Hans Peter Freyther 03ff1c8477 Revert "tests: Make the test setup more abusive to fix the build"
This reverts commit 41b42c7229.
2012-01-09 21:49:47 +01:00
Holger Hans Peter Freyther 41b42c7229 tests: Make the test setup more abusive to fix the build
Paolo says I will need to use atconfig/atlocal, need to read up on
it first though.
2012-01-09 21:13:15 +01:00
Holger Hans Peter Freyther faf1f64a2d gprs: Honor GSM 04.64 8.4.2 Receipt of unacknowledged information
GSM 04.64 8.4.2 asks to ignore UI frames if the DLCI is not known,
or if the "(V(UR)- 32) <= N(U) < V(UR)". E.g. if we want to have
V(UR) == 511 and this frame is dropped, we would ignore N(U)'s
0 to 510. Calculate the delta.

The code is based on Jonathan Santos's "LLC UI window" fix but the
issue was discovered independly.
2012-01-06 18:52:05 +01:00
Holger Hans Peter Freyther 6c88217c19 tests: Introduce running tests with GNU autotest in OpenBSC
The quality of the tests is of different value but it is good to
get started and improve from here.
2012-01-06 18:52:05 +01:00
Holger Hans Peter Freyther d5b3ca621b mgcp: Print message when the test is finished 2012-01-06 17:23:19 +01:00
Holger Hans Peter Freyther 300457b7d2 gsm0408: Print message when the test is done 2012-01-06 17:23:19 +01:00
Holger Hans Peter Freyther 45222a79e2 db: Fix the test code
* Initialize logging
* use a dummy net before calling subcr_put as the keep in ram
  option is going to be set.
2012-01-06 17:23:19 +01:00
Holger Hans Peter Freyther 08e324fda7 channel: Make the test not crash again.
* Initialize logging
* The callback expects NULL or a subscriber connection
2012-01-06 17:23:19 +01:00
Holger Hans Peter Freyther f5ede52a22 nat: Log test output stdout using printf in prep for GNU autotest 2012-01-06 17:23:19 +01:00
Holger Hans Peter Freyther 06c9da6c22 misc: Move the bsc_parse_reg to libcommom and name it gsm_parse_reg
Move the regexp parsing code from the NAT to libcommon as it will
be used by the NAT and BSC code. This also adds the #include <regex.h>
include to gsm_data. This header should be split up.
2011-08-22 18:21:33 +02:00
Pablo Neira Ayuso ed5cacb240 src: port openBSC over libosmo-abis
This is a big patch that ports openBSC over libosmo-abis.
Sorry, the changes that are included here are all dependent
of libosmo-abis, splitting them into smaller pieces would
leave the repository in some intermediate state, which is
not desired.

The main changes are:

- The directory libabis/ has been removed as it now lives in
  libosmo-abis.

- new configuration file format for nanoBTS and HSL femto, we
  need to define the virtual e1_line and attach it to the OML
  link.

- all the existing BTS drivers (nanoBTS, hsl femto, Nokia site,
  BS11 and rbs2000) now use the new libosmo-abis framework.

- use r232 input driver available in libosmo-abis for bs11_config.

- use ipa_msg_recv instead of old ipaccess_read_msg function.

- delete definition of gsm_e1_subslot and input_signal_data.
  These structures now lives in libosmo-abis.

Most of this patch are deletions of libabis/ which has been
moved to libosmo-abis.

This patch also modifies openBSC to use all the new definitions
available in libosmocore and libosmo-abis. In order to do that,
we have replaced the following:

- DINP, DMI, DMIB and DMUX by their respective DL* correspondences.
- SS_GLOBAL by SS_L_GLOBAL
- SS_INPUT by SS_L_INPUT
- S_GLOBAL_SHUTDOWN by S_L_GLOBAL_SHUTDOWN
- SS_INPUT by SS_L_INPUT
- S_INP_* by S_L_INP_* sub-signals
- E1INP_NODE by L_E1INP_NODE vty node

This patch has been tested with:
- one nanoBTS
- the HSL femto with the examples available under libosmo-abis
- BS11 with both dahdi and misdn drivers.
2011-08-19 22:38:35 +02:00
Holger Hans Peter Freyther 3d331c0062 misc: Link to libosmogsm after adding our static libraries
GCC 4.6.0 and LD.BFD 2.21 on ARM somehow fail to resolve
the dbi symbols when we have the library in front of the
static libraries, move them to the back.

Without this patch the tlv_def_patch symbol and the
gsm48_construct_ra.
2011-06-30 21:41:08 +02:00
Holger Hans Peter Freyther f5bbb1eb71 misc: Link to -ldbi after adding our static libraries
GCC 4.6.0 and LD.BFD 2.21 on ARM somehow fail to resolve
the dbi symbols when we have the library in front of the
static libraries, move them to the back.
2011-06-30 20:32:33 +02:00
Harald Welte 23cf666359 update debug_test with logging system changes
Thanks to Konrad Meier
2011-06-27 14:23:40 +02:00
Harald Welte e31816c83b make channel_test build again 2011-06-26 14:55:06 +02:00
Holger Hans Peter Freyther acc4031cf5 nat: Look into the TPDU/SMS-SUBMIT and use the TP-DestAddress for matches
Match the used SMSC and the destination of the SMS and change
the SMSC address if both are matched.
2011-06-01 20:45:12 +02:00
Holger Hans Peter Freyther 9c20571280 nat: Patch the destination SMS address of a message
Use the same filtering infrasturcture to patch the SMSC
address in a CP-DATA/RP-DATA message. Add a very simple
testcase for this code.
2011-06-01 20:45:03 +02:00
Holger Hans Peter Freyther df8e6e9e4a nat: Prepare to patch more than the CC Setup message
Refactor the code to allow having different handlers. The goal
is to be able to patch some SMS messages too.
2011-06-01 20:41:30 +02:00
Holger Hans Peter Freyther ad75eababc nat: Allow to have a regexp to match the MSISDN
The idea that MCC and MNC is enough to classify a subscriber
turns out to be wrong. Certain operatos license a number range
of IMSIs to others. When we see a '^' in the MCC field we treat
it as a regexp. The code now turns the MCC/MNC into a regexp
for the IMSI. It is not using extended POSIX regexp to match
the behavior of the access list.
2011-06-01 20:40:35 +02:00
Holger Hans Peter Freyther 67cd75f9fa misc: Use the osmo_init code for signals and logging
Use the libosmocore code to ignore certain signals by
default (e.g. SIGHUP, SIGPIPE) and use the new code to
create a default stderr logging target and initialize
it properly.
2011-05-12 16:11:14 +02:00
Pablo Neira Ayuso ab46cf38d4 src: rename msg_entr* to osmo_config_*
Summary of changes:

s/msg_entry_parse/osmo_config_list_parse/g
s/msg_entry/osmo_config_entry/g
s/msg_entries/osmo_config_list/g
2011-05-07 13:15:11 +02:00
Pablo Neira Ayuso c0d17f2266 src: use namespace prefix osmo_* for misc utils
Summary of changes:

s/bcd2char/osmo_bcd2char/g
s/char2bcd/osmo_char2bcd/g
s/hexparse/osmo_hexparse/g
s/hexdump/osmo_hexdump/g
s/hexdump_nospc/osmo_hexdump_nospc/g
s/ubit_dump/osmo_ubit_dump/g
s/static_assert/osmo_static_assert/g
2011-05-07 12:58:59 +02:00