aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2017-08-15 11:01:18 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-08-23 02:08:36 +0200
commite29e9035b5b2ecb5bb7c2d05becd2311853b1100 (patch)
tree88e5f6ff60755bb0f90ea4c69a85785c3c5035d1
parent514aae7dbaf95c8122420886ac6c2d3e66962cb2 (diff)
osmo-bsc: fix (null) string in VTY config
When writing the config file the options bsc-addr, and msc-addr, a (null) string is written to the config file, which prevents the config file from reading it back. memorize the string names given to bsc-addr and msc-addr and write them back, also check if the strings are NULL in case the user did not set any names.
-rw-r--r--openbsc/include/openbsc/bsc_msc_data.h2
-rw-r--r--openbsc/src/osmo-bsc/osmo_bsc_vty.c17
2 files changed, 12 insertions, 7 deletions
diff --git a/openbsc/include/openbsc/bsc_msc_data.h b/openbsc/include/openbsc/bsc_msc_data.h
index 1ffe2a9c5..4a283d165 100644
--- a/openbsc/include/openbsc/bsc_msc_data.h
+++ b/openbsc/include/openbsc/bsc_msc_data.h
@@ -124,12 +124,14 @@ struct bsc_msc_data {
* with the A interface of this particular BSC,
* this address is filled up by the VTY interface */
struct osmo_sccp_addr bsc_addr;
+ char *bsc_addr_name;
/* Holds a copy of the MSC address. This is the
* address of the MSC that handles the calls of
* this BSC. The address is configured via the
* VTY interface */
struct osmo_sccp_addr msc_addr;
+ char *msc_addr_name;
struct a_reset_ctx *reset;
} a;
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_vty.c b/openbsc/src/osmo-bsc/osmo_bsc_vty.c
index 6fd85a86f..5ac8d9160 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_vty.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_vty.c
@@ -187,13 +187,14 @@ static void write_msc(struct vty *vty, struct bsc_msc_data *msc)
write_msc_amr_options(vty, msc);
/* write sccp connection configuration */
- /* FIXME: This can not work, as we manipulate the address,
- * we can not expect to find it in the addressbok. We should
- * store the string names instead. */
- vty_out(vty, " bsc-addr %s%s",
- osmo_sccp_name_by_addr(&msc->a.bsc_addr), VTY_NEWLINE);
- vty_out(vty, " msc-addr %s%s",
- osmo_sccp_name_by_addr(&msc->a.msc_addr), VTY_NEWLINE);
+ if (msc->a.bsc_addr_name) {
+ vty_out(vty, " bsc-addr %s%s",
+ msc->a.bsc_addr_name, VTY_NEWLINE);
+ }
+ if (msc->a.msc_addr_name) {
+ vty_out(vty, " msc-addr %s%s",
+ msc->a.msc_addr_name, VTY_NEWLINE);
+ }
}
static int config_write_msc(struct vty *vty)
@@ -738,6 +739,7 @@ DEFUN(cfg_msc_cs7_bsc_addr,
msc->a.cs7_instance = ss7->cfg.id;
msc->a.cs7_instance_valid = true;
enforce_standard_ssn(vty, &msc->a.bsc_addr);
+ msc->a.bsc_addr_name = talloc_strdup(msc, bsc_addr_name);
return CMD_SUCCESS;
}
@@ -770,6 +772,7 @@ DEFUN(cfg_msc_cs7_msc_addr,
msc->a.cs7_instance = ss7->cfg.id;
msc->a.cs7_instance_valid = true;
enforce_standard_ssn(vty, &msc->a.msc_addr);
+ msc->a.msc_addr_name = talloc_strdup(msc, msc_addr_name);
return CMD_SUCCESS;
}