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>