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>