When we switched to a pthread per client, we lost the ability to
correlate zapi message debugs with their handlers in zlog, because the
message was logged when it was read off the zapi socket and not right
before it was processed. Move the zapi msg hexdump to happen right
before we call the message handler.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
zapi_parse_header(msg, &hdr);
+ if (IS_ZEBRA_DEBUG_PACKET && IS_ZEBRA_DEBUG_RECV)
+ zserv_log_message(NULL, msg, &hdr);
+
#if defined(HANDLE_ZAPI_FUZZING)
zserv_write_incoming(msg, hdr.command);
#endif
* hdr (optional)
* The message header
*/
-static void zserv_log_message(const char *errmsg, struct stream *msg,
- struct zmsghdr *hdr)
+void zserv_log_message(const char *errmsg, struct stream *msg,
+ struct zmsghdr *hdr)
{
zlog_debug("Rx'd ZAPI message");
if (errmsg)
hdr.vrf_id, hdr.length,
sock);
- if (IS_ZEBRA_DEBUG_PACKET && IS_ZEBRA_DEBUG_RECV)
- zserv_log_message(NULL, client->ibuf_work, &hdr);
-
stream_set_getp(client->ibuf_work, 0);
struct stream *msg = stream_dup(client->ibuf_work);
*/
extern void zserv_close_client(struct zserv *client);
+
+/*
+ * Log a ZAPI message hexdump.
+ *
+ * errmsg
+ * Error message to include with packet hexdump
+ *
+ * msg
+ * Message to log
+ *
+ * hdr
+ * Message header
+ */
+void zserv_log_message(const char *errmsg, struct stream *msg,
+ struct zmsghdr *hdr);
+
#if defined(HANDLE_ZAPI_FUZZING)
extern void zserv_read_file(char *input);
#endif