GSMTAP: allow configuring local address

Change-Id: If047cbaf95b343ee115690bf7a724a8edc5df735
This commit is contained in:
Max 2023-02-19 00:15:13 +03:00 committed by msuraev
parent af9466159e
commit f19f533139
4 changed files with 45 additions and 5 deletions

View File

@ -366,6 +366,7 @@ struct gsm_bts {
struct {
struct gsmtap_inst *inst;
char *remote_host;
char *local_host;
uint32_t sapi_mask;
uint8_t sapi_acch;
} gsmtap;

View File

@ -354,12 +354,12 @@ int bts_main(int argc, char **argv)
/* TODO: move this to gsm_bts_alloc() */
if (g_bts->gsmtap.remote_host != NULL) {
LOGP(DLGLOBAL, LOGL_NOTICE,
"Setting up GSMTAP Um forwarding to '%s:%u'\n",
g_bts->gsmtap.remote_host, GSMTAP_UDP_PORT);
g_bts->gsmtap.inst = gsmtap_source_init(g_bts->gsmtap.remote_host,
GSMTAP_UDP_PORT, 1);
"Setting up GSMTAP Um forwarding '%s->'%s:%u'\n",
g_bts->gsmtap.local_host, g_bts->gsmtap.remote_host, GSMTAP_UDP_PORT);
g_bts->gsmtap.inst = gsmtap_source_init2(g_bts->gsmtap.local_host, 0,
g_bts->gsmtap.remote_host, GSMTAP_UDP_PORT, 1);
if (g_bts->gsmtap.inst == NULL) {
fprintf(stderr, "Failed during gsmtap_source_init()\n");
fprintf(stderr, "Failed during gsmtap_source_init2()\n");
exit(1);
}
gsmtap_source_add_sink(g_bts->gsmtap.inst);

View File

@ -2217,6 +2217,22 @@ DEFUN(cfg_bts_gsmtap_remote_host,
return CMD_SUCCESS;
}
DEFUN(cfg_bts_gsmtap_local_host,
cfg_bts_gsmtap_local_host_cmd,
"gsmtap-local-host HOSTNAME",
"Enable local bind for GSMTAP Um logging (see also 'gsmtap-sapi')\n"
"Local IP address or hostname\n")
{
struct gsm_bts *bts = vty->index;
osmo_talloc_replace_string(bts, &bts->gsmtap.local_host, argv[0]);
if (vty->type != VTY_FILE)
vty_out(vty, "%% This command requires restart%s", VTY_NEWLINE);
return CMD_SUCCESS;
}
DEFUN(cfg_bts_no_gsmtap_remote_host,
cfg_bts_no_gsmtap_remote_host_cmd,
"no gsmtap-remote-host",
@ -2234,6 +2250,24 @@ DEFUN(cfg_bts_no_gsmtap_remote_host,
return CMD_SUCCESS;
}
DEFUN(cfg_bts_no_gsmtap_local_host,
cfg_bts_no_gsmtap_local_host_cmd,
"no gsmtap-local-host",
NO_STR "Disable local bind for GSMTAP Um logging\n")
{
struct gsm_bts *bts = vty->index;
if (bts->gsmtap.local_host != NULL)
talloc_free(bts->gsmtap.local_host);
bts->gsmtap.local_host = NULL;
if (vty->type != VTY_FILE)
vty_out(vty, "%% This command requires restart%s", VTY_NEWLINE);
return CMD_SUCCESS;
}
DEFUN(cfg_bts_gsmtap_sapi_all, cfg_bts_gsmtap_sapi_all_cmd,
"gsmtap-sapi (enable-all|disable-all)",
"Enable/disable sending of UL/DL messages over GSMTAP\n"
@ -2652,6 +2686,8 @@ int bts_vty_init(void *ctx)
install_element(BTS_NODE, &cfg_bts_gsmtap_remote_host_cmd);
install_element(BTS_NODE, &cfg_bts_no_gsmtap_remote_host_cmd);
install_element(BTS_NODE, &cfg_bts_gsmtap_local_host_cmd);
install_element(BTS_NODE, &cfg_bts_no_gsmtap_local_host_cmd);
install_element(BTS_NODE, &cfg_bts_gsmtap_sapi_all_cmd);
install_element(BTS_NODE, &cfg_bts_gsmtap_sapi_cmd);
install_element(BTS_NODE, &cfg_bts_no_gsmtap_sapi_cmd);

View File

@ -251,6 +251,8 @@ OsmoBTS(bts)# list
smscb queue-hysteresis <0-30>
gsmtap-remote-host [HOSTNAME]
no gsmtap-remote-host
gsmtap-local-host HOSTNAME
no gsmtap-local-host
gsmtap-sapi (enable-all|disable-all)
gsmtap-sapi (bcch|ccch|rach|agch|pch|sdcch|tch/f|tch/h|pacch|pdtch|ptcch|cbch|sacch)
no gsmtap-sapi (bcch|ccch|rach|agch|pch|sdcch|tch/f|tch/h|pacch|pdtch|ptcch|cbch|sacch)
@ -274,6 +276,7 @@ OsmoBTS(bts)# ?
supp-meas-info Configure the RSL Supplementary Measurement Info
smscb SMSCB (SMS Cell Broadcast) / CBCH configuration
gsmtap-remote-host Enable GSMTAP Um logging (see also 'gsmtap-sapi')
gsmtap-local-host Enable local bind for GSMTAP Um logging (see also 'gsmtap-sapi')
gsmtap-sapi Enable/disable sending of UL/DL messages over GSMTAP
osmux Configure Osmux
trx Select a TRX to configure