Skip to content

Commit

Permalink
Trace the real ports (from IP level) instead of SIP level ports
Browse files Browse the repository at this point in the history
As the TCP based ops may report different ports at IP level versus SIP level, trace (if available) the IP level information.

Related to #1692

(cherry picked from commit d6a663f)
  • Loading branch information
bogdan-iancu committed Jun 11, 2019
1 parent 1bdf0b9 commit d698b42
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions modules/siptrace/siptrace.c
Expand Up @@ -1908,7 +1908,8 @@ static void trace_msg_out(struct sip_msg* msg, str *sbuf,
db_vals[4].val.str_val.s = fromip_buff;
db_vals[4].val.str_val.len = nbuff - fromip_buff;
db_vals[5].val.str_val = send_sock->address_str;
db_vals[6].val.int_val = send_sock->port_no;
db_vals[6].val.int_val = send_sock->last_local_real_port?
send_sock->last_local_real_port:send_sock->port_no;
}
}

Expand All @@ -1918,7 +1919,10 @@ static void trace_msg_out(struct sip_msg* msg, str *sbuf,
} else {
su2ip_addr(&to_ip, to);
set_sock_columns( db_vals[7], db_vals[8], db_vals[9], toip_buff,
&to_ip, (unsigned short)su_getport(to), proto);
&to_ip,
(unsigned long)(send_sock->last_remote_real_port?
send_sock->last_remote_real_port:su_getport(to)),
proto);
}

db_vals[10].val.time_val = time(NULL);
Expand Down Expand Up @@ -2175,7 +2179,8 @@ static void trace_onreply_out(struct cell* t, int type, struct tmcb_params *ps)
db_vals[4].val.str_val.s = fromip_buff;
db_vals[4].val.str_val.len = nbuff - fromip_buff;
db_vals[5].val.str_val = dst->send_sock->address_str;
db_vals[6].val.int_val = dst->send_sock->port_no;
db_vals[6].val.int_val = dst->send_sock->last_local_real_port?
dst->send_sock->last_local_real_port:dst->send_sock->port_no;
}
}

Expand All @@ -2186,7 +2191,10 @@ static void trace_onreply_out(struct cell* t, int type, struct tmcb_params *ps)
memset(&to_ip, 0, sizeof(struct ip_addr));
su2ip_addr(&to_ip, &dst->to);
set_sock_columns( db_vals[7], db_vals[8], db_vals[9], toip_buff,
&to_ip, (unsigned long)su_getport(&dst->to), dst->proto);
&to_ip,
(unsigned long)(dst->send_sock->last_remote_real_port?
dst->send_sock->last_remote_real_port:su_getport(&dst->to)),
dst->proto);
}

db_vals[10].val.time_val = time(NULL);
Expand Down

0 comments on commit d698b42

Please sign in to comment.