Commit Graph

188 Commits

Author SHA1 Message Date
Harald Welte 40c4461c3a osmo_ss7: Truncate route 'mask' to point code bit length
Otherwise we run into the problem that a route with mask 0xffffff
differs from one with a mask of 0x3fff despite having only 14 bit
point code length and them being logically equal.

Change-Id: I5d5c828de45724d93a0461bb0dd7858fd8378acd
Related: SYS#5422
2021-04-29 20:07:34 +02:00
Harald Welte 7eedb6b03c Add osmo_ss7_pointcode_print_buf() to API
Like osmo_ss7_pointcode_print(), but prints into an user-supplied
buffer.

Change-Id: I5fc7d7746eb90a9d404b6b50bf9ded6789a1c33c
2021-02-23 17:20:08 +01:00
Harald Welte afbcc5d532 xua_snm: Implement handling of DUPU messages
A DUPU message in SUA and M3UA indicates the unavailability of
a (MTP-level) user, i.e. the entire SCCP, ISUP, ... is not available.

If we receive a DUPU (destination user part unavailable) message in ASP
role, then we must
 * distribute it to any other ASPs for which we operate in SG mode
 * pass it as MTP-STATUS.ind to SCCP, which can then generates
   N-PCSTATE.ind to the SCCP User

Change-Id: I1559ed0f761a8495b222df48c6bd43798e220471
2021-02-10 19:58:38 +01:00
Harald Welte bf85d6f433 xua: introduce xua_msg_get_u32p() helper
Change-Id: Id7780074b82bc668ae148456750b1a01799decd1
2021-02-08 18:11:12 +01:00
Harald Welte d2dc5ed987 sccp: Add minimalistic SCMG implementation
SCMG (SCCP Management) is a special sub-system that normally resides
at SSN=1.  In Osmocom we so far ignored its existence.  However,
in terms of interop with other implementation, we should implement
at least some basic features.

The only procedure implemented in this initial commit is the response
to an incoming SST (Subsystem Test) message.  If we don't respond to
this message, a remote SCCP entity could assume the SSN is dead on
our side, rendering communication impossible.

Change-Id: I04b162476f7652ef0540b5ea7299e9447efd1d09
2021-02-08 18:11:08 +01:00
Harald Welte 943affdd48 sccp: Notify users of point code available/unavailable
* add N-PCSTATE.ind and N-STATE.ind definitions to SCCP user SAP
* add minimal SCMG (SCCP Management) and LBCS (Local Broadcast)
* generate MTP-PAUSE.ind/MTP-RESUME.ind based on received xUA DUNA/DAVA
* generate N-PCSTATE.ind towards the local SCCP users

Change-Id: Idb799f7d7ab329ad12f07b7cbe6336da0891ae92
Related: OS#2623, OS#3403, OS#4701
2021-02-08 18:00:56 +01:00
Harald Welte bdf5ae5f02 Introduce osmo_ss7_asp_get_log_subsys()
This will allow us to write generic code that uses DLM3UA/DSUA depending
on the ASP protocol.

Change-Id: I7c015b3a2727deff4fc4e6f3bc7bdeeb57e86166
2021-02-08 10:40:46 +00:00
Harald Welte 1153675012 xua_msg: Add xua_msg*_get_str() to obtain string IE
We copy the contents to a static thread-local buffer to ensure
zero termination of the string received by a remote entity.

Change-Id: I8cbb7aeaf0cb64db0ce01c21e5fca9ab3cd932b6
2021-02-08 10:40:46 +00:00
Harald Welte 3bd913398a osmo_ss7: const-ify input arguments to osmo_ss7_as_has_asp()
Change-Id: Id23d90ffea855680cd7d4a16b89e652eed0cf39f
2021-02-07 12:43:47 +01:00
Harald Welte 30c2edb099 xua_msg: const-ify input arguments to xua_*_get_u32()
Change-Id: I517943bd11d73195de9418fb1c5d4151dab77873
2021-02-07 12:43:47 +01:00
Harald Welte c584d87d0c xua_msg_add_data() Mark input argument as 'const'
We only read from it.

Change-Id: I12c17273b9d64a084f59d91fc06ae1512d70855b
2021-02-06 17:45:33 +01:00
Neels Hofmeyr 7a4f614ba9 add osmo_sccp_addr_to_id_c()
Change-Id: Iadd34a167a7712796b2501f6a75b5a8d26a828eb
2020-09-23 21:13:18 +02:00
Neels Hofmeyr 134e463230 add osmo_sccp_addr_to_str_c osmo_sccp_inst_addr_to_str_c
Change-Id: Ia7f9d891ea92abd20855374b936aac8b28ae15df
2020-09-22 22:47:24 +02:00
Neels Hofmeyr b114b73e5d add OSMO_SCCP_ADDR_T_MASK for osmo_sccp_addr_cmp()
Avoid magic number 0xffffffff and rather provide a mask value for all address
components.

Change-Id: I13ff0858e496c4392b8e1590d62f7eb80f191a07
2020-09-05 00:10:01 +02:00
Neels Hofmeyr ec3e7e43ab enum osmo_sccp_ssn: rename to OSMO_SCCP_SSN_SMLC_BSSAP_LE
Quoting 3GPP TS 23.003 8.2:

 1111 1010 BSC (BSSAP-LE);
 1111 1011 MSC (BSSAP-LE);
 1111 1100 SMLC (BSSAP-LE);

Hence the SMLC one should also be named *_BSSAP_LE.

I'm certain no other osmocom code is using this SSN yet, but anyway keep a
backwards compat shim #define.

Change-Id: I3e0c1be0ebbd3883d024174d1e7e9167a8281cfb
2020-09-03 23:56:13 +02:00
Neels Hofmeyr d25ba11eef add osmo_sccp_user_find() as public API
To allow osmo-bsc to add more than one MSC peer on a single SCCP instance, it
must add a local SCCP user only once per SCCP instance. The first configured
MSC adds a local user, all subsequent MSC should use the same local SCCP user.
So, it is most convenient to provide a public function to return such user if
it exists.

Add as thin wrapper instead of renaming and moving the internal
sccp_user_find(): to keep the patch smaller, and to match the way
osmo_sccp_user_bind_pc() is a 1:1 wrapper for sccp_user_bind_pc().

Related: OS#3682
Change-Id: I9ecbab16b45268f626950303d6ff8296dd6acda0
2020-05-22 23:15:55 +02:00
Neels Hofmeyr c5691330d9 cosmetic: apply changes to match struct_endianess.py output
Rationale: the script is a good way to avoid bugs from manually composing the
big endian parts (for example, it detected the missing endian.h include, fixed
in I5906d94e0e0a74674c3a14cf2ec81c681e696474). However, it becomes cumbersome
if it creates numerous edits in the source tree, which cause more time spent
for whoever wanted to rather save time with it. So let's keep the code tree
matching that script's output.

Change-Id: I04ad3795fbaf495cae168aed69124b1dc132a9bd
2020-05-19 22:37:41 +02:00
Pau Espin 253e6fecb6 sccp: Fix wrong param type in osmo_sccp_pnc_name()
Wrong type was used when the function was introduced a few commits ago.

Fixes: 5a7eb34f735e0ae93a74da3bc8361454457e49cdi
Closes: CID#207712
Change-Id: Ie9b89483158dd6b988e4c34b497bf3b231c15cd3
2020-01-18 13:25:30 +01:00
Pau Espin 5a7eb34f73 sccp: Improve logging in sccp_to_xua_opt()
Change-Id: Icb3f18f34ecfe0602c6e491b61107a30287dcafb
2020-01-17 14:41:53 +01:00
Pau Espin d3e28faa35 sccp: Add value_string for SCCP message types
Change-Id: Ibf3ee4be88a4ca633a01fad08d4c714bfa9008bc
2020-01-17 14:38:22 +01:00
Pau Espin 7b56b75f36 ss7: Introduce APIs to manage asp_peer hosts
The code managing addresses is decoupled from xua_server since they will
also be used to manage addresses for ASPs.

Change-Id: I4af2a6915ac57c7baa67343bd9414c65154d67f7
2020-01-13 12:41:51 +01:00
Harald Welte 58de416ff0 osmo_ss7: Add osmo_ss7_asp_find()
This is like osmo_ss7_asp_find_and_create(), i.e. it's doing a full
match for an ASP within the specified SS7 instance, of the specified
port numbers.  It just doesn't create it if it is missing.

Change-Id: I1ed3cf2b69ee622d6f9d8b50487f392fe913ae90
Related: OS#4271
2019-11-19 01:28:05 +01:00
Vadim Yanitskiy c19962e1e1 osmo_ss7_vty.c: implement 'active' filter for show_cs7_as_cmd
Change-Id: I356d90642a500be6a70f60c8240ce1211fd0d934
2019-11-14 22:31:40 +00:00
Pau Espin 6c4fabc826 xua: loadshare: select ASP for tx only if active
Change-Id: I4f1d1aa9395698e5b6b930a5092a4b914dd15fb3
2019-11-06 04:55:37 +00:00
Harald Welte 1a822635f8 Allow ASP role to be configured
So far, we had a static role model:
* SCTP servers (listening, such as OsmoSTP) are role SGW
* SCTP clients (connecting, such as OsmoMSC) are role ASP

While this is customary, it is not actually required by the
specification.  The SGW can establish the SCTP connection to an ASP
but still remain "SG" role.

Let's make things more flexible by having the role configurable.

Related: OS#2005
Change-Id: I2df9cd9747ad5c9a05d567d9a71bab6184c53674
2019-11-05 20:50:51 +00:00
Harald Welte 79fb8a66f3 introduce public enum osmo_ss7_asp_role for ASP/SG/IPSP
This supersedes the library-internal enum xua_asp_role.

Change-Id: I28b0888b8f8206e9dd67ef64ce0f71ba9a7105ce
2019-11-05 20:50:37 +00:00
Harald Welte ebd2fc6046 M3UA: Reject ASP activation + RKM registration for incompatible traffic-mode
If the AS is e.g. configured as broadcast, then individual ASPs cannot
be activated in loadshare or override.  Everyone must agree.

Change-Id: Ic73410fbc88d50710202453f759fa132ce14db4c
2019-11-05 20:50:26 +00:00
Pau Espin 907121b85d xua: Allow traffic mode set by peer if not set by VTY
Change-Id: I8ca17439b4dd023625f8f22689c0432341986099
2019-11-05 20:41:56 +00:00
Pau Espin 2b139a65f0 ss7: Only override traffic mode from recv REG REQ if not set by VTY
RFC 4666 (SS7/MTP3/M3UA) states in isection 4.3.4.3 ASP Active Procedures:
"""
If the traffic handling mode of the Application Server is not already known via
configuration data, then the traffic handling mode indicated in the
first ASP Active message causing the transition of the Application
Server state to AS-ACTIVE MAY be used to set the mode.
"""

In section 3.6.1 Registration Request (REG REQ), no related information
is provided on how to handle it, but still makes sense to apply same
behavior as in 4.3.4.3.

Related: OS#4220
Change-Id: Iaebe3a93ad8d2d84ae01e41b02674f8ece9dfc95
2019-10-24 13:23:09 +02:00
Pau Espin 3eae8ec9ef ss7: Implement AS traffic mode loadshare using round robin ASP selection
Related: OS#4220
Change-Id: I98144dde237672df2e78c7c92923e6f4cb77a271
2019-10-24 13:23:09 +02:00
Pau Espin 80b1355819 ss7: Support multiple addresses in SCTP connections
After this patch, Several "local-ip" and "remote-ip" lines are accepted
under "listen" and "asp" VTY nodes, allowing to configure an SCTP
connection with multiple connections, hence allowing control of SCTP
multi-homing features.
libosmo-sccp clients such as osmo-bsc and osmo-msc also gain support for
this feature with this commit.

Related: OS#3608
Depends: libosmocore.git Ic8681d9e093216c99c6bca4be81c31ef83688ed1
Depends: libosmo-netif.git I0fe62f518e195db4e34f3b0ad1762bb57ba9d92a
Change-Id: Ibd15de7a4e00dbec78ff2e2dd6a686b0f3af22de
2019-10-22 19:38:53 +00:00
Pau Espin 38ae954da5 Defer xua server binding until exit of VTY node
Commit 10d4815bb1 already fixed the issue
where binding was done during L_CS7_XUA_NODE (listen) done, meaning
local-ip inside it had no effect. In that comment, binding was moved to
happen during "local-ip" VTY cmd. Furthermore, that commit added a new
osmo_ss7_bind_all_instances() and related APIs to allow osmo-stp to have
all xua servers bound if no "local-ip" was provided.
These APIs have only been used so far by osmo-stp (which lays in the
same git repo that libosmo-sccp) since it's the only program using the
xua server features.

In the present commit, let's drop the APIs added by commit described
above, and instead let libosmo-sccp code to internally bind the xua
server upon exit of the VTY node. As a result, the previously introduced
APIs can be dropped (not used by anyone anymore) and it will provide
ways to support multiple "local-ip" commands in the future, hence
supporting SCTP multi-home features.

It's recommended to require libosmocore.git Ia6d88c0e63d94ba99e950da6efbc4c1871070012
since it fixes a bug where go_parent_cb was not called for nodes at the
end of the file.

Related: OS#3608
Change-Id: I2cff17b5e2e2fbfd4591e23a416e510e94e173d6
2019-10-22 19:38:53 +00:00
Harald Welte ecb2cf1a31 ipa: VTY config option to explicitly enable/disable SCCP patching
When receiving SCCP messages from an IPA peer/ASP, osmo-stp so far
unconditionally inserted origin/destination point codes int the SCCP
called / calling party addresses.

This behaviro is now made optional with the introduction of the
following per-AS configuration:
	"point-code override patch-sccp (disabled|both)"

The default behavior is switched from 'both' to 'disabled' at the same
time.

Change-Id: I535e2170adadfe755d2bcbf5bbf4556bebb77737
Closes: OS#4219
2019-10-19 22:31:04 +02:00
Harald Welte 1c197af06c Move definition of LOGSS7() to header file; add LOGPAS() like LOGPASP()
Change-Id: Ic85fc460cc1f31d0fb407095afe417ceaa60e7bd
2019-10-19 12:19:15 +02:00
Holger Hans Peter Freyther 1646d9b827 xudt: Implement address and data extraction
The cellmgr-ng unfortunately looks at the data being sent and can't
handle the presence of XUDT at all. Add the structure definition
and refactor extraction code to work on offsets. Add a unit test.

Change-Id: I45a7447cc1be432fff34849e0e35abc0410cf153
2019-05-01 23:52:31 +01:00
Neels Hofmeyr 21ff9ae426 add osmo_sccp_addr_cmp(), osmo_sccp_addr_ri_cmp()
osmo-msc identifies its BSC and RNC peers by SCCP address, and compares those
by memcmp(), which is not really accurate. Rather provide a meaningful
osmo_sccp_addr_cmp() API to determine whether SCCP addresses are identical.

Go for a full cmp that would also allow sorting.

Change-Id: Ie9e2add7bbfae651c04e230d62e37cebeb91b0f5
2019-04-12 06:28:34 +02:00
Neels Hofmeyr ac729eb5a8 add caller-owns-msgb variant osmo_sccp_user_sap_down_nofree()
Add osmo_sccp_user_sap_down_nofree(), which is identical to
osmo_sccp_user_sap_down(), but doesn't imply a msgb_free().

To implement that, sccp_sclc_user_sap_down_nofree() with the same msgb
semantics is required.

Rationale:

Avoiding msgb leaks is easiest if the caller retains ownership of the msgb.
Take this hypothetical chain where leaks are obviously avoided:

  void send()
  {
  	msg = msgb_alloc();
	dispatch(msg);
	msgb_free(msg);
  }

  void dispatch(msg)
  {
  	osmo_fsm_inst_dispatch(fi, msg);
  }

  void fi_on_event(fi, data)
  {
	if (socket_is_ok)
		socket_write((struct msgb*)data);
  }

  void socket_write(msgb)
  {
  	if (!ok1)
		return;
	if (ok2) {
		if (!ok3)
			return;
		write(sock, msg->data);
	}
  }

However, if the caller passes ownership down to the msgb consumer, things
become nightmarishly complex:

  void send()
  {
  	msg = msgb_alloc();
	rc = dispatch(msg);
	/* dispatching event failed? */
	if (rc)
		msgb_free(msg);
  }

  int dispatch(msg)
  {
  	if (osmo_fsm_inst_dispatch(fi, msg))
		return -1;
	if (something_else())
		return -1; // <-- double free!
  }

  void fi_on_event(fi, data)
  {
	if (socket_is_ok) {
		socket_write((struct msgb*)data);
	else
		/* socket didn't consume? */
		msgb_free(data);
  }

  int socket_write(msgb)
  {
  	if (!ok1)
		return -1; // <-- leak!
	if (ok2) {
		if (!ok3)
			goto out;
		write(sock, msg->data);
	}
  out:
        msgb_free(msg);
	return -2;
  }

If any link in this call chain fails to be aware of the importance to return a
failed RC or to free a msgb if the chain is broken, or to not return a failed
RC if the msgb is consumed, we have a hidden msgb leak or double free.

This is the case with osmo_sccp_user_sap_down(). In new osmo-msc, passing data
through various FSM instances, there is high potential for leak/double-free
bugs. A very large brain is required to track down every msgb path.

osmo_sccp_user_sap_down_nofree() makes this problem trivial to solve even for
humans.

Change-Id: Ic818efa78b90f727e1a94c18b60d9a306644f340
2019-04-12 06:27:10 +02:00
Harald Welte 99beede80c Fix output of route destination in 'show ss7 instance <0-15> route'
We were printing the mask of the route, but not the point code itself.

Best would probably be to print both?

Closes: OS#3835
Change-Id: Ifa4fdbad953d40f222beb470a082eed8c20991ef
2019-03-15 17:26:01 +00:00
Max 8d0343872e Make pointcode width function public
That's useful for external programs veryfying pointcode validity. For
example if used as part of BSS-related identity in GCR construction by
LCLS code we should be able to double.check that no significant bits off
pointcode are lost/ignored.

Change-Id: I5a9981dd2c1d78966c61a3f6b50c7c0d9b542caf
2018-11-19 05:50:13 +00:00
Stefan Sperling b59ebe9f22 skip simple-client default as/asp when saving VTY config
When saving the current VTY config to a configuration file,
do not write out AS/ASP configuration items which are generated
as a fallback by osmo_sccp_simple_client_on_ss7_id().

Since the user did not explicitly configure these configuration
items they should not be saved to the user's configuration file.

Change-Id: Id8a3afc6dee29ae1ee9c862cbe404a61fe979dba
Related: OS#3616
2018-10-29 19:25:34 +01:00
Neels Hofmeyr 6a973bab9c build: move include/{mtp,sccp} to include/osmocom/
Anywhere else in the Osmocom code base, we arrange headers in
include/osmocom/foo/ and pass -I ${root_srcdir}/include/.
This way including an osmocom header always has the format
  #include <osmocom/foo/bar.h>
whether we are including from the local source tree or from $prefix.

For some reason not clear to me, the mtp and sccp folders, even though they are
being installed to $prefix/include/osmocom/, were kept *next* to the osmocom/
dir, instead of inside it. Fix that weird situation.

The motivation is that I wanted to use a definition from sccp_types.h in a
public-API header. That is impossible if it requires
  #include <sccp/sccp_types.h>
in a local build, but
  #include <osmocom/sccp/sccp_types.h>
for any other source tree using libosmo-sccp. After this patch, both are
identical and including works without quirks. (The other patch that needed this
has changed in the meantime on and no longer needs this, but this still makes
sense for future hacking.)

The installed result does not change, since both mtp/*.h and sccp/*.h have
always been installed to $prefix/include/osmocom/{mtp,sccp}/. This merely
changes their position in the source tree.

The most curious situation before this is that any patch #including
<osmocom/sccp/sccp_types.h> might not get a notice that the header didn't
exist, but might instead include an older system-installed file.

Change-Id: I1209a4ecf9f692a8030b5c93cd281fc9dd58d105
2018-10-21 12:35:11 +00:00
Neels Hofmeyr 6d867d1d08 cosmetic: allocate ss7->sccp in one common function
Instead of allocating ss7->sccp in various places, unify that in one common
function. We shouldn't spread the decision what to pass as priv pointer around
everywhere.  There is no functional difference.

This is preparation for a patch where the sccp_instance gets allocated from the
telnet VTY: I would prefer to hide all allocation details from that code; which
also makes sense for the other callers of osmo_sccp_instance_create().

Change-Id: Ie912898c66d31ce4ac8eeeea5a6ddc3f821c06f7
2018-09-27 14:44:30 +02:00
Neels Hofmeyr 28c8a4bf2f add osmo_xua_msg_tall_ctx_init()
So far the tall_xua ctx used to allocate from in xua_msg_alloc() was never
initialized, actually hiding memory leaks from the talloc report.
Add this API to allow branching the xua_msg ctx off a sane root ctx.

Explicitly initialize tall_xua to NULL, so that, if xua_msg_ctx_init() isn't
called, tall_xua is still guaranteed to not be a random pointer.

osmo-bsc will use this function to hook the tall_xua ctx to osmo-bsc's own root
ctx.

Change-Id: I618878680a096a7f7fc2d83098590f2e4cb08870
2018-07-12 05:25:56 +02:00
Harald Welte 5d571ce044 Introduce osmo_ss7_register_rx_unknown_cb() for unknown PPID/StreamID
Applications may be interested in handling data for those SCTP PPID or
IPA StreamID which libosmo-sigtran doesn't implement
natively/internally.

Let's add osmo_ss7_register_rx_unknown_cb() using which applications
can register a call-back to implement whatever behaviour they'd want for
those PPID/StreamIDs.

Change-Id: I8616f914192000df0ec6547ff4ada80e0f9042a2
2018-06-08 18:47:44 +00:00
Harald Welte b956b606d8 sccp_types.h: Fix value for SCCP_REFUSAL_UNEQUIPPED_USER
It seems we have been sending the wrong numeric value in SCCP connection
refusal due to an unqeuipped user.  It turns out our list of refusal
causes was missing one entry, causing an off-by-one for this refusal
cause.  While at it, add a comment which section of which spec is
relevant for this enum.

Change-Id: I113645bd6df1ec9ae5137977028df38560fc4789
2018-01-17 19:17:34 +01:00
Neels Hofmeyr 8800b7cf9f add osmo_ss7_route_name()
There is a naming dilemma: though the osmo_ prefix is now reserved for
libosmocore, all surrounding API already has the osmo_ prefix.

This will be used by osmo-hnbgw's VTY 'show cnlink' command.

Change-Id: Ia0d15a2814b08bc3f052a1ed12dbb68bade55309
2017-12-24 20:32:03 +01:00
Neels Hofmeyr e4a77d4673 add osmo_sccp_user_name()
There is a naming dilemma: though the osmo_ prefix is now reserved for
libosmocore, all surrounding API already has the osmo_ prefix.

This will be used by osmo-hnbgw's VTY 'show cnlink' command.

Change-Id: Ib7abf69cfcf4c56273223054b280458451e6c2f6
2017-12-24 20:32:03 +01:00
Pau Espin 10d4815bb1 ss7: Re-bind xUA server socket after setting new IP
In osmo-stp, cmd "local-ip" inside node "listen m3ua 2905" was actually
not being applied, because the server was created + bound at "listen" command
time using NULL as IP, and at "local-ip" time the IP was changed but the
server was not re-bound using the new IP, so it kept listening at
0.0.0.0.

With this patch, we defer binding the socket to "local-ip" cmd time,
after the IP has been applied.

As a result, if no "local-ip" command is provided, then the bind never
happens, which means it is now mandatory that users of osmo_ss7_xua_server_create
API not using osmo_ss7_xua_server_set_local_host call new provided API
osmo_ss7_xua_server_bind. Another new API osmo_ss7_bind_all_instances is
provided to easily make sure all servers are bound after configuration
process. This is specially important for servers which doesn't contain
the "local-ip" parameter.

Users of osmo_sccp_simple_server API are not affected by this change,
and they not requrie to call any new API.

Furthermore, using osmo_ss7_xua_server_bind in VTY code ensures the xUA
server is automatically bound to the new address if the operator changes
the "local-ip" cmd at runtime.

Related: OS#2647

Change-Id: I79738963d633bec70705ff159c5b2127cd498aa2
2017-12-20 16:04:08 +00:00
Neels Hofmeyr 12715e8e99 add osmo_sccp_inst_addr_name(), a variant of osmo_sccp_addr_name()
It can be cumbersome to derive the ss7 instance needed to pass to
sccp_addr_name(), because struct osmo_sccp_instance is opaque and only
available in sccp_internal.h, within libosmo-sccp.

Add osmo_sccp_inst_addr_name() which derives the ss7 instance from the internal
knowledge of the osmo_sccp_instance struct. This can save calls to
osmo_ss7_instance_find() just to do some logging of an sccp address.

Naming: first I thought to pick osmo_sccp_addr_name2(), but for some of the
string composing functions, adding a 2 already means that it is identical but
using a second static buffer (to be used twice within the same printf).

Change-Id: I70ec5c8b42682a23f11a5820431c7e34e225709b
2017-11-08 02:33:14 +01:00
Neels Hofmeyr a8929fdb56 sccp_scrc: fix Network Indicator in SIO composition
Since the NI is in bits DC, not BA, it needs to be shifted by 6, not 4, to end
up in the two most significant bits. Also, NI is two bits wide, hence & 0x3.
(The m3ua.c side of this is already correct.)

See ITU-T Recommendation Q.704 (07/96), 14.2 "Service information octet".

Before this patch, NI was always sent as 00 == International regardless of the
VTY configuration.

This patch was verified to work by a wireshark trace of osmo-bsc connecting to
osmo-msc, showing the NI decoded as configured by an osmo-bsc.cfg file in the
BSSMAP Reset message MTP 3 / Protocol data.

Change-Id: I7bb4eb6518a1e0d74313bda776d2a6acd0b02e1b
2017-10-26 17:34:28 +02:00