diff options
author | Kinsey Moore <kmoore@digium.com> | 2012-03-01 14:22:01 +0000 |
---|---|---|
committer | Kinsey Moore <kmoore@digium.com> | 2012-03-01 14:22:01 +0000 |
commit | e291318df2c7ed5ebbaec059d73271976c792091 (patch) | |
tree | 491e7c9b3b5d2bbc86121da693d759f45c0d2a0d /main/acl.c | |
parent | 41f5a1ab3582b01261526f1da8b32dac0cc83c21 (diff) |
Prevent outbound SIP NOTIFY packets from displaying a port of 0
In the change from 1.6.2 to 1.8, ast_sockaddr was introduced which changed the
behavior of ast_find_ourip such that port number was wiped out. This caused
the port in internip (which is used for Contact and Call-ID on NOTIFYs) to be
0. This change causes ast_find_ourip to be port-preserving again.
(closes issue ASTERISK-19430)
........
Merged revisions 357665 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 357667 from http://svn.asterisk.org/svn/asterisk/branches/10
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357673 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/acl.c')
-rw-r--r-- | main/acl.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/main/acl.c b/main/acl.c index 2c9e40086..7616236bc 100644 --- a/main/acl.c +++ b/main/acl.c @@ -737,6 +737,7 @@ int ast_find_ourip(struct ast_sockaddr *ourip, const struct ast_sockaddr *bindad { char ourhost[MAXHOSTNAMELEN] = ""; struct ast_sockaddr root; + int res, port = ast_sockaddr_port(ourip); /* just use the bind address if it is nonzero */ if (!ast_sockaddr_is_any(bindaddr)) { @@ -749,6 +750,8 @@ int ast_find_ourip(struct ast_sockaddr *ourip, const struct ast_sockaddr *bindad ast_log(LOG_WARNING, "Unable to get hostname\n"); } else { if (resolve_first(ourip, ourhost, PARSE_PORT_FORBID, family) == 0) { + /* reset port since resolve_first wipes this out */ + ast_sockaddr_set_port(ourip, port); return 0; } } @@ -756,8 +759,12 @@ int ast_find_ourip(struct ast_sockaddr *ourip, const struct ast_sockaddr *bindad /* A.ROOT-SERVERS.NET. */ if (!resolve_first(&root, "A.ROOT-SERVERS.NET", PARSE_PORT_FORBID, 0) && !ast_ouraddrfor(&root, ourip)) { + /* reset port since resolve_first wipes this out */ + ast_sockaddr_set_port(ourip, port); return 0; } - return get_local_address(ourip); + res = get_local_address(ourip); + ast_sockaddr_set_port(ourip, port); + return res; } |