Hey Daniel,
Have just tested and patch is fine. You can proceed with backport.
Cheers
Jason
On Tue, Oct 25, 2011 at 7:19 PM, Jason Penton <jason.penton(a)gmail.com>wrote;wrote:
Thanks Daniel.
I tested the version I sent u and it worked fine. Seeing yours is similar I
would imagine u can backport so long, but I will test and let you know
tomorrow anyway.
Cheers
Jason
Sent from Android phone
On Oct 25, 2011 5:40 PM, "Daniel-Constantin Mierla" <miconda(a)gmail.com>
wrote:
> Hello,
>
> extract_mediaip() was pretty much completely refactored since there was a
> bug reported by Juha, resulting in missing the setting of IP address type.
> Reverting would have been wrong -- I just committed a patch to set the
> address, but slightly different, to set it after the other checks for it are
> done.
>
> If you can give it a try and all works fine, it can be backported to 3.2.
>
> Thanks,
> Daniel
>
> On 10/25/11 2:09 PM, Jason Penton wrote:
>
> Hi All,
>
> Just curious as to why the parsing of IP type was removed from
> extract_mediaip in parser/sdp/sdp_helper_funcs.c. The latest code looks like
> below (could I suggest adding the highlighted part?):
>
> p.s. If there are no objections/responses I will commit to master branch.
>
> Cheers
> Jason
>
> int extract_mediaip(str *body, str *mediaip, int *pf, char *line)
> {
> char *cp, *cp1;
> int len;
>
> cp1 = NULL;
> for (cp = body->s; (len = body->s + body->len - cp) > 0;) {
> cp1 = (char*)ser_memmem(cp, line, len, 2);
> if (cp1 == NULL || cp1[-1] == '\n' || cp1[-1] ==
'\r')
> break;
> cp = cp1 + 2;
> }
> if (cp1 == NULL)
> return -1;
>
> mediaip->s = cp1 + 2;
> mediaip->len = eat_line(mediaip->s, body->s + body->len -
> mediaip->s) - mediaip->s;
> trim_len(mediaip->len, mediaip->s, *mediaip);
> if (mediaip->len == 0) {
> LM_ERR("no [%s] line in SDP\n",line);
> return -1;
> }
>
> /* search reverse for IP[4|6] in c=/o= line */
> cp = (char*)ser_memrmem(mediaip->s, " IP", mediaip->len, 3);
> if (cp == NULL) {
> LM_ERR("no `IP[4|6]' in `%s' field\n",line);
> return -1;
> }
>
> switch (cp[3]) {
> case '4':
> *pf = AF_INET;
> break;
>
> case '6':
> *pf = AF_INET6;
> break;
> }
>
> /* safety checks:
> * - for lenght, at least 6: ' IP[4|6] x...'
> * - white space after
> */
> if(cp + 6 > mediaip->s + mediaip->len && cp[4]!=' ')
{
> LM_ERR("invalid content for `%s' line\n",line);
> return -1;
> }
> if(cp[3]!='4' && cp[3]!='6') {
> LM_ERR("invalid addrtype IPx for `%s' line\n",line);
> return -1;
> }
> cp += 5;
>
> /* next token is the IP address */
> cp = eat_space_end(cp, mediaip->s + mediaip->len);
> len = eat_token_end(cp, mediaip->s + mediaip->len) - cp;
> mediaip->s = cp;
> mediaip->len = len;
>
> if (mediaip->len == 0) {
> LM_ERR("no `IP[4|6]' address in `%s'
field\n",line);
> return -1;
> }
>
> LM_DBG("located IP address [%.*s] in `%s' field\n",
> mediaip->len, mediaip->s, line);
> return 1;
> }
>
>
>
> _______________________________________________
> sr-dev mailing
listsr-dev@lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>
>
> --
> Daniel-Constantin Mierla --
http://www.asipto.com
> Kamailio Advanced Training, Dec 5-8, Berlin:
http://asipto.com/u/kathttp://linkedin.com/in/miconda --
http://twitter.com/miconda
>
>