[asterisk-commits] schmidts: branch 10 r346293 - in /branches/10: ./ res/res_rtp_asterisk.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Nov 28 08:32:35 CST 2011
Author: schmidts
Date: Mon Nov 28 08:32:31 2011
New Revision: 346293
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=346293
Log:
Fix regression that 'rtp/rtcp set debup ip' only works when also a port was specified.
(closes issue ASTERISK-18693)
Reported by: Davide Dal Fra
Review: https://reviewboard.asterisk.org/r/1600/
Reviewed by: Walter Doekes
........
Merged revisions 346292 from http://svn.asterisk.org/svn/asterisk/branches/1.8
Modified:
branches/10/ (props changed)
branches/10/res/res_rtp_asterisk.c
Propchange: branches/10/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.
Modified: branches/10/res/res_rtp_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/res/res_rtp_asterisk.c?view=diff&rev=346293&r1=346292&r2=346293
==============================================================================
--- branches/10/res/res_rtp_asterisk.c (original)
+++ branches/10/res/res_rtp_asterisk.c Mon Nov 28 08:32:31 2011
@@ -91,6 +91,8 @@
static int rtcpinterval = RTCP_DEFAULT_INTERVALMS; /*!< Time between rtcp reports in millisecs */
static struct ast_sockaddr rtpdebugaddr; /*!< Debug packets to/from this host */
static struct ast_sockaddr rtcpdebugaddr; /*!< Debug RTCP packets to/from this host */
+static int rtpdebugport; /*< Debug only RTP packets from IP or IP+Port if port is > 0 */
+static int rtcpdebugport; /*< Debug only RTCP packets from IP or IP+Port if port is > 0 */
#ifdef SO_NO_CHECK
static int nochecksums;
#endif
@@ -315,8 +317,15 @@
if (!rtpdebug) {
return 0;
}
-
- return ast_sockaddr_isnull(&rtpdebugaddr) ? 1 : ast_sockaddr_cmp(&rtpdebugaddr, addr) == 0;
+ if (!ast_sockaddr_isnull(&rtpdebugaddr)) {
+ if (rtpdebugport) {
+ return (ast_sockaddr_cmp(&rtpdebugaddr, addr) == 0); /* look for RTP packets from IP+Port */
+ } else {
+ return (ast_sockaddr_cmp_addr(&rtpdebugaddr, addr) == 0); /* only look for RTP packets from IP */
+ }
+ }
+
+ return 1;
}
static inline int rtcp_debug_test_addr(struct ast_sockaddr *addr)
@@ -324,8 +333,15 @@
if (!rtcpdebug) {
return 0;
}
-
- return ast_sockaddr_isnull(&rtcpdebugaddr) ? 1 : ast_sockaddr_cmp(&rtcpdebugaddr, addr) == 0;
+ if (!ast_sockaddr_isnull(&rtcpdebugaddr)) {
+ if (rtcpdebugport) {
+ return (ast_sockaddr_cmp(&rtcpdebugaddr, addr) == 0); /* look for RTCP packets from IP+Port */
+ } else {
+ return (ast_sockaddr_cmp_addr(&rtcpdebugaddr, addr) == 0); /* only look for RTCP packets from IP */
+ }
+ }
+
+ return 1;
}
static int __rtp_recvfrom(struct ast_rtp_instance *instance, void *buf, size_t size, int flags, struct ast_sockaddr *sa, int rtcp)
@@ -2723,11 +2739,14 @@
static char *rtp_do_debug_ip(struct ast_cli_args *a)
{
char *arg = ast_strdupa(a->argv[4]);
-
- if (!ast_sockaddr_parse(&rtpdebugaddr, arg, 0)) {
+ char *debughost = NULL;
+ char *debugport = NULL;
+
+ if (!ast_sockaddr_parse(&rtpdebugaddr, arg, 0) || !ast_sockaddr_split_hostport(arg, &debughost, &debugport, 0)) {
ast_cli(a->fd, "Lookup failed for '%s'\n", arg);
return CLI_FAILURE;
}
+ rtpdebugport = (!ast_strlen_zero(debugport) && debugport[0] != '0');
ast_cli(a->fd, "RTP Debugging Enabled for address: %s\n",
ast_sockaddr_stringify(&rtpdebugaddr));
rtpdebug = 1;
@@ -2737,11 +2756,14 @@
static char *rtcp_do_debug_ip(struct ast_cli_args *a)
{
char *arg = ast_strdupa(a->argv[4]);
-
- if (!ast_sockaddr_parse(&rtcpdebugaddr, arg, 0)) {
+ char *debughost = NULL;
+ char *debugport = NULL;
+
+ if (!ast_sockaddr_parse(&rtcpdebugaddr, arg, 0) || !ast_sockaddr_split_hostport(arg, &debughost, &debugport, 0)) {
ast_cli(a->fd, "Lookup failed for '%s'\n", arg);
return CLI_FAILURE;
}
+ rtcpdebugport = (!ast_strlen_zero(debugport) && debugport[0] != '0');
ast_cli(a->fd, "RTCP Debugging Enabled for address: %s\n",
ast_sockaddr_stringify(&rtcpdebugaddr));
rtcpdebug = 1;
More information about the asterisk-commits
mailing list