[asterisk-commits] mmichelson: trunk r275104 - /trunk/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jul 9 11:39:20 CDT 2010


Author: mmichelson
Date: Fri Jul  9 11:39:16 2010
New Revision: 275104

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=275104
Log:
Return logic of sip_debug_test_addr() to its original functionality.


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=275104&r1=275103&r2=275104
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Fri Jul  9 11:39:16 2010
@@ -2881,7 +2881,24 @@
 /*! \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 */




More information about the asterisk-commits mailing list