diff options
author | Mark Michelson <mmichelson@digium.com> | 2010-07-09 16:39:16 +0000 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2010-07-09 16:39:16 +0000 |
commit | 5f92aed2ba51c65e035a65bbbdba3ed1d268b893 (patch) | |
tree | 46559c63effed0ce27dd1676cad7c95ec112b515 /channels | |
parent | 759872902ad5df7fec52315ddda8db18dbfbae81 (diff) |
Return logic of sip_debug_test_addr() to its original functionality.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@275104 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index d9a97fcfa..ad6e00ab2 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -2881,7 +2881,24 @@ static int find_sip_method(const char *msg) /*! \brief See if we pass debug IP filter */ static inline int sip_debug_test_addr(const struct ast_sockaddr *addr) { - return sipdebug && !ast_sockaddr_isnull(addr) && !ast_sockaddr_cmp_addr(&debugaddr, addr); + /* Can't debug if sipdebug is not enabled */ + if (!sipdebug) { + return 0; + } + + /* A null debug_addr means we'll debug any address */ + if (ast_sockaddr_isnull(&debugaddr)) { + return 1; + } + + /* If no port was specified for a debug address, just compare the + * addresses, otherwise compare the address and port + */ + if (ast_sockaddr_port(&debugaddr)) { + return !ast_sockaddr_cmp(&debugaddr, addr); + } else { + return !ast_sockaddr_cmp_addr(&debugaddr, addr); + } } /*! \brief The real destination address for a write */ |