diff options
author | Philipp Maier <pmaier@sysmocom.de> | 2017-08-15 11:01:18 +0200 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2017-08-23 02:08:36 +0200 |
commit | e29e9035b5b2ecb5bb7c2d05becd2311853b1100 (patch) | |
tree | 88e5f6ff60755bb0f90ea4c69a85785c3c5035d1 /openbsc/src | |
parent | 514aae7dbaf95c8122420886ac6c2d3e66962cb2 (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.
Diffstat (limited to 'openbsc/src')
-rw-r--r-- | openbsc/src/osmo-bsc/osmo_bsc_vty.c | 17 |
1 files changed, 10 insertions, 7 deletions
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; } |