Commit Graph

30 Commits

Author SHA1 Message Date
Neels Hofmeyr 18db4ad72d vty: fix doc for 'xua rkm routing-key-allocation'
A doc element is missing, which fails the VTY tests in osmo-msc at Change-Id
I5ae4e05ee7c57cad341ea5e86af37c1f6b0ffa77.

Change-Id: I16aa74244ed5332bdc1fddd538e17b86f62ec3b2
2017-08-22 14:45:50 +02:00
Philipp Maier 52d1ee9617 vty: fix (null) string in vty config
The asp->cfg.remote.host is allowed to be NULL in cases where the
localhost is used.

Check if asp->cfg.remote.host is NULL when writing the config file
and omit it when it is set to NULL.

Change-Id: I18f79cc4d4f1db8f2858e8e95098c5821d50594f
2017-08-15 10:45:34 +02:00
Philipp Maier 50a40f9218 vty: hide SG commands when running as ASP
The SG (signal gateway) requires an extra set of VTY commands in
order to be fully configurable. These VTY commands do not make
sense in a situation where libosmo-sccp is used to implement an
ASP (application server process).

Detect in which role libosmo-sccp is used by which of the VTY
initalization functions are called:

osmo_ss7_vty_init_asp() ==> ASP
osmo_ss7_vty_init_sg() ==> SG

Prevent writing back of SG specific configuration when in
running as ASP. Only write back the full parameter set when
running as SG.

Change-Id: I707bcd790f4c6d0f618e41163b51d2179ea3aeaf
2017-08-09 19:01:27 +02:00
Neels Hofmeyr e634a6f325 sccp-addr vty: set RI to SSN_PC when setting a point-code
Change-Id: I75c67d289693f1c2a049ac61cf2b2097d6e5687d
2017-08-09 13:54:44 +02:00
Neels Hofmeyr c881c49127 introduce OSMO_SCCP_RI_NONE to indicate unset RI
Allows to automatically set an RI in future change
I75c67d289693f1c2a049ac61cf2b2097d6e5687d
"sccp-addr vty: set RI to SSN_PC when setting a point-code"

Change-Id: I6e2f31b023b08cba2f2ee8234e6108efcaca41c0
2017-08-09 13:54:44 +02:00
Neels Hofmeyr b352ca030d ensure valid primary_pc in osmo_ss7_instance
Initialize osmo_ss7_instance.cfg.primary_pc = OSMO_SS7_PC_INVALID.
Adjust all code paths using primary_pc to ensure it is indeed valid.

Rationale:

It looks like we are going to use the primary point-code of an SS7 instance to
derive a local SCCP address, e.g. for osmo-bsc and osmo-hnbgw.

 cs7-instance 1
  point-code 1.2.3   ! sets osmo_ss7_instance.primary_pc = 1.2.3
  sccp-address msc
   point-code 0.0.1
   routing-indicator PC

 hnb
  iucs
   remote-addr msc   ! derives cs7 instance 1 and local pc 1.2.3

If 'point-code 1.2.3' is omitted, this becomes '0.0.0' without the user
noticing, and this happens for each client that omits it. I would like to barf
when no local PC is set.

Change-Id: I7f0f0c89b7335d9da24161bfac8234be214ca00c
2017-08-09 13:54:44 +02:00
Neels Hofmeyr 41b6803fd5 osmo_ss7_vty_init: ensure a talloc ctx is set by user
Drop the separate osmo_ss7_set_vty_alloc_ctx() because we are likely to forget
calling it. Instead, incorporate into osmo_ss7_vty_init_*() with a new ctx arg,
and set the static context var in vty_init_shared().

Change-Id: Id4e7f47979001f7856b0b3665c9e94982e75e490
2017-08-07 16:04:39 +02:00
Philipp Maier b06c887cf0 sccp: ensure addressbook entry names are unique
It is possible to add two (or more) different
sccp-addresses under the same name, when the
addresses are defined in different cs7 instances.

Add a check to make sure an address name is not
used multiple times

Change-Id: I63227cd87bc24f7d9ac995430b869f0393818335
2017-07-26 15:14:49 +00:00
Philipp Maier 9fc351de69 sccp: global addressbook search + api fix
The sccp-addressbook only allows defining addresses for a specific
ss7 instance. It is not possible to use an sscp-address, that is
defined in the one ss7 instance in another ss7 instance.

Add a second global list where all sscp-addresses are added,
regardless on which instance they are defined.

Fixup the search functions so that they always search the global
list.

Change the API, so that the address data is written to a
destination pointer. This protects the stored address from
unintentional changes. Also return the ss7 instance, where the
address is associated with.

Change-Id: I5acc1e5abc3b3081149a9f476038e4e53d23b763
2017-07-20 12:38:37 +02:00
Philipp Maier 2b74a5fdc0 cosmetic: remove comment
The vty command string already says it all, remove the comment entirely.

Change-Id: I8ecad584a1bc9b97693b199abd1ec2e5f6ce156d
2017-07-20 10:40:31 +02:00
Philipp Maier 6823dd9f44 vty: make addressbook available for _sg and _asp
The installation of the vty commands for the sccp addressbook is
currently located in osmo_ss7_vty_init_sg(), which is normally
only used in signalling gateway applications. An ASP would lack
the addressbook functionality.

Make SCCP addressbook available for both SG and ASP

Change-Id: Ib49ab623055e9ada7f95e0163ba7e33c5f6f99cb
2017-07-19 12:08:18 +00:00
Philipp Maier 4f30f785c8 vty: Check returncode of osmo_ss7_pointcode_parse()
The result of osmo_ss7_pointcode_parse() is currently not
checked. This means that -EINVAL could end up as value
in the pointcode configuration.

Check the return code of osmo_ss7_pointcode_parse() and
exit the VTY command with CMD_WARNING if the returned
pointcode is < 0

Change-Id: Iae6d92b1d135063dfd0a26bc23a89802cb3b1a78
2017-07-07 10:11:35 +02:00
Philipp Maier 34cb3c16a5 sccp: add addressbook functionality for sccp addresses
SCCP addresses are defined through a number of compoinents, not
just an IP-Address, there is also point code, ssn and more. To
simplify and unify the handling of such objects, this patch
introduces an addressbook functionality. The user can set up
multiple addresses per ss7 instance and give them names. Later
that name can be used to reference the address at a later point
in the config. This means that the usage of sccp-addresses from
the programmers point of view boils down to a VTY function that
reads the string name of a previously defined address. The
programmer can then use the API to get a pointer to the SCCP
address struct and use it normally.

For this feature, two additional VTY nodes are necessary,
this commit depends libosmocore change:
Change-Id I42aa29c0cccc97f284b85801c5329b015b189640

Change-Id: I068ed7f7d113dab88424a9d47bab7fc703bb7942
2017-06-21 18:02:05 +02:00
Philipp Maier b781b371fc cosmetic: fix typo in osmo_ss7_vty.c VTY doc
Change-Id: I931ccf6f765d4fe916ea94bde704314561e4537c
2017-06-18 02:03:25 +00:00
Harald Welte 57d0449d4e IPA: Override/Set point codes
As an IPA SCCPlite message arrives without any MTP routing label, we
simply construct one artificially for all inbound IPA/SCCPlite packets:

* we set the SPC to the point-code of the routing key of the AS
  (as this is the PC we route to this IPA/SCCPlite client anyway)
* we set the DPC to a point-code from a new vty config command
  "point-code override dpc"

Change-Id: Id556398e1ded3e613cfde7ea8b71aff7a414ff90
2017-04-18 10:08:25 +00:00
Harald Welte 5f0a8df34c Add IPA/SCCPlite support as SIGTRAN alternative
This tries as good as possible to fit the IPA/SCCPlite stacking into the
existing SIGTRAN/SS7 code architecture/model.  To the user, the IPA
protocol looks like yet another protocol on the same level as the choice
between SUA and M3AU.  On the inside, things are obviously quite
different.

We need to handle TCP with IPA framing instead of SCTP for both server
and client.  We also implement an alternative "ASP FSM" for IPA, which
takes care of the CCM handshake (ID_REQ/ID_RESP/ID_ACK/ID_ACK2) for both
client and server mode.

In server mode, we use the 'unit name' as identifier to look up the AS,
similar to how we use a routing context to look up the AS in the xUA
case.

We also have to bypass activating the default layer manager in the
simple client to make sure we don't run into even more complexity.

What's missing right now is some way to manually override/set the point
codes.  As IPA/SCCPlite is missing any routing label, we currently
simply generate one with SPC=0/DPC=0, which will obviously not work in
most configurations.

Change-Id: I9098574cddeba10fcf8f1b6c196a7069a6805c56
2017-04-18 10:08:25 +00:00
Harald Welte 05ad104c58 get rid of global osmo_ss7_xua_servers variable
By moving this variable into the SS7 instance, we avoid one more global
variable, and we also fix a bug where the xua servers would be saved
multiple times (once per instance).

Change-Id: Icbab59d773f23cc8514cbeb6e21e25ca35dd337f
2017-04-14 22:48:46 +02:00
Harald Welte d282c4cc47 osmo_ss7_vty: Print AS and ASP state names during 'show'
Change-Id: I6a06d93d6e6c0386676742d6d19f5483a46d7fba
2017-04-14 21:51:04 +02:00
Harald Welte 47c2a97c6d ss7_vty: don't re-define xUA dialect strings
If we add more xUA variants/protocols, we want to avoid having to touch
too many parts of the code with copy+pasted strings.

Change-Id: I085b884d98fb4c45ac15910a8ebf82b91e861fd4
2017-04-14 20:40:00 +02:00
Harald Welte c031536808 SCCP: Add VTY interface for SCCP
Change-Id: I100daaa947dbab6a4528c4e9fbd0d30790288f63
2017-04-14 20:25:50 +02:00
Harald Welte f06c7f559a osmo_ss7_vty: Don't save dynamically generated AS / ASP
If RKM has dynamically generated some AS definitions on the fly, or if
we accepted auto-creation of ASPs on SCTP connect time, then we don't
wnat to save such objects during vty config file store.

Change-Id: I9d0b0b61737a30b9d6e76cecbe42ec071bcddeeb
2017-04-14 20:25:50 +02:00
Harald Welte fa049a4914 osmo_ss7_vty: Fix config file writing for xUA listeners
We so far generated un-parseable config files..

Change-Id: Iff6940ef6f52739b6f30a152487038cb0220da43
2017-04-14 17:11:21 +02:00
Harald Welte e7589d107c osmo_ss7_vty: Introduce xUA listener accept-asp-connections command
Using this command one can specify if ASP connections should be refused
if there's no matching configuration, or whether ASPs should simply be
create on-demand.

Change-Id: Ic93b99047fb566cdb25a2f4139ebef54849dece9
2017-04-14 17:11:21 +02:00
Harald Welte 993da0b4c2 osmo_ss7_vty: Add 'description' command for SS7 instances
This allows the user to add some description to each SS7 instance

Change-Id: Ia5d22f2f70ec12dd13151f949bb45b5fdab42fc5
2017-04-14 17:11:21 +02:00
Harald Welte 246266c939 osmo_ss7_vty: Add Command to permit (or disallow) dynamc routing key allocation
This feature has been introduced in
8dec5a8ec5, but so far hasn't been exposed
to the VTY yet.

Change-Id: I7355522bacbad1072feb5484b865dfd1be50a64d
2017-04-14 17:11:21 +02:00
Harald Welte f9aa940105 osmo_ss7_vty: Add 'show cs7 instance <0-15> users' command
This will list which Service Indicators have bound local users (like SCCP)

Change-Id: Ibb21810e2ebe520e07cfdda3a0c62172b152015e
2017-04-14 17:11:21 +02:00
Harald Welte 74915be10b osmo_ss7_vty: Make 'instance <0-15>' mandatory of all show commands
This way it is systematic and doesn't clash with other optional
arguments we may introduce sooner or later at the end of the commands

Change-Id: I5c1050b0564791b5684619d3737d1cb6c4539d63
2017-04-14 15:00:22 +02:00
Harald Welte 8b282e954a move osmo_ss7_vty.c [back] into libosmo-sigtran
Now that the VTY has no static dependencies like a global ss7_instance
anymore, we can move it back to libosmo-sigtran and make use of it in
other programs outside osmo-stp.

This requires Change-Id I184a7e3187b48c15c71bf773f86e188fe1daad15 in
libosmocore

Change-Id: I2e549f1eadbfb28dde79f620b130cbf022312c42
2017-04-14 14:53:59 +02:00
Harald Welte 9654e65feb Add osmo-stp executable as new "Osmocom Signaling Transfer Point"
osmo-stp is able to define multiple M3UA and/or SUA application servers
(AS) as well as application server processes (ASPs).  Clients can then
connect via M3UA or SUA, perform the respective ASPSM / ASPTM state
changes and finally exchange MTP signaling such as ISUP or SCCP on top
of it.  Routing is currently only based on point codes (PC).  Routing table
is fully configurable with Destination PC and mask.

Shortcomings:
* xUA: only "override" traffic mode supported, no load-balance or broadcast
* xUA: no SNM supported, i.e. DAVA/DUNA/... messages are neither parsed
  nor generated
* SCCP: no Global Title based Routing (GTR) yet
* SCCP: no Global Title Translation (GTT) yet
* no M2PA / M2UA sigtran dialects
* no classic CS7 based signaling links(E1/T1 TDM)

Change-Id: If32227b8d3127c6178e4ee45527ce65f69bc7b1e
2017-04-13 18:05:01 +02:00
Harald Welte 2d3a709527 Add new 'osmo_ss7' SS7 core code with M3UA, ASP/AS FSM, ...
This is what aims to be a rather complete/proper implementation of the
SIGTRAN + SS7 protocol suite.  It has proper abstraction between the
layers with primitives, finite state machines for things like the AS and
ASP state machines, support for point code routing, etc.

What's not implemented at this point:
* re-integration of pre-existing SUA (pending)
* actual MTP2 and physical E1/T1 link support
* different trafic modes like broadcast/fail-over/load-balance

Change-Id: I375eb80f01acc013094851d91d1d3333ebc12bc7
2017-04-10 10:41:16 +02:00