From 9d72660d671739452d9825609fbf73ec7245f2e8 Mon Sep 17 00:00:00 2001 From: Wesley Coakley Date: Thu, 28 May 2020 10:41:10 -0400 Subject: [PATCH] zebra, lib: bugfix on zebra packet debugging `debug zebra packet detail` dumps the full message whereas it had been dropping exactly 10 bytes, the size of the zebra header Signed-off-by: Wesley Coakley --- lib/stream.c | 5 +++++ lib/stream.h | 3 +++ zebra/zserv.c | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/stream.c b/lib/stream.c index 683a130e44..b378ab62a5 100644 --- a/lib/stream.c +++ b/lib/stream.c @@ -1122,6 +1122,11 @@ int stream_flush(struct stream *s, int fd) return nbytes; } +void stream_hexdump(struct stream *s) +{ + zlog_hexdump(s->data, s->endp); +} + /* Stream first in first out queue. */ struct stream_fifo *stream_fifo_new(void) diff --git a/lib/stream.h b/lib/stream.h index 5c7d94fab8..f84f028852 100644 --- a/lib/stream.h +++ b/lib/stream.h @@ -252,6 +252,9 @@ extern void stream_reset(struct stream *); extern int stream_flush(struct stream *, int); extern int stream_empty(struct stream *); /* is the stream empty? */ +/* debugging */ +extern void stream_hexdump(struct stream *); + /* deprecated */ extern uint8_t *stream_pnt(struct stream *); diff --git a/zebra/zserv.c b/zebra/zserv.c index 8a1ed115a7..9d6ae2ec2e 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -160,7 +160,7 @@ void zserv_log_message(const char *errmsg, struct stream *msg, zlog_debug("Command: %s", zserv_command_string(hdr->command)); zlog_debug(" VRF: %u", hdr->vrf_id); } - zlog_hexdump(msg->data, STREAM_READABLE(msg)); + stream_hexdump(msg); } /* -- 2.39.5