msuraev has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/31661 )
Change subject: mobile: allow configuring local GSMTAP address ......................................................................
mobile: allow configuring local GSMTAP address
Change-Id: Ia1555db653cf0bb20af74617f33aad31c971bfdb --- M src/host/layer23/include/osmocom/bb/common/l23_app.h M src/host/layer23/src/common/vty.c M src/host/layer23/src/mobile/main.c 3 files changed, 47 insertions(+), 3 deletions(-)
Approvals: pespin: Looks good to me, but someone else must approve osmith: Looks good to me, but someone else must approve msuraev: Looks good to me, approved Jenkins Builder: Verified
diff --git a/src/host/layer23/include/osmocom/bb/common/l23_app.h b/src/host/layer23/include/osmocom/bb/common/l23_app.h index 290a09b..8ae4ead 100644 --- a/src/host/layer23/include/osmocom/bb/common/l23_app.h +++ b/src/host/layer23/include/osmocom/bb/common/l23_app.h @@ -34,6 +34,7 @@ struct l23_global_config { struct { char *remote_host; + char *local_host; uint32_t lchan_mask; /* see l23_gsmtap_gprs_category */ uint32_t lchan_acch_mask; /* see l23_gsmtap_gprs_category */ bool lchan_acch; diff --git a/src/host/layer23/src/common/vty.c b/src/host/layer23/src/common/vty.c index 396d4cc..c083a33 100644 --- a/src/host/layer23/src/common/vty.c +++ b/src/host/layer23/src/common/vty.c @@ -192,6 +192,32 @@ return CMD_SUCCESS; }
+DEFUN(cfg_gsmtap_gsmtap_local_host, + cfg_gsmtap_gsmtap_local_host_cmd, + "local-host " VTY_IPV46_CMD, + "Set source for GSMTAP Um logging\n" + "Local IP address\n") +{ + osmo_talloc_replace_string(l23_ctx, &l23_cfg.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_gsmtap_no_gsmtap_local_host, + cfg_gsmtap_no_gsmtap_local_host_cmd, + "no local-host", + NO_STR "Disable explicit source for GSMTAP Um logging\n") +{ + TALLOC_FREE(l23_cfg.gsmtap.local_host); + if (vty->type != VTY_FILE) + vty_out(vty, "%% This command requires restart%s", VTY_NEWLINE); + + return CMD_SUCCESS; +} + DEFUN(cfg_gsmtap_gsmtap_lchan_all, cfg_gsmtap_gsmtap_lchan_all_cmd, "lchan (enable-all|disable-all)", "Enable/disable sending of UL/DL messages over GSMTAP\n" @@ -414,6 +440,11 @@ else vty_out(vty, " no remote-host%s", VTY_NEWLINE);
+ if (l23_cfg.gsmtap.local_host) + vty_out(vty, " local-host %s%s", l23_cfg.gsmtap.local_host, VTY_NEWLINE); + else + vty_out(vty, " no local-host%s", VTY_NEWLINE); + if (l23_cfg.gsmtap.lchan_acch) vty_out(vty, " lchan sacch%s", VTY_NEWLINE);
@@ -516,6 +547,8 @@ install_node(&gsmtap_node, l23_vty_config_write_gsmtap_node); install_element(GSMTAP_NODE, &cfg_gsmtap_gsmtap_remote_host_cmd); install_element(GSMTAP_NODE, &cfg_gsmtap_no_gsmtap_remote_host_cmd); + install_element(GSMTAP_NODE, &cfg_gsmtap_gsmtap_local_host_cmd); + install_element(GSMTAP_NODE, &cfg_gsmtap_no_gsmtap_local_host_cmd); install_element(GSMTAP_NODE, &cfg_gsmtap_gsmtap_lchan_all_cmd); install_element(GSMTAP_NODE, &cfg_gsmtap_gsmtap_lchan_cmd); install_element(GSMTAP_NODE, &cfg_gsmtap_no_gsmtap_lchan_cmd); diff --git a/src/host/layer23/src/mobile/main.c b/src/host/layer23/src/mobile/main.c index 581c6cb..43909ce 100644 --- a/src/host/layer23/src/mobile/main.c +++ b/src/host/layer23/src/mobile/main.c @@ -312,10 +312,11 @@ }
if (l23_cfg.gsmtap.remote_host) { - l23_cfg.gsmtap.inst = gsmtap_source_init(l23_cfg.gsmtap.remote_host, GSMTAP_UDP_PORT, 1); + l23_cfg.gsmtap.inst = gsmtap_source_init2(l23_cfg.gsmtap.local_host, 0, + l23_cfg.gsmtap.remote_host, GSMTAP_UDP_PORT, 1); if (!l23_cfg.gsmtap.inst) { - fprintf(stderr, "Failed during gsmtap_source_init(%s:%u)\n", - l23_cfg.gsmtap.remote_host, GSMTAP_UDP_PORT); + fprintf(stderr, "Failed during gsmtap_source_init2(%s -> %s:%u)\n", + l23_cfg.gsmtap.local_host, l23_cfg.gsmtap.remote_host, GSMTAP_UDP_PORT); exit(1); } gsmtap_source_add_sink(l23_cfg.gsmtap.inst);