aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-04-16 16:59:48 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-04-17 06:45:08 +0200
commit8d9833ef8376a144ef384d0f47b5c67bd0a1f6e2 (patch)
treed398356ed022299f614e174f4b4a6a6b3b74e3f4 /openbsc/src
parent2d425059af3339a86aea70857997ccb43dc1a908 (diff)
[mgcp] Fix vty file generation for the BSC nat and other cases
The current setting was not properly written out, this commit is fixing it. This includes indention, empty bts ip, wrong command for endpoints and the wrong number (+1 as zero is allocated but unused).
Diffstat (limited to 'openbsc/src')
-rw-r--r--openbsc/src/mgcp/mgcp_vty.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/openbsc/src/mgcp/mgcp_vty.c b/openbsc/src/mgcp/mgcp_vty.c
index 6bfb28784..bf5d15f0b 100644
--- a/openbsc/src/mgcp/mgcp_vty.c
+++ b/openbsc/src/mgcp/mgcp_vty.c
@@ -33,6 +33,8 @@
#include <vty/command.h>
#include <vty/vty.h>
+#include <string.h>
+
static struct mgcp_config *g_cfg = NULL;
/*
@@ -48,8 +50,8 @@ static int config_write_mgcp(struct vty *vty)
{
vty_out(vty, "mgcp%s", VTY_NEWLINE);
if (g_cfg->local_ip)
- vty_out(vty, " local ip %s%s", g_cfg->local_ip, VTY_NEWLINE);
- if (g_cfg->bts_ip)
+ vty_out(vty, " local ip %s%s", g_cfg->local_ip, VTY_NEWLINE);
+ if (g_cfg->bts_ip && strlen(g_cfg->bts_ip) != 0)
vty_out(vty, " bts ip %s%s", g_cfg->bts_ip, VTY_NEWLINE);
vty_out(vty, " bind ip %s%s", g_cfg->source_addr, VTY_NEWLINE);
vty_out(vty, " bind port %u%s", g_cfg->source_port, VTY_NEWLINE);
@@ -60,13 +62,13 @@ static int config_write_mgcp(struct vty *vty)
if (g_cfg->audio_name)
vty_out(vty, " sdp audio payload name %s%s", g_cfg->audio_name, VTY_NEWLINE);
vty_out(vty, " loop %u%s", !!g_cfg->audio_loop, VTY_NEWLINE);
- vty_out(vty, " endpoints %u%s", g_cfg->number_endpoints, VTY_NEWLINE);
+ vty_out(vty, " number endpoints %u%s", g_cfg->number_endpoints - 1, VTY_NEWLINE);
if (g_cfg->forward_ip)
- vty_out(vty, " forward audio ip %s%s", g_cfg->forward_ip, VTY_NEWLINE);
+ vty_out(vty, " forward audio ip %s%s", g_cfg->forward_ip, VTY_NEWLINE);
if (g_cfg->forward_port != 0)
- vty_out(vty, " forward audio port %d%s", g_cfg->forward_port, VTY_NEWLINE);
+ vty_out(vty, " forward audio port %d%s", g_cfg->forward_port, VTY_NEWLINE);
if (g_cfg->call_agent_addr)
- vty_out(vty, " call agent ip %s%s", g_cfg->call_agent_addr, VTY_NEWLINE);
+ vty_out(vty, " call agent ip %s%s", g_cfg->call_agent_addr, VTY_NEWLINE);
return CMD_SUCCESS;
}