Commit Graph

441 Commits

Author SHA1 Message Date
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 32b821005e log: fix number format for domain indicator
CN_DomainIndicator_t is a long, so use %l format.
Error was introduced in recent 2b5021fd8d.

Fixes: CID#157119
Change-Id: I22f49d45bc87897beb24a6b1eee6c83da3e57b0f
2016-12-07 15:32:31 +01:00
Neels Hofmeyr 2b5021fd8d hnbgw: rua rx: fix rc and log unhandled Private Msg
Fixes: CID#57949
Change-Id: I822888a3cf450e2787fc352e0352aed92236ddb7
2016-11-27 18:27:33 +00:00
Neels Hofmeyr a6a68e62d9 fix error rc in various ASN.1 decoding functions
Fixes: CID#57945, CID#57946, CID#57947, CID#57948, CID#57950, CID#57951
Change-Id: I2d9ee1aa79959c5973041393f4769faa13720898
2016-11-27 18:27:33 +00:00
Neels Hofmeyr fe87809c92 hnbgw_rua: reject invalid domain indicator
Fixes: CID#135226, CID#135227
Change-Id: I0c44179aac02772585214e528207e959ad168f3c
2016-11-27 18:27:32 +00:00
Harald Welte e08cdd92a6 ue_context_alloc(): Avoid ue->imsi without NULL termination
Change-Id: I152e84206e0b2b80fa79956f5adbbe84ff10b4ab
Fixes: Coverity CID 57625
2016-11-26 00:04:44 +01:00
Neels Hofmeyr 5ee050c1e7 hnbgw: parameterize IuCS and IuPS ips and ports: add vty cmds
Basically copy-paste the Iuh local-ip and local-port code to provide
parameterization of the IuCS and IuPS remote addresses.

Add IUCS and IUPS nodes, enhance go_parent_cb and config writing accordingly.

Change-Id: I2c28977011009df4e1fa472290bbbc359e406971
2016-10-27 14:01:25 +02:00
Neels Hofmeyr c510fc29fc hnbgw: vty: set explicit go_parent_cb
A second level of depth will be added to the hnbgw node soon, which will need
explicit go-parent logic.

Change-Id: I8d1c18a396c215e8425ae49872b5c73316087d7d
2016-10-27 14:01:25 +02:00
Neels Hofmeyr 9153de6498 hnbgw: parameterize iuh local port: add vty cmd
For completeness' sake, add VTY command to set the local Iuh port, to go with
the command that sets the local IP.

Change-Id: I4b5e9fe9fcfa489069a0728d47899ef4a61f7ce5
2016-10-27 14:01:25 +02:00
Neels Hofmeyr 6e3e594ee3 hnbgw: cosmetic: local-ip config: drop getter function
Use the g_hnb_gw->config.iuh_local_ip directly, drop hnbgw_get_iuh_local_ip().

Change-Id: Ie91aea82ae5d128ad735a0857ea814b440c3232c
Suggested-by: hwelte
2016-10-27 13:43:03 +02:00
Neels Hofmeyr c7ccdd490f cosmetic: hnbgw: addr related renames, move define, move comment
Prepare for parameterization of IuCS and IuPS addresses:

Conform internal variable naming to local-ip, local-port, remote-ip,
remote-port (instead of bind-ip).

Rename HNBGW_IUH_LOCAL_IP_DEFAULT to HNGGW_LOCAL_IP_DEFAULT to be more general
and move it to the top.

Move a function doc comment to the .c file.

Change-Id: Ice85941c978498e3ddf41d151248507e7f56cb5d
2016-10-13 15:17:06 +02:00
Neels Hofmeyr 4ff1a5a957 fix msgb talloc context initialization
Properly initialize msgb talloc context in hnbgw and all tests, using the new
msgb_talloc_ctx_init().

test-ranap.c: since msgb talloc ctx is now in test_common_init(), remove msgb
talloc init here.

Change-Id: I807c799aff1239184728551ed77fdafa73bd683f
2016-10-13 04:17:40 +02:00
Neels Hofmeyr 793b273a70 fix build: look for generated sources in builddir, not srcdir
Fixes 'make check' from a different dir than the source tree.

Change-Id: I97606dadef3c2184f9538b0198029047cc3af71c
2016-10-10 13:34:38 +02:00
Neels Hofmeyr f41b2fa500 fix: apply rename of osmo_sua_link_get_user_priv()
In the course of a rebase in libosmo-sccp, osmo_sua_link_get_user_priv() was
renamed to osmo_sccp_link_get_user_priv(). Apply this rename here to fix the
build.

Change-Id: I09603f5eb983f17c1e4a1232967fc43c7ceea12a
2016-09-27 18:13:28 +02:00
Neels Hofmeyr 39ee926062 hnbgw: vty conformance: rename iuh 'bind' command to 'local-ip'
The standard osmo VTY terminology is 'remote-ip', 'remote-port', 'local-ip',
'local-port'. Conform to that. osmo-hnbgw is so far not rolled out widely, so
it makes sense to do this now.

Change-Id: Ifda2653bf58044552a5f1477cd7008dec3fb9100
2016-09-27 05:55:55 +00:00
Neels Hofmeyr 0476e2854e log: hnbgw: add hnbap UE context allocation info log
Change-Id: Iac0ca948d6e699d984c6e424afe7106dcaf2ab1e
2016-09-27 05:55:55 +00:00
Neels Hofmeyr 12181a937f hnbap: accept UE Register Requests with TMSI and pTMSI
Add the option to allow UE Register Requests with a TMSI identity.
Add VTY command to enable this option, 'hnbap-allow-tmsi'.
Add hnbgw_tx_ue_register_acc_tmsi().

HNBGW so far keeps track of UEs that have registered, with their IMSI. When a
UE registers with only a TMSI, we obviously can't store an IMSI. However, since
we're so far never *using* the list of UEs in osmo-hnbgw, we might as well just
accept the TMSI registration and carry on as usual. All that is needed for
proper operation is a valid UE context.

This is aimed at the ip.access nano3G femto cell, as it apparently feeds
whichever identification the UE sends through to HNBAP (TMSI+LAI, pTMSI+RAI),
instead of an IMSI as expected. So far this caused failures and the need to
make the UE clear its TMSI (wait several minutes or attempt to subscribe to a
different network), so that UE registration switched back to IMSI. When simply
accepting the TMSI in osmo-hngw, no problems are apparent in our current code
state.

For example, a Samsung Galaxy S4 seems to send a UE_Identity_PR_tMSILAI (CS
identity), and a GT-I9100 seems to send a UE_Identity_PR_pTMSIRAI (PS identity)
upon first registration to the network.

Recording the IMSI in hnbgw: we could use the subscriber list during paging, to
page a UE on only its last seen HNB. On the other hand, it doesn't hurt to
anyway always page to all HNBs connected to osmo-hnbgw. The paging procedure
does include a page-to-all-HNBs in case the first HNB paging fails. But we must
be aware that UEs that register by TMSI will simply not have an IMSI recorded
in the list of UE contexts, so a lookup based on IMSI may fail.

Patch-by: Harald Welte <laforge@gnumonks.org>, me
Change-Id: I87bc1aa3e85815ded7ac1dbdca48f1680b468589
2016-09-27 05:55:55 +00:00
Neels Hofmeyr f33e8358cc hnbgw: UE context: add handling by tmsi identification
To prepare for an upcoming commit that accepts TMSI identification upon UE
Register Requests:

Add tmsi arg to ue_context_alloc().
Add ue_context_by_tmsi().

This is aimed at the ip.access nano3G femto cell, as it apparently feeds
whichever identification the UE sends through to HNBAP (TMSI+LAI, pTMSI+RAI),
instead of an IMSI as expected.

See the upcoming commit that enables accepting TMSI identities for further
detail.

Change-Id: I138458443319cc4cbea5ee7906cf5dd72d582130
2016-09-27 05:55:55 +00:00
Neels Hofmeyr c94ed09f50 hnbap: add UE Register Reject for pTMSIRAI identity
This is aimed at the ip.access nano3G femto cell, as it apparently feeds
whichever identification the UE sends through to HNBAP (TMSI+LAI, pTMSI+RAI),
instead of an IMSI as expected.

Sending a proper registration reject speeds up the response seen on the UE and
avoids needless waiting.

See the upcoming commit that enables accepting TMSI identities for further
detail.

Change-Id: I03b69613e6ddd8a08d9358ffc2f74954c231fd2c
2016-09-27 05:55:55 +00:00
Neels Hofmeyr c83e49fc8d log VTY telnet bind only once
After libosmocore 55dc2edc89c1a85187ef8aafc09f7d922383231f which outputs
'telnet at <ip> <port>' from telnet_init_dynif(), there's no need to log the
telnet VTY bind here anymore.

Change-Id: Icd9e670c1d30c156f7bd5d0d34892150aeba95e9
2016-09-26 22:44:18 +02: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 a872421e43 build: parallel build: require ../libosmo-ranap.la from tests/
This rule is bad because it re-invokes $(MAKE), but it seems to fix the
parallel build. It should probably be done differently.

Change-Id: I8107e08e4c211f20d671f520bf6bab9356f3c90e
2016-09-09 06:43:32 +00:00
Neels Hofmeyr df63de2e37 build: move headers to include/osmocom/*
This came up while fixing 'make distcheck'; this is certainly not the easiest
way but it makes sense to have the headers in include/, like we do in openbsc.

The easy alternative might be to add -I$(top_srcdir)/src to src/Makefile.am.

Remove -I$(top_srcdir)/src from src/tests/Makefile.am, no longer needed.

Change-Id: I5a82e029dcdc4df0a60a31271a4883393fe59234
2016-09-09 06:43:32 +00:00
Neels Hofmeyr 30e08f5b8e build: cosmetic: hnbap: undup asn1 src path
Change-Id: I0507277995302261c87db1b0c48105065cf13ae4
2016-09-09 06:43:32 +00:00
Neels Hofmeyr 2f1b1189da build: distcheck: add missing bits for testsuite distcheck
Got some errors during 'make distcheck', copying the way openbsc.git does these
things.

Change-Id: I13d76cd56dfb8fe4eb02d6fcada78a9e3311b51b
2016-09-09 06:43:32 +00:00
Neels Hofmeyr ba03c430a6 build: distcheck: look for asn1 in top_srcdir, not top_builddir
Change-Id: Iebcff240ba2fae964dad2a2c481fcbfd29e14e69
2016-09-09 06:43:32 +00:00
Neels Hofmeyr 347f8ef218 build: distcheck: add missing distclean files
Change-Id: I24d72b2b1bae52a1b2cf8a989396d2aac31d119e
2016-09-09 06:43:31 +00:00
Neels Hofmeyr 8345792281 build: fix ranap gen, use same for gen hnbap and rua gen
fix extraneous rebuild for each make invocation: touch the ranap.stamp file in
src/ as the make target suggests.

fix for 'make distcheck': ranap gen: move generated sources to builddir, not
srcdir. Thus we also -I the builddir include to pick up those headers.

hnbap and rua have the same situation as ranap (they generate numerous files
from a single make rule). Use the same makefile semantics for those two
(commit for ranap gen omitted the same changes for hnbap and rua).

The generated headers are thus moved to include/osmocom/*/, so adjust #include
statements accordingly (*_common.h, *_ies_defs.h).

Also move hnbap_common.h to include/osmocom/hnbap and rua_common.h to
include/osmocom/rua, since the *_ies_defs.h want to include them; and since
*_ies_defs.h are now in include/osmocom/*, we want a '<foo>' include now.

Also adjust gitignore.

Change-Id: I32213666fcdfc144008fa7d46497c0938d093e86
2016-09-09 06:43:31 +00:00
Neels Hofmeyr 52c6ae25be tests: don't log filename nor color in unit tests
In experr, we had line numbers in log output, which might change. Also, for
make distcheck, the path of the source file might have some '../../' added in
the log output (to indicate the src dir as seen from the build dir).

Fix both by dropping source file and line.

Also drop color while at it.

Change-Id: Ie76384c4176ce0a7d89d093f2efb848fe3f19400
2016-09-09 06:43:30 +00:00
Neels Hofmeyr 1a0bb5108c UE Register with TMSI: reply with a Register Reject
When receiving a UE Register Request with TMSI and no IMSI, compose a
Register Reject with the same UE Identity and send.

The accepting function expects a ue_context argument and composes the
message from the IMSI found there. This new rejection message cannot rely
on a ue_context struct and hence uses the asn1 uE_Identity directly.

Change-Id: Ia47e398e50e316842cd260dc0d9a4e2d8a1c627c
2016-09-09 06:34:24 +00: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
Neels Hofmeyr f495b2347b hnbgw: make Iuh bind address configurable via VTY
Add config node hnbgw/iuh/bind, taking an IPv4 address.

Use this address to bind the Iuh server.

This is particularly useful for the ip.access nano3G, which is very sensitive
with SCTP addresses that don't respond to SCTP heartbeats. If the hnbgw listens
on 0.0.0.0, there will be SCTP heartbeats for all local interfaces on the
machine that the hnbgw runs on; the nano3G will interpret the "missing", or
rather, redundant heartbeat acks for the interfaces that aren't really related
to the Iuh server and assume a broken Iuh link, leading to an Iuh shutdown and
reconnection, looping every minute or so. By binding the hnbgw to only one
local interface, the SCTP addresses can be reduced and "missing" heartbeat acks
can be avoided.

Change-Id: Ie2749c152b878e17aa65dfb806826357d5c494f1
2016-08-18 03:21:22 +02:00
Neels Hofmeyr 926153b9af hnbgw vty: add empty hnbgw and hnbgw/iuh vty nodes
Add include/osmocom/iuh/ named after this project (osmo-iuh), and add vty.h to
define VTY node enum values. Also add (to) Makefile.am and configure.ac to
include in the build.

An upcoming commit will add the actual first config item to the hnbgw/iuh node.

Change-Id: I71545823d3bd81cb888c85df8e298a56c98bf131
2016-08-18 03:21:22 +02:00
Neels Hofmeyr 4d8eb4cbd7 hnbgw: move vty commands out to new hnbgw_vty.c
Pass g_hnb_gw and tall_hnb_ctx to hnbgw_vty_init() as they are no longer
statically available.

Change-Id: If85c1b97a240bd1dcf9f367ea6fca857d542ab22
2016-08-18 03:21:22 +02:00
Neels Hofmeyr 1d03f19e06 hnbgw: make cmdline options stronger than config file
Now that a config file gets parsed after the command line options, e.g. the
'logging timestamp 0' config item is stronger than a -T commandline option. So
rather store the cmdline options to take effect after config file parsing.

This adds a stupid 'log_disable_color = true' reverse boolean logic, which is
unavoidable if we want to use the same default cmdline options as osmo-nitb /
osmo-cscn.

Change-Id: I16ad55b173a443c36b71dc6b70f58695f6665312
2016-08-18 03:18:03 +02:00
Neels Hofmeyr 085cd67672 hnbgw: add config file and -c cmdline option
Change-Id: I6ac9fa17b35260031c55aab664124d466f60c937
2016-08-18 02:37:11 +02:00
Neels Hofmeyr 4d675a7df9 hnbgw: add cmdline arg parsing with default options
Default options taken from osmo-nitb:

    -h --help                  This text.
    -d option --debug=DHNBAP:DSUA:DRUA:DRANAP:DMAIN  Enable debugging.
    -D --daemonize             Fork the process into a background daemon.
    -s --disable-color
    -T --timestamp             Prefix every log line with a timestamp.
    -V --version               Print the version of OsmoHNBGW.
    -e --log-level number      Set a global loglevel.

Change-Id: I931cee01c605c1b507c16041ada226cf963ea433
2016-08-18 02:36:03 +02:00
Neels Hofmeyr 4c45d2b9fd hnbgw: add copyright to vty_info
Change-Id: I702b606837199ab64c3590546900d4d30357b919
2016-08-18 02:35:57 +02:00
Neels Hofmeyr a1bf4f330f fix compiler warning: osmo_prim_cb() has void* arg
Change-Id: I16741976050b3f36196af1b4f18d795af2b2722a
2016-07-12 00:51:31 +02:00
Neels Hofmeyr 0a43722a48 fix compiler warnings with new libosmo-sccp: rename to osmo_sccp_*
See libosmo-sccp.git 1a3875092f93df3c3054d26eac52bb0ea9bd09c3

Note: at time of commit, osmo-iuh still depends on the libosmo-sccp sysmocom/iu
branch to build.

The same rename has been committed to both sysmocom/iu and master on
libosmo-sccp. Above commit hash is on sysmocom/iu. The master commit is
03ad002c28073b347b92bcde16d5af80a06389e4.

Change-Id: Id9c0065d7398a6205ff24477d47c9663caac669c
2016-07-12 00:51:21 +02:00
Neels Hofmeyr fef2e86003 make regen: fix: use $(MAKE) instead of make
On FreeBSD, we use gmake, so calling 'make -C ...' won't work here.
We need to invoke $(MAKE) so gmake is used again.

Change-Id: If8d09889db2c101eca66675fff8f820d6d1d7a65
2016-07-12 00:44:18 +02:00
Alexander Huemer 156fa393fc attempt to fix parallel build, improve AM logic
The formerly existing make rule caused a race condition in parallel builds and
wrongly stated the .c files as targets, which caused make to execute the
rule twice (once for each target). This was actually only fallout of the
attempt to express the fact that those two files are generated by the rule.

The generated file ranap_ies_defs.h was moved by one make job, another
job then tried to access the file in the old location and failed.

parallel build verified with:
$ for i in $(seq 1 10)
do
	echo "XXXX iteration $i"
	git clean -xfd
	autoreconf -i
	./configure
	make -j${i} || break
done

Coauthored by Andreas Rottmann <mail@rotty.xx.vu>

Change-Id: I439edcb4b7742de861c99ed401114f51061f8088
Reviewed-on: https://gerrit.osmocom.org/65
Tested-by: Jenkins Builder
Reviewed-by: Harald Welte <laforge@gnumonks.org>
2016-05-15 23:28:14 +00:00
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
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
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
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
Neels Hofmeyr e25faa8966 hnb-test: print sent bytes 2016-03-30 14:10:39 +02:00
Neels Hofmeyr 3588810cb7 hnb-test: answer MM Authentication Request
With hardcoded SRES matching the hardcoded auth tuple in openbsc's
sysmocom/iu branch for testing.
2016-03-30 14:10:39 +02:00
Neels Hofmeyr 5dbb7b2c3f hnb-test: print LU Reject 2016-03-30 14:10:39 +02:00
Neels Hofmeyr d4598fa453 hnb-test: factor out MM header parsing 2016-03-30 14:10:39 +02:00
Neels Hofmeyr 576f642eba use of sccp_helpers: apply osmo_ name prefix addition 2016-03-30 14:10:39 +02:00
Neels Hofmeyr 3da8608b6a Move sccp_helpers.[hc] to libosmo-sigtran 2016-03-30 14:10:39 +02:00
Neels Hofmeyr c04eb533e1 hnb-test: send TMSI REALLOC COMPL only when LU ACC sent a TMSI 2016-03-04 12:40:53 +01:00
Neels Hofmeyr f67803684f build: use $top_srcdir instead of ../ 2016-02-29 14:28:00 +01:00
Neels Hofmeyr 92b13bc875 fix build: move local include dir before sys installed one 2016-02-29 14:22:21 +01:00
Neels Hofmeyr 5f9be1ed5e hnb-test: make hnb-gw address configurable 2016-02-29 13:33:44 +01:00
Neels Hofmeyr ae93712977 hnb-test: add messages leading to Location Update Accept
But note, authentication is not there yet; the CSCN should initiate that.
2016-02-29 10:02:10 +01:00
Neels Hofmeyr 5c1cc8cce4 hnb-test: replace some hex vals with GSM48_* constants 2016-02-29 10:02:10 +01:00
Neels Hofmeyr c164a97bc6 hnb-test-ranap.c: fix missing return 2016-02-29 10:02:10 +01:00
Neels Hofmeyr e1f709fa51 hnb-test fix id resp 2016-02-29 10:02:10 +01:00
Neels Hofmeyr 860a12977c hnb-test: attempt to reply to an MM Identity Request 2016-02-29 10:02:10 +01:00
Neels Hofmeyr b984f36f58 hnb-test: decode NAS pdu when receiving RUA from CN 2016-02-29 10:02:10 +01:00
Neels Hofmeyr 32828708b2 hnb-test: tweak comment 2016-02-29 10:02:10 +01:00
Neels Hofmeyr 7b81128d44 hnb-test: comment on gen_initue_lu() IMSI 2016-02-29 10:02:10 +01:00
Neels Hofmeyr 0968a58836 hnb-test: some rua rx printfs 2016-02-24 20:51:04 +01:00
Neels Hofmeyr a0d21479a7 osmo-hnbgw, hnb-test: allow configuring VTY address 2016-02-24 20:51:04 +01:00
Neels Hofmeyr 8f67f8e83c test-ranap.ok: fix expectations after commit 49f99cd26
49f99cd26: 'ranap_msg_factory: Use network byte order for 16 bit mode_versions field'
2016-02-20 15:23:12 +01:00
Daniel Willmann 635fac0c3e ranap: Add custom ranap_decode_rab_setupormodifieditemies() function 2016-02-18 16:02:37 +01:00
Daniel Willmann 4870b995ec ranap_common: Add helper function to get IP from transport layer addr 2016-02-18 13:21:35 +01: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 de111bc1f8 hnbgw: fix errmsg typo 2016-02-18 01:31:30 +01:00
Neels Hofmeyr 110bb5c9af hnbgw vty: add logging commands 2016-02-18 01:30:42 +01:00
Neels Hofmeyr 6a62e549cd hnb-test: fix wrong domain indicator in ranap.
ranap_new_msg_initial_ue() called with wrong argument order.
2016-02-18 01:30:42 +01:00
Neels Hofmeyr b9f46a7434 dummy_cn_sua: missing include 2016-02-18 01:30:42 +01:00
Neels Hofmeyr 44beab9c3b hnbgw: hnb_context_alloc(): fix missing free, missing return, wrong error return type
Also move INIT_LLIST_HEAD further up for good measure (cosmetic).
2016-02-18 01:30:42 +01:00
Daniel Willmann 5f8c718786 hnbgw: Print out the hnbgw context map per HNB 2016-01-14 15:42:07 +01:00
Daniel Willmann 8592716116 hnb-test: Increment UE conn_id for each new loc_upd_req 2016-01-14 15:36:49 +01:00
Daniel Willmann b39bad1281 dummy_cn: Respond to initial UE message with empty ranap message 2016-01-14 15:36:12 +01:00
Daniel Willmann 4deab942cc hnbgw: Mark ps_cnlink as ps 2016-01-14 15:35:11 +01:00
Daniel Willmann defd29912c context_map: Have one mapping per UE/cnlink combination 2016-01-14 15:10:05 +01:00
Daniel Willmann 0118839829 Revert "hnbgw_hnbap: Zero IEs_t before decode is called"
This reverts commit a8b6b1e3a1.
Zeroing is now done inside of the decode function
2016-01-12 10:14:11 +01:00
Daniel Willmann a8b6b1e3a1 hnbgw_hnbap: Zero IEs_t before decode is called
This ensures that presenceMask is zero and optional fields will be freed
correctly.
This needs to happen for ranap and rua as well.
2016-01-07 18:01:06 +01:00
Daniel Willmann c858fe9f90 ranap_common_cn: Free structs allocated through ranap_cn_rx_co()
After the callback handled the ranap_message the decoded IEs need to be
freed again.
2016-01-07 14:33:00 +01:00
Daniel Willmann c35b298ce9 ranap_common_cn: Free structs allocated through ranap_cn_rx_cl()
After the callback handled the ranap_message the decoded IEs need to be
freed again.
2016-01-07 14:32:56 +01:00
Daniel Willmann 366dcf24c5 ranap_common_cn: Fix copy/paste bug when decoding outcome message 2016-01-07 14:12:07 +01:00
Daniel Willmann 618f0f5bdb ranap_common_cn: Add missing break in switch statement 2016-01-07 14:11:01 +01:00
Daniel Willmann 11e912aa6e Free ies struct after use in tests and hnbgw_cn/rua 2016-01-07 13:19:30 +01:00
Daniel Willmann b02d77c2c1 tests/dummy_cn_sua.c: Fix ranap_common_cn include 2016-01-07 12:59:21 +01:00
Daniel Willmann d10002cf8d asn1tostruct: Add memory free functions and use them in HNBAP 2016-01-07 12:27:41 +01:00
Daniel Willmann b433b97474 hnbgw_hnbap: Handle hnb deregister message as well 2016-01-07 11:01:15 +01:00
Daniel Willmann 1ee089f37a hnbgw: When a HNB is released release associated UEs as well 2016-01-07 11:01:15 +01:00
Daniel Willmann 6480cadd8e hnbgw: Use libosmo-netif for SCCP connection handling 2016-01-07 11:01:12 +01:00
Daniel Willmann 8fda362dd8 Correct postprocessing of generated files
Rewrite ranap_common.h include path in ranap_ies_defs.h as well
Don't move ranap_ies_defs.h to the install directory, but move it inside
the source tree
2016-01-07 10:52:52 +01:00
Harald Welte f3d2c74250 also 'sed' the include path of the ranap_common.h file 2016-01-06 19:53:48 +01:00
Harald Welte 5c6bd5104e make ranap_common.cn.[ch] part of libosmo-ranap 2016-01-06 19:53:44 +01:00
Harald Welte 8fa5d558fb ranap_common_cn.c: Use call-backs rather than function calls
When we use call-back function pointers with ranap_cn_rx_c{o,l}()
functions, we can (soon) migrate it into libosmo-ranap without an
application having to provide 'magic symbols' that the library expects
to be able to call.
2016-01-06 19:44:36 +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 bea34f26c2 hnbap_common.c: Fix include path 2016-01-05 14:24:08 +01:00
Neels Hofmeyr 0de6b94d71 rebuild en/decoders when asn1tostruct.py changed
Add asn1tostruct.py as dependency for the targets that use it, so that any
modification to the asn1tostruct.py regenerates everything related
automatically.
2016-01-05 12:59:58 +01:00
Neels Hofmeyr f193c221cf Fix -I in tests/ (broken by include dir changes) 2016-01-05 12:54:25 +01:00
Neels Hofmeyr f1f2d7ca19 Remove osmo-iuh subdir level from include/ (2/2)
Make all changes to #include statements and build files.
2016-01-05 12:00:06 +01:00
Neels Hofmeyr c04a96c476 move asn1 headers to include/ dir (5/5)
Do all remaining changes necessary for a working build.

Add Makefile.am files in include/... subdirs.

Remove noinst_HEADERS directives from src/*/Makefile.am, but keep the headers
list to feed to move-asn1-header-files.sh.

Adjust all #includes in src/*_common.h and elsewhere. In hnbap_common.h,
separate the ASN.1 "primitive" headers from the others, and include them
without a subdir path, as before.
2016-01-04 18:11:19 +01:00
Neels Hofmeyr 16c97669bd move asn1 headers to include/ dir (4/5)
Move headers.
2016-01-04 18:11:19 +01:00
Neels Hofmeyr b0429374e2 move asn1 headers to include/ dir (2/5)
Show effects of the new sed step on asn1-generated files, without moving the
files.
2016-01-04 18:11:18 +01:00
Neels Hofmeyr 5aabad1380 move asn1 headers to include/ dir (1/5)
Add move-asn1-header-files.sh to do header file moving and sed'ding the include
statements. The file moving part is disabled until a later commit, to make
reading the diffs easier.

Call shell script from src/{hnbap,ranap,rua}/Makefile.am regen targets.

Add convenience regen target to src/Makefile.am, calling regen in the three subdirs.

This change is split over several commits to ease diff reading. Subsequent
commits show, in steps:
- the "unmoved" effect of sed,
- header moves,
- adjust build system and include statements.
2016-01-04 18:09:37 +01:00
Harald Welte b66c5d0e62 move tests/rua_helper.[ch] to src directory
The RUA Helper is not test-specific.
2016-01-03 18:04:28 +01:00
Harald Welte 1f6bd7b51c add test-ranap to testsuite 2016-01-03 18:01:05 +01:00