Skip to content

Commit

Permalink
sipcapture: fix overlapping function name
Browse files Browse the repository at this point in the history
the build_dummy_msg() function being used without the static identifier
causes confusion for some compilers. An example is the AL2 compiler,
which instead of using the module's implementation, it uses the core's
one, hence resulting in broken behavior.

Credit goes to @ghmj2417 (GitHub) for reporting this in ticket #2255
Close #2255

(cherry picked from commit 7ba72d4)
  • Loading branch information
razvancrainea committed Sep 29, 2020
1 parent 406d579 commit e0d8d73
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 20 deletions.
29 changes: 10 additions & 19 deletions modules/sipcapture/sipcapture.c
Expand Up @@ -430,10 +430,6 @@ static str hep_app_protos[]= {
#define MAX_PAYLOAD 32767
static char payload_buf[MAX_PAYLOAD];

/* dummy request for the hep route */
struct sip_msg dummy_req;


/* values to be set from script for hep pvar */


Expand Down Expand Up @@ -731,18 +727,6 @@ static int parse_hep_route(char *val)
return 0;
}

void build_dummy_msg(void) {
memset(&dummy_req, 0, sizeof(struct sip_msg));
dummy_req.first_line.type = SIP_REQUEST;
dummy_req.first_line.u.request.method.s= "DUMMY";
dummy_req.first_line.u.request.method.len= 5;
dummy_req.first_line.u.request.uri.s= "sip:user@domain.com";
dummy_req.first_line.u.request.uri.len= 19;
dummy_req.rcv.src_ip.af = AF_INET;
dummy_req.rcv.dst_ip.af = AF_INET;
}


void parse_table_str(str* table_s, tz_table_t* tz_table)
{
if ((tz_table->suffix.s=q_memchr(table_s->s, '%', table_s->len)) == NULL) {
Expand Down Expand Up @@ -2443,18 +2427,25 @@ int hep_msg_received(void)
} else if (hep_route_id > HEP_SIP_ROUTE) {

/* builds a dummy message */
build_dummy_msg();
memset(&msg, 0, sizeof(struct sip_msg));
msg.first_line.type = SIP_REQUEST;
msg.first_line.u.request.method.s= "DUMMY";
msg.first_line.u.request.method.len= 5;
msg.first_line.u.request.uri.s= "sip:user@domain.com";
msg.first_line.u.request.uri.len= 19;
msg.rcv.src_ip.af = AF_INET;
msg.rcv.dst_ip.af = AF_INET;

/* set request route type */
set_route_type( REQUEST_ROUTE );

/* run given hep route */
run_top_route( sroutes->request[hep_route_id].a, &dummy_req);
run_top_route( sroutes->request[hep_route_id].a, &msg);

/* free possible loaded avps */
reset_avps();

free_sip_msg( &dummy_req );
free_sip_msg( &msg );

/* requested to go through the main sip route */
if (ctx->resume_with_sip) {
Expand Down
2 changes: 1 addition & 1 deletion net/trans_trace.c
Expand Up @@ -205,7 +205,7 @@ int tcpconn2su( struct tcp_connection* c, union sockaddr_union* src_su,
return 0;
}

void build_dummy_msg(struct receive_info* rcv) {
static void build_dummy_msg(struct receive_info* rcv) {
memset(&dummy_req, 0, sizeof(struct sip_msg));
dummy_req.first_line.type = SIP_REQUEST;
dummy_req.first_line.u.request.method.s= "DUMMY";
Expand Down

0 comments on commit e0d8d73

Please sign in to comment.