Osmocom Mobile Switching Centre
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
osmo-msc/src/libmsc/msc_vty.c

1748 lines
50 KiB

/* MSC interface to quagga VTY */
/* (C) 2016-2018 by sysmocom s.m.f.c. GmbH <info@sysmocom.de>
* Based on OpenBSC interface to quagga VTY (libmsc/vty_interface_layer3.c)
* (C) 2009-2017 by Harald Welte <laforge@gnumonks.org>
* (C) 2009-2011 by Holger Hans Peter Freyther
* All Rights Reserved
*
* 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/>.
*
*/
/* NOTE: I would have liked to call this the MSC_NODE instead of the MSC_NODE,
* but MSC_NODE already exists to configure a remote MSC for osmo-bsc. */
#include "../../bscconfig.h"
#include <inttypes.h>
#include <limits.h>
#include <osmocom/gsm/protocol/gsm_08_58.h>
#include <osmocom/gsm/protocol/gsm_04_14.h>
#include <osmocom/gsm/protocol/gsm_08_08.h>
#include <osmocom/sigtran/sccp_helpers.h>
#include <osmocom/vty/command.h>
#include <osmocom/vty/logging.h>
#include <osmocom/vty/misc.h>
#include <osmocom/vty/stats.h>
#ifdef BUILD_IU
#include <osmocom/ranap/iu_client.h>
#endif
#include <osmocom/msc/vty.h>
#include <osmocom/msc/gsm_data.h>
#include <osmocom/msc/gsm_subscriber.h>
#include <osmocom/msc/vlr.h>
#include <osmocom/msc/transaction.h>
#include <osmocom/msc/db.h>
#include <osmocom/msc/a_iface.h>
#include <osmocom/msc/sms_queue.h>
#include <osmocom/msc/silent_call.h>
#include <osmocom/msc/gsm_04_80.h>
#include <osmocom/msc/gsm_04_14.h>
#include <osmocom/msc/signal.h>
#include <osmocom/msc/mncc_int.h>
#include <osmocom/msc/rrlp.h>
#include <osmocom/msc/vlr_sgs.h>
#include <osmocom/msc/sgs_vty.h>
static struct gsm_network *gsmnet = NULL;
struct cmd_node net_node = {
GSMNET_NODE,
"%s(config-net)# ",
1,
};
#define VSUB_USE_VTY "VTY"
#define NETWORK_STR "Configure the GSM network\n"
#define CODE_CMD_STR "Code commands\n"
#define NAME_CMD_STR "Name Commands\n"
#define NAME_STR "Name to use\n"
DEFUN(cfg_net,
cfg_net_cmd,
"network", NETWORK_STR)
{
vty->index = gsmnet;
vty->node = GSMNET_NODE;
return CMD_SUCCESS;
}
DEFUN(cfg_net_ncc,
cfg_net_ncc_cmd,
"network country code <1-999>",
"Set the GSM network country code\n"
"Country commands\n"
CODE_CMD_STR
"Network Country Code to use\n")
{
gsmnet->plmn.mcc = atoi(argv[0]);
return CMD_SUCCESS;
}
DEFUN(cfg_net_mnc,
cfg_net_mnc_cmd,
"mobile network code <0-999>",
"Set the GSM mobile network code\n"
"Network Commands\n"
CODE_CMD_STR
"Mobile Network Code to use\n")
{
uint16_t mnc;
bool mnc_3_digits;
if (osmo_mnc_from_str(argv[0], &mnc, &mnc_3_digits)) {
vty_out(vty, "%% Error decoding MNC: %s%s", argv[0], VTY_NEWLINE);
return CMD_WARNING;
}
gsmnet->plmn.mnc = mnc;
gsmnet->plmn.mnc_3_digits = mnc_3_digits;
return CMD_SUCCESS;
}
DEFUN(cfg_net_name_short,
cfg_net_name_short_cmd,
"short name NAME",
"Set the short GSM network name\n" NAME_CMD_STR NAME_STR)
{
osmo_talloc_replace_string(gsmnet, &gsmnet->name_short, argv[0]);
return CMD_SUCCESS;
}
DEFUN(cfg_net_name_long,
cfg_net_name_long_cmd,
"long name NAME",
"Set the long GSM network name\n" NAME_CMD_STR NAME_STR)
{
osmo_talloc_replace_string(gsmnet, &gsmnet->name_long, argv[0]);
return CMD_SUCCESS;
}
DEFUN(cfg_net_encryption,
cfg_net_encryption_cmd,
"encryption a5 <0-3> [<0-3>] [<0-3>] [<0-3>]",
"Encryption options\n"
"GSM A5 Air Interface Encryption\n"
"A5/n Algorithm Number\n"
"A5/n Algorithm Number\n"
"A5/n Algorithm Number\n"
"A5/n Algorithm Number\n")
{
unsigned int i;
gsmnet->a5_encryption_mask = 0;
for (i = 0; i < argc; i++)
gsmnet->a5_encryption_mask |= (1 << atoi(argv[i]));
return CMD_SUCCESS;
}
DEFUN(cfg_net_authentication,
cfg_net_authentication_cmd,
"authentication (optional|required)",
"Whether to enforce MS authentication in 2G\n"
"Allow MS to attach via 2G BSC without authentication\n"
"Always do authentication\n")
{
gsmnet->authentication_required = (argv[0][0] == 'r') ? true : false;
return CMD_SUCCESS;
}
DEFUN(cfg_net_rrlp_mode, cfg_net_rrlp_mode_cmd,
"rrlp mode (none|ms-based|ms-preferred|ass-preferred)",
"Radio Resource Location Protocol\n"
"Set the Radio Resource Location Protocol Mode\n"
"Don't send RRLP request\n"
"Request MS-based location\n"
"Request any location, prefer MS-based\n"
"Request any location, prefer MS-assisted\n")
{
gsmnet->rrlp.mode = msc_rrlp_mode_parse(argv[0]);
return CMD_SUCCESS;
}
DEFUN(cfg_net_mm_info, cfg_net_mm_info_cmd,
"mm info (0|1)",
"Mobility Management\n"
"Send MM INFO after LOC UPD ACCEPT\n"
"Disable\n" "Enable\n")
{
gsmnet->send_mm_info = atoi(argv[0]);
return CMD_SUCCESS;
}
DEFUN(cfg_net_timezone,
cfg_net_timezone_cmd,
"timezone <-19-19> (0|15|30|45)",
"Set the Timezone Offset of the network\n"
"Timezone offset (hours)\n"
"Timezone offset (00 minutes)\n"
"Timezone offset (15 minutes)\n"
"Timezone offset (30 minutes)\n"
"Timezone offset (45 minutes)\n"
)
{
struct gsm_network *net = vty->index;
int tzhr = atoi(argv[0]);
int tzmn = atoi(argv[1]);
net->tz.hr = tzhr;
net->tz.mn = tzmn;
net->tz.dst = 0;
net->tz.override = 1;
return CMD_SUCCESS;
}
DEFUN(cfg_net_timezone_dst,
cfg_net_timezone_dst_cmd,
"timezone <-19-19> (0|15|30|45) <0-2>",
"Set the Timezone Offset of the network\n"
"Timezone offset (hours)\n"
"Timezone offset (00 minutes)\n"
"Timezone offset (15 minutes)\n"
"Timezone offset (30 minutes)\n"
"Timezone offset (45 minutes)\n"
"DST offset (hours)\n"
)
{
struct gsm_network *net = vty->index;
int tzhr = atoi(argv[0]);
int tzmn = atoi(argv[1]);
int tzdst = atoi(argv[2]);
net->tz.hr = tzhr;
net->tz.mn = tzmn;
net->tz.dst = tzdst;
net->tz.override = 1;
return CMD_SUCCESS;
}
DEFUN(cfg_net_no_timezone,
cfg_net_no_timezone_cmd,
"no timezone",
NO_STR
"Disable network timezone override, use system tz\n")
{
struct gsm_network *net = vty->index;
net->tz.override = 0;
return CMD_SUCCESS;
}
DEFUN(cfg_net_per_loc_upd, cfg_net_per_loc_upd_cmd,
"periodic location update <6-1530>",
"Periodic Location Updating Interval\n"
"Periodic Location Updating Interval\n"
"Periodic Location Updating Interval\n"
"Periodic Location Updating Interval in Minutes\n")
{
struct gsm_network *net = vty->index;
net->t3212 = atoi(argv[0]) / 6;
return CMD_SUCCESS;
}
DEFUN(cfg_net_no_per_loc_upd, cfg_net_no_per_loc_upd_cmd,
"no periodic location update",
NO_STR
"Periodic Location Updating Interval\n"
"Periodic Location Updating Interval\n"
"Periodic Location Updating Interval\n")
{
struct gsm_network *net = vty->index;
net->t3212 = 0;
return CMD_SUCCESS;
}
static int config_write_net(struct vty *vty)
{
int i;
vty_out(vty, "network%s", VTY_NEWLINE);
vty_out(vty, " network country code %s%s", osmo_mcc_name(gsmnet->plmn.mcc), VTY_NEWLINE);
vty_out(vty, " mobile network code %s%s",
osmo_mnc_name(gsmnet->plmn.mnc, gsmnet->plmn.mnc_3_digits), VTY_NEWLINE);
vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE);
vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE);
vty_out(vty, " encryption a5");
for (i = 0; i < 8; i++) {
if (gsmnet->a5_encryption_mask & (1 << i))
vty_out(vty, " %u", i);
}
vty_out(vty, "%s", VTY_NEWLINE);
vty_out(vty, " authentication %s%s",
gsmnet->authentication_required ? "required" : "optional", VTY_NEWLINE);
vty_out(vty, " rrlp mode %s%s", msc_rrlp_mode_name(gsmnet->rrlp.mode),
VTY_NEWLINE);
vty_out(vty, " mm info %u%s", gsmnet->send_mm_info, VTY_NEWLINE);
if (gsmnet->tz.override != 0) {
if (gsmnet->tz.dst)
vty_out(vty, " timezone %d %d %d%s",
gsmnet->tz.hr, gsmnet->tz.mn, gsmnet->tz.dst,
VTY_NEWLINE);
else
vty_out(vty, " timezone %d %d%s",
gsmnet->tz.hr, gsmnet->tz.mn, VTY_NEWLINE);
}
if (gsmnet->t3212 == 0)
vty_out(vty, " no periodic location update%s", VTY_NEWLINE);
else
vty_out(vty, " periodic location update %u%s",
gsmnet->t3212 * 6, VTY_NEWLINE);
if (gsmnet->emergency.route_to_msisdn) {
vty_out(vty, " emergency-call route-to-msisdn %s%s",
gsmnet->emergency.route_to_msisdn, VTY_NEWLINE);
}
return CMD_SUCCESS;
}
static struct cmd_node msc_node = {
MSC_NODE,
"%s(config-msc)# ",
1,
};
DEFUN(cfg_msc, cfg_msc_cmd,
"msc", "Configure MSC options")
{
vty->node = MSC_NODE;
return CMD_SUCCESS;
}
#define MNCC_STR "Configure Mobile Network Call Control\n"
#define MNCC_GUARD_TIMEOUT_STR "Set global guard timer for mncc interface activity\n"
#define MNCC_GUARD_TIMEOUT_VALUE_STR "guard timer value (sec.)\n"
DEFUN(cfg_msc_mncc_internal,
cfg_msc_mncc_internal_cmd,
"mncc internal",
MNCC_STR "Use internal MNCC handler (default; changes need a program restart)\n")
{
gsm_network_set_mncc_sock_path(gsmnet, NULL);
return CMD_SUCCESS;
}
DEFUN(cfg_msc_mncc_external,
cfg_msc_mncc_external_cmd,
"mncc external MNCC_SOCKET_PATH",
MNCC_STR "Use external MNCC handler (changes need a program restart)\n"
"File system path to create the MNCC unix domain socket at\n")
{
gsm_network_set_mncc_sock_path(gsmnet, argv[0]);
return CMD_SUCCESS;
}
DEFUN(cfg_msc_mncc_guard_timeout,
cfg_msc_mncc_guard_timeout_cmd,
"mncc guard-timeout <0-255>",
MNCC_STR
MNCC_GUARD_TIMEOUT_STR MNCC_GUARD_TIMEOUT_VALUE_STR)
{
gsmnet->mncc_guard_timeout = atoi(argv[0]);
return CMD_SUCCESS;
}
ALIAS_DEPRECATED(cfg_msc_mncc_guard_timeout,
cfg_msc_deprecated_mncc_guard_timeout_cmd,
"mncc-guard-timeout <0-255>",
MNCC_GUARD_TIMEOUT_STR MNCC_GUARD_TIMEOUT_VALUE_STR);
#define NCSS_STR "Configure call independent Supplementary Services\n"
DEFUN(cfg_msc_ncss_guard_timeout,
cfg_msc_ncss_guard_timeout_cmd,
"ncss guard-timeout <0-255>",
NCSS_STR "Set guard timer for session activity\n"
"guard timer value (sec.), or 0 to disable\n")
{
gsmnet->ncss_guard_timeout = atoi(argv[0]);
return CMD_SUCCESS;
}
DEFUN(cfg_msc_assign_tmsi, cfg_msc_assign_tmsi_cmd,
"assign-tmsi",
"Assign TMSI during Location Updating.\n")
{
gsmnet->vlr->cfg.assign_tmsi = true;
return CMD_SUCCESS;
}
DEFUN(cfg_msc_no_assign_tmsi, cfg_msc_no_assign_tmsi_cmd,
"no assign-tmsi",
NO_STR "Assign TMSI during Location Updating.\n")
{
gsmnet->vlr->cfg.assign_tmsi = false;
return CMD_SUCCESS;
}
DEFUN(cfg_msc_cs7_instance_a,
cfg_msc_cs7_instance_a_cmd,
"cs7-instance-a <0-15>",
"Set SS7 to be used by the A-Interface.\n" "SS7 instance reference number\n")
{
gsmnet->a.cs7_instance = atoi(argv[0]);
return CMD_SUCCESS;
}
DEFUN(cfg_msc_cs7_instance_iu,
cfg_msc_cs7_instance_iu_cmd,
"cs7-instance-iu <0-15>",
"Set SS7 to be used by the Iu-Interface.\n" "SS7 instance reference number\n")
{
#if BUILD_IU
gsmnet->iu.cs7_instance = atoi(argv[0]);
return CMD_SUCCESS;
#else
vty_out(vty, "WARNING: 'cs7-instance-iu' without effect: built without Iu support%s",
VTY_NEWLINE);
return CMD_WARNING;
#endif
}
DEFUN(cfg_msc_auth_tuple_max_reuse_count, cfg_msc_auth_tuple_max_reuse_count_cmd,
"auth-tuple-max-reuse-count <-1-2147483647>",
"Configure authentication tuple re-use\n"
"0 to use each auth tuple at most once (default), >0 to limit re-use, -1 to re-use infinitely (vulnerable!).\n")
{
gsmnet->vlr->cfg.auth_tuple_max_reuse_count = atoi(argv[0]);
return CMD_SUCCESS;
}
DEFUN(cfg_msc_auth_tuple_reuse_on_error, cfg_msc_auth_tuple_reuse_on_error_cmd,
"auth-tuple-reuse-on-error (0|1)",
"Configure authentication tuple re-use when HLR is not responsive\n"
"Never re-use auth tuples beyond auth-tuple-max-reuse-count (default)\n"
"If the HLR does not deliver new tuples, do re-use already available old ones.\n")
{
gsmnet->vlr->cfg.auth_reuse_old_sets_on_error = atoi(argv[0]) ? true : false;
return CMD_SUCCESS;
}
DEFUN(cfg_msc_check_imei_rqd, cfg_msc_check_imei_rqd_cmd,
"check-imei-rqd (0|1)",
"Send each IMEI to the EIR to ask if it is permitted or not. The EIR is implemented as part of OsmoHLR, "
"and can optionally save the IMEI in the HLR.\n"
"Do not send IMEIs to the EIR\n"
"Send each IMEI to the EIR\n")
{
gsmnet->vlr->cfg.check_imei_rqd = atoi(argv[0]) ? true : false;
return CMD_SUCCESS;
}
DEFUN(cfg_msc_paging_response_timer, cfg_msc_paging_response_timer_cmd,
"paging response-timer (default|<1-65535>)",
"Configure Paging\n"
"Set Paging timeout, the minimum time to pass between (unsuccessful) Pagings sent towards"
" BSS or RNC\n"
"Set to default timeout (" OSMO_STRINGIFY_VAL(MSC_PAGING_RESPONSE_TIMER_DEFAULT) " seconds)\n"
"Set paging timeout in seconds\n")
{
if (!strcmp(argv[1], "default"))
gsmnet->paging_response_timer = MSC_PAGING_RESPONSE_TIMER_DEFAULT;
else
gsmnet->paging_response_timer = atoi(argv[0]);
return CMD_SUCCESS;
}
DEFUN(cfg_msc_emergency_msisdn, cfg_msc_emergency_msisdn_cmd,
"emergency-call route-to-msisdn MSISDN",
"Configure Emergency Call Behaviour\n"
"MSISDN to which Emergency Calls are Dispatched\n"
"MSISDN (E.164 Phone Number)\n")
{
osmo_talloc_replace_string(gsmnet, &gsmnet->emergency.route_to_msisdn, argv[0]);
return CMD_SUCCESS;
}
/* TODO: to be deprecated as soon as we rip SMS handling out (see OS#3587) */
DEFUN(cfg_msc_sms_over_gsup, cfg_msc_sms_over_gsup_cmd,
"sms-over-gsup",
"Enable routing of SMS messages over GSUP\n")
{
gsmnet->sms_over_gsup = true;
return CMD_SUCCESS;
}
/* TODO: to be deprecated as soon as we rip SMS handling out (see OS#3587) */
DEFUN(cfg_msc_no_sms_over_gsup, cfg_msc_no_sms_over_gsup_cmd,
"no sms-over-gsup",
NO_STR "Disable routing of SMS messages over GSUP\n")
{
gsmnet->sms_over_gsup = false;
return CMD_SUCCESS;
}
static int config_write_msc(struct vty *vty)
{
vty_out(vty, "msc%s", VTY_NEWLINE);
if (gsmnet->mncc_sock_path)
vty_out(vty, " mncc external %s%s", gsmnet->mncc_sock_path, VTY_NEWLINE);
vty_out(vty, " mncc guard-timeout %i%s",
gsmnet->mncc_guard_timeout, VTY_NEWLINE);
vty_out(vty, " ncss guard-timeout %i%s",
gsmnet->ncss_guard_timeout, VTY_NEWLINE);
vty_out(vty, " %sassign-tmsi%s",
gsmnet->vlr->cfg.assign_tmsi? "" : "no ", VTY_NEWLINE);
vty_out(vty, " cs7-instance-a %u%s", gsmnet->a.cs7_instance,
VTY_NEWLINE);
#if BUILD_IU
vty_out(vty, " cs7-instance-iu %u%s", gsmnet->iu.cs7_instance,
VTY_NEWLINE);
#endif
if (gsmnet->vlr->cfg.auth_tuple_max_reuse_count)
vty_out(vty, " auth-tuple-max-reuse-count %d%s",
OSMO_MAX(-1, gsmnet->vlr->cfg.auth_tuple_max_reuse_count),
VTY_NEWLINE);
if (gsmnet->vlr->cfg.auth_reuse_old_sets_on_error)
vty_out(vty, " auth-tuple-reuse-on-error 1%s",
VTY_NEWLINE);
if (gsmnet->vlr->cfg.check_imei_rqd)
vty_out(vty, " check-imei-rqd 1 %s",
VTY_NEWLINE);
if (gsmnet->paging_response_timer != MSC_PAGING_RESPONSE_TIMER_DEFAULT)
vty_out(vty, " paging response-timer %u%s", gsmnet->paging_response_timer, VTY_NEWLINE);
if (gsmnet->emergency.route_to_msisdn) {
vty_out(vty, " emergency-call route-to-msisdn %s%s",
gsmnet->emergency.route_to_msisdn, VTY_NEWLINE);
}
if (gsmnet->sms_over_gsup)
vty_out(vty, " sms-over-gsup%s", VTY_NEWLINE);
mgcp_client_config_write(vty, " ");
#ifdef BUILD_IU
ranap_iu_vty_config_write(vty, " ");
#endif
return CMD_SUCCESS;
}
DEFUN(show_bsc, show_bsc_cmd,
"show bsc", SHOW_STR "BSC\n")
{
struct bsc_context *bsc_ctx;
struct osmo_ss7_instance *ss7 = osmo_ss7_instance_find(gsmnet->a.cs7_instance);
llist_for_each_entry(bsc_ctx, &gsmnet->a.bscs, list) {
vty_out(vty, "BSC %s%s", osmo_sccp_addr_name(ss7, &bsc_ctx->bsc_addr), VTY_NEWLINE);
}
return CMD_SUCCESS;
}
static void vty_conn_hdr(struct vty *vty)
{
unsigned lnum = 0;
struct ran_conn *conn;
llist_for_each_entry(conn, &gsmnet->ran_conns, entry)
lnum++;
if (lnum)
vty_out(vty, "--ConnId RAN --LAC Use --Tokens C A5 State ------------ Subscriber%s",
VTY_NEWLINE);
}
static void vty_dump_one_conn(struct vty *vty, const struct ran_conn *conn)
{
vty_out(vty, "%08x %3s %5u %3u %08x %c /%1u %27s %22s%s",
conn->a.conn_id,
osmo_rat_type_name(conn->via_ran),
conn->lac,
conn->use_count,
conn->use_tokens,
conn->received_cm_service_request ? 'C' : '-',
conn->geran_encr.alg_id,
conn->fi ? osmo_fsm_inst_state_name(conn->fi) : "-",
conn->vsub ? vlr_subscr_name(conn->vsub) : "-",
VTY_NEWLINE);
}
DEFUN(show_msc_conn, show_msc_conn_cmd,
"show connection", SHOW_STR "Subscriber Connections\n")
{
struct ran_conn *conn;
vty_conn_hdr(vty);
llist_for_each_entry(conn, &gsmnet->ran_conns, entry)
vty_dump_one_conn(vty, conn);
return CMD_SUCCESS;
}
static void vty_trans_hdr(struct vty *vty)
{
unsigned lnum = 0;
struct gsm_trans *trans;
llist_for_each_entry(trans, &gsmnet->trans_list, entry)
lnum++;
if (lnum)
vty_out(vty, "--ConnId -P TI -CallRef [--- Proto ---] ------------ Subscriber%s",
VTY_NEWLINE);
}
static const char *get_trans_proto_str(const struct gsm_trans *trans)
{
static char buf[256];
switch (trans->protocol) {
case GSM48_PDISC_CC:
snprintf(buf, sizeof(buf), "%s %4u %4u",
gsm48_cc_state_name(trans->cc.state),
trans->cc.Tcurrent,
trans->cc.T308_second);
break;
case GSM48_PDISC_SMS:
snprintf(buf, sizeof(buf), "%s %s",
gsm411_cp_state_name(trans->sms.smc_inst.cp_state),
gsm411_rp_state_name(trans->sms.smr_inst.rp_state));
break;
default:
buf[0] = '\0';
break;
}
return buf;
}
static void vty_dump_one_trans(struct vty *vty, const struct gsm_trans *trans)
{
vty_out(vty, "%08x %s %02u %08x [%s] %22s%s",
trans->conn ? trans->conn->a.conn_id : 0,
gsm48_pdisc_name(trans->protocol),
trans->transaction_id,
trans->callref,
get_trans_proto_str(trans),
trans->vsub ? vlr_subscr_name(trans->vsub) : "-",
VTY_NEWLINE);
}
DEFUN(show_msc_transaction, show_msc_transaction_cmd,
"show transaction", SHOW_STR "Transactions\n")
{
struct gsm_trans *trans;
vty_trans_hdr(vty);
llist_for_each_entry(trans, &gsmnet->trans_list, entry)
vty_dump_one_trans(vty, trans);
return CMD_SUCCESS;
}
static void subscr_dump_full_vty(struct vty *vty, struct vlr_subscr *vsub)
{
struct gsm_trans *trans;
int reqs;
struct llist_head *entry;
char buf[128];
if (strlen(vsub->name))
vty_out(vty, " Name: '%s'%s", vsub->name, VTY_NEWLINE);
if (strlen(vsub->msisdn))
vty_out(vty, " Extension: %s%s", vsub->msisdn,
VTY_NEWLINE);
vty_out(vty, " LAC: %d/0x%x%s",
vsub->cgi.lai.lac, vsub->cgi.lai.lac, VTY_NEWLINE);
vty_out(vty, " RAN: %s%s",
osmo_rat_type_name(vsub->cs.attached_via_ran), VTY_NEWLINE);
vty_out(vty, " IMSI: %s%s", vsub->imsi, VTY_NEWLINE);
if (vsub->tmsi != GSM_RESERVED_TMSI)
vty_out(vty, " TMSI: %08X%s", vsub->tmsi,
VTY_NEWLINE);
if (vsub->tmsi_new != GSM_RESERVED_TMSI)
vty_out(vty, " new TMSI: %08X%s", vsub->tmsi_new,
VTY_NEWLINE);
if (vsub->imei[0] != '\0')
vty_out(vty, " IMEI: %s%s", vsub->imei, VTY_NEWLINE);
if (vsub->imeisv[0] != '\0')
vty_out(vty, " IMEISV: %s%s", vsub->imeisv, VTY_NEWLINE);
vty_out(vty, " Flags: %s", VTY_NEWLINE);
vty_out(vty, " IMSI detached: %s%s",
vsub->imsi_detached_flag ? "true" : "false", VTY_NEWLINE);
vty_out(vty, " Conf. by radio contact: %s%s",
vsub->conf_by_radio_contact_ind ? "true" : "false",
VTY_NEWLINE);
vty_out(vty, " Subscr. data conf. by HLR: %s%s",
vsub->sub_dataconf_by_hlr_ind ? "true" : "false", VTY_NEWLINE);
vty_out(vty, " Location conf. in HLR: %s%s",
vsub->loc_conf_in_hlr_ind ? "true" : "false", VTY_NEWLINE);
vty_out(vty, " Subscriber dormant: %s%s",
vsub->dormant_ind ? "true" : "false", VTY_NEWLINE);
vty_out(vty, " Received cancel locataion: %s%s",
vsub->cancel_loc_rx ? "true" : "false", VTY_NEWLINE);
vty_out(vty, " MS not reachable: %s%s",
vsub->ms_not_reachable_flag ? "true" : "false", VTY_NEWLINE);
vty_out(vty, " LA allowed: %s%s",
vsub->la_allowed ? "true" : "false", VTY_NEWLINE);
#if 0
/* TODO: add this to vlr_subscr? */
if (vsub->auth_info.auth_algo != AUTH_ALGO_NONE) {
struct gsm_auth_info *i = &vsub->auth_info;
vty_out(vty, " A3A8 algorithm id: %d%s",
i->auth_algo, VTY_NEWLINE);
vty_out(vty, " A3A8 Ki: %s%s",
osmo_hexdump(i->a3a8_ki, i->a3a8_ki_len),
VTY_NEWLINE);
}
#endif
if (vsub->last_tuple) {
struct vlr_auth_tuple *t = vsub->last_tuple;
vty_out(vty, " A3A8 last tuple (used %d times):%s",
t->use_count, VTY_NEWLINE);
vty_out(vty, " seq # : %d%s",
t->key_seq, VTY_NEWLINE);
vty_out(vty, " RAND : %s%s",
osmo_hexdump(t->vec.rand, sizeof(t->vec.rand)),
VTY_NEWLINE);
vty_out(vty, " SRES : %s%s",
osmo_hexdump(t->vec.sres, sizeof(t->vec.sres)),
VTY_NEWLINE);
vty_out(vty, " Kc : %s%s",
osmo_hexdump(t->vec.kc, sizeof(t->vec.kc)),
VTY_NEWLINE);
}
reqs = 0;
llist_for_each(entry, &vsub->cs.requests)
reqs += 1;
vty_out(vty, " Paging: %s paging for %d requests%s",
vsub->cs.is_paging ? "is" : "not", reqs, VTY_NEWLINE);
/* SGs related */
vty_out(vty, " SGs-state: %s%s",
osmo_fsm_inst_state_name(vsub->sgs_fsm), VTY_NEWLINE);
if (strlen(vsub->sgs.mme_name))
vty_out(vty, " SGs-MME: %s%s", vsub->sgs.mme_name, VTY_NEWLINE);
else
vty_out(vty, " SGs-MME: (none)%s", VTY_NEWLINE);
vty_out(vty, " Use: %s%s", osmo_use_count_name_buf(buf, sizeof(buf), &vsub->use_count), VTY_NEWLINE);
/* Connection */
if (vsub->msc_conn_ref) {
struct ran_conn *conn = vsub->msc_conn_ref;
vty_conn_hdr(vty);
vty_dump_one_conn(vty, conn);
}
/* Transactions */
vty_trans_hdr(vty);
llist_for_each_entry(trans, &gsmnet->trans_list, entry) {
if (trans->vsub != vsub)
continue;