Commit Graph

687 Commits

Author SHA1 Message Date
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 afcaac08ee asn1helpers.h: Add missing declarations of functions in asn1helpers.c 2015-12-24 15:03:11 +01:00
Harald Welte b0de90639b hnbgw_rua.c: Incoming context IDs are 24bit wide according to spec
so don't try to decode them to u32, which expects 32bit input values.
2015-12-24 14:10:17 +01:00
Harald Welte c89c2a6e6a RANAP: Replace the last remainng TBCD-STRING with OCTET STRING
in order to work around a bug in asn1c.  When we keep the original
TBCD-STRING, the APER-encoded PLMNidentity always has an extra leading
length byte that the decoder doesn't expect.
2015-12-24 14:07:05 +01:00
Harald Welte 37166a27ca improve logging, remove obsolete FIXMEs, return of non-void functions 2015-12-24 10:12:09 +01:00
Harald Welte bc4560cf18 Implement forwarding of RANAP PAGING from CN to all HNBs 2015-12-24 08:46:58 +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 cd5e981490 hnbgw_rua: Don't use msgb as imput, allow more parameters 2015-12-23 22:14:16 +01:00
Harald Welte 90256bad58 Add a context mapper to map RUA ContextIDs <-> SUA Connection IDs 2015-12-23 22:13:53 +01:00
Harald Welte f42317ba9c Introduce DRANAP/DRUA log categories to separate logging 2015-12-23 15:37:17 +01:00
Alexander Huemer f6d0138d76 fix copy/paste mistake in src/Makefile.am 2015-12-23 13:56:23 +01:00
Harald Welte ffa7c0ad39 use msgb_sctp_ppid() from libosmo-netif, remove local declaration 2015-12-23 00:04:05 +01:00
Harald Welte 75a4e65f52 hnbgw: Add SUA client socket towards localhost
This socket doesn't do much yet except to connect to localhost:14001

The host/port needs to be made configurable, and the RUA<->SUA
interfacing needs to be implemented.

Also, we'll need two SUA sockets, one for MSC and one for SGSN.
2015-12-23 00:04:05 +01:00
Harald Welte 38a4f32d58 remove sigtran code, now part of libosmo-sccp 2015-12-23 00:04:05 +01:00
Daniel Willmann 269b8ac7ee hnbgw: Free msgb when connection is closed 2015-12-22 16:40:46 +01:00
Daniel Willmann 541e429a39 hnbgw_hnbap.c: Clean up after encoding a UE register accept
Need to free the ASN.1 structs after using them to encode the UE
register accept message.
2015-12-22 16:40:46 +01:00
Daniel Willmann d174e76f1d asn1tostruct.py: Fix memory leaks in generated code
The decode_*ies functions did not clean up after them. This change is
taken from changes made to asn1tostruct.py in openair-cn repository.
2015-12-22 16:40:46 +01:00
Neels Hofmeyr 8aac21a5e8 Remove obsolete ffasn1c files.
The ffasn1c files from early trials are obsolete, we're using asn1c now.
2015-12-22 13:02:42 +01:00
Neels Hofmeyr c51f735b35 really fix src/Makefile.am
Add BUILT_SOURCES to src/Makefile.am.

(And remove a stray space.)
2015-12-22 12:27:02 +01:00
Alexander Huemer fec171d8b4 fix Makefile.am 2015-12-22 12:24:27 +01:00
Neels Hofmeyr 6682a37875 README, .gitignore
Update building instructions and add tests/atconfig to .gitignore.
2015-12-22 12:22:10 +01:00
Harald Welte 8960704d1c SUA: Ensure osmo_ prefix is used on all global symbols 2015-12-21 23:51:08 +01:00
Harald Welte 70e84ab5f9 SUA: More FIXMEs 2015-12-21 23:50:36 +01:00
Harald Welte 283c7fde38 Add WIP code for SCCP User Adaptation (SUA) and SCCP User SAP
The idea of this code is to
* provide a SCCP User SAP as boundary between the User of SCCP
  or SCCP-like transport like SUA
* implement the minimum subset of SUA to transport RANAP messages
  betweene HNB-GW and MSC/SGSN

At this point
* we don't yet implement the proper state machines and timer
* we don't imp[lement the SCCP RESET procedure
* we don't implement AS/ASP management

The code is full of FIXMEs whihc hopefully will get fixed gradually.

After some cleanup + verification, it should move to a library, possibly
either replacing/renaming libomo-sccp, or adding it to libosmo-netif?
2015-12-21 23:35:56 +01:00
Harald Welte 71f73a2919 move COPYING file to root directory 2015-12-21 21:01:00 +01:00
Harald Welte ef5055c275 Makefile.am: Try to model the asn1tostruct.py generation dependencies 2015-12-21 17:50:11 +01:00
Harald Welte e98dacd1cb add TS 25.412 spec 2015-12-19 16:24:22 +01:00
Harald Welte c32b0d9848 Add various RANAP packet captures (pcap files) found on the net 2015-12-19 14:52:44 +01:00
Harald Welte b2daa0d803 ranap ASN.1: Define IMSI as OCTET STRING to work around asn1c bug
When IMSI is a TBCD-STRING type, and TBCD-STRING is defined as OCTET
STRING, we end up encoding the IMSI the wrong way.  I don't knwo why
that is, but changing it fixed the problem, as described below:

before this commit:
00 17                           PeranentNAS-UE-ID
40                              criticality ignore
0a                              (length)
00                              presence = IMSI
08                              BUG: why the additional length field?
46 23 91 34 70 77 80 f3         IMSI (643219430777083)

after this commit:
00 17                           PeranentNAS-UE-ID
40                              criticality ignore
09                              (length)
50                              presence = IMSI
46 23 91 34 70 77 80 f3         IMSI (643219430777083)
2015-12-19 13:05:19 +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 de9055f142 Makefile.am: Replace .PHONY asn1tostruct.py rules
asn1tostruct.py generates three files.  Try to teach the makefile that
all three of them depend on the .asn source file to ensure they're
re-built whenever the .asn source file changes.
2015-12-18 20:20:51 +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
Harald Welte fcabec3665 implement BIT_STRING_fromBuf() similar to OCTET_STRING_fromBuf() 2015-12-18 17:51:50 +01:00
Harald Welte 16232780d8 ranap_common: Fix error cleanup path while generating IE Pair 2015-12-18 17:22:04 +01:00
Harald Welte 04329dcbdc {hnbap,rua,ranap}_common: check for encoding errors in new_ie() 2015-12-18 15:18:13 +01:00
Harald Welte 629391321f {hnbap,ranap,rua}_common: use FREEMEM(), not free() directly
If we allocate with CALLOC/MALLOC macros, we need to release memory via the
same API.
2015-12-18 14:58:34 +01:00
Harald Welte 8526d158f8 hnbap/rua: Don't usse malloc() directly but use CALLOC() macro 2015-12-18 13:41:39 +01:00
Harald Welte 9c397d4969 ranap: Use CALLOC() macro of libasn1c
we don't use malloc() directly, as that doesn't mix well with
our libasn1c using talloc.
2015-12-18 13:35:58 +01:00
Harald Welte 2676554c92 ranap: Ensure we free any intermediate dynamically allocated memory 2015-12-18 13:35:58 +01:00
Harald Welte d062df5307 test-ranap.c: Further WIP, it now actually compiles 2015-12-18 13:35:58 +01:00
Harald Welte 93690184b0 RANAP: Split FormatInformationParameter / SDUParameterItem
The definition of the above data types as per 3GPP specs results in a
SEQUENCE_OF() an anonymous structure, which is slightly inconvenient to
use.  So let's split the SEQUENCE OF part and the actual definition of
the item in separate types.
2015-12-18 13:35:58 +01:00
Harald Welte 091039d47e test-ranap.c: More WIP code for convoluted RANAP message encoding 2015-12-18 13:35:58 +01:00
Daniel Willmann 141a0baac9 hnb-test: Add an option to transmit multiple UE register/deregister msgs 2015-12-17 18:03:52 +01:00
Daniel Willmann 28b9ec1473 Enable vty command to output talloc report
I don't think I can print this into a string and thus output it via VTY.
In that case it might be smarte to do in a signal handler
2015-12-17 18:02:37 +01:00
Daniel Willmann 5f810f4222 hnbgw_hnbap: Initialize return value and always return something 2015-12-17 17:57:51 +01:00
Daniel Willmann 59d17d8961 hnbap: Free ASN.1 components after they are no longer needed 2015-12-17 17:56:56 +01:00
Daniel Willmann 6637a289da hnb-test: Handle closed connections correctly 2015-12-17 14:47:51 +01:00