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 252) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@275308 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
parent
d348c9aa1e
commit
e46325f18c
|
@ -14209,7 +14209,9 @@ static attribute_unused void check_via_response(struct sip_pvt *p, struct sip_re
|
|||
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 @@ static void check_via(struct sip_pvt *p, struct sip_request *req)
|
|||
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",
|
||||
|
|
Loading…
Reference in New Issue