From 20626dde8fd04c2ded3788a8417ea67abf17c4cf Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Fri, 2 Oct 2015 18:15:18 +0200 Subject: osmux: Enforce Osmux only global and per BSC configuration Extend the osmux only setting from the MGCP MGW to the NAT. This is applied when an endpoint is allocated and/or when the allocation is confirmed by the remote system. Not tested. The impact should only be when the new option is being used. Fixes: OW#1492 --- openbsc/src/osmo-bsc_nat/bsc_nat_vty.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'openbsc/src/osmo-bsc_nat/bsc_nat_vty.c') diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c b/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c index 981168cc1..cd8293cc9 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c @@ -162,8 +162,14 @@ static void config_write_bsc_single(struct vty *vty, struct bsc_config *bsc) if (bsc->paging_group != -1) vty_out(vty, " paging group %d%s", bsc->paging_group, VTY_NEWLINE); vty_out(vty, " paging forbidden %d%s", bsc->forbid_paging, VTY_NEWLINE); - if (bsc->osmux) + switch (bsc->osmux) { + case OSMUX_USAGE_ON: vty_out(vty, " osmux on%s", VTY_NEWLINE); + break; + case OSMUX_USAGE_ONLY: + vty_out(vty, " osmux only%s", VTY_NEWLINE); + break; + } } static int config_write_bsc(struct vty *vty) @@ -1124,18 +1130,20 @@ DEFUN(show_ussd_connection, #define OSMUX_STR "RTP multiplexing\n" DEFUN(cfg_bsc_osmux, cfg_bsc_osmux_cmd, - "osmux (on|off)", - OSMUX_STR "Enable OSMUX\n" "Disable OSMUX\n") + "osmux (on|off|only)", + OSMUX_STR "Enable OSMUX\n" "Disable OSMUX\n" "Only OSMUX\n") { struct bsc_config *conf = vty->index; int old = conf->osmux; if (strcmp(argv[0], "on") == 0) - conf->osmux = 1; + conf->osmux = OSMUX_USAGE_ON; else if (strcmp(argv[0], "off") == 0) - conf->osmux = 0; + conf->osmux = OSMUX_USAGE_OFF; + else if (strcmp(argv[0], "only") == 0) + conf->osmux = OSMUX_USAGE_ONLY; - if (old == 0 && conf->osmux == 1 && !conf->nat->mgcp_cfg->osmux_init) { + if (old == 0 && conf->osmux > 0 && !conf->nat->mgcp_cfg->osmux_init) { LOGP(DMGCP, LOGL_NOTICE, "Setting up OSMUX socket\n"); if (osmux_init(OSMUX_ROLE_BSC_NAT, conf->nat->mgcp_cfg) < 0) { LOGP(DMGCP, LOGL_ERROR, "Cannot init OSMUX\n"); @@ -1143,7 +1151,7 @@ DEFUN(cfg_bsc_osmux, VTY_NEWLINE); return CMD_WARNING; } - } else if (old == 1 && conf->osmux == 0) { + } else if (old > 0 && conf->osmux == 0) { LOGP(DMGCP, LOGL_NOTICE, "Disabling OSMUX socket\n"); /* Don't stop the socket, we may already have ongoing voice * flows already using Osmux. This just switch indicates that -- cgit v1.2.3