From ed197fd4f923512fca5b93b90c2132845896fa59 Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Tue, 27 Oct 2015 14:43:24 +0100 Subject: stats: Make net config optional To support reporters without network configuration, this commit introduces the have_net_config flag to provide corresponding error messages. Sponsored-by: On-Waves ehf --- src/vty/stats_vty.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'src/vty/stats_vty.c') diff --git a/src/vty/stats_vty.c b/src/vty/stats_vty.c index 0911fbb8..18ad2835 100644 --- a/src/vty/stats_vty.c +++ b/src/vty/stats_vty.c @@ -281,18 +281,21 @@ static int config_write_stats_reporter(struct vty *vty, struct stats_reporter *s vty_out(vty, " disable%s", VTY_NEWLINE); - if (srep->dest_addr_str) - vty_out(vty, " remote-ip %s%s", - srep->dest_addr_str, VTY_NEWLINE); - if (srep->dest_port) - vty_out(vty, " remote-port %d%s", - srep->dest_port, VTY_NEWLINE); - if (srep->bind_addr_str) - vty_out(vty, " local-ip %s%s", - srep->bind_addr_str, VTY_NEWLINE); - if (srep->mtu) - vty_out(vty, " mtu %d%s", - srep->mtu, VTY_NEWLINE); + if (srep->have_net_config) { + if (srep->dest_addr_str) + vty_out(vty, " remote-ip %s%s", + srep->dest_addr_str, VTY_NEWLINE); + if (srep->dest_port) + vty_out(vty, " remote-port %d%s", + srep->dest_port, VTY_NEWLINE); + if (srep->bind_addr_str) + vty_out(vty, " local-ip %s%s", + srep->bind_addr_str, VTY_NEWLINE); + if (srep->mtu) + vty_out(vty, " mtu %d%s", + srep->mtu, VTY_NEWLINE); + } + if (srep->name_prefix && *srep->name_prefix) vty_out(vty, " prefix %s%s", srep->name_prefix, VTY_NEWLINE); -- cgit v1.2.3