osmo_sccp_addr_dump() just prints the raw values. In osmo_sccp_addr_name(), use
osmo_ss7_pointcode_print() and newly added RI, SSN and GT value_string[] to
print more human readable log output.
Change-Id: Ie1aedd7894acd69ddc887cd65a8a0df4b888838c
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
A previous patch added ss7_instance primary_pc validity checks by means of
OSMO_SS7_PC_INVALID. To be consistent, also adjust sccp_user accordingly.
(see I7f0f0c89b7335d9da24161bfac8234be214ca00c)
Remove the osmo_sccp_user's pc_valid field, replaced by pc=OSMO_SS7_PC_INVALID.
Adjust all code paths.
Simplify some log printing, using the fact that osmo_ss7_pointcode_print() now
outputs "(no PC)" for unset point codes.
Change-Id: I8684c9b559712072c772012890bbf7efa7c8eb35
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
Introduce OSMO_SS7_PC_INVALID to mark an unset point code.
Add static osmo_ss7_pc_is_valid() (name matches schema of
osmo_ss7_pc_is_local()).
In osmo_ss7_pointcode_print(), return "(no PC)" if !osmo_ss7_pc_is_valid(), for
convenient printing of any PC state.
Subsequent patches will use this for
osmo_ss7_instance (I7f0f0c89b7335d9da24161bfac8234be214ca00c)
as well as osmo_sccp_user (I8684c9b559712072c772012890bbf7efa7c8eb35).
Rationale:
Currently, in osmo_ss7_vty.c we had "if (inst->cfg.primary_pc)" suggesting 0 is
invalid, but in struct osmo_sccp_user we have flag pc_valid suggesting 0 is
indeed valid. All known point code formats are <= 24bit, so we can easily use
0xffffffff as indicator for an unset PC, which removes the need to remember to
set a second field for validity and keeps the structs nice and lean.
Change-Id: Ib5715bf03a4de7713a7a809dfd821c700255ba8c
In order to catch invalid CS7 configurations, It is necessary
to check if sccp addresses contain plausible address data.
Change-Id: Ic6245288b0171eae10aa708403c1ddb584c92f38
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
The most important parts of an SCCP address are the routing
indicator and the pointcode. The latter one is always available
via the SS7 instance, so a basic local address can be derived
from there.
Add function osmo_sccp_local_addr_by_instance() to derive a basic
local SCCP address from a given SCCP instance
Change-Id: I371dc9132871aad3d8321ea13cf9fd69d76eff8f
check input parameters local_ip and remote_ip of the function
osmo_sccp_simple_client_on_ss7_id() before using them with
talloc_strdup()
Change-Id: I1a5dd1ea3167513bf9e7ae153f83e1ae3136c905
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
The function seems osmo_ss7_asp_use_default_lm() does not guard
against an asp->lm_priv FSM instance already existing. If this
function is called a second time, it will overwrite asp->lm_priv,
causing the original fsm instance to leaked.
Check if asp->lm_priv already exists and terminate (free) the
FSM if present.
Change-Id: I4ad435c042a435c4e641c6e5c53b91265dd23d40
The osmo_sccp_simple_client_on_ss7_id and osmo_sccp_simple_client
are not entirely configurable via VTY commands. The relation to
the VTY is implicit. The user may set up instance objects via
VTY (cs7/ss7, AS, ASP), which are then automatically created on
startup.
Each cs7 instance gets its own ID via the VTY configuration. When
osmo_sccp_simple_client_on_ss7_id() is called with the cs7 instance
id. (for osmo_sccp_simple_client() the ID will be hardcoded to 1),
the function automatically checks if the CS7 instance is present,
if not it will create one automatically using the caller supplied
parameters as a defult. If a CS7 instance is present, the function
checks for the presence of an AS and an ASP. These objects are
present, they will be used. If not, new objects will be created.
Both functions must not be called if an SCCP instance is already
present. Since there can only be one SCCP instance per CS7 instance,
this is an error condition.
Add additional logic that checks to detect an already existing, valid
configuration. If no or an insufficient configuration is detected,
use the caller supplied parameters as default configuration.
Change-Id: I293f3526ce6182dca74a169a23449dbc7af57c7c
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
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
Following warning was being printed:
warning: statement will never be executed [-Wswitch-unreachable]
The code in there seems not to be finished, so better leave the code and a
pragma message to get notified when we compile.
Change-Id: I4e2c482803954c984cb6792b11b4ea0fe674e269
Issue first found in libosmocore. It seems the BSD build doesn't use
bash which means using += to append to a variable doesn't work
correctly.
Change-Id: I33f6b9de4990de0c4d3a6fc0bd7df632094e79ac
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
osmo_sccp_simple_client() and osmo_sccp_simple_server() are binding
on the ss7 instance with the id 1 by default. If the instance does
not exist, it is created automatically.
Allow choosing the ss7 instance by supplying the id number as
function parameter. Add two new functions:
osmo_sccp_simple_client_on_ss7_id()
osmo_sccp_simple_server_on_ss7_id()
Change-Id: I62e608253212415bddbb4c7dcf5d3b5e79c8d28e
This reverts commit 5527df78ad.
I tried some time to figure out what other changes are needed to make this
commit work and fix a confusion, until I noticed:
The commit's *log message* is correct that SRC == calling, but the *patch*
modifies callED addr to be the SRC, which is wrong. So reverting this commit is
indeed the correct way to fix our addresses.
Change-Id: Ic76aacc81f87f8885fe04121aead5c79a761ef07
Add function osmo_ss7_point_code_print2() to be able to print two point codes
in the same log message.
Change signatures of two static functions to aid logging:
add invalid ref arg to sccp_scoc_rx_inval_src_ref(),
pass conn instead of inst to sccp_scoc_rx_inval_opc().
Change-Id: Ia3243606d6cad7721f7da7f6caba2caa90ae2bbd
The sanitize build fails because gt_out is not initialized to zero, but is
later mem-compared to a zero-initialized struct.
Zero-initialize gt_out.
Also print in the test output both byte dumps. It helped to figure out the test
failure and might as well stay.
Change-Id: Ice8ee9c2a6bde4924f3ae6d95aa9268ebef9f070
In osmo_ss7_route_create() as is only initalized if lset can not
be initalized. If lset can be initalized, as will not be used so
everything is fine. However, the compiler complains that as may
not be initalized. Initalizing as to NULL solves the problem.
Change-Id: Ibcb3ebf9aaa7717cb553242517abce1499bc9c2a
As discussed in chat, -Werror should not be enabled by default.
Instead it should be added in our jenkins build scripts.
This reverts commit fc252ca384.
Change-Id: I92955c2f74f9a5c40e80028459100cf5e79a537b
stp_main uses osmo_fsm_vty_add_cmds which is defined in /osmocom/vty/misc.h
Fixes 'implicit declaration of function' compilation warning.
Change-Id: I3cc9543fcb908eeb172d36fa472a19b01bf52c46
Instead of removing the variable, leave it there with unused attribute
set because it is an example and gives extra information to potential
readers of the function (it provides you with the actual type of void* _scu).
Change-Id: Id5fddf261a7a75ee1d6e9aff0734065ebf8551ab
translate function is always present in the same file, thus we can
remove this check.
Fixes following warning:
warning: the address of ‘translate’ will always evaluate as ‘true’ [-Waddress]
if (translate &&
As requested by Harald, leave a comment there stating that there are some
checks missing and yet to be implemented. The translate function check
was used for this purpose.
Change-Id: I48a711f3a43496e2c0c637f34f56784f765938c4
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
You will need to have
* GNU/Linux with support for [network] namespaces
* the 'unshare' command line tool
* m3ua-testtool and sua-testtool repositories
from git.osmocom.org/nplab installed adjacent to libosmo-sccp
* their requirements, i.e.
** guile
** guile-sctp from https://github.com/nplab/guile-sctp
When those are installed, you can do things like
(cd contrib/test && ./run-in-ns.sh test-m3ua.sh)
(cd contrib/test && ./run-in-ns.sh test-sua.sh)
to execute the test suite.
Change-Id: Ic36eafbb9868b2ec9ae2173f8d1b651b976ccf88
SUA uses different semantics (source / destination) address, while SCCP
uses Calling/CalledParty. This leads to some confusion. At least in the
CR/CORE and CREF/COREF case, the CallingParty equals the SRC_ADDR.
Change-Id: I1c641aac7b53c6de7c4e369aaf3004523bd85936
SUA uses different semantics (source / destination) address, while SCCP
uses Calling/CalledParty. This leads to some confusion. At least in the
CR/CORE case, the CallingParty equals the SRC_ADDR.
Change-Id: I5a3c27b112148dd539f092cce7618b4f62fde73c
"(cur[1] << 8) & 0x3f" is always 0 regardless of the values of its
operands.
Change-Id: Ie47e632f4bca490baf4282dc5d55ee55ca7f1ae8
Fixes: coverity CID#166932
The 'user' argument to osmo_ss7_user_unregister() can be NULL, so let's
make sure we don't dereference it.
Change-Id: Ia34b181dcbcb179b2639e2f405364cc952069842
Fixes: coverity CID#166933