Commit Graph

18 Commits

Author SHA1 Message Date
Oliver Smith 1a75755f9b m3ua: reject deregistration of static routing keys
Make STP_Tests_M3UA.TC_rkm_unreg_never_registered pass.

Closes: OS#4239
Change-Id: Ie5d84d06e7d5d32c8a22f770f71a5449f4a78484
2021-07-23 10:02:16 +02: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
Harald Welte f4f4e8c310 xua_rkm: Don't permit de-registration of rctx with ASP active
Change-Id: Ie47eb205b397f3d2ce94c4ec3531664ed290a819
Closes: OS#4238
2019-10-23 18:11:17 +00:00
Harald Welte 8a7c2eba43 xua_rkm: Print NOTICE log message if registration for wrong rctx
Change-Id: Ifb70940e9edfad8c99473ec724dc52f5885561de
2019-10-23 18:11:17 +00:00
Pau Espin b2ab192327 cosmetic: ss7: Fix trailing whitespace
Change-Id: Ifd947c51067842b83ea43ce25ba0d652baff259b
2019-10-22 19:38:53 +00:00
Neels Hofmeyr bf7eded0fc improve logging for rejected AS in xua_rkm.c
Change a loglevel from NOTICE to ERROR, for when a routing key gets
re-purposed.

Add another error log for insufficient resources case.

Change-Id: Id22e3c6bab5f7b597df3514eedb162277ce0ef7d
2019-03-14 03:41:59 +00:00
Pau Espin 39fdaf62ba xua_rkm: Fix xua_msg memleank in handle_rkey_reg_resp
From LeakSanitizer report:
Indirect leak of 384 byte(s) in 3 object(s) allocated from:
    #0 0x7f986da27d99 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:86
    #1 0x7f9868d0cb61 in _talloc_zero (/usr/lib/libtalloc.so.2+0x5b61)
    #2 0x7f986ad33766 in xua_msg_add_data /home/pespin/dev/sysmocom/git/libosmo-sccp/src/xua_msg.c:73
    #3 0x7f986ad343c3 in xua_from_msg_common /home/pespin/dev/sysmocom/git/libosmo-sccp/src/xua_msg.c:143
    #4 0x7f986ad347d2 in xua_from_nested /home/pespin/dev/sysmocom/git/libosmo-sccp/src/xua_msg.c:201
    #5 0x7f986ad65563 in m3ua_rx_rkm_reg_rsp /home/pespin/dev/sysmocom/git/libosmo-sccp/src/xua_rkm.c:431
    #6 0x7f986ad65f96 in m3ua_rx_rkm /home/pespin/dev/sysmocom/git/libosmo-sccp/src/xua_rkm.c:510
    #7 0x7f986ad31ef7 in m3ua_rx_msg /home/pespin/dev/sysmocom/git/libosmo-sccp/src/m3ua.c:749
    #8 0x7f986ad7c1e8 in xua_cli_read_cb /home/pespin/dev/sysmocom/git/libosmo-sccp/src/osmo_ss7.c:1590
    #9 0x7f986a66cdb4 in osmo_stream_cli_read /home/pespin/dev/sysmocom/git/libosmo-netif/src/stream.c:192
    #10 0x7f986a66e091 in osmo_stream_cli_fd_cb /home/pespin/dev/sysmocom/git/libosmo-netif/src/stream.c:276
    #11 0x7f986994e795 in osmo_fd_disp_fds /home/pespin/dev/sysmocom/git/libosmocore/src/select.c:217
    #12 0x7f986994eabb in osmo_select_main /home/pespin/dev/sysmocom/git/libosmocore/src/select.c:257
    #13 0x5630cb294bd3 in main /home/pespin/dev/sysmocom/git/osmo-msc/src/osmo-msc/msc_main.c:697
    #14 0x7f98678b806a in __libc_start_main (/usr/lib/libc.so.6+0x2306a)
    #15 0x5630cb292649 in _start (/home/pespin/dev/sysmocom/build/new/out/bin/osmo-msc+0x185649)

Following code paths:
m3ua_rx_rkm_reg_rsp
	xua_from_nested
		xua_from_msg_common
			xua_msg_add_data
				talloc_zero (part)
	handle_rkey_reg_resp

Take the chance to fix the same issue in m3ua_rx_rkm_dereg_rsp.

Change-Id: I0b15d81099a9f8274b7e39962caa339da644e0dc
2018-08-13 18:32:27 +02:00
Stefan Sperling 3b8ff68a0a free msgb for primitive allocated in lm_timer_cb() of lm_fsm
A primitive allocated in lm_timer_cb() with xua_xlm_prim_alloc()
was never freed. Don't forget to free the msgb in osmo_xlm_sap_down().

Found by code inspection.

Also, assert that allocation suceeded like we do elsewhere.

Change-Id: Ie667b1b8beeda2aa4520a1413f51101435215cc0
Related: OS#2449
2018-05-15 13:47:02 +02:00
Harald Welte b393b3f4cc Add SPDX-License-Identifier + missing copyright statements
Change-Id: I113232bbeaa7a835871df7f9b883ba573d8a2534
2017-11-13 01:25:47 +09:00
Harald Welte 7c56ab30c9 xua_rkm: Fix handling of RK Registration with multiple Routing Keys
RKM permits multiple routing key IEs to be inside a single Routing Key
Registration message.  We were trying to handle this, but the counter we
used as array index into the 'newly_assigned_as' array was actually
always kept at zero.

Change-Id: I08a962d2f242cefb67fb2dc93818c1ed532e8990
Fixes: coverity CID#166991
2017-04-27 10:45:09 +02:00
Harald Welte e316635f07 osmo_ss7: Release any dynamically-allocated ASs
When RKM dynamically allocates ASs on the SGP based on RKM registration
requests, we must make sure to properly destroy those at the time the
related ASP disconnects.  Also, make sure to send
XUA_ASP_E_SCTP_COMM_DOWN_IND to the layer manager (if any).

Change-Id: Ie6505680bb6890814ae36858c54a2a6d2850f5cf
2017-04-13 18:05:13 +02:00
Harald Welte 8dec5a8ec5 xua_rkm: Make dynamic registration of Routing Keys work
The existign xua_rkm code was merged a bit pre-maturely as it was not
properly tested.  This adds a lot of fixes to make it work at all in the
first place, as well as the configurable option for fully dynamic
routing key management, where ASs and routing keys must not be
configured statically by administrative means, but clients (ASPs) can
simply come and register for whatever point code they want.

Change-Id: I79a070fa7b271b44995511f7b3ff7cc6beec8278
2017-04-13 18:05:13 +02:00
Harald Welte 2346850ae2 xua_rkm: Improve comments about functions
Change-Id: I2f17baae37718e277eae54d4d225f8fcb2eb4aae
2017-04-13 18:05:13 +02:00
Harald Welte ed15c74a01 Add a default layer manager using RKM to register PC with SG
This "default layer manager" can optionally be used by a xUA ASP. It
will handle the xUA Layer Manager (xlm) primitives and use them to
behave as follows:

* bring the ASP into state "INACTIVE"
* see if the SG can match our connection (based on IP address + port
  information) to a statically configured ASP configuration with
  associated AS(s).  If yes, it will send us a NOTIFY message with
  AS-INACTIVE.
* if the above doesn't work, try to dynamically register a routing key
  using RKM for the point code that was locally confiured on the
  ASP/client.   If that works, the SG will now have created ASP and AS
  objects as well as a routing key and be able to serve us, sending the
  NOTIFY with the AS-INACTIVE state.
* After either of the two above, we will attempt to transition into
  ASP-ACTIVE.  The SG should send us an AS-ACTIVE notification in return
* if anything fails, abort and disconnect the SCTP connection, restart
  related FSMs and start from scratch

Change-Id: I78d4623dd213b5c59007a026a6cc3cfe5c04af50
2017-04-13 18:05:13 +02:00
Harald Welte b5e569ee67 xua: Add value_string for routing key [de]registration results
Change-Id: If8f0a0ad0837810388cfe65a7b571b6ce4df33e3
2017-04-11 21:45:25 +02:00
Harald Welte 4e818c3cfd Add M3UA RKM (routing key management) support, SGW side only
Change-Id: I9b1cf438a42519c0fe2f555c1672fafa499122a1
2017-04-10 11:48:35 +02:00