Hi Seth,
it was yet another char* to str conversion error. Please see the
additional patch to be applied on top of the previous one. It should
solve this issue.
Thanks and regards,
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com
On 02/07/2013 09:25 PM, Seth Schultz wrote:
Alexander,
I am not so much worried about the port range. I am trying to
determine where that port is coming from in the first place. Nothing
on my end should ever be advertising anything other than port 5060. I
believe it is getting corrupted somewhere, just not sure how to track
it down.
Thanks,
Seth
Seth Schultz
E-Mail: [email protected]
Phone: 212.255.8005 x 124
Fax: 212.255.8091
On 2/7/2013 2:13 PM, Alexandr Dubovikov wrote:
I can make a patch to ignore the port range, but I think something
wrong in
the socket structure: the port number is too high.
Wbr,
Alexandr
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Seth Schultz
Sent: Thursday, February 07, 2013 7:40 PM
To: Bogdan-Andrei Iancu
Cc: OpenSIPS users mailling list
Subject: Re: [OpenSIPS-Users] Siptrace Issue
Bogdan,
The patch did solve the error I was receiving, however, now I am
receiving a
new error "ERROR:siptrace:pipport2su: invalid port number; must be in
[1024,65536]". I captured some information from the branch route and
I also
modified the error message to display the port number.
I also added abort(); just after the error message to capture a core
file.
I have no idea where this port number is coming from.
Feb 7 13:33:17 opensips-vm /sbin/opensips[15149]: ----- BRANCH:
172.16.1.105 <null> domain=172.16.1.1 port=5060 transport=udp
uri=sip:172.16.1.1
Feb 7 13:33:17 opensips-vm /sbin/opensips[15149]:
ERROR:siptrace:pipport2su: port = 5060060 invalid port number; must
be in
[1024,65536] Feb 7 13:33:17 opensips-vm /sbin/opensips[15146]:
ERROR:siptrace:pipport2su: port = 5060600 invalid port number; must
be in
[1024,65536] Feb 7 13:33:19 opensips-vm /sbin/opensips[15140]:
ERROR:siptrace:pipport2su: port = 5060060 invalid port number; must
be in
[1024,65536]
Thanks for all your help. I truly appreciate it!
Seth
On 2/7/2013 6:52 AM, Bogdan-Andrei Iancu wrote:
Hi Seth,
Thanks a lot for your help - I found and hopefully fixed the bug - I
made the commit on SVN trunk only and I would ask you to test it first
(see the attached patch). Let me know if works fine for you and i will
do the backport .
Regards,
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com
Index: modules/siptrace/siptrace.c
===================================================================
--- modules/siptrace/siptrace.c (revision 9769)
+++ modules/siptrace/siptrace.c (working copy)
@@ -97,8 +97,8 @@
static struct mi_root* sip_trace_mi(struct mi_root* cmd, void* param );
static struct mi_root* trace_to_database_mi(struct mi_root* cmd, void* param );
-static int trace_send_hep_duplicate(str *body, const char *fromip, const char *toip);
-static int pipport2su (char *pipport, union sockaddr_union *tmp_su, unsigned int *proto);
+static int trace_send_hep_duplicate(str *body, str *fromip, str *toip);
+static int pipport2su (str *pipport, union sockaddr_union *tmp_su, unsigned int *proto);
static str db_url = {NULL, 0};
@@ -530,8 +530,12 @@
int_str *first_val,db_key_t *keys,db_val_t *vals)
{
- if(duplicate_with_hep) trace_send_hep_duplicate(&db_vals[0].val.blob_val, db_vals[4].val.string_val, db_vals[5].val.string_val);
- else trace_send_duplicate(db_vals[0].val.blob_val.s, db_vals[0].val.blob_val.len);
+ if (duplicate_with_hep)
+ trace_send_hep_duplicate(&db_vals[0].val.blob_val,
+ &db_vals[4].val.str_val, &db_vals[5].val.str_val);
+ else
+ trace_send_duplicate(db_vals[0].val.blob_val.s,
+ db_vals[0].val.blob_val.len);
if(trace_to_database_flag!=NULL && *trace_to_database_flag!=0) {
@@ -1573,7 +1577,7 @@
return ret;
}
-static int trace_send_hep_duplicate(str *body, const char *fromip, const char *toip)
+static int trace_send_hep_duplicate(str *body, str *fromip, str *toip)
{
struct proxy_l * p=NULL /* make gcc happy */;
void* buffer = NULL;
@@ -1616,7 +1620,8 @@
}
/* Convert proto:ip:port to sockaddress union SRC IP */
- if (pipport2su((char *)fromip, &from_su, &proto)==-1 || (pipport2su((char *)toip, &to_su, &proto)==-1))
+ if (pipport2su(fromip, &from_su, &proto)==-1 ||
+ (pipport2su(toip, &to_su, &proto)==-1))
goto error;
/* check if from and to are in the same family*/
@@ -1764,7 +1769,7 @@
* \param proto uint protocol type
* \return success / unsuccess
*/
-static int pipport2su (char *pipport, union sockaddr_union *tmp_su,
+static int pipport2su (str *pipport, union sockaddr_union *tmp_su,
unsigned int *proto)
{
unsigned int port_no, cutlen = 4;
@@ -1773,33 +1778,34 @@
str port_str, host_uri;
/*parse protocol */
- if(strncmp(pipport, "udp:",4) == 0) *proto = IPPROTO_UDP;
- else if(strncmp(pipport, "tcp:",4) == 0) *proto = IPPROTO_TCP;
- else if(strncmp(pipport, "tls:",4) == 0) *proto = IPPROTO_IDP; /* fake proto type */
+ if(strncmp(pipport->s, "udp:",4) == 0) *proto = IPPROTO_UDP;
+ else if(strncmp(pipport->s, "tcp:",4) == 0) *proto = IPPROTO_TCP;
+ else if(strncmp(pipport->s, "tls:",4) == 0) *proto = IPPROTO_IDP; /* fake proto type */
#ifdef USE_SCTP
- else if(strncmp(pipport, "sctp:",5) == 0) cutlen = 5, *proto = IPPROTO_SCTP;
+ else if(strncmp(pipport->s, "sctp:",5) == 0) cutlen = 5, *proto = IPPROTO_SCTP;
#endif
- else if(strncmp(pipport, "any:",4) == 0) *proto = IPPROTO_UDP;
+ else if(strncmp(pipport->s, "any:",4) == 0) *proto = IPPROTO_UDP;
else {
- LM_ERR("bad protocol %s\n", pipport);
+ LM_ERR("bad protocol %.*s\n", pipport->len,pipport->s);
return -1;
}
/*separate proto and host */
- p = pipport+cutlen;
+ p = pipport->s + cutlen;
if( (*(p)) == '\0') {
LM_ERR("malformed ip address\n");
return -1;
}
host_uri.s = p;
- if( (p = strrchr(p+1, ':')) == 0 ) {
+ for (p=pipport->s+pipport->len ; p>=host_uri.s && *p!=':' ; p--);
+ if (*p!=':') {
LM_ERR("no port specified\n");
return -1;
}
/*the address contains a port number*/
port_str.s = p + 1;
- port_str.len = strlen(port_str.s);
+ port_str.len = pipport->len+pipport->s - port_str.s;
LM_DBG("the port string is %.*s\n", port_str.len, port_str.s);
if(str2int(&port_str, &port_no) != 0 ) {
LM_ERR("there is not a valid number port\n");
@@ -1811,6 +1817,7 @@
return -1;
}
host_uri.len = p - host_uri.s;
+ LM_DBG("proto %d, host %.*s , port %d \n",*proto,host_uri.len,host_uri.s,port_no );
/* now IPv6 address has no brakets. It should be fixed! */
if (host_uri.s[0] == '[') {
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users