vty: fix (null) string in vty config

The asp->cfg.remote.host is allowed to be NULL in cases where the
localhost is used.

Check if asp->cfg.remote.host is NULL when writing the config file
and omit it when it is set to NULL.

Change-Id: I18f79cc4d4f1db8f2858e8e95098c5821d50594f
This commit is contained in:
Philipp Maier 2017-08-15 10:45:34 +02:00
parent 3219e52dcf
commit 52d1ee9617
1 changed files with 2 additions and 1 deletions

View File

@ -632,7 +632,8 @@ static void write_one_asp(struct vty *vty, struct osmo_ss7_asp *asp)
osmo_ss7_asp_protocol_name(asp->cfg.proto), VTY_NEWLINE);
if (asp->cfg.description)
vty_out(vty, " description %s%s", asp->cfg.description, VTY_NEWLINE);
vty_out(vty, " remote-ip %s%s", asp->cfg.remote.host, VTY_NEWLINE);
if (asp->cfg.remote.host)
vty_out(vty, " remote-ip %s%s", asp->cfg.remote.host, VTY_NEWLINE);
if (asp->cfg.qos_class)
vty_out(vty, " qos-class %u%s", asp->cfg.qos_class, VTY_NEWLINE);
}