iu_client: derive local SCCP addr from sccp instance

ranap_iu_init() is passed an sccp instance that has a local primary point code.
Use this primary PC by default as the local address for IuCS and IuPS clients.

Remove the current vty command 'iu local-address point-code PC':
- It is possible that we would like to configure a differing local point code
  at some point; this should then happen via sccp address book entries, not
  parsing PC directly.
- Obtaining the local PC from the SCCP instance makes this command obsolete for
  all setups we're currently aiming at: one local PC per SCCP instance.
- There are vty doc failures in this vty command, which cause osmo-msc and
  osmo-bsc vty test failures; rather than fixing this, let's drop it entirely
  until we see a need for it (and then do it properly with the address book).

Cosmetic: prefix the local static variable with g_* like g_sccp and g_scu and
define it in the same place. No default values are needed anymore, it gets
overwritten in ranap_iu_init().

Change-Id: I3bb7fc1cd5261d214c6ba0cccfe95f637e6db087
This commit is contained in:
Neels Hofmeyr 2017-08-12 18:02:44 +02:00 committed by Harald Welte
parent e485cdd38b
commit 1aef9a6e1f
2 changed files with 3 additions and 27 deletions

View File

@ -83,6 +83,7 @@ static LLIST_HEAD(rnc_list);
static struct osmo_sccp_instance *g_sccp;
static struct osmo_sccp_user *g_scu;
static struct osmo_sccp_addr g_local_sccp_addr;
const struct value_string ranap_iu_event_type_names[] = {
OSMO_VALUE_STRING(RANAP_IU_EVENT_RAB_ASSIGN),
@ -584,13 +585,6 @@ static void cn_ranap_handle_cl(void *ctx, ranap_message *message)
* Paging
***********************************************************************/
struct osmo_sccp_addr local_sccp_addr = {
.presence = OSMO_SCCP_ADDR_T_SSN | OSMO_SCCP_ADDR_T_PC,
.ri = OSMO_SCCP_RI_SSN_PC,
.ssn = OSMO_SCCP_SSN_RANAP,
.pc = 1,
};
/* Send a paging command down a given SCCP User. tmsi and paging_cause are
* optional and may be passed NULL and 0, respectively, to disable their use.
* See enum RANAP_PagingCause.
@ -604,7 +598,7 @@ static int iu_tx_paging_cmd(struct osmo_sccp_addr *called_addr,
struct msgb *msg;
msg = ranap_new_msg_paging_cmd(imsi, tmsi, is_ps? 1 : 0, paging_cause);
msg->l2h = msg->data;
osmo_sccp_tx_unitdata_msg(g_scu, &local_sccp_addr, called_addr, msg);
osmo_sccp_tx_unitdata_msg(g_scu, &g_local_sccp_addr, called_addr, msg);
return 0;
}
@ -776,6 +770,7 @@ int ranap_iu_init(void *ctx, int log_subsystem, const char *sccp_user_name, stru
global_iu_recv_cb = iu_recv_cb;
global_iu_event_cb = iu_event_cb;
g_sccp = sccp;
osmo_sccp_local_addr_by_instance(&g_local_sccp_addr, sccp, OSMO_SCCP_SSN_RANAP);
g_scu = osmo_sccp_user_bind(g_sccp, sccp_user_name, sccp_sap_up, OSMO_SCCP_SSN_RANAP);
return 0;

View File

@ -75,21 +75,6 @@ DEFUN(cfg_iu_rab_assign_addr_enc, cfg_iu_rab_assign_addr_enc_cmd,
return CMD_SUCCESS;
}
extern struct osmo_sccp_addr local_sccp_addr;
DEFUN(cfg_iu_local_addr_pc, cfg_iu_local_addr_pc_cmd,
"iu local-address point-code PC",
IU_STR "Local SCCP Address\n")
{
local_sccp_addr.presence = OSMO_SCCP_ADDR_T_PC | OSMO_SCCP_ADDR_T_SSN;
local_sccp_addr.ri = OSMO_SCCP_RI_SSN_PC;
local_sccp_addr.pc = osmo_ss7_pointcode_parse(NULL, argv[0]);
return CMD_SUCCESS;
}
/* TODO: GT address configuration, in line with 4.5.1.1.1 of TS 25.410 */
int ranap_iu_vty_config_write(struct vty *vty, const char *indent)
{
if (!g_rab_assign_addr_enc) {
@ -113,9 +98,6 @@ int ranap_iu_vty_config_write(struct vty *vty, const char *indent)
return CMD_WARNING;
}
vty_out(vty, "%siu local-address point-code %s%s", indent,
osmo_ss7_pointcode_print(NULL, local_sccp_addr.pc), VTY_NEWLINE);
if (asn_debug)
vty_out(vty, "%sasn1 debug 1%s", indent, VTY_NEWLINE);
@ -130,7 +112,6 @@ void ranap_iu_vty_init(int iu_parent_node, enum ranap_nsap_addr_enc *rab_assign_
g_rab_assign_addr_enc = rab_assign_addr_enc;
install_element(iu_parent_node, &cfg_iu_rab_assign_addr_enc_cmd);
install_element(iu_parent_node, &cfg_iu_local_addr_pc_cmd);
/* Technically, these are global ASN.1 settings and not necessarily limited to the Iu interface.
* Practically, only Iu users will use ASN.1 in Osmocom programs -- at least so far. So it is