[asterisk-commits] mmichelson: trunk r275308 - /trunk/channels/chan_sip.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jul 9 14:46:25 CDT 2010
Author: mmichelson
Date: Fri Jul 9 14:46:20 2010
New Revision: 275308
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=275308
Log:
Fix port parsing in check_via.
If a Via header contained an IPv6 address, we would not properly parse
the port. We would instead get the information after the first colon in
the address.
(closes issue #17614)
Reported by: oej
Patches:
diff uploaded by sperreault (license )
Modified:
trunk/channels/chan_sip.c
Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=275308&r1=275307&r2=275308
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Fri Jul 9 14:46:20 2010
@@ -14209,7 +14209,9 @@
static void check_via(struct sip_pvt *p, struct sip_request *req)
{
char via[512];
- char *c, *pt, *maddr;
+ char *c, *maddr;
+ struct ast_sockaddr tmp;
+ uint16_t port;
ast_copy_string(via, get_header(req, "Via"), sizeof(via));
@@ -14246,15 +14248,15 @@
ast_log(LOG_WARNING, "Don't know how to respond via '%s'\n", via);
return;
}
- pt = strchr(c, ':');
- if (pt)
- *pt++ = '\0'; /* remember port pointer */
if (maddr && ast_sockaddr_resolve_first(&p->sa, maddr, 0)) {
p->sa = p->recv;
}
- ast_sockaddr_set_port(&p->sa, port_str2int(pt, STANDARD_SIP_PORT));
+ ast_sockaddr_resolve_first(&tmp, c, 0);
+ port = ast_sockaddr_port(&tmp);
+ ast_sockaddr_set_port(&p->sa,
+ port != 0 ? port : STANDARD_SIP_PORT);
if (sip_debug_test_pvt(p)) {
ast_verbose("Sending to %s (%s)\n",
More information about the asterisk-commits
mailing list