pespin has uploaded this change for review.

View Change

mgcp-client: Fix no 'mgw ' prefix written in old VTY node

Recent commit dropped the 'mgw ' prefix in commands under the "mgw" VTY
node because it was redundant.
However, for old apps still not supporting the 'mgw' node, the commands
are still printed in another node and hence the 'mgw ' prefix must still
be appeneded to them, to avoid breaking backward compatibility.

Related: SYS#5987
Fixes: 8c138fe89cc070f860eca641481a092225b1247e
Change-Id: Ifbfb71f8864b425c1b842cdee241ce279d17a8ba
---
M src/libosmo-mgcp-client/mgcp_client_vty.c
1 file changed, 12 insertions(+), 9 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/10/29810/1
diff --git a/src/libosmo-mgcp-client/mgcp_client_vty.c b/src/libosmo-mgcp-client/mgcp_client_vty.c
index 4f71e3d..704203c 100644
--- a/src/libosmo-mgcp-client/mgcp_client_vty.c
+++ b/src/libosmo-mgcp-client/mgcp_client_vty.c
@@ -286,33 +286,36 @@
int port;
struct reset_ep *reset_ep;

- if (conf->description)
+ /* If caller doesn't the MGW pool API (mgcp_client_pool_vty_init was never called),
+ * then the "mgw" cmd prefix must be added since the old node always contained it.
+ */
+ const char *mgw_prefix = global_mgcp_client_pool ? "" : "mgw ";
+
+ if (conf->description) /* description never had "mgw" prefix even on old node: */
vty_out(vty, "%sdescription %s%s", indent, conf->description, VTY_NEWLINE);

addr = conf->local_addr;
if (addr)
- vty_out(vty, "%slocal-ip %s%s", indent, addr,
- VTY_NEWLINE);
+ vty_out(vty, "%s%slocal-ip %s%s", indent, mgw_prefix, addr, VTY_NEWLINE);
port = conf->local_port;
if (port >= 0)
- vty_out(vty, "%slocal-port %u%s", indent,
+ vty_out(vty, "%s%slocal-port %u%s", indent, mgw_prefix,
(uint16_t)port, VTY_NEWLINE);

addr = conf->remote_addr;
if (addr)
- vty_out(vty, "%sremote-ip %s%s", indent, addr,
- VTY_NEWLINE);
+ vty_out(vty, "%s%sremote-ip %s%s", indent, mgw_prefix, addr, VTY_NEWLINE);
port = conf->remote_port;
if (port >= 0)
- vty_out(vty, "%sremote-port %u%s", indent,
+ vty_out(vty, "%s%sremote-port %u%s", indent, mgw_prefix,
(uint16_t)port, VTY_NEWLINE);

if (conf->endpoint_domain_name[0])
- vty_out(vty, "%sendpoint-domain %s%s", indent,
+ vty_out(vty, "%s%sendpoint-domain %s%s", indent, mgw_prefix,
conf->endpoint_domain_name, VTY_NEWLINE);

llist_for_each_entry(reset_ep, &conf->reset_epnames, list)
- vty_out(vty, "%sreset-endpoint %s%s", indent, reset_ep->name, VTY_NEWLINE);
+ vty_out(vty, "%s%sreset-endpoint %s%s", indent, mgw_prefix, reset_ep->name, VTY_NEWLINE);

return CMD_SUCCESS;
}

To view, visit change 29810. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: Ifbfb71f8864b425c1b842cdee241ce279d17a8ba
Gerrit-Change-Number: 29810
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin@sysmocom.de>
Gerrit-MessageType: newchange