Hey Daniel,<br><br>Have just tested and patch is fine. You can proceed with backport.<br><br>Cheers<br>Jason<br><br><div class="gmail_quote">On Tue, Oct 25, 2011 at 7:19 PM, Jason Penton <span dir="ltr">&lt;<a href="mailto:jason.penton@gmail.com">jason.penton@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><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><div></div><div class="h5">
<div class="gmail_quote">On Oct 25, 2011 5:40 PM, &quot;Daniel-Constantin Mierla&quot; &lt;<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>&gt; 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-&gt;s; (len = body-&gt;s + body-&gt;len - cp) &gt; 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] == &#39;\n&#39; || cp1[-1] == &#39;\r&#39;)</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-&gt;s = cp1 + 2;</span><br style="font-family:courier new,monospace">
      <span style="font-family:courier new,monospace">       
        mediaip-&gt;len = eat_line(mediaip-&gt;s, body-&gt;s +
        body-&gt;len - mediaip-&gt;s) - mediaip-&gt;s;</span><br style="font-family:courier new,monospace">
      <span style="font-family:courier new,monospace">       
        trim_len(mediaip-&gt;len, mediaip-&gt;s, *mediaip);</span><br style="font-family:courier new,monospace">
      <span style="font-family:courier new,monospace">        if
        (mediaip-&gt;len == 0) {</span><br style="font-family:courier new,monospace">
      <span style="font-family:courier new,monospace">               
        LM_ERR(&quot;no [%s] line in SDP\n&quot;,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-&gt;s, &quot; IP&quot;, mediaip-&gt;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(&quot;no `IP[4|6]&#39; in `%s&#39; field\n&quot;,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 &#39;4&#39;:</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 &#39;6&#39;:</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: &#39; IP[4|6] x...&#39;</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 &gt; mediaip-&gt;s + mediaip-&gt;len &amp;&amp; cp[4]!=&#39; &#39;) {</span><br style="font-family:courier new,monospace">
      <span style="font-family:courier new,monospace">               
        LM_ERR(&quot;invalid content for `%s&#39; line\n&quot;,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]!=&#39;4&#39; &amp;&amp; cp[3]!=&#39;6&#39;) {</span><br style="font-family:courier new,monospace">
      <span style="font-family:courier new,monospace">               
        LM_ERR(&quot;invalid addrtype IPx for `%s&#39; line\n&quot;,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-&gt;s + mediaip-&gt;len);</span><br style="font-family:courier new,monospace">
      <span style="font-family:courier new,monospace">        len =
        eat_token_end(cp, mediaip-&gt;s + mediaip-&gt;len) - cp;</span><br style="font-family:courier new,monospace">
      <span style="font-family:courier new,monospace">       
        mediaip-&gt;s = cp;</span><br style="font-family:courier new,monospace">
      <span style="font-family:courier new,monospace">       
        mediaip-&gt;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-&gt;len == 0) {</span><br style="font-family:courier new,monospace">
      <span style="font-family:courier new,monospace">               
        LM_ERR(&quot;no `IP[4|6]&#39; address in `%s&#39; field\n&quot;,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(&quot;located IP address [%.*s] in `%s&#39; field\n&quot;,</span><br style="font-family:courier new,monospace">
      <span style="font-family:courier new,monospace">                       
        mediaip-&gt;len, mediaip-&gt;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>
</div></div></blockquote></div><br>