diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2017-08-11 14:25:56 +0200 |
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2017-08-11 15:45:38 +0200 |
| commit | 2cb5980f20bb642e60484a1647031cb6f013ddc3 (patch) | |
| tree | 6b63f1d1af42fccc46a103f43826a4271be67cfd | |
| parent | 695bb8f0d144def36295bd5af8b14fbf064b97b8 (diff) | |
bgpd: don't sidestep vty code
afi_header_vty_out is sidestepping the vty code, writing straight to the
output (either stdout or the obuf), which results in newline translation
not being performed.
Easiest fix is replacing it with a macro. Longer-term, I have some old
code to add "prefaces" to the vty output, planning to dig that up.
Fixes: #949 ("bgpd show running doesn't show new lines")
Reported-by: Lou Berger <lberger@labn.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| -rw-r--r-- | bgpd/bgpd.c | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index d30def0f07..ae0a22f28a 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -6135,27 +6135,11 @@ char *peer_uptime(time_t uptime2, char *buf, size_t len, u_char use_json, return buf; } -static void afi_header_vty_out(struct vty *vty, afi_t afi, safi_t safi, - int *write, const char *format, ...) -{ - va_list args; - int len = 0; - char buf[1024]; - - bgp_config_write_family_header(vty, afi, safi, write); - - if (vty_shell(vty)) { - va_start(args, format); - vprintf(format, args); - va_end(args); - } else { - va_start(args, format); - len = vsnprintf(buf, sizeof(buf), format, args); - va_end(args); - - buffer_put(vty->obuf, (u_char *)buf, len); - } -} +#define afi_header_vty_out(vty, afi, safi, write, format, ...) \ + do { \ + bgp_config_write_family_header(vty, afi, safi, write); \ + vty_out(vty, format, ## __VA_ARGS__); \ + } while (0) static void bgp_config_write_filter(struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, int *write) |
