Commit Graph

368 Commits

Author SHA1 Message Date
Neels Hofmeyr fd666890f7 fix test-ranap, after tmsi endianness fix
a9cf70f665 changed the TMSI byte order, the test expectations need to be
adjusted accordingly.
2016-05-04 14:06:53 +02:00
Daniel Willmann a9cf70f665 ranap_msg_factory: Fix endianess in paging command
the asn1 helper functions already take care of byte ordering, so use these.
2016-05-04 13:50:43 +02:00
Neels Hofmeyr 802acd0da4 fix: test-ranap.c: missing NULL init
The decoding target pointer has to be NULL so that a new structure is allocated
by aper_decode(). Fixes a probable segmentation fault upon decoding at
test-ranap.c:77 or free of unallocated memory in test-ranap.c:81.
2016-05-03 13:14:30 +02:00
Holger Hans Peter Freyther 75f8116132 jenkins: Disable parallel make as it is broken right now
sed -i 's,^#include "ranap_ies_defs.h",#include <osmocom/ranap/ranap_ies_defs.h>,' ranap_encoder.c ranap_decoder.c
sed -i 's,^#include "ranap_common.h",#include <osmocom/ranap/ranap_common.h>,' ranap_encoder.c ranap_decoder.c ranap_ies_defs.h
sed -i 's,^#include "ranap_common.h",#include <osmocom/ranap/ranap_common.h>,' ranap_encoder.c ranap_decoder.c ranap_ies_defs.h
mv ranap_ies_defs.h ../include/osmocom/ranap/
sed: can't read ranap_ies_defs.h: No such file or directory
Makefile:916: recipe for target 'ranap_decoder.c' failed
2016-05-03 13:08:55 +02:00
Neels Hofmeyr 95d0ba5f40 test-ranap: fix missing free in test_aper_causemisc, fixes expout
After aper_decode(), we still need to free the decoded struct.

This was introduced in 14da5411a4
("test-ranap: Add test case about constrained integer range decode")

Note, in that commit there is another test failure in expout (a reversed byte
order) which is "secretly" fixed in bb289e3b81
("RAB parameters: add Extended Max Bitrate").

This commit fixes:

@@ -213,6 +212,7 @@
 </RANAP_IE>
 00 0a 00 11 00 00 01 00 29 40 0a 00 00 01 00 28 40 03 05 c2 d0
 report
-talloc report on 'asn1_context' (total      0 bytes in   1 blocks)
+talloc report on 'asn1_context' (total     40 bytes in   2 blocks)
+    constr_CHOICE.c:927            contains     40 bytes in   1 blocks (ref 0) 0x187e690
 talloc report on 'msgb' (total      1 bytes in   1 blocks)
 exit
2016-05-02 14:44:56 +02:00
Harald Welte bb289e3b81 RAB parameters: add Extended Max Bitrate
Adjust test expectation in test-ranap.c.

This IE is seen in a "real life" pcap of hNodeB operation. We did not need it
so far, but add it to test the ip.access nano3G.

Comment from the future: the ip.access nano3G rebooted upon RAB Assignment
Request, and after adding/tweaking some IEs it stopped rebooting. This is one
of the changes that fixed the reboot issue. The changes have been tested
incrementally until reboots vanished, but it's not clear/hasn't been tested
whether omitting this change alone will cause reboots to re-appear.
2016-05-01 15:45:26 +02:00
Neels Hofmeyr 0a461568f0 hnbgw: dumb fix of context map hnb_list double delete 2016-05-01 15:45:26 +02:00
Harald Welte 14da5411a4 test-ranap: Add test case about constrained integer range decode
There was a bug in the asn1c/libffasn1c APER patch that caused
constrained integer ranges to be decoded incorrectly.  Add a test
case for that to avoid people falling into that trap...
2016-05-01 15:44:13 +02:00
Harald Welte f764a15c23 Add test case about RANAP MaxBitrate encoding
Our version of asn1c/libasn1c used to have an INTEGER encoding but,
where the encoding of integers of > 2 bytes length was broken.

Add a test case to what we expect with the updated/fixed libasn1c.

If your compilation breaks, please upate to libasn1c with related
fix commited a few minutes ago.
2016-04-30 17:47:16 +02:00
Holger Hans Peter Freyther 02601c8785 contrib: Put asn1c into the PATH as well 2016-04-27 22:36:20 +02:00
Holger Hans Peter Freyther 64f5639eae contrib: Add build script used on the jenkins to build it
This tests compilation, runs the tests, regenerates the ASN1 code,
compiles it and tests it as well. The make distcheck target is not
working right now.
2016-04-27 22:06:46 +02:00
Neels Hofmeyr b248c8c8ca UE Register: fix: free ies when no IMSI is found 2016-04-25 15:34:28 +02:00
Neels Hofmeyr f098c7abda ranap_msg_factory: fix RAB IP addr byte order for use_x213_nsap==false 2016-04-25 15:34:28 +02:00
Neels Hofmeyr edf1367e62 new RAB: add use_x213_nsap parameter / change it to bool
Allow the *caller* of ranap_new_msg_rab_assign_data() to make the decision for
using 32 bit or longer IP addresses in RAB Assignment Request messages.

This requires a follow-up change in openbsc branch sysmocom/iu.
2016-04-25 15:34:28 +02:00
Neels Hofmeyr f168a3b470 compiler warning: hnbgw_ranap.c: include ranap_msg_factory.h
At least ranap_new_msg_reset_ack() needs a function declaration to avoid a
compiler warning.
2016-04-25 15:33:40 +02:00
Neels Hofmeyr 9246cc9e1e cosmetic: comments, log typo, explicit pointer
Fix log typo 'REGSITER' and add some comments on UE Register with TMSI.

The container_pair struct starts with 'list', so passing the container_pair
pointer is equivalent to passing the list; but instead, explicitly mention the
list member to avoid confusion.
2016-04-25 15:25:12 +02:00
Neels Hofmeyr 8f62106d5d hnbgw: remove unused static function 2016-04-25 15:25:12 +02:00
Neels Hofmeyr f6e56058f4 ranap_parse_lai(): properly initialize out-arg, adjust test experr
The test stderr output changes merely because the source code line numbers
of the error logging changed.

Fixes: CID#93770
2016-04-25 13:26:07 +02:00
Neels Hofmeyr 3d12748f5b dummy-cn: add optarg, add --bind argument
To test CSCN, I want dummy-cn to listen on 127.0.0.2 and mock IuPS instead of
the hardcoded 127.0.0.1 to mock IuCS.

Add commandline option parsing and the --bind option to set the local bind
address.
2016-04-20 11:05:22 +02:00
Daniel Willmann f44d12ce27 ranap_msg_factory: Add keystatus parameter for security mode cmd 2016-04-20 10:17:53 +02:00
Neels Hofmeyr 5ad72b91bb hnb-test: receive Paging, add CL rx
Add ability to receive ConnectionLess transfers in order to read the
Paging and (so far only) print the IMSI paged for.
2016-04-19 18:19:31 +02:00
Neels Hofmeyr d045ceb5f0 hnbgw: add debug log about new CN links 2016-04-19 18:19:31 +02:00
Neels Hofmeyr 630483b310 cosmetic: indentation fix 2016-04-19 18:19:31 +02:00
Neels Hofmeyr 2b01f3aca7 hnbgw_cn.c: fix uninitialized hnb_gw pointer
In cn_ranap_rx_paging_cmd(), actually initialize the gw var.

Upon creation of an hnbgw_cnlink, actually set hnbgw_cnlink->gw.
2016-04-19 18:19:31 +02:00
Neels Hofmeyr 6503767e84 hnbgw_cn.c: pass cnlink instead of slink
As soon as possible, clarify that slink is an osmo_sua_link*. Immediately
obtain the priv as hnbgw_cnlink and pass that to all the static functions.
Thus remove code dup and clarify argument typing.
2016-04-19 18:19:30 +02:00
Neels Hofmeyr 525a69ef4e cosmetic: comment typos 2016-04-19 18:19:30 +02:00
Neels Hofmeyr bde4d3b3b7 hnb-test: request Iu Release, handle Iu Release Command 2016-04-19 18:19:30 +02:00
Neels Hofmeyr 39fc8811f9 ranap_common_cn.c: for now add more decoding that doesn't belong here
Allow Iu Release Command decoding and freeing.
Add Paging decoding and freeing.

These are all needed by hnb-test, which still uses the CN parsing functions,
still to be fixed, as commented in the code.
2016-04-19 18:19:30 +02:00
Neels Hofmeyr f6e16b72e6 ranap_msg_factory: add Iu Release Complete msg generator
Needed by hnb-test.
2016-04-19 18:19:30 +02:00
Neels Hofmeyr 7e760acc65 add missing comment in ranap_msg_factory.c 2016-04-19 01:41:27 +02:00
Neels Hofmeyr 4a0a69a88d hnb-test: add Security Mode Command handling 2016-04-19 01:32:25 +02:00
Neels Hofmeyr a9f5566482 ranap_msg_factory: add Security Mode Complete msg generator
Needed by hnb-test to reply to a Security Mode Command message.
2016-04-19 01:32:25 +02:00
Neels Hofmeyr 68b7a47868 RANAP Initiating msg: rx and free Security Mode Command
Add the Security Mode Command procedure code to cn_ranap_rx_initiating_msg_co()
and cn_ranap_free_initiating_msg_co(), for hnb-test (see comments in the code).
2016-04-19 01:32:25 +02:00
Neels Hofmeyr c28ed375b3 hnb-test: cosmetic: rename hnb_test_nas_tx_dt() to hnb_test_tx_dt()
Not all Direct Transfer messages contain a NAS PDU, see Security Mode
Complete.
2016-04-19 01:32:25 +02:00
Neels Hofmeyr 4470f93074 hnb-test: simplify crossing message layers
Adding the Security Mode Control command would break the current scheme of
callbacks across layers. This brought to my attention that the scheme is indeed
unnecessarily complex, so simplify it.

Instead of passing callbacks, call functions directly. Add hnb-test-layers.h to
declare those functions that cross from main to rua, to ranap and back to main
and remove the callback type definitions.

Instead of copying the NAS PDU to a newly allocated msgb, pass the data and len
directly to hnb_test_nas_rx_dtap().

Instead of repeatedly checking the gsm48_hdr length, just pass the struct
gsm48_hdr* and len around and assume the basic header length has been checked.

In some places, rename 'length' to 'len' for cosmetic consistency.
2016-04-19 01:32:25 +02:00
Neels Hofmeyr 26779f8573 hnb-test: generate SRES from hardcoded Ki
Previously the SRES was hardcoded, but the CN changed to generate the SRES.
So now, generate the SRES while still using the hardcoded Ki.

Fixes the Authentication Response message when testing IuCS Location Update.
2016-04-19 01:32:24 +02:00
Neels Hofmeyr 37017f5df8 hnbgw_cn.c: add #include for inet_ntoa() 2016-04-15 22:47:42 +02:00
Harald Welte 04861ef1ed update dependencies in README file 2016-04-09 20:29:37 +02:00
Neels Hofmeyr d7ad0ac238 hnb-test: parse_mm: assert MM pdisc 2016-04-06 18:58:37 +02:00
Neels Hofmeyr 998726054e hnb-test: on auth response, make it seq nr 2 2016-04-06 18:58:37 +02:00
Neels Hofmeyr ad00d2bee5 hnb-test: rx dtap: log message size 2016-04-06 18:58:37 +02:00
Neels Hofmeyr 8c2b4ec6d6 hnb-test: don't segfault when msgb has no l3 2016-04-06 18:58:37 +02:00
Neels Hofmeyr a4540be792 hnbgw: set default RNC ID to 23 (for testing)
This should ultimately be user configurable, but for now 23 is better than 0.
2016-04-06 18:58:36 +02:00
Neels Hofmeyr 02be4e3933 hnbgw: debug-log cn disconnect ind 2016-04-06 18:58:36 +02:00
Neels Hofmeyr 0ff24430a1 hnbgw: add handle_cn_conn_conf() debug logging 2016-04-06 18:58:36 +02:00
Neels Hofmeyr 1befe6b221 cosmetic: add comment to hnbgw_cnlink_init() 2016-04-06 18:58:36 +02:00
Neels Hofmeyr 6341f4d410 hnbgw: set DMAIN loglevel to DEBUG by default 2016-04-06 18:58:36 +02:00
Neels Hofmeyr 7c28f6f438 hnb-test: use gsm48_hdr_pdisc() and gsm48_hdr_msg_type() instead of bitmasks 2016-04-06 18:58:36 +02:00
Neels Hofmeyr d8013d1f8c ranap_parse_lai(): Fix wrong BCD decoding for MNC. Add test.
Fix the ranap_parse_lai() part that decodes the MNC: place the *10 at the
proper MNC digit.

Add a comprehensive test for ranap_parse_lai() in test-helpers.c. Because
ranap_parse_lai() logs things, add test_common.c to test-helpers compilation
and an expected stderr output to test-helpers' testsuite.at def.
2016-04-06 18:55:14 +02:00
Neels Hofmeyr 8f4cd86904 ranap_parse_lai(): add LAC size check, and log all parse errors 2016-04-06 18:55:14 +02:00