Commit Graph

38 Commits

Author SHA1 Message Date
Pau Espin bc7c69d170 hnbap: Use specific prefix for HNBAP generated code
Other libraries already use ASN1C_PREFIX except the HNBAP one. Let's use
it here to avoid collisions.

All new include/osmocom/hnbap/HNBAP_*.h and src/hnbap/HNBAP_*.c are
generated using the updated src/hnbap/Makefile.am.
Files such as src/*.c, test/* and include/osmocom/hnbap/hnbap_common.h
are modified manually to update structs/enums to new prefix.

Related: SYS#5516
Change-Id: I6c062f631527ae42811bfec134933671c05ecba6
2021-10-26 16:42:07 +02:00
Pau Espin 5310f5458e hnbgw_rua.c: Use proper type struct
Change-Id: I9e21b504e4fac072d8481d0a699bc58d1b94a12d
2021-10-26 13:50:36 +02:00
Harald Welte f05c5bf6cd hnbgw: Use LOGHNB() to add log context information to log lines
So far we don't really have any way of matching a given log message
to a specific hNB.  Let's use the newly-introduced LOGHNB() macro.

Change-Id: Ia16eed4ca5e9ef231259e94c65105f7586f366bc
2021-02-03 08:45:04 +00:00
Thorsten Alteholz 445bdccffa spelling stuff found by lintian
Change-Id: I8434640701746d5db8707472d1d26c313e0814e9
2019-07-16 21:48:47 +02:00
Neels Hofmeyr 6814d22d5f hnbgw_rua: fix dereference of unset pointer
In the UNITDATA case, there is no map, so a) initialize map as NULL and b)
print the RUA ctx id directly from local var context_id instead.

Fixes: CID#181969
Change-Id: I73f508b719b61a389e10cbad1bafad1650634abe
2018-01-15 23:28:08 +01:00
Neels Hofmeyr 70d3ece487 hnbgw_rua.c: log: fix integer format for cN_DomainIndicator
Fixes: CID#135219
Change-Id: I32c11100c87a59f34d7c1fefd2f0037e5d63f0e0
2018-01-15 23:28:00 +01:00
Neels Hofmeyr 23f3fdc6b2 comments: hnbgw_rua.c: remove obsolete fixmes for asn1 free
The comments are all right above the line that does the proper asn1 free step.

Change-Id: I60e3be8c56ecc75c22e76f9e9dce8c72753e153b
2017-12-25 00:46:12 +01:00
Neels Hofmeyr 1e9f4f5432 rua_to_scu(): don't create a context map for UNITDATA
UNITDATA is connection-less, and as can be observed further below, the 'map'
doesn't get used in the N_UNIDATA case.

Related: OS#2776
Change-Id: Ic35562e6d7bfa54b6be859860657f9a235ad5a50
2017-12-25 00:46:12 +01:00
Neels Hofmeyr b10e2937d9 rua: discard context maps on id-Disconnect
When an id-Disconnect is received, the RUA to SCCP user context becomes unused.
Mark the context map as inactive in that case. It will be cleaned up by the
context map garbage collector.

Related: OS#2776
Change-Id: I9616f72bfa566de081098ee13e720ff0f5266c77
2017-12-25 00:46:12 +01:00
Harald Welte da86fe5ae3 Fix various compiler warnings in hnb-gw code
Since we finally started to use -Wall, the related warnings became
visible.

Change-Id: I516700eab2aa7c3412dd62775c4960aed9d4b682
2017-11-21 11:08:56 +00:00
Neels Hofmeyr ecbdc5cb06 make point codes configurable by SCCP address book
In the vty config, use the SCCP address book to configure the local and remote
SCCP addresses. Add VTY commands to set the remote SCCP addresses by name,
derive the ss7 instance from these addresses:

  cs7 instance 1
   point-code 0.23.0
   sccp-address msc
    point-code 0.0.1
   sccp-address sgsn
    point-code 0.0.2
  hnbgw
   iucs
    remote-addr msc
   iups
    remote-addr sgsn

Enforce that both IuCS and IuPS use the same ss7 instance. In the future, we
may add the feature to use two separate instances.

Depends: libosmo-sccp I75c67d289693f1c2a049ac61cf2b2097d6e5687d,
         Ie1aedd7894acd69ddc887cd65a8a0df4b888838c,
         I85b46269dbe7909e52873ace3f720f6292a4516c

Change-Id: I33a7ba11eb7c2d9a5dc74d10fb0cf04bf664477b
2017-08-09 15:30:14 +02:00
Neels Hofmeyr 54e6e1fc30 rua_to_scu(): add debug log for calling/called addr
This might help in resolving whether we are conforming to SCCP specs regarding
our calling/called address choices.

Change-Id: Ie91953f7e9033419257d556d3a9f14e125f5c60d
2017-07-05 13:04:16 +02:00
Neels Hofmeyr c3614318af rua_to_scu(), rua_rx_init_connect(): add debug logging
In rua_to_scu(), log domain indicator and remote address.

In rua_rx_init_connect(), add domain indicator to log.

Change-Id: Ibe510bf0aca5eadbc0ce6031d3026e770de6559f
2017-07-05 13:04:16 +02:00
Neels Hofmeyr 0f88c11009 migrate osmo-hnbgw to libosmo-sigtran's SCCP/M3UA
libosmo-sigtran now has a "proper" SCCP/M3UA stack, so we can make our hnb-gw
3GPP compliant by switching from the old SUA code to the new universal SCCP
user API with support for (currently) M3UA and SUA.

Main changes:

Use one cn_link to STP: We will connect to the core network using an (Osmo)STP
instance that routes to MSC and SGSN, so we want one SCCP link instead of two.
The only difference between IuCS and IuPS is a different remote osmo_sccp_addr.

This has various effects through the messaging code; the patch is a bit larger
than I would like, but it is hard to separate out truly independent smaller
changes.

CS or PS domain was previously flagged in the separate cn_link, as ctx pointer
for two separate sccp_sap_up()s. Now there's just one such ctx, so determine
is_ps from the RANAP Domain Indicator, or from the conn's hnbgw_context_map:

- Add is_ps to context_map_alloc_by_hnb().
- To find a matching context, the RUA ID alone is no longer sufficient, also
  match is_ps (possible optimization todo: separate lists).

We would send separate CS or PS Reset messages based on the cn_link, instead
send both CS and PS Reset at the same time for the single cn_link. This could
be adjusted to detect presence of MSC or SGSN instead.

Pending: adjust the VTY config to reflect that there is only one remote
address. Place a TODO comment for that.

Smaller changes:

rua_to_scu(): populate called and calling addresses for N_CONNECT and
N_UNITDATA.

Remove DSUA.

Don't build dummy_cn, which is still implemented on SUA. Mark todo to maybe
re-include it based on M3UA later.

In hnbgw_cnlink, place sccp related items in a separate sub-struct.

Do not keep an llist of cn_links, just have the one. Remove iteration and list
management.

Change jenkins script to build libosmo-sccp master.

Patch-by: hwelte, nhofmeyr
Change-Id: I8ac15fa2fd25bedb26297177e416976a5389b573
2017-07-05 13:04:15 +02:00
Neels Hofmeyr 12ed975996 cosmetic: move callers' common switch() into rua_to_scu()
Change-Id: If6274e3738dc04646d0dc18332c12237e6910d18
2017-07-05 13:03:47 +02: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
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 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
Daniel Willmann 11e912aa6e Free ies struct after use in tests and hnbgw_cn/rua 2016-01-07 13:19:30 +01:00
Daniel Willmann 6480cadd8e hnbgw: Use libosmo-netif for SCCP connection handling 2016-01-07 11:01:12 +01:00
Harald Welte 4928797807 more verbose logging in various places 2015-12-29 19:00:35 +01:00
Harald Welte 5bea800fa7 More verbose logging (CS/PS domain) 2015-12-26 23:40:31 +01:00
Harald Welte 831e1ee8f4 hnbgw_rua.c: Print RUA cause in error indication 2015-12-25 10:28:55 +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 37166a27ca improve logging, remove obsolete FIXMEs, return of non-void functions 2015-12-24 10:12:09 +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 f42317ba9c Introduce DRANAP/DRUA log categories to separate logging 2015-12-23 15:37:17 +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 77847ad020 add copyright statement and AGPLv3 headers to source code files 2015-10-06 22:07:04 +02:00
Harald Welte 0f0ea8112f RUA: hand off RANAP from all PDU types, not just UnitDataTransfer
Also, we now offer a ranap_tx_dt() message for connection-oriented
RANAP transfers.  A far as I understand the RUA spec, on RUA layer,
all operations are Class 2, i.e. without any response/confirmation.
2015-09-11 18:58:28 +02:00
Harald Welte e2e5d4dd53 Back RUA/RANAP integration until RANAP Reset works for cs+ps
The hNodeB is now actively transmitting and we are getting up to the
HNBAP UE-REGISTER.req with the IMSI of the MS.
2015-09-10 23:49:45 +02:00
Harald Welte 350814a5cb first dispatch of RUA into RANAP
This is becoming more and more of a hack, as asn1c + asn1tostruct.py
don't really deal well with the RANAP syntax :(
2015-09-10 22:32:15 +02:00
Harald Welte 64b4ebe57c rua: dispatch different message types and print context/cause 2015-09-10 19:29:59 +02:00
Harald Welte 318e4d5713 actually dispatch RUA messages to RUA handling code 2015-09-10 18:47:08 +02:00