2017-04-09 10:32:51 +00:00
|
|
|
/* (C) 2017 by Sysmocom s.f.m.c. GmbH
|
2018-02-09 00:42:50 +00:00
|
|
|
* (C) 2018 by Harald Welte <laforge@gnumonks.org>
|
2017-04-09 10:32:51 +00:00
|
|
|
* All Rights Reserved
|
|
|
|
*
|
|
|
|
* Author: Philipp Maier
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <osmocom/core/utils.h>
|
|
|
|
#include <osmocom/core/msgb.h>
|
|
|
|
#include <osmocom/core/logging.h>
|
|
|
|
#include <osmocom/sigtran/sccp_helpers.h>
|
|
|
|
#include <osmocom/sccp/sccp_types.h>
|
|
|
|
#include <osmocom/gsm/gsm0808.h>
|
2017-09-15 09:22:30 +00:00
|
|
|
#include <osmocom/gsm/gsm48.h>
|
2017-04-09 10:32:51 +00:00
|
|
|
#include <osmocom/gsm/gsm0808_utils.h>
|
2017-09-04 13:04:35 +00:00
|
|
|
#include <osmocom/msc/debug.h>
|
|
|
|
#include <osmocom/msc/gsm_data.h>
|
|
|
|
#include <osmocom/msc/a_iface_bssap.h>
|
|
|
|
#include <osmocom/msc/a_iface.h>
|
2017-04-09 10:32:51 +00:00
|
|
|
#include <osmocom/core/byteswap.h>
|
2017-09-04 13:04:35 +00:00
|
|
|
#include <osmocom/msc/a_reset.h>
|
2017-09-15 09:22:30 +00:00
|
|
|
#include <osmocom/msc/transaction.h>
|
2017-11-07 16:19:25 +00:00
|
|
|
#include <osmocom/msc/msc_mgcp.h>
|
2017-09-15 09:22:30 +00:00
|
|
|
|
|
|
|
#include <errno.h>
|
2017-04-09 10:32:51 +00:00
|
|
|
|
|
|
|
#define IP_V4_ADDR_LEN 4
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Helper functions to lookup and allocate subscribers
|
|
|
|
*/
|
|
|
|
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
/* Allocate a new RAN connection */
|
|
|
|
static struct ran_conn *ran_conn_allocate_a(const struct a_conn_info *a_conn_info,
|
2017-04-09 10:32:51 +00:00
|
|
|
struct gsm_network *network,
|
|
|
|
uint16_t lac, struct osmo_sccp_user *scu, int conn_id)
|
|
|
|
{
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
struct ran_conn *conn;
|
2017-04-09 10:32:51 +00:00
|
|
|
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
LOGP(DMSC, LOGL_DEBUG, "Allocating A-Interface RAN conn: lac %i, conn_id %i\n", lac, conn_id);
|
2017-04-09 10:32:51 +00:00
|
|
|
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
conn = ran_conn_alloc(network, RAN_GERAN_A, lac);
|
2017-04-09 10:32:51 +00:00
|
|
|
if (!conn)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
conn->a.conn_id = conn_id;
|
|
|
|
conn->a.scu = scu;
|
|
|
|
|
|
|
|
/* Also backup the calling address of the BSC, this allows us to
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
* identify later which BSC is responsible for this RAN connection */
|
2018-02-08 23:09:16 +00:00
|
|
|
memcpy(&conn->a.bsc_addr, &a_conn_info->bsc->bsc_addr, sizeof(conn->a.bsc_addr));
|
2017-04-09 10:32:51 +00:00
|
|
|
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
LOGPCONN(conn, LOGL_DEBUG, "A-Interface RAN connection successfully allocated!\n");
|
2017-04-09 10:32:51 +00:00
|
|
|
return conn;
|
|
|
|
}
|
|
|
|
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
/* Return an existing A RAN connection record for the given
|
2017-04-09 10:32:51 +00:00
|
|
|
* connection IDs, or return NULL if not found. */
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
static struct ran_conn *ran_conn_lookup_a(const struct gsm_network *network, int conn_id)
|
2017-04-09 10:32:51 +00:00
|
|
|
{
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
struct ran_conn *conn;
|
2017-04-09 10:32:51 +00:00
|
|
|
|
|
|
|
OSMO_ASSERT(network);
|
|
|
|
|
|
|
|
DEBUGP(DMSC, "Looking for A subscriber: conn_id %i\n", conn_id);
|
|
|
|
|
|
|
|
/* FIXME: log_subscribers() is defined in iucs.c as static inline, if
|
|
|
|
* maybe this function should be public to reach it from here? */
|
|
|
|
/* log_subscribers(network); */
|
|
|
|
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
llist_for_each_entry(conn, &network->ran_conns, entry) {
|
2017-04-09 10:32:51 +00:00
|
|
|
if (conn->via_ran == RAN_GERAN_A && conn->a.conn_id == conn_id) {
|
2018-02-08 23:53:17 +00:00
|
|
|
LOGPCONN(conn, LOGL_DEBUG, "Found A subscriber for conn_id %i\n", conn_id);
|
2017-04-09 10:32:51 +00:00
|
|
|
return conn;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DEBUGP(DMSC, "No A subscriber found for conn_id %i\n", conn_id);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* BSSMAP handling for UNITDATA
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Endpoint to handle BSSMAP reset */
|
|
|
|
static void bssmap_rx_reset(struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm_network *network = a_conn_info->network;
|
|
|
|
struct osmo_ss7_instance *ss7;
|
|
|
|
|
|
|
|
ss7 = osmo_ss7_instance_find(network->a.cs7_instance);
|
|
|
|
OSMO_ASSERT(ss7);
|
|
|
|
|
2018-02-09 00:49:01 +00:00
|
|
|
LOGP(DBSSAP, LOGL_NOTICE, "Rx BSSMAP RESET from BSC %s, sending RESET ACK\n",
|
2018-02-08 23:09:16 +00:00
|
|
|
osmo_sccp_addr_name(ss7, &a_conn_info->bsc->bsc_addr));
|
|
|
|
osmo_sccp_tx_unitdata_msg(scu, &a_conn_info->bsc->msc_addr, &a_conn_info->bsc->bsc_addr,
|
|
|
|
gsm0808_create_reset_ack());
|
2017-04-09 10:32:51 +00:00
|
|
|
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
/* Make sure all orphand RAN connections will be cleard */
|
2018-02-08 23:09:16 +00:00
|
|
|
a_clear_all(scu, &a_conn_info->bsc->bsc_addr);
|
|
|
|
|
2018-05-07 08:15:49 +00:00
|
|
|
if (!a_conn_info->bsc->reset_fsm)
|
2018-02-08 23:09:16 +00:00
|
|
|
a_start_reset(a_conn_info->bsc, true);
|
2018-03-18 21:20:34 +00:00
|
|
|
|
|
|
|
/* Treat an incoming RESET like an ACK to any RESET request we may have just sent.
|
|
|
|
* After all, what we wanted is the A interface to be reset, which we now know has happened. */
|
2018-05-07 08:15:49 +00:00
|
|
|
a_reset_ack_confirm(a_conn_info->bsc->reset_fsm);
|
2017-04-09 10:32:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Endpoint to handle BSSMAP reset acknowlegement */
|
|
|
|
static void bssmap_rx_reset_ack(const struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info,
|
|
|
|
struct msgb *msg)
|
|
|
|
{
|
|
|
|
|
|
|
|
struct gsm_network *network = a_conn_info->network;
|
|
|
|
struct osmo_ss7_instance *ss7;
|
|
|
|
|
|
|
|
ss7 = osmo_ss7_instance_find(network->a.cs7_instance);
|
|
|
|
OSMO_ASSERT(ss7);
|
|
|
|
|
2018-05-07 08:15:49 +00:00
|
|
|
if (a_conn_info->bsc->reset_fsm == NULL) {
|
2018-02-09 00:49:01 +00:00
|
|
|
LOGP(DBSSAP, LOGL_ERROR, "Received RESET ACK from an unknown BSC %s, ignoring...\n",
|
2018-02-08 23:09:16 +00:00
|
|
|
osmo_sccp_addr_name(ss7, &a_conn_info->bsc->bsc_addr));
|
2018-02-09 20:33:24 +00:00
|
|
|
return;
|
2017-04-09 10:32:51 +00:00
|
|
|
}
|
|
|
|
|
2018-02-09 00:49:01 +00:00
|
|
|
LOGP(DBSSAP, LOGL_NOTICE, "Received RESET ACK from BSC %s\n",
|
2018-02-08 23:09:16 +00:00
|
|
|
osmo_sccp_addr_name(ss7, &a_conn_info->bsc->bsc_addr));
|
2017-04-09 10:32:51 +00:00
|
|
|
|
|
|
|
/* Confirm that we managed to get the reset ack message
|
|
|
|
* towards the connection reset logic */
|
2018-05-07 08:15:49 +00:00
|
|
|
a_reset_ack_confirm(a_conn_info->bsc->reset_fsm);
|
2017-04-09 10:32:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle UNITDATA BSSMAP messages */
|
|
|
|
static void bssmap_rcvmsg_udt(struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info, struct msgb *msg)
|
|
|
|
{
|
|
|
|
/* Note: When in the MSC role, RESET ACK is the only valid message that
|
|
|
|
* can be received via UNITDATA */
|
|
|
|
|
|
|
|
if (msgb_l3len(msg) < 1) {
|
2018-02-09 00:49:01 +00:00
|
|
|
LOGP(DBSSAP, LOGL_NOTICE, "Error: No data received -- discarding message!\n");
|
2017-04-09 10:32:51 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-02-09 00:49:01 +00:00
|
|
|
LOGP(DBSSAP, LOGL_DEBUG, "Rx BSSMAP UDT %s\n", gsm0808_bssmap_name(msg->l3h[0]));
|
2017-04-09 10:32:51 +00:00
|
|
|
|
|
|
|
switch (msg->l3h[0]) {
|
|
|
|
case BSS_MAP_MSG_RESET:
|
|
|
|
bssmap_rx_reset(scu, a_conn_info, msg);
|
|
|
|
break;
|
|
|
|
case BSS_MAP_MSG_RESET_ACKNOWLEDGE:
|
|
|
|
bssmap_rx_reset_ack(scu, a_conn_info, msg);
|
|
|
|
break;
|
|
|
|
default:
|
2018-02-09 00:49:01 +00:00
|
|
|
LOGP(DBSSAP, LOGL_NOTICE, "Unimplemented message format: %s -- message discarded!\n",
|
2017-04-09 10:32:51 +00:00
|
|
|
gsm0808_bssmap_name(msg->l3h[0]));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Receive incoming connection less data messages via sccp */
|
2017-12-18 03:06:04 +00:00
|
|
|
void a_sccp_rx_udt(struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info, struct msgb *msg)
|
2017-04-09 10:32:51 +00:00
|
|
|
{
|
|
|
|
/* Note: The only valid message type that can be received
|
|
|
|
* via UNITDATA are BSS Management messages */
|
|
|
|
struct bssmap_header *bs;
|
|
|
|
|
|
|
|
OSMO_ASSERT(scu);
|
|
|
|
OSMO_ASSERT(a_conn_info);
|
|
|
|
OSMO_ASSERT(msg);
|
|
|
|
|
2018-02-09 00:49:01 +00:00
|
|
|
LOGP(DBSSAP, LOGL_DEBUG, "Rx BSSMAP UDT: %s\n", msgb_hexdump_l2(msg));
|
2017-04-09 10:32:51 +00:00
|
|
|
|
|
|
|
if (msgb_l2len(msg) < sizeof(*bs)) {
|
2018-02-09 00:49:01 +00:00
|
|
|
LOGP(DBSSAP, LOGL_ERROR, "Error: Header is too short -- discarding message!\n");
|
2017-04-09 10:32:51 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
bs = (struct bssmap_header *)msgb_l2(msg);
|
|
|
|
if (bs->length < msgb_l2len(msg) - sizeof(*bs)) {
|
2018-02-09 00:49:01 +00:00
|
|
|
LOGP(DBSSAP, LOGL_ERROR, "Error: Message is too short -- discarding message!\n");
|
2017-04-09 10:32:51 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (bs->type) {
|
|
|
|
case BSSAP_MSG_BSS_MANAGEMENT:
|
|
|
|
msg->l3h = &msg->l2h[sizeof(struct bssmap_header)];
|
|
|
|
bssmap_rcvmsg_udt(scu, a_conn_info, msg);
|
|
|
|
break;
|
|
|
|
default:
|
2018-02-09 00:49:01 +00:00
|
|
|
LOGP(DBSSAP, LOGL_ERROR,
|
2017-04-09 10:32:51 +00:00
|
|
|
"Error: Unimplemented message type: %s -- message discarded!\n", gsm0808_bssmap_name(bs->type));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* BSSMAP handling for connection oriented data
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Endpoint to handle BSSMAP clear request */
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
static int bssmap_rx_clear_rqst(struct ran_conn *conn,
|
2018-02-14 11:13:35 +00:00
|
|
|
struct msgb *msg, struct tlv_parsed *tp)
|
2017-04-09 10:32:51 +00:00
|
|
|
{
|
|
|
|
uint8_t cause;
|
|
|
|
|
2018-02-09 00:31:29 +00:00
|
|
|
LOGPCONN(conn, LOGL_INFO, "Rx BSSMAP CLEAR REQUEST\n");
|
2017-04-09 10:32:51 +00:00
|
|
|
|
2018-02-14 11:13:35 +00:00
|
|
|
if (!TLVP_PRESENT(tp, GSM0808_IE_CAUSE)) {
|
2018-02-09 00:49:01 +00:00
|
|
|
LOGP(DBSSAP, LOGL_ERROR, "Cause code is missing -- discarding message!\n");
|
2018-02-09 20:33:24 +00:00
|
|
|
return -EINVAL;
|
2017-04-09 10:32:51 +00:00
|
|
|
}
|
2018-02-14 11:13:35 +00:00
|
|
|
cause = TLVP_VAL(tp, GSM0808_IE_CAUSE)[0];
|
2017-04-09 10:32:51 +00:00
|
|
|
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
ran_conn_mo_close(conn, cause);
|
2017-04-09 10:32:51 +00:00
|
|
|
|
2018-04-05 23:07:42 +00:00
|
|
|
return 0;
|
2017-04-09 10:32:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Endpoint to handle BSSMAP clear complete */
|
2018-02-09 00:23:25 +00:00
|
|
|
static int bssmap_rx_clear_complete(struct osmo_sccp_user *scu,
|
2018-04-01 18:55:54 +00:00
|
|
|
const struct a_conn_info *a_conn_info,
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
struct ran_conn *conn)
|
2017-04-09 10:32:51 +00:00
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
2018-04-01 18:55:54 +00:00
|
|
|
LOGPCONN(conn, LOGL_INFO, "Rx BSSMAP CLEAR COMPLETE, releasing SCCP connection\n");
|
|
|
|
|
|
|
|
if (conn)
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
ran_conn_rx_bssmap_clear_complete(conn);
|
2018-04-01 18:55:54 +00:00
|
|
|
|
2017-04-09 10:32:51 +00:00
|
|
|
rc = osmo_sccp_tx_disconn(scu, a_conn_info->conn_id,
|
2018-02-08 23:09:16 +00:00
|
|
|
NULL, SCCP_RELEASE_CAUSE_END_USER_ORIGINATED);
|
2017-04-09 10:32:51 +00:00
|
|
|
|
|
|
|
/* Remove the record from the list with active connections. */
|
|
|
|
a_delete_bsc_con(a_conn_info->conn_id);
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Endpoint to handle layer 3 complete messages */
|
2018-02-14 11:13:35 +00:00
|
|
|
static int bssmap_rx_l3_compl(struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info,
|
|
|
|
struct msgb *msg, struct tlv_parsed *tp)
|
2017-04-09 10:32:51 +00:00
|
|
|
{
|
2018-03-14 13:00:00 +00:00
|
|
|
struct gsm0808_cell_id_list2 cil;
|
|
|
|
uint16_t lac = 0;
|
2017-04-09 10:32:51 +00:00
|
|
|
uint8_t data_length;
|
|
|
|
const uint8_t *data;
|
|
|
|
struct gsm_network *network = a_conn_info->network;
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
struct ran_conn *conn;
|
2017-04-09 10:32:51 +00:00
|
|
|
|
2018-02-09 00:49:01 +00:00
|
|
|
LOGP(DBSSAP, LOGL_INFO, "Rx BSSMAP COMPLETE L3 INFO (conn_id=%i)\n", a_conn_info->conn_id);
|
2017-04-09 10:32:51 +00:00
|
|
|
|
2018-02-14 11:13:35 +00:00
|
|
|
if (!TLVP_PRESENT(tp, GSM0808_IE_CELL_IDENTIFIER)) {
|
2018-02-09 00:49:01 +00:00
|
|
|
LOGP(DBSSAP, LOGL_ERROR, "Mandatory CELL IDENTIFIER not present -- discarding message!\n");
|
2018-02-09 20:33:24 +00:00
|
|
|
return -EINVAL;
|
2017-04-09 10:32:51 +00:00
|
|
|
}
|
2018-02-14 11:13:35 +00:00
|
|
|
if (!TLVP_PRESENT(tp, GSM0808_IE_LAYER_3_INFORMATION)) {
|
2018-02-09 00:49:01 +00:00
|
|
|
LOGP(DBSSAP, LOGL_ERROR, "Mandatory LAYER 3 INFORMATION not present -- discarding message!\n");
|
2018-02-09 20:33:24 +00:00
|
|
|
return -EINVAL;
|
2017-04-09 10:32:51 +00:00
|
|
|
}
|
|
|
|
|
2018-03-14 13:00:00 +00:00
|
|
|
/* Parse Cell ID element -- this should yield a cell identifier "list" with 1 element. */
|
|
|
|
|
2018-02-14 11:13:35 +00:00
|
|
|
data_length = TLVP_LEN(tp, GSM0808_IE_CELL_IDENTIFIER);
|
|
|
|
data = TLVP_VAL(tp, GSM0808_IE_CELL_IDENTIFIER);
|
2018-03-14 13:00:00 +00:00
|
|
|
if (gsm0808_dec_cell_id_list2(&cil, data, data_length) < 0 || cil.id_list_len != 1) {
|
2018-02-09 00:49:01 +00:00
|
|
|
LOGP(DBSSAP, LOGL_ERROR,
|
2018-03-14 13:00:00 +00:00
|
|
|
"Unable to parse element CELL IDENTIFIER -- discarding message!\n");
|
2018-02-09 20:33:24 +00:00
|
|
|
return -EINVAL;
|
2017-04-09 10:32:51 +00:00
|
|
|
}
|
2018-03-14 13:00:00 +00:00
|
|
|
|
|
|
|
/* Determine the LAC which we will use for this subscriber. */
|
|
|
|
switch (cil.id_discr) {
|
|
|
|
case CELL_IDENT_WHOLE_GLOBAL: {
|
|
|
|
const struct osmo_cell_global_id *id = &cil.id_list[0].global;
|
|
|
|
if (osmo_plmn_cmp(&id->lai.plmn, &network->plmn) != 0) {
|
|
|
|
LOGP(DBSSAP, LOGL_ERROR,
|
|
|
|
"WHOLE GLOBAL CELL IDENTIFIER does not match network MCC/MNC -- discarding message!\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
lac = id->lai.lac;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CELL_IDENT_LAC_AND_CI: {
|
|
|
|
const struct osmo_lac_and_ci_id *id = &cil.id_list[0].lac_and_ci;
|
|
|
|
lac = id->lac;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CELL_IDENT_LAI_AND_LAC: {
|
|
|
|
const struct osmo_location_area_id *id = &cil.id_list[0].lai_and_lac;
|
|
|
|
if (osmo_plmn_cmp(&id->plmn, &network->plmn) != 0) {
|
|
|
|
LOGP(DBSSAP, LOGL_ERROR,
|
|
|
|
"LAI AND LAC CELL IDENTIFIER does not match network MCC/MNC -- discarding message!\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
lac = id->lac;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CELL_IDENT_LAC:
|
|
|
|
lac = cil.id_list[0].lac;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CELL_IDENT_CI:
|
|
|
|
case CELL_IDENT_NO_CELL:
|
|
|
|
case CELL_IDENT_BSS:
|
|
|
|
LOGP(DBSSAP, LOGL_ERROR,
|
|
|
|
"CELL IDENTIFIER does not specify a LAC -- discarding message!\n");
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
default:
|
2018-02-09 00:49:01 +00:00
|
|
|
LOGP(DBSSAP, LOGL_ERROR,
|
2018-03-14 13:00:00 +00:00
|
|
|
"Unable to parse element CELL IDENTIFIER (unknown cell identification discriminator 0x%x) "
|
|
|
|
"-- discarding message!\n", cil.id_discr);
|
2018-02-09 20:33:24 +00:00
|
|
|
return -EINVAL;
|
2017-04-09 10:32:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Parse Layer 3 Information element */
|
2018-02-14 11:13:35 +00:00
|
|
|
msg->l3h = (uint8_t*)TLVP_VAL(tp, GSM0808_IE_LAYER_3_INFORMATION);
|
2017-12-15 17:55:43 +00:00
|
|
|
msgb_l3trim(msg, TLVP_LEN(tp, GSM0808_IE_LAYER_3_INFORMATION));
|
2017-04-09 10:32:51 +00:00
|
|
|
|
2018-03-18 20:55:37 +00:00
|
|
|
if (msgb_l3len(msg) < sizeof(struct gsm48_hdr)) {
|
|
|
|
LOGP(DBSSAP, LOGL_ERROR, "COMPL_L3 with too short L3 (%d) -- discarding\n",
|
|
|
|
msgb_l3len(msg));
|
|
|
|
return -ENODATA;
|
|
|
|
}
|
|
|
|
|
2017-04-09 10:32:51 +00:00
|
|
|
/* Create new subscriber context */
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
conn = ran_conn_allocate_a(a_conn_info, network, lac, scu, a_conn_info->conn_id);
|
2017-04-09 10:32:51 +00:00
|
|
|
|
|
|
|
/* Handover location update to the MSC code */
|
2018-11-30 00:08:36 +00:00
|
|
|
ran_conn_compl_l3(conn, msg, 0);
|
2018-11-30 00:20:32 +00:00
|
|
|
return 0;
|
2017-04-09 10:32:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Endpoint to handle BSSMAP classmark update */
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
static int bssmap_rx_classmark_upd(struct ran_conn *conn, struct msgb *msg,
|
2018-02-14 11:13:35 +00:00
|
|
|
struct tlv_parsed *tp)
|
2017-04-09 10:32:51 +00:00
|
|
|
{
|
|
|
|
const uint8_t *cm2 = NULL;
|
|
|
|
const uint8_t *cm3 = NULL;
|
|
|
|
uint8_t cm2_len = 0;
|
|
|
|
uint8_t cm3_len = 0;
|
|
|
|
|
2018-02-09 00:05:27 +00:00
|
|
|
LOGPCONN(conn, LOGL_DEBUG, "Rx BSSMAP CLASSMARK UPDATE\n");
|
2017-04-09 10:32:51 +00:00
|
|
|
|
2018-02-14 11:13:35 +00:00
|
|
|
if (!TLVP_PRESENT(tp, GSM0808_IE_CLASSMARK_INFORMATION_T2)) {
|
2018-02-08 23:53:17 +00:00
|
|
|
LOGPCONN(conn, LOGL_ERROR, "Mandatory Classmark Information Type 2 not present -- discarding message!\n");
|
2018-02-09 20:33:24 +00:00
|
|
|
return -EINVAL;
|
2017-04-09 10:32:51 +00:00
|
|
|
}
|
|
|
|
|
2018-02-14 11:13:35 +00:00
|
|
|
cm2 = TLVP_VAL(tp, GSM0808_IE_CLASSMARK_INFORMATION_T2);
|
|
|
|
cm2_len = TLVP_LEN(tp, GSM0808_IE_CLASSMARK_INFORMATION_T2);
|
2017-04-09 10:32:51 +00:00
|
|
|
|
2018-02-14 11:13:35 +00:00
|
|
|
if (TLVP_PRESENT(tp, GSM0808_IE_CLASSMARK_INFORMATION_T3)) {
|
|
|
|
cm3 = TLVP_VAL(tp, GSM0808_IE_CLASSMARK_INFORMATION_T3);
|
|
|
|
cm3_len = TLVP_LEN(tp, GSM0808_IE_CLASSMARK_INFORMATION_T3);
|
2017-04-09 10:32:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Inform MSC about the classmark change */
|
2018-11-30 00:08:36 +00:00
|
|
|
ran_conn_classmark_chg(conn, cm2, cm2_len, cm3, cm3_len);
|
2017-04-09 10:32:51 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Endpoint to handle BSSMAP cipher mode complete */
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
static int bssmap_rx_ciph_compl(struct ran_conn *conn, struct msgb *msg,
|
2018-02-14 11:13:35 +00:00
|
|
|
struct tlv_parsed *tp)
|
2017-04-09 10:32:51 +00:00
|
|
|
{
|
|
|
|
/* FIXME: The field GSM0808_IE_LAYER_3_MESSAGE_CONTENTS is optional by
|
|
|
|
* means of the specification. So there can be messages without L3 info.
|
2018-11-30 00:08:36 +00:00
|
|
|
* In this case, the code will crash becrause ran_conn_cipher_mode_compl()
|
2017-04-09 10:32:51 +00:00
|
|
|
* is not able to deal with msg = NULL and apperently
|
2018-11-30 00:08:36 +00:00
|
|
|
* ran_conn_cipher_mode_compl() was never meant to be used without L3 data.
|
2017-04-09 10:32:51 +00:00
|
|
|
* This needs to be discussed further! */
|
|
|
|
|
|
|
|
uint8_t alg_id = 1;
|
2018-11-02 15:01:03 +00:00
|
|
|
struct rate_ctr_group *msc = conn->network->msc_ctrs;
|
2017-04-09 10:32:51 +00:00
|
|
|
|
2018-02-09 00:05:27 +00:00
|
|
|
LOGPCONN(conn, LOGL_DEBUG, "Rx BSSMAP CIPHER MODE COMPLETE\n");
|
2017-04-09 10:32:51 +00:00
|
|
|
|
2018-02-14 11:13:35 +00:00
|
|
|
if (TLVP_PRESENT(tp, GSM0808_IE_CHOSEN_ENCR_ALG)) {
|
|
|
|
alg_id = TLVP_VAL(tp, GSM0808_IE_CHOSEN_ENCR_ALG)[0] - 1;
|
2017-04-09 10:32:51 +00:00
|
|
|
}
|
|
|
|
|
2018-02-14 11:13:35 +00:00
|
|
|
if (TLVP_PRESENT(tp, GSM0808_IE_LAYER_3_MESSAGE_CONTENTS)) {
|
|
|
|
msg->l3h = (uint8_t*)TLVP_VAL(tp, GSM0808_IE_LAYER_3_MESSAGE_CONTENTS);
|
2017-12-15 17:55:43 +00:00
|
|
|
msgb_l3trim(msg, TLVP_LEN(tp, GSM0808_IE_LAYER_3_MESSAGE_CONTENTS));
|
2017-04-09 10:32:51 +00:00
|
|
|
} else {
|
|
|
|
msg = NULL;
|
|
|
|
}
|
|
|
|
|
2018-11-02 15:01:03 +00:00
|
|
|
rate_ctr_inc(&msc->ctr[MSC_CTR_BSSMAP_CIPHER_MODE_COMPLETE]);
|
|
|
|
|
2017-09-07 09:39:58 +00:00
|
|
|
/* Hand over cipher mode complete message to the MSC */
|
2018-11-30 00:08:36 +00:00
|
|
|
ran_conn_cipher_mode_compl(conn, msg, alg_id);
|
2017-04-09 10:32:51 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-11-01 16:34:12 +00:00
|
|
|
/* Endpoint to handle BSSMAP cipher mode reject, 3GPP TS 08.08 §3.2.1.48 */
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
static int bssmap_rx_ciph_rej(struct ran_conn *conn,
|
2018-02-14 11:13:35 +00:00
|
|
|
struct msgb *msg, struct tlv_parsed *tp)
|
2017-04-09 10:32:51 +00:00
|
|
|
{
|
2018-11-19 14:04:55 +00:00
|
|
|
int rc;
|
2018-11-01 16:34:12 +00:00
|
|
|
enum gsm0808_cause cause;
|
2018-11-02 15:01:03 +00:00
|
|
|
struct rate_ctr_group *msc = conn->network->msc_ctrs;
|
2017-04-09 10:32:51 +00:00
|
|
|
|
2018-02-09 00:05:27 +00:00
|
|
|
LOGPCONN(conn, LOGL_NOTICE, "RX BSSMAP CIPHER MODE REJECT\n");
|
2017-04-09 10:32:51 +00:00
|
|
|
|
2018-11-19 14:04:55 +00:00
|
|
|
rc = gsm0808_get_cipher_reject_cause(tp);
|
|
|
|
if (rc < 0) {
|
|
|
|
LOGPCONN(conn, LOGL_ERROR, "failed (%s) to extract Cause from Cipher mode reject: %s\n",
|
|
|
|
strerror(-rc), msgb_hexdump(msg));
|
|
|
|
return rc;
|
2017-04-09 10:32:51 +00:00
|
|
|
}
|
|
|
|
|
2018-11-02 15:01:03 +00:00
|
|
|
rate_ctr_inc(&msc->ctr[MSC_CTR_BSSMAP_CIPHER_MODE_REJECT]);
|
2018-11-19 14:04:55 +00:00
|
|
|
cause = (enum gsm0808_cause)rc;
|
2018-11-01 16:34:12 +00:00
|
|
|
LOGPCONN(conn, LOGL_NOTICE, "Cipher mode rejection cause: %s\n", gsm0808_cause_name(cause));
|
2017-04-09 10:32:51 +00:00
|
|
|
|
|
|
|
/* FIXME: Can we do something meaningful here? e.g. report to the
|
|
|
|
* msc code somehow that the cipher mode command has failed. */
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Endpoint to handle BSSMAP assignment failure */
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
static int bssmap_rx_ass_fail(struct ran_conn *conn, struct msgb *msg,
|
2018-02-14 11:13:35 +00:00
|
|
|
struct tlv_parsed *tp)
|
2017-04-09 10:32:51 +00:00
|
|
|
{
|
|
|
|
uint8_t cause;
|
|
|
|
uint8_t *rr_cause_ptr = NULL;
|
|
|
|
uint8_t rr_cause;
|
|
|
|
|
2018-02-09 00:05:27 +00:00
|
|
|
LOGPCONN(conn, LOGL_NOTICE, "Rx BSSMAP ASSIGNMENT FAILURE message\n");
|
2017-04-09 10:32:51 +00:00
|
|
|
|
2018-02-14 11:13:35 +00:00
|
|
|
if (!TLVP_PRESENT(tp, GSM0808_IE_CAUSE)) {
|
2018-02-08 23:53:17 +00:00
|
|
|
LOGPCONN(conn, LOGL_ERROR, "Cause code is missing -- discarding message!\n");
|
2018-02-09 20:33:24 +00:00
|
|
|
return -EINVAL;
|
2017-04-09 10:32:51 +00:00
|
|
|
}
|
2018-02-14 11:13:35 +00:00
|
|
|
cause = TLVP_VAL(tp, GSM0808_IE_CAUSE)[0];
|
2017-04-09 10:32:51 +00:00
|
|
|
|
2018-02-14 11:13:35 +00:00
|
|
|
if (TLVP_PRESENT(tp, GSM0808_IE_RR_CAUSE)) {
|
|
|
|
rr_cause = TLVP_VAL(tp, GSM0808_IE_RR_CAUSE)[0];
|
2017-04-09 10:32:51 +00:00
|
|
|
rr_cause_ptr = &rr_cause;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: In AoIP, the Assignment failure will carry also an optional
|
|
|
|
* Codec List (BSS Supported) element. It has to be discussed if we
|
2018-11-30 00:08:36 +00:00
|
|
|
* can ignore this element. If not, The ran_conn_assign_fail() function
|
|
|
|
* call has to change. However ran_conn_assign_fail() does nothing in the
|
2017-04-09 10:32:51 +00:00
|
|
|
* end. So probably we can just leave it as it is. Even for AoIP */
|
|
|
|
|
|
|
|
/* Inform the MSC about the assignment failure event */
|
2018-11-30 00:08:36 +00:00
|
|
|
ran_conn_assign_fail(conn, cause, rr_cause_ptr);
|
2017-04-09 10:32:51 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Endpoint to handle sapi "n" reject */
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
static int bssmap_rx_sapi_n_rej(struct ran_conn *conn, struct msgb *msg,
|
2018-02-14 11:13:35 +00:00
|
|
|
struct tlv_parsed *tp)
|
2017-04-09 10:32:51 +00:00
|
|
|
{
|
|
|
|
uint8_t dlci;
|
|
|
|
|
2018-02-09 00:31:29 +00:00
|
|
|
LOGPCONN(conn, LOGL_NOTICE, "Rx BSSMAP SAPI-N-REJECT message\n");
|
2017-04-09 10:32:51 +00:00
|
|
|
|
|
|
|
/* Note: The MSC code seems not to care about the cause code, but by
|
|
|
|
* the specification it is mandatory, so we check its presence. See
|
|
|
|
* also 3GPP TS 48.008 3.2.1.34 SAPI "n" REJECT */
|
2018-02-14 11:13:35 +00:00
|
|
|
if (!TLVP_PRESENT(tp, GSM0808_IE_CAUSE)) {
|
2018-02-08 23:53:17 +00:00
|
|
|
LOGPCONN(conn, LOGL_ERROR, "Cause code is missing -- discarding message!\n");
|
2018-02-09 20:33:24 +00:00
|
|
|
return -EINVAL;
|
2017-04-09 10:32:51 +00:00
|
|
|
}
|
2018-02-14 11:13:35 +00:00
|
|
|
if (!TLVP_PRESENT(tp, GSM0808_IE_DLCI)) {
|
2018-02-08 23:53:17 +00:00
|
|
|
LOGPCONN(conn, LOGL_ERROR, "DLCI is missing -- discarding message!\n");
|
2018-02-09 20:33:24 +00:00
|
|
|
return -EINVAL;
|
2017-04-09 10:32:51 +00:00
|
|
|
}
|
2018-02-14 11:13:35 +00:00
|
|
|
dlci = TLVP_VAL(tp, GSM0808_IE_DLCI)[0];
|
2017-04-09 10:32:51 +00:00
|
|
|
|
|
|
|
/* Inform the MSC about the sapi "n" reject event */
|
2018-11-30 00:08:36 +00:00
|
|
|
ran_conn_sapi_n_reject(conn, dlci);
|
2017-04-09 10:32:51 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-08-07 11:00:14 +00:00
|
|
|
/* Use the speech codec info we go with the assignment complete to dtermine
|
|
|
|
* which codec we will signal to the MGW */
|
|
|
|
static enum mgcp_codecs mgcp_codec_from_sc(struct gsm0808_speech_codec *sc)
|
|
|
|
{
|
|
|
|
switch (sc->type) {
|
|
|
|
case GSM0808_SCT_FR1:
|
|
|
|
return CODEC_GSM_8000_1;
|
|
|
|
break;
|
|
|
|
case GSM0808_SCT_FR2:
|
|
|
|
return CODEC_GSMEFR_8000_1;
|
|
|
|
break;
|
|
|
|
case GSM0808_SCT_FR3:
|
|
|
|
return CODEC_AMR_8000_1;
|
|
|
|
break;
|
|
|
|
case GSM0808_SCT_FR4:
|
|
|
|
return CODEC_AMRWB_16000_1;
|
|
|
|
break;
|
|
|
|
case GSM0808_SCT_FR5:
|
|
|
|
return CODEC_AMRWB_16000_1;
|
|
|
|
break;
|
|
|
|
case GSM0808_SCT_HR1:
|
|
|
|
return CODEC_GSMHR_8000_1;
|
|
|
|
break;
|
|
|
|
case GSM0808_SCT_HR3:
|
|
|
|
return CODEC_AMR_8000_1;
|
|
|
|
break;
|
|
|
|
case GSM0808_SCT_HR4:
|
|
|
|
return CODEC_AMRWB_16000_1;
|
|
|
|
break;
|
|
|
|
case GSM0808_SCT_HR6:
|
|
|
|
return CODEC_AMRWB_16000_1;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return CODEC_PCMU_8000_1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-09 10:32:51 +00:00
|
|
|
/* Endpoint to handle assignment complete */
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
static int bssmap_rx_ass_compl(struct ran_conn *conn, struct msgb *msg,
|
2018-02-14 11:13:35 +00:00
|
|
|
struct tlv_parsed *tp)
|
2017-04-09 10:32:51 +00:00
|
|
|
{
|
|
|
|
struct sockaddr_storage rtp_addr;
|
2018-08-07 11:00:14 +00:00
|
|
|
struct gsm0808_speech_codec sc;
|
2017-04-09 10:32:51 +00:00
|
|
|
struct sockaddr_in *rtp_addr_in;
|
|
|
|
int rc;
|
|
|
|
|
2018-02-09 00:31:29 +00:00
|
|
|
LOGPCONN(conn, LOGL_INFO, "Rx BSSMAP ASSIGNMENT COMPLETE message\n");
|
2017-04-09 10:32:51 +00:00
|
|
|
|
2018-02-14 11:13:35 +00:00
|
|
|
if (!TLVP_PRESENT(tp, GSM0808_IE_AOIP_TRASP_ADDR)) {
|
2018-02-08 23:53:17 +00:00
|
|
|
LOGPCONN(conn, LOGL_ERROR, "AoIP transport identifier missing -- discarding message!\n");
|
2018-02-09 20:33:24 +00:00
|
|
|
return -EINVAL;
|
2017-04-09 10:32:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Decode AoIP transport address element */
|
2018-02-14 11:13:35 +00:00
|
|
|
rc = gsm0808_dec_aoip_trasp_addr(&rtp_addr, TLVP_VAL(tp, GSM0808_IE_AOIP_TRASP_ADDR),
|
|
|
|
TLVP_LEN(tp, GSM0808_IE_AOIP_TRASP_ADDR));
|
2017-04-09 10:32:51 +00:00
|
|
|
if (rc < 0) {
|
2018-02-08 23:53:17 +00:00
|
|
|
LOGPCONN(conn, LOGL_ERROR, "Unable to decode aoip transport address.\n");
|
2018-02-09 20:33:24 +00:00
|
|
|
return -EINVAL;
|
2017-04-09 10:32:51 +00:00
|
|
|
}
|
|
|
|
|
2018-08-07 11:00:14 +00:00
|
|
|
/* Decode speech codec (choosen) element */
|
|
|
|
rc = gsm0808_dec_speech_codec(&sc, TLVP_VAL(tp, GSM0808_IE_SPEECH_CODEC),
|
|
|
|
TLVP_LEN(tp, GSM0808_IE_SPEECH_CODEC));
|
|
|
|
if (rc < 0) {
|
|
|
|
LOGPCONN(conn, LOGL_ERROR, "Unable to decode speech codec (choosen).\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
conn->rtp.codec_ran = mgcp_codec_from_sc(&sc);
|
|
|
|
|
2017-04-09 10:32:51 +00:00
|
|
|
/* use address / port supplied with the AoIP
|
|
|
|
* transport address element */
|
|
|
|
if (rtp_addr.ss_family == AF_INET) {
|
|
|
|
rtp_addr_in = (struct sockaddr_in *)&rtp_addr;
|
2017-11-07 16:19:25 +00:00
|
|
|
msc_mgcp_ass_complete(conn, osmo_ntohs(rtp_addr_in->sin_port), inet_ntoa(rtp_addr_in->sin_addr));
|
2017-04-09 10:32:51 +00:00
|
|
|
} else {
|
2018-02-08 23:53:17 +00:00
|
|
|
LOGPCONN(conn, LOGL_ERROR, "Unsopported addressing scheme. (supports only IPV4)\n");
|
2018-02-09 20:33:24 +00:00
|
|
|
return -EINVAL;
|
2017-04-09 10:32:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: Seems to be related to authentication or,
|
|
|
|
encryption. Is this really in the right place? */
|
2018-11-30 00:08:36 +00:00
|
|
|
ran_conn_rx_sec_mode_compl(conn);
|
2017-04-09 10:32:51 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle incoming connection oriented BSSMAP messages */
|
|
|
|
static int rx_bssmap(struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info, struct msgb *msg)
|
|
|
|
{
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
struct ran_conn *conn;
|
2018-02-14 11:13:35 +00:00
|
|
|
struct tlv_parsed tp;
|
2018-02-14 13:12:24 +00:00
|
|
|
int rc;
|
2018-04-01 18:58:08 +00:00
|
|
|
uint8_t msg_type;
|
2018-02-09 00:23:25 +00:00
|
|
|
|
2017-04-09 10:32:51 +00:00
|
|
|
if (msgb_l3len(msg) < 1) {
|
2018-02-09 00:49:01 +00:00
|
|
|
LOGP(DBSSAP, LOGL_NOTICE, "Error: No data received -- discarding message!\n");
|
2017-04-09 10:32:51 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2018-04-01 18:58:08 +00:00
|
|
|
msg_type = msg->l3h[0];
|
2017-04-09 10:32:51 +00:00
|
|
|
|
2018-11-19 13:55:56 +00:00
|
|
|
rc = osmo_bssap_tlv_parse(&tp, msg->l3h + 1, msgb_l3len(msg) - 1);
|
2018-02-14 13:12:24 +00:00
|
|
|
if (rc < 0) {
|
|
|
|
LOGP(DBSSAP, LOGL_ERROR, "Failed parsing TLV -- discarding message! %s\n",
|
|
|
|
osmo_hexdump(msg->l3h, msgb_l3len(msg)));
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
2018-02-14 11:13:35 +00:00
|
|
|
|
2018-02-09 00:23:25 +00:00
|
|
|
/* Only message types allowed without a 'conn' */
|
2018-04-01 18:58:08 +00:00
|
|
|
switch (msg_type) {
|
2017-04-09 10:32:51 +00:00
|
|
|
case BSS_MAP_MSG_COMPLETE_LAYER_3:
|
2018-02-14 11:13:35 +00:00
|
|
|
return bssmap_rx_l3_compl(scu, a_conn_info, msg, &tp);
|
2018-02-09 00:23:25 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
conn = ran_conn_lookup_a(a_conn_info->network, a_conn_info->conn_id);
|
2018-02-09 00:23:25 +00:00
|
|
|
if (!conn) {
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
LOGP(DBSSAP, LOGL_ERROR, "Couldn't find ran_conn for conn_id=%d\n", a_conn_info->conn_id);
|
2018-04-01 18:55:54 +00:00
|
|
|
/* We expect a Clear Complete to come in on a valid conn. But if for some reason we still
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
* have the SCCP connection while the RAN connection data is already gone, at
|
2018-04-01 18:55:54 +00:00
|
|
|
* least close the SCCP conn. */
|
|
|
|
|
|
|
|
if (msg_type == BSS_MAP_MSG_CLEAR_COMPLETE)
|
|
|
|
return bssmap_rx_clear_complete(scu, a_conn_info, NULL);
|
|
|
|
|
2018-02-09 00:23:25 +00:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2018-04-01 18:58:08 +00:00
|
|
|
LOGPCONN(conn, LOGL_DEBUG, "Rx BSSMAP DT1 %s\n", gsm0808_bssmap_name(msg_type));
|
2018-02-09 00:23:25 +00:00
|
|
|
|
2018-04-01 18:58:08 +00:00
|
|
|
switch (msg_type) {
|
2018-02-09 00:23:25 +00:00
|
|
|
case BSS_MAP_MSG_CLEAR_RQST:
|
2018-02-14 11:13:35 +00:00
|
|
|
return bssmap_rx_clear_rqst(conn, msg, &tp);
|
2018-04-01 18:55:54 +00:00
|
|
|
case BSS_MAP_MSG_CLEAR_COMPLETE:
|
|
|
|
return bssmap_rx_clear_complete(scu, a_conn_info, conn);
|
2017-04-09 10:32:51 +00:00
|
|
|
case BSS_MAP_MSG_CLASSMARK_UPDATE:
|
2018-02-14 11:13:35 +00:00
|
|
|
return bssmap_rx_classmark_upd(conn, msg, &tp);
|
2017-04-09 10:32:51 +00:00
|
|
|
case BSS_MAP_MSG_CIPHER_MODE_COMPLETE:
|
2018-02-14 11:13:35 +00:00
|
|
|
return bssmap_rx_ciph_compl(conn, msg, &tp);
|
2017-04-09 10:32:51 +00:00
|
|
|
case BSS_MAP_MSG_CIPHER_MODE_REJECT:
|
2018-02-14 11:13:35 +00:00
|
|
|
return bssmap_rx_ciph_rej(conn, msg, &tp);
|
2017-04-09 10:32:51 +00:00
|
|
|
case BSS_MAP_MSG_ASSIGMENT_FAILURE:
|
2018-02-14 11:13:35 +00:00
|
|
|
return bssmap_rx_ass_fail(conn, msg, &tp);
|
2017-04-09 10:32:51 +00:00
|
|
|
case BSS_MAP_MSG_SAPI_N_REJECT:
|
2018-02-14 11:13:35 +00:00
|
|
|
return bssmap_rx_sapi_n_rej(conn, msg, &tp);
|
2017-04-09 10:32:51 +00:00
|
|
|
case BSS_MAP_MSG_ASSIGMENT_COMPLETE:
|
2018-02-14 11:13:35 +00:00
|
|
|
return bssmap_rx_ass_compl(conn, msg, &tp);
|
2017-04-09 10:32:51 +00:00
|
|
|
default:
|
2018-04-01 18:58:08 +00:00
|
|
|
LOGPCONN(conn, LOGL_ERROR, "Unimplemented msg type: %s\n", gsm0808_bssmap_name(msg_type));
|
2017-04-09 10:32:51 +00:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2018-02-09 20:33:24 +00:00
|
|
|
/* Endpoint to handle regular BSSAP DTAP messages. No ownership of 'msg' is passed on! */
|
2017-04-09 10:32:51 +00:00
|
|
|
static int rx_dtap(const struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info, struct msgb *msg)
|
|
|
|
{
|
|
|
|
struct gsm_network *network = a_conn_info->network;
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
struct ran_conn *conn;
|
2018-04-09 14:35:01 +00:00
|
|
|
struct dtap_header *dtap = (struct dtap_header *) msg->l2h;
|
2017-04-09 10:32:51 +00:00
|
|
|
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
conn = ran_conn_lookup_a(network, a_conn_info->conn_id);
|
2017-04-09 10:32:51 +00:00
|
|
|
if (!conn) {
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2018-02-09 00:05:27 +00:00
|
|
|
LOGPCONN(conn, LOGL_DEBUG, "Rx DTAP %s\n", msgb_hexdump_l2(msg));
|
2017-04-09 10:32:51 +00:00
|
|
|
|
2018-11-30 00:08:36 +00:00
|
|
|
/* ran_conn_dtap expects the dtap payload in l3h */
|
2017-04-09 10:32:51 +00:00
|
|
|
msg->l3h = msg->l2h + 3;
|
2018-04-09 14:35:01 +00:00
|
|
|
OMSC_LINKID_CB(msg) = dtap->link_id;
|
2017-04-09 10:32:51 +00:00
|
|
|
|
2017-09-07 09:39:58 +00:00
|
|
|
/* Forward dtap payload into the msc */
|
2018-11-30 00:08:36 +00:00
|
|
|
ran_conn_dtap(conn, msg);
|
2017-04-09 10:32:51 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-02-09 20:33:24 +00:00
|
|
|
/* Handle incoming connection oriented messages. No ownership of 'msg' is passed on! */
|
2017-12-18 03:06:04 +00:00
|
|
|
int a_sccp_rx_dt(struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info, struct msgb *msg)
|
2017-04-09 10:32:51 +00:00
|
|
|
{
|
|
|
|
OSMO_ASSERT(scu);
|
|
|
|
OSMO_ASSERT(a_conn_info);
|
|
|
|
OSMO_ASSERT(msg);
|
|
|
|
|
|
|
|
if (msgb_l2len(msg) < sizeof(struct bssmap_header)) {
|
2018-02-09 00:49:01 +00:00
|
|
|
LOGP(DBSSAP, LOGL_NOTICE, "The header is too short -- discarding message!\n");
|
2017-09-07 09:39:58 +00:00
|
|
|
return -EINVAL;
|
2017-04-09 10:32:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (msg->l2h[0]) {
|
|
|
|
case BSSAP_MSG_BSS_MANAGEMENT:
|
|
|
|
msg->l3h = &msg->l2h[sizeof(struct bssmap_header)];
|
|
|
|
return rx_bssmap(scu, a_conn_info, msg);
|
|
|
|
case BSSAP_MSG_DTAP:
|
|
|
|
return rx_dtap(scu, a_conn_info, msg);
|
|
|
|
default:
|
2018-02-09 00:49:01 +00:00
|
|
|
LOGP(DBSSAP, LOGL_ERROR, "Unimplemented BSSAP msg type: %s\n", gsm0808_bssap_name(msg->l2h[0]));
|
2017-04-09 10:32:51 +00:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return -EINVAL;
|
|
|
|
}
|