diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2015-01-21 16:53:53 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2015-01-21 16:56:53 +0100 |
commit | 9d1a17e15f6902bc9591680da3375b2d14db16ab (patch) | |
tree | 08421a65dbebd0b5a3a372673c8667f691986d39 /openbsc/src/osmo-bsc_nat/bsc_nat_vty.c | |
parent | b194862b62ffd808c91011f37f2412ebd3cb7378 (diff) |
osmux: Initialize the socket only once
The per BSC code didn't guard against the init already having
been executed. This lead to:
Adding a osmo_fd that is already in the list.
<000b> bsc_nat_vty.c:1200 Setting up OSMUX socket
So a new socket got created and the old one leaked. Luckily
Linux appears to allow to bind multiple times so we were able
to just read from the new one. Use the same guard that is used
on the MGCP MGW. Re-order the log message to say "Setting up"
before we actually do that. I manually verified that osmux_init
is called at most once.
The log message was spotted by Roch
Diffstat (limited to 'openbsc/src/osmo-bsc_nat/bsc_nat_vty.c')
-rw-r--r-- | openbsc/src/osmo-bsc_nat/bsc_nat_vty.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c b/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c index 5229976af..5f4ad284e 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c @@ -1192,12 +1192,14 @@ DEFUN(cfg_bsc_osmux, else if (strcmp(argv[0], "off") == 0) conf->osmux = 0; - if (old == 0 && conf->osmux == 1) { + if (old == 0 && conf->osmux == 1 && !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"); - return -1; + vty_out(vty, "%% failed to create Osmux socket%s", + VTY_NEWLINE); + return CMD_WARNING; } - LOGP(DMGCP, LOGL_NOTICE, "Setting up OSMUX socket\n"); } else if (old == 1 && conf->osmux == 0) { LOGP(DMGCP, LOGL_NOTICE, "Disabling OSMUX socket\n"); /* Don't stop the socket, we may already have ongoing voice |