Commit Graph

38 Commits

Author SHA1 Message Date
Pau Espin 6334953f1c hnbgw_cn.c: Use proper type struct
Change-Id: Icc8b90866a8edce9d10c87f4ced7137edf1c46f0
2021-10-26 14:15:49 +02:00
Neels Hofmeyr e22027ae2a osmo-hnbgw: reply with RESET ACK when receiving a RESET
Rationale: current osmo-msc refactoring introduces RESET handling on IuCS.

In particular, it makes osmo-hnbgw be able to operate with an (upcoming)
osmo-msc that has strict RESET handling: it will send a RESET and require a
RESET ACK if it sees a new IuCS peer sending messages without prior RESET.

Even though a workaround to ignore missing RESET messages on IuCS will also be
in place in the new osmo-msc, this is a first small step towards more sane
RESET handling in osmo-hnbgw.

Related: OS#3820
Change-Id: I02bc74ef9fef61f4490b4d4dc3ce6c0a6d965909
2019-03-08 05:10:48 +01:00
Neels Hofmeyr 39d7b5c646 osmo-hnbgw: logging tweaks
Log about:
- sending RESET messages to CN;
- accepting a new hNodeB peer on HNBAP.

Change-Id: I317831dbc6c463e4d4dcde9e6716431e026c4398
2019-03-08 05:10:48 +01:00
Neels Hofmeyr e3644ac476 hnbgw_cn: rx ranap: set rc in all cases
There don't seem to be any evaluations of the rc, nevertheless return
well-defined values.

Fixes: CID#181968
Change-Id: I59295388564e5d270da32db6e7488755231f8a11
2018-01-15 23:28:08 +01:00
Neels Hofmeyr b593969dd7 cosmetic: osmo-hnbgw: log remote SCCP addresses on startup
Change-Id: I6395dcde35359617cae52ff59d4eb53930097c7d
2017-11-24 04:35:41 +01:00
Neels Hofmeyr 2af648f443 osmo-hnbgw: auto-config local and remote PCs if omitted
The current default point-code for OsmoMSC is 0.23.1 and for OsmoSGSN 0.23.4.
See https://osmocom.org/projects/cellular-infrastructure/wiki/Point_Codes.

Before this patch, osmo-hnbgw requires a cs7 config and explicit point-codes
for MSC and SGSN as well as a local one. Provide default config if none is
provided:

Use above default point-codes if no MSC and/or SGSN address are provided. Also
create a default cs7 instance with local PC 0.23.5.

This allows completely omitting cs7 instance and SCCP addresses from
osmo-hnbgw.cfg in a single-box setup.

Change-Id: I056547f26858d3ad52e66a15f7a4273dcc300e97
2017-11-24 04:35:05 +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
Harald Welte ffc2093858 sccp_sap_up(): Fix never-hit "default" case in switch
As the default was called "defualt", it became a standard C label
and was never actually performing any default catch-all behavior.

As we didn't use -Wall, gcc never warned us about it so far :/

Change-Id: I9dbad21e75a55ad91b12d3d3ee8bd6dfb5326c3e
2017-11-21 08:25:52 +01:00
Neels Hofmeyr 8e1c07308c osmo-hnbgw: drop erratic log line on remote STP address
The stp_host is just the *default* that may be overridden by the VTY
configuration. Don't log it as the one that is going to be used.

It's not trivial to print the actual IP address being used, there may be any
number of ASP, theoretically. Hence leave logging up to
osmo_sccp_simple_client_on_ss7_id(), after another hypothetical patch.

Change-Id: Ia438143606913faccc8cdf4fd5f7d376f93e7891
2017-11-20 17:00:20 +01:00
Alexander Couzens e03d8a0c97 hnbgw_cn.c: use new signature of osmo_sccp_addr_name(osmo_ss7_instance *ss7, osmo_sccp_addr *addr)
libosmo-sccp introduce the new signature in
564ff618004b ("sccp: make osmo_sccp_addr_name() available")

Change-Id: I5c9abba321ec182d293c33bcffea3462f8717045
2017-08-15 19:33:54 +02: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 a3bcd6d1e7 cn unitdata: verify correct remote addr
When receiving unitdata from the CN, verify that it is indeed coming from the
remote address that matches our CS/PS domain settings.

This patch came from an earlier stage where the is_ps out-parameter was
actually used. While it currently isn't, it doesn't hurt to leave it there.

Change-Id: I7190b4c3a05e8bac0eeffa1eab18c9e47429cb17
2017-07-27 15:49:25 +00:00
Neels Hofmeyr cb24631650 sccp_sap_up(): guard against NULL pointers
Change-Id: Icd64b92b00461cace5c476c8bcf69eec3fdbbdd3
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
Pau Espin 46fea15afc hnbgw: Fix crash if cnlink fails to connect
Return NULL in the error code path, otherwise an uninitialized pointer
is returned and later accessed when a UE tries to register using the
cnlink.

Change-Id: I4f3e2e0680de3216e2e569958bd64f70dc30c2a3
2017-04-06 18:53:20 +02: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 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 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 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 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 37017f5df8 hnbgw_cn.c: add #include for inet_ntoa() 2016-04-15 22:47:42 +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 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
Daniel Willmann 4deab942cc hnbgw: Mark ps_cnlink as ps 2016-01-14 15:35:11 +01:00
Daniel Willmann 11e912aa6e Free ies struct after use in tests and hnbgw_cn/rua 2016-01-07 13:19:30 +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 552fdf144a Start to use SUA local referencs from 1000 upwards
... which allows us to detect sequence 0 as something that's wrong
(i.e. uninitalized)
2015-12-26 23:39:30 +01:00
Harald Welte 2ebe42fed7 properly resolve the cnlink from SUA signalling link 2015-12-26 23:38:38 +01:00
Harald Welte 8c572fee2a use libosmocore SCCP_SSN_RANAP definition 2015-12-26 08:42:07 +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