<p>Thanks Daniel. </p>
<p>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.</p>
<p>Cheers<br>
Jason</p>
<p>Sent from Android phone</p>
<div class="gmail_quote">On Oct 25, 2011 5:40 PM, "Daniel-Constantin Mierla" <<a href="mailto:miconda@gmail.com">miconda@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
Hello,<br>
<br>
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.<br>
<br>
If you can give it a try and all works fine, it can be backported to
3.2.<br>
<br>
Thanks,<br>
Daniel<br>
<br>
On 10/25/11 2:09 PM, Jason Penton wrote:
<blockquote type="cite">Hi All,<br>
<br>
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?):<br>
<br>
p.s. If there are no objections/responses I will commit to master
branch.<br>
<br>
Cheers<br>
Jason<br>
<br>
<span style="font-family:courier new,monospace">int
extract_mediaip(str *body, str *mediaip, int *pf, char *line)</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">{</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> char
*cp, *cp1;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> int len;</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> cp1 =
NULL;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> for (cp
= body->s; (len = body->s + body->len - cp) > 0;) {</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">
cp1 = (char*)ser_memmem(cp, line, len, 2);</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">
if (cp1 == NULL || cp1[-1] == '\n' || cp1[-1] == '\r')</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">
break;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">
cp = cp1 + 2;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> }</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> if (cp1
== NULL)</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">
return -1;</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">
mediaip->s = cp1 + 2;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">
mediaip->len = eat_line(mediaip->s, body->s +
body->len - mediaip->s) - mediaip->s;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">
trim_len(mediaip->len, mediaip->s, *mediaip);</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> if
(mediaip->len == 0) {</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">
LM_ERR("no [%s] line in SDP\n",line);</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">
return -1;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> }</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> /*
search reverse for IP[4|6] in c=/o= line */</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> cp =
(char*)ser_memrmem(mediaip->s, " IP", mediaip->len, 3);</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> if (cp
== NULL) {</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">
LM_ERR("no `IP[4|6]' in `%s' field\n",line);</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">
return -1;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> }</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace">
<div style="text-align:left;font-family:courier new,monospace">
<span style="background-color:rgb(255, 255, 51)">switch
(cp[3]) {</span><br style="background-color:rgb(255, 255, 51)">
<span style="background-color:rgb(255, 255, 51)">
case '4':</span><br style="background-color:rgb(255, 255, 51)">
<span style="background-color:rgb(255, 255, 51)">
*pf = AF_INET;</span><br style="background-color:rgb(255, 255, 51)">
<span style="background-color:rgb(255, 255, 51)">
break;</span><br style="background-color:rgb(255, 255, 51)">
<br style="background-color:rgb(255, 255, 51)">
<span style="background-color:rgb(255, 255, 51)">
case '6':</span><br style="background-color:rgb(255, 255, 51)">
<span style="background-color:rgb(255, 255, 51)">
*pf = AF_INET6;</span><br style="background-color:rgb(255, 255, 51)">
<span style="background-color:rgb(255, 255, 51)">
break;</span><br style="background-color:rgb(255, 255, 51)">
<span style="background-color:rgb(255, 255, 51)"> }</span><br>
</div>
<br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> /*
safety checks:</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> * - for
lenght, at least 6: ' IP[4|6] x...'</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> * -
white space after</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> */</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> if(cp +
6 > mediaip->s + mediaip->len && cp[4]!=' ') {</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">
LM_ERR("invalid content for `%s' line\n",line);</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">
return -1;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> }</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">
if(cp[3]!='4' && cp[3]!='6') {</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">
LM_ERR("invalid addrtype IPx for `%s' line\n",line);</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">
return -1;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> }</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> cp += 5;</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> /* next
token is the IP address */</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> cp =
eat_space_end(cp, mediaip->s + mediaip->len);</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> len =
eat_token_end(cp, mediaip->s + mediaip->len) - cp;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">
mediaip->s = cp;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">
mediaip->len = len;</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> if
(mediaip->len == 0) {</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">
LM_ERR("no `IP[4|6]' address in `%s' field\n",line);</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">
return -1;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> }</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">
LM_DBG("located IP address [%.*s] in `%s' field\n",</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">
mediaip->len, mediaip->s, line);</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> return
1;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">}</span><br>
<br>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
sr-dev mailing list
<a href="mailto:sr-dev@lists.sip-router.org" target="_blank">sr-dev@lists.sip-router.org</a>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a>
</pre>
</blockquote>
<br>
<pre cols="72">--
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" target="_blank">http://www.asipto.com</a>
Kamailio Advanced Training, Dec 5-8, Berlin: <a href="http://asipto.com/u/kat" target="_blank">http://asipto.com/u/kat</a>
<a href="http://linkedin.com/in/miconda" target="_blank">http://linkedin.com/in/miconda</a> -- <a href="http://twitter.com/miconda" target="_blank">http://twitter.com/miconda</a></pre>
</div>
</blockquote></div>