add VTY commands: mncc internal / external (== -M)
So far the only way to use external MNCC is to pass the -M cmdline arg: osmo-msc -M /path/to/socket However, the osmo-msc.service file for systemd is installed by 'make install', and hence it is quite impractical to depend on such a config item to be required in the service file: - It defies any scheme an operator may have in place to compose the osmo-msc.cfg file -- this option doesn't go in the .cfg file but needs separate action to add to the installed service file. - After a make install or package upgrades / re-installations, this option will be plain overwritten silently, or lead to the need for resolving file conflicts. The initial spark for this came from configuring the 35c3 GSM from cfg templates. Change-Id: I2ec59d5eba407f83295528b51b93678d446b9ceechanges/31/12131/7
parent
05c5680ba1
commit
80447ebe6c
|
@ -140,6 +140,7 @@ struct gsm_network {
|
|||
struct osmo_counter *active_nc_ss;
|
||||
|
||||
/* layer 4 */
|
||||
char *mncc_sock_path;
|
||||
struct mncc_sock_state *mncc_state;
|
||||
mncc_recv_cb_t mncc_recv;
|
||||
struct llist_head upqueue;
|
||||
|
|
|
@ -15,6 +15,7 @@ enum nsap_addr_enc {
|
|||
typedef int (*mncc_recv_cb_t)(struct gsm_network *, struct msgb *);
|
||||
|
||||
struct gsm_network *gsm_network_init(void *ctx, mncc_recv_cb_t mncc_recv);
|
||||
void gsm_network_set_mncc_sock_path(struct gsm_network *net, const char *mncc_sock_path);
|
||||
|
||||
int msc_vlr_alloc(struct gsm_network *net);
|
||||
int msc_vlr_start(struct gsm_network *net);
|
||||
|
|
|
@ -339,6 +339,25 @@ DEFUN(cfg_msc, cfg_msc_cmd,
|
|||
#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>",
|
||||
|
@ -442,6 +461,8 @@ DEFUN(cfg_msc_emergency_msisdn, cfg_msc_emergency_msisdn_cmd,
|
|||
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, " %sassign-tmsi%s",
|
||||
|
@ -1451,6 +1472,8 @@ void msc_vty_init(struct gsm_network *msc_network)
|
|||
install_element(CONFIG_NODE, &cfg_msc_cmd);
|
||||
install_node(&msc_node, config_write_msc);
|
||||
install_element(MSC_NODE, &cfg_msc_assign_tmsi_cmd);
|
||||
install_element(MSC_NODE, &cfg_msc_mncc_internal_cmd);
|
||||
install_element(MSC_NODE, &cfg_msc_mncc_external_cmd);
|
||||
install_element(MSC_NODE, &cfg_msc_mncc_guard_timeout_cmd);
|
||||
install_element(MSC_NODE, &cfg_msc_deprecated_mncc_guard_timeout_cmd);
|
||||
install_element(MSC_NODE, &cfg_msc_no_assign_tmsi_cmd);
|
||||
|
|
|
@ -76,6 +76,13 @@ struct gsm_network *gsm_network_init(void *ctx, mncc_recv_cb_t mncc_recv)
|
|||
return net;
|
||||
}
|
||||
|
||||
void gsm_network_set_mncc_sock_path(struct gsm_network *net, const char *mncc_sock_path)
|
||||
{
|
||||
if (net->mncc_sock_path)
|
||||
talloc_free(net->mncc_sock_path);
|
||||
net->mncc_sock_path = mncc_sock_path ? talloc_strdup(net, mncc_sock_path) : NULL;
|
||||
}
|
||||
|
||||
/* Receive a SAPI-N-REJECT from BSC */
|
||||
void ran_conn_sapi_n_reject(struct ran_conn *conn, int dlci)
|
||||
{
|
||||
|
|
|
@ -573,11 +573,20 @@ int main(int argc, char **argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* Initialize MNCC socket if appropriate */
|
||||
/* Initialize MNCC socket if appropriate. If the cmdline option -M is present, it overrides the .cfg file
|
||||
* setting 'msc' / 'mncc external MNCC_SOCKET_PATH'. Note that when -M is given, it "bleeds" back into the vty
|
||||
* 'write' command and is reflected in the written out 'mncc external' cfg. */
|
||||
if (msc_cmdline_config.mncc_sock_path) {
|
||||
LOGP(DMNCC, LOGL_NOTICE,
|
||||
"MNCC socket path is configured from commandline argument -M."
|
||||
" This affects a written-back config file. Instead consider using the config file directly"
|
||||
" ('msc' / 'mncc external MNCC_SOCKET_PATH').\n");
|
||||
gsm_network_set_mncc_sock_path(msc_network, msc_cmdline_config.mncc_sock_path);
|
||||
}
|
||||
if (msc_network->mncc_sock_path) {
|
||||
msc_network->mncc_recv = mncc_sock_from_cc;
|
||||
rc = mncc_sock_init(msc_network,
|
||||
msc_cmdline_config.mncc_sock_path);
|
||||
msc_network->mncc_sock_path);
|
||||
if (rc) {
|
||||
fprintf(stderr, "MNCC socket initialization failed. exiting.\n");
|
||||
exit(1);
|
||||
|
|
|
@ -30,6 +30,8 @@ OsmoMSC(config)# msc
|
|||
OsmoMSC(config-msc)# list
|
||||
...
|
||||
assign-tmsi
|
||||
mncc internal
|
||||
mncc external MNCC_SOCKET_PATH
|
||||
mncc guard-timeout <0-255>
|
||||
no assign-tmsi
|
||||
auth-tuple-max-reuse-count <-1-2147483647>
|
||||
|
@ -46,6 +48,29 @@ OsmoMSC(config-msc)# list
|
|||
mgw bts-base <0-65534>
|
||||
...
|
||||
|
||||
OsmoMSC(config-msc)# mncc?
|
||||
mncc Configure Mobile Network Call Control
|
||||
|
||||
OsmoMSC(config-msc)# mncc ?
|
||||
internal Use internal MNCC handler (default; changes need a program restart)
|
||||
external Use external MNCC handler (changes need a program restart)
|
||||
guard-timeout Set global guard timer for mncc interface activity
|
||||
|
||||
OsmoMSC(config-msc)# mncc external ?
|
||||
MNCC_SOCKET_PATH File system path to create the MNCC unix domain socket at
|
||||
|
||||
OsmoMSC(config-msc)# mncc external /path/not/used
|
||||
OsmoMSC(config-msc)# show running-config
|
||||
...
|
||||
msc
|
||||
...
|
||||
mncc external /path/not/used
|
||||
...
|
||||
|
||||
OsmoMSC(config-msc)# mncc internal
|
||||
OsmoMSC(config-msc)# show running-config
|
||||
... ! mncc external
|
||||
|
||||
OsmoMSC(config-msc)# exit
|
||||
OsmoMSC(config)# mncc-int
|
||||
OsmoMSC(config-mncc-int)# list
|
||||
|
|
Loading…
Reference in New Issue