Commit Graph

42 Commits

Author SHA1 Message Date
Philipp Maier ed1537e9cb iu_helpers: make new_transp_info_(rtp|gtp) public
The functions new_transp_info_rtp and new_transp_info_gtp are needed to
generate the transport layer information struct. The functions are currently
not public since they are only used in ranap_msg_factory.c but to
reqwrite the RANAP RAB AssignmentReqtest / AssignmentResponse messages we
can reuse this code, so lets make them public.

Change-Id: I1e369718de8c4c7db1f1af1e6864562164ada6cf
Related: OS#5152
2022-01-10 14:00:29 +00:00
Harald Welte e8299eb745 ranap_msg_factory: Fix LOGP statements
The related compiler warnings were overlooked as due to the
asn1c-generated code there always are tons of warnings printed compiling
this project :(

Change-Id: I40b1265ba696501cc72e674f3ef4146c47aacf1b
2021-02-11 10:15:37 +01:00
Harald Welte e3f707b8c6 ranap_msg_factory: Allow detailed control over UEA/UIA algorithm encoded
Change-Id: I6d2d033b0427bdc84fee61e0f3cb7b29935214bf
Closes: OS#4143
2021-02-08 18:34:02 +01:00
Harald Welte 11b1ddee21 ranap_msg_factory: Fix criticality of PDUs
Seveal of our RANAP messages were using criticality values at the
PDU level differing from what RANAP_PDU_Descriptions.asn states
for the respective procedures.  Let's fix that.

This was discovered while working on the initial IuCS TTCN3 tests,
where the receive templates require the criticality to match.

Change-Id: I98eec0bdc0d0cb1b9284bd5d042b1f4403abef95
2019-04-20 22:53:49 +02:00
Philipp Maier aa8d48cbe0 ranap_msg_factory: remove unusued variable
remove variable i in ranap_new_msg_sec_mod_compl() as it is not
used (compiler warning)

Change-Id: I93d9e95109fb78bc6cc161745b9e14de8b623d4f
2017-12-20 16:03:19 +00:00
Philipp Maier 1eb19cf690 ranap_msg_factory: check IE encoder return codes
in many functions, the returncode (rc) from the IE encoder functions
is not checked.

Add a return code check and log error message (like it is already
done in the functions which already check the return code)

Change-Id: I592c0794a94c50fde5c574b1e9bc581eb28af4ae
2017-12-20 16:03:19 +00:00
Neels Hofmeyr 54df0a1095 ranap_msg_factory: sanitize: memcpy instead of unaligned int copy
The sanitize build complains about writing to a uint32_t that is not 4-byte
aligned. Instead, write the uint32_t by memcpy.

For that, move the common ntohl() to the top and store in a local uint32_t,
memcpy() from that in both code paths.

Change-Id: Iacdd15421f824dd009448a96355b533dff28258b
2017-11-22 03:11:40 +01:00
Neels Hofmeyr e90f13e82d api doc: clarify byte order in ranap_new_msg_rab_assign_*
Change-Id: Ib0d2cc538488a995be5278092d3ac105be8aad33
2017-11-20 21:38:50 +00:00
Neels Hofmeyr 8e29b23119 new_rab_par_voice(): add bitrate params, call with (6700, 12200)
The guaranteedBitrate lowers from 12200 to 6700, which is mimicking the values
found in a trace from a production 3G environment. So far we have no reason to
choose these values other than knowing that other operators seem to do this.

This came up while trying to fix voice RAB for the nano3G, but this patch had
no effect on that. Now that it's here, we might as well keep it.

Change-Id: Ia7eecca43d62a6a020466e9b8dc8b566ca988f9f
2017-02-02 04:58:54 +01:00
Neels Hofmeyr 135bc06c35 ranap: make X.213 NSAP 160 bits long, zero padded
For IPv4 addresses, only 56bit of X.213 NSAP are used. The sysmocell5000
accepts such a field that is 56bits long, but the ip.access nano3G does not
(and crashes instead). Both work when zero-padded to 160bits size.

So far we used to send the IPv4 address as "raw" 32bits to the nano3G to avoid
the crash. With this zero padding we no longer need such a workaround and can
use identical config for both cells.

Change-Id: I070bbfe887ab93d08322df30571050a381d082d5
2017-02-02 04:53:41 +01:00
Neels Hofmeyr ad14ff96c3 cs RAB: add nAS_SynchronisationIndicator
This is mimicking the IEs found in a trace from a production 3G environment. We
have no reason to add this other than knowing that other operators seem to do
this.

This came up while trying to fix voice RAB for the nano3G, but this patch had
no effect on that. Now that it's here, we might as well keep it.

Change-Id: I14c22b0befb308bac2eded662fe13a58c8478743
2017-02-01 14:02:11 +01:00
Neels Hofmeyr 74b0565d9f comment: note RAB assignment spec reference
Change-Id: Ifef8da82a01cd781ef560d1ec21cbfb23efb1495
2016-09-22 21:12:28 +02:00
Neels Hofmeyr 7b48749783 ranap: include port in RTP TransportLayerInformation
Remove an #if 0 to properly include the port information (verified to work).

Adjust test expectations.

Change-Id: I45fb134959dea9bcdfbfd9d8a061e67c3cc80fb7
2016-09-16 02:41:38 +02:00
Neels Hofmeyr f6673b7257 RAB Assign for voice: heed the x213 nsap flag
Add use_x213_nsap arg to ranap_new_msg_rab_assign_voice() and
new_transp_info_rtp(). Pass this to new_transp_layer_addr() to compose 32bit
addresses when use_x213_nsap == false.

This is analogous to ranap_new_msg_rab_assign_data().

Particularly, the ip.access nano3G does not accept x213 NSAP 56bit addresses,
so we want to send 32bit addresses there.

Change-Id: I0c3c95d709c8a2b1c48d7a187faca34102226329
2016-09-08 15:50:32 +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
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 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 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
Daniel Willmann f44d12ce27 ranap_msg_factory: Add keystatus parameter for security mode cmd 2016-04-20 10:17:53 +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 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
Daniel Willmann 49f99cd265 ranap_msg_factory: Use network byte order for 16 bit mode_versions field
Instead of 0x0001 the field was 0x0100
2016-02-18 13:21:35 +01:00
Neels Hofmeyr 96979af054 move ranap_*.h,iu_helpers.h to include/osmocom/ranap/
A bit hacky: the ranap_ies_defs.h is generated together with the
ranap_encoder.c and ranap_decoder.c. See comments in src/Makefile.am and
include/osmocom/ranap/Makefile.am.
2016-01-05 15:37:23 +01:00
Harald Welte bdf3fd1dc4 don't include hnbgw.h from ranap header files
To use libosmo-ranap from outside of this repository, we need to
eliminated all dependencies to local header files
2016-01-03 17:25:51 +01:00
Harald Welte 056984fab1 merge (+rename) iu_helpers.c into libosmo-ranap 2016-01-03 16:31:31 +01:00
Harald Welte 74157f6120 ranap_msg_factory: Fix memory leaks in OCTET_STRING
the 'ies' types do not have a free() function, and thus we have to avoid using
any functions that dynamically allocate memory, such as OCTET_STRING_fromBuf.
2016-01-01 16:47:13 +01:00
Harald Welte 1cdb81dd98 ranap_msg_factory: Mark 'RANAP_Cause_t *' as const 2016-01-01 16:47:13 +01:00
Harald Welte 37223d8218 ranap_msg_factory: functions for RAB and IU Release Request 2016-01-01 16:47:13 +01:00
Harald Welte 01de8d716a fix copy+paste mistakes when encoding GTP TEI in RAB Parameters 2015-12-29 19:10:48 +01:00
Harald Welte 05ac677840 make bitrates configurable in new_rab_par_data() 2015-12-29 19:10:11 +01:00
Harald Welte bfe49a2293 ranap_msg_factory.c: Use X.213 NSAP encoding for TransportLayerAddr 2015-12-28 13:14:52 +01:00
Harald Welte 2cf0d8f1eb ranap_msg_factory: CipheringInformation is optional in SecurityModeCommand 2015-12-28 13:13:47 +01:00
Harald Welte f9c9aa5f20 ranap_msg_factory.c: Fix compiler warnings 2015-12-24 15:39:00 +01:00
Harald Welte 57d873392c ranap_msg_factory: use OCTET_STRING_fromBuf() in ranap_new_msg_dt()
When using asn1c, we cannot use buffers allocated elsewhere and/or on
the stack as input into encoding.
2015-12-24 15:33:21 +01:00
Harald Welte ea98b6f6d6 ranap: New ranap_new_msg_initial_ue() funcition
for testing, it is useful if we can also generate an InitialUE
message - even though a HNB-GW only needs to receive it.
2015-12-24 15:09:06 +01:00
Harald Welte c4338deee9 hnbgw: Bring all parts together
We now have the RUA and SUA parts interconnected by the
context ID mapper, and should be able to pass messages back and forward
between both sides.

Unfortunately this touches a bit of everything, but the structures are
all still very much in flux.  Hopefully they will start to stabilize at
some point soon...
2015-12-24 00:41:45 +01:00
Harald Welte 0a3eafee45 ranap: Don' shift the RAB ID by 3 bits 2015-12-19 02:38:09 +01:00
Harald Welte 94a62d591d ranap: No need for htonl() of IP addresses and the like 2015-12-19 02:37:48 +01:00
Harald Welte b7f67c4b14 ranap: Don't forget ProtocolIE-CointainerPair around ProtocolIE-FieldPair 2015-12-19 02:37:35 +01:00
Harald Welte f8db61b554 First compiling (and leak-free) RANAP message generation functions
encoding correctness still needs to be verified at this point.  At least
they generate some binary output without failing somewhere earlier in
the encoding process - and they don't leave any leaked memory behind,
see talloc_report() at the end of test-ranap.c:main().
2015-12-18 20:20:47 +01:00