mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-30 18:40:46 +00:00
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 ........ Merged revisions 346293 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@346294 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -91,6 +91,8 @@ static int rtcpstats; /*!< Are we debugging RTCP? */
|
|||||||
static int rtcpinterval = RTCP_DEFAULT_INTERVALMS; /*!< Time between rtcp reports in millisecs */
|
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 rtpdebugaddr; /*!< Debug packets to/from this host */
|
||||||
static struct ast_sockaddr rtcpdebugaddr; /*!< Debug RTCP 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
|
#ifdef SO_NO_CHECK
|
||||||
static int nochecksums;
|
static int nochecksums;
|
||||||
#endif
|
#endif
|
||||||
@@ -315,8 +317,15 @@ static inline int rtp_debug_test_addr(struct ast_sockaddr *addr)
|
|||||||
if (!rtpdebug) {
|
if (!rtpdebug) {
|
||||||
return 0;
|
return 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 ast_sockaddr_isnull(&rtpdebugaddr) ? 1 : ast_sockaddr_cmp(&rtpdebugaddr, addr) == 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int rtcp_debug_test_addr(struct ast_sockaddr *addr)
|
static inline int rtcp_debug_test_addr(struct ast_sockaddr *addr)
|
||||||
@@ -324,8 +333,15 @@ static inline int rtcp_debug_test_addr(struct ast_sockaddr *addr)
|
|||||||
if (!rtcpdebug) {
|
if (!rtcpdebug) {
|
||||||
return 0;
|
return 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 ast_sockaddr_isnull(&rtcpdebugaddr) ? 1 : ast_sockaddr_cmp(&rtcpdebugaddr, addr) == 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __rtp_recvfrom(struct ast_rtp_instance *instance, void *buf, size_t size, int flags, struct ast_sockaddr *sa, int rtcp)
|
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 int ast_rtp_sendcng(struct ast_rtp_instance *instance, int level)
|
|||||||
static char *rtp_do_debug_ip(struct ast_cli_args *a)
|
static char *rtp_do_debug_ip(struct ast_cli_args *a)
|
||||||
{
|
{
|
||||||
char *arg = ast_strdupa(a->argv[4]);
|
char *arg = ast_strdupa(a->argv[4]);
|
||||||
|
char *debughost = NULL;
|
||||||
|
char *debugport = NULL;
|
||||||
|
|
||||||
if (!ast_sockaddr_parse(&rtpdebugaddr, arg, 0)) {
|
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);
|
ast_cli(a->fd, "Lookup failed for '%s'\n", arg);
|
||||||
return CLI_FAILURE;
|
return CLI_FAILURE;
|
||||||
}
|
}
|
||||||
|
rtpdebugport = (!ast_strlen_zero(debugport) && debugport[0] != '0');
|
||||||
ast_cli(a->fd, "RTP Debugging Enabled for address: %s\n",
|
ast_cli(a->fd, "RTP Debugging Enabled for address: %s\n",
|
||||||
ast_sockaddr_stringify(&rtpdebugaddr));
|
ast_sockaddr_stringify(&rtpdebugaddr));
|
||||||
rtpdebug = 1;
|
rtpdebug = 1;
|
||||||
@@ -2737,11 +2756,14 @@ static char *rtp_do_debug_ip(struct ast_cli_args *a)
|
|||||||
static char *rtcp_do_debug_ip(struct ast_cli_args *a)
|
static char *rtcp_do_debug_ip(struct ast_cli_args *a)
|
||||||
{
|
{
|
||||||
char *arg = ast_strdupa(a->argv[4]);
|
char *arg = ast_strdupa(a->argv[4]);
|
||||||
|
char *debughost = NULL;
|
||||||
|
char *debugport = NULL;
|
||||||
|
|
||||||
if (!ast_sockaddr_parse(&rtcpdebugaddr, arg, 0)) {
|
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);
|
ast_cli(a->fd, "Lookup failed for '%s'\n", arg);
|
||||||
return CLI_FAILURE;
|
return CLI_FAILURE;
|
||||||
}
|
}
|
||||||
|
rtcpdebugport = (!ast_strlen_zero(debugport) && debugport[0] != '0');
|
||||||
ast_cli(a->fd, "RTCP Debugging Enabled for address: %s\n",
|
ast_cli(a->fd, "RTCP Debugging Enabled for address: %s\n",
|
||||||
ast_sockaddr_stringify(&rtcpdebugaddr));
|
ast_sockaddr_stringify(&rtcpdebugaddr));
|
||||||
rtcpdebug = 1;
|
rtcpdebug = 1;
|
||||||
|
Reference in New Issue
Block a user