[asterisk-bugs] [Asterisk 0019366]: Message ID does not match trid field in message structure

Asterisk Bug Tracker noreply at bugs.digium.com
Thu Jun 2 15:19:19 CDT 2011


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=19366 
====================================================================== 
Reported By:                JeffW
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   19366
Category:                   Channels/chan_mgcp
Reproducibility:            random
Severity:                   major
Priority:                   normal
Status:                     acknowledged
Asterisk Version:           1.8.3.2 
JIRA:                        
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2011-05-25 15:15 CDT
Last Modified:              2011-06-02 15:19 CDT
====================================================================== 
Summary:                    Message ID does not match trid field in message
structure
Description: 
chan_mgcp.c is using a global variable to allocate transaction IDs.  The
global variable is used to populate the "trid" field in the message struct
and build the message string.  A window exists where the process of
building a message can be interrupted by a second message build process and
cause the "trid" field to be different from the ID in the actual message
data.  I added an additional log message on retrans_pkt to display the
first 30 characters of the message data.  I consistently see the maximum
retires exceeded for message ID N followed by the message data showing the
message ID is actually N+1.
====================================================================== 

---------------------------------------------------------------------- 
 (0135654) JeffW (reporter) - 2011-06-02 15:19
 https://issues.asterisk.org/view.php?id=19366#c135654 
---------------------------------------------------------------------- 
Here is the diff of the changes I made to correct this:
2111c2111
< 		snprintf(req->header[req->headers], sizeof(req->data) - req->len, "%s
%d %s@[%s] MGCP 1.0%s\r\n", verb, oseq, p->name, p->parent->name, p->ncs ?
" NCS 1.0" : "");
---
> 		snprintf(req->header[req->headers], sizeof(req->data) - req->len, "%s
%d %s@[%s] MGCP 1.0%s\r\n", verb, req->trid, p->name, p->parent->name,
p->ncs ? " NCS 1.0" : "");
2113c2113
< +		snprintf(req->header[req->headers], sizeof(req->data) - req->len, "%s
%d %s@%s MGCP 1.0%s\r\n", verb, oseq, p->name, p->parent->name, p->ncs ? "
NCS 1.0" : "");
---
> +		snprintf(req->header[req->headers], sizeof(req->data) - req->len, "%s
%d %s@%s MGCP 1.0%s\r\n", verb, req->trid, p->name, p->parent->name, p->ncs
? " NCS 1.0" : "");
2138a2139
> 	req->trid = oseq;
2318,2319c2319,2320
< 	resp.trid = oseq;
< 	return send_request(p, sub, &resp, oseq);
---
> 	//resp.trid = oseq;
> 	return send_request(p, sub, &resp, resp.trid);
2363,2364c2364,2365
< 	resp.trid = oseq;
< 	return send_request(p, sub, &resp, oseq);
---
> 	//resp.trid = oseq;
> 	return send_request(p, sub, &resp, resp.trid);
2446,2447c2447,2448
< 	resp.trid = oseq;
< 	return send_request(p, sub, &resp, oseq);
---
> 	//resp.trid = oseq;
> 	return send_request(p, sub, &resp, resp.trid);
2473,2474c2474,2475
< 	resp.trid = oseq;
< 	return send_request(p, NULL, &resp, oseq);
---
> 	//resp.trid = oseq;
> 	return send_request(p, NULL, &resp, resp.trid);
2517,2518c2518,2519
< 	resp.trid = oseq;
< 	return send_request(p, NULL, &resp, oseq);
---
> 	//resp.trid = oseq;
> 	return send_request(p, NULL, &resp, resp.trid);
2587,2588c2588,2589
< 	resp.trid = oseq;
< 	return send_request(p, sub, &resp, oseq);
---
> 	//resp.trid = oseq;
> 	return send_request(p, sub, &resp, resp.trid);
2629,2630c2630,2631
< 	resp.trid = oseq;
< 	return send_request(p, NULL, &resp, oseq);
---
> 	//resp.trid = oseq;
> 	return send_request(p, NULL, &resp, resp.trid);
2651,2652c2652,2653
< 	resp.trid = oseq;
< 	return send_request(p, sub, &resp, oseq);
---
> 	//resp.trid = oseq;
> 	return send_request(p, sub, &resp, resp.trid);
2670,2671c2671,2672
< 	resp.trid = oseq;
< 	return send_request(p, p->sub, &resp, oseq);
---
> 	//resp.trid = oseq;
> 	return send_request(p, p->sub, &resp, resp.trid); 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-06-02 15:19 JeffW          Note Added: 0135654                          
======================================================================




More information about the asterisk-bugs mailing list