Skip to content

Commit

Permalink
Fix the src/dest info for the HEP "log" packages
Browse files Browse the repository at this point in the history
This fixes the way the logs are displayed in the call flow of Homer
  • Loading branch information
bogdan-iancu committed Jun 11, 2020
1 parent a9cc33a commit 356ed94
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion xlog.c
Expand Up @@ -31,6 +31,7 @@
#include "sr_module.h"
#include "dprint.h"
#include "error.h"
#include "socket_info.h"
#include "mem/mem.h"
#include "xlog.h"

Expand Down Expand Up @@ -211,6 +212,7 @@ static inline int trace_xlog(struct sip_msg* msg, char* buf, int len)
struct modify_trace mod_p;
xl_trace_t xtrace_param;
str correlation_str;
union sockaddr_union su;

if (msg == NULL || buf == NULL) {
LM_ERR("bad input!\n");
Expand All @@ -236,7 +238,15 @@ static inline int trace_xlog(struct sip_msg* msg, char* buf, int len)
correlation_str.len = 6;
}

if (sip_context_trace(xlog_proto_id, 0, 0, 0, IPPROTO_TCP,
if (msg->rcv.bind_address && msg->rcv.bind_address->port_no)
init_su( &su, &msg->rcv.bind_address->address,
msg->rcv.bind_address->port_no);
else
su.s.sa_family = 0;

if (sip_context_trace(xlog_proto_id,
su.s.sa_family ? &su : NULL /*src*/, su.s.sa_family ? &su : NULL /*dst*/,
0, IPPROTO_TCP,
&correlation_str, &mod_p) < 0) {
LM_ERR("failed to trace xlog message!\n");
return -1;
Expand Down

0 comments on commit 356ed94

Please sign in to comment.