Skip to content

Commit

Permalink
[siptrace][Bugfix]Use hep proto socket_info struct when trying to send
Browse files Browse the repository at this point in the history
  • Loading branch information
ionutrazvanionita committed Jan 25, 2016
1 parent dfa7787 commit 48bc2d4
Showing 1 changed file with 3 additions and 36 deletions.
39 changes: 3 additions & 36 deletions modules/siptrace/siptrace.c
Expand Up @@ -1801,8 +1801,7 @@ static int trace_send_hep_duplicate(str *body, str *fromproto, str *fromip,
int ret;
union sockaddr_union from_su;
union sockaddr_union to_su;
unsigned int proto, osip_proto;
struct socket_info* send_sock;
unsigned int proto;
union sockaddr_union* to = NULL;

int heplen;
Expand Down Expand Up @@ -1848,43 +1847,11 @@ static int trace_send_hep_duplicate(str *body, str *fromproto, str *fromip,
return -1;
}

switch (proto) {
case IPPROTO_UDP:
osip_proto = PROTO_UDP;
break;

case IPPROTO_TCP:
osip_proto = PROTO_TCP;
break;

case IPPROTO_IDP:
osip_proto = PROTO_TLS;
break;

case IPPROTO_SCTP:
osip_proto = PROTO_SCTP;
break;

case IPPROTO_ESP:
osip_proto = PROTO_WS;
break;

default:
LM_ERR("Unknown protocol [%d]\n", proto);
return -1;
}

ret = -1;

do {
send_sock=get_send_socket(0, to, osip_proto);
if (send_sock==0){
LM_ERR("can't forward to af %d, proto %d no corresponding listening socket\n",
to->s.sa_family,proto);
continue;
}

if (msg_send(send_sock, PROTO_HEP, to, 0, hepbuf, heplen, NULL)<0){
/* send sock is being found in msg_send() function*/
if (msg_send(NULL, PROTO_HEP, to, 0, hepbuf, heplen, NULL)<0){
LM_ERR("cannot send duplicate message\n");
continue;
}
Expand Down

0 comments on commit 48bc2d4

Please sign in to comment.