[asterisk-bugs] [JIRA] (ASTERISK-17797) Coding error in find_subchannel_and_lock()

Matt Jordan (JIRA) noreply at issues.asterisk.org
Sat Nov 8 18:44:29 CST 2014


     [ https://issues.asterisk.org/jira/browse/ASTERISK-17797?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matt Jordan closed ASTERISK-17797.
----------------------------------

    Resolution: Fixed

This was fixed by a patch provided by Xavier Hienne in ASTERISK-24500.

> Coding error in find_subchannel_and_lock()
> ------------------------------------------
>
>                 Key: ASTERISK-17797
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-17797
>             Project: Asterisk
>          Issue Type: Bug
>          Components: Channels/chan_mgcp
>    Affects Versions: 1.8.3
>            Reporter: Jeff Waltz
>            Severity: Minor
>
> The function find_subchannel_and_lock()in mgcp_chan.c has a coding error in two locations that prevent the subchannel from being found on non-dynamic gateways. This results in responses from half the gateways to be ignored.  I built Asterisk from source on a Fedora 14 system.  Here is the C code in question from Asterisk version 1.8.3.2:
> {code}
> 	for (g = gateways ? gateways : find_realtime_gw(name, at, sin);
>                 g; g = g->next ? g->next : find_realtime_gw(name, at, sin)) {
>         [lines omitted]
>                         /* not dynamic, check if the name matches */
>                         } else if (name) {
>                              if (strcasecmp(g->name, at)) {
> >>>> error >>>>                 g = g->next;
>                                 continue;
>                              }
>                         /* not dynamic, no name, check if the addr matches */
>                         } else if (!name && sin) {
>                              if ((g->addr.sin_addr.s_addr != 
>                                   sin->sin_addr.s_addr) ||
>                                  (g->addr.sin_port != sin->sin_port)) {
> >>>> error >>>>                  if(!g->next)
> >>>> error >>>>                        g = find_realtime_gw(name, at, sin);
> >>>> error >>>>                   else
> >>>> error >>>>                        g = g->next;
>                                   continue;
>                             }
>                         } else {
>                             continue;
>                         }
> {code}
> Since the "for" statement includes updating "g" from "g->next", the extra updates to "g" in the code above cause gateway entries to be skipped and responses from those gateways to continually exceed the maximum retry count.
> I hope this helps!
> Jeff Waltz
> ****** ADDITIONAL INFORMATION ******
> I just downloaded the source for 1.8.4 and the erroneous code is still present.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list