[asterisk-bugs] [JIRA] (ASTERISK-26430) res_hep: will fail, when an IPv6 interface is enabled on the installed server
Nir Simionovich (GreenfieldTech - Israel) (JIRA)
noreply at issues.asterisk.org
Thu Oct 6 16:38:01 CDT 2016
[ https://issues.asterisk.org/jira/browse/ASTERISK-26430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=232573#comment-232573 ]
Nir Simionovich (GreenfieldTech - Israel) commented on ASTERISK-26430:
----------------------------------------------------------------------
Well,
I added the following code to res_hep.c:
{noformat}
if (ast_sockaddr_is_ipv4(&capture_info->src_addr) != ast_sockaddr_is_ipv4(&capture_info->dst_addr)) {
ast_log(AST_LOG_NOTICE, "Unable to send packet: Address Family mismatch between source/destination\n");
ast_log(AST_LOG_NOTICE, "Sending from: %d\n", ast_sockaddr_is_ipv4(&capture_info->src_addr));
ast_log(AST_LOG_NOTICE, "To server: %d\n", ast_sockaddr_is_ipv4(&capture_info->dst_addr));
ast_log(AST_LOG_NOTICE, "Sending from: %s\n", ast_sockaddr_stringify(&capture_info->src_addr));
ast_log(AST_LOG_NOTICE, "To server: %s\n", ast_sockaddr_stringify(&capture_info->dst_addr));
return -1;
}
{noformat}
Now, the output on the CLI shows the following:
{noformat}
-- Executing [500 at default:1] Playback("SIP/test-00000001", "demo-abouttotry") in new stack
[Oct 6 21:32:08] NOTICE[31965][C-00000002]: netsock2.c:472 ast_sockaddr_is_ipv4: My address family is: 2
[Oct 6 21:32:08] NOTICE[31965][C-00000002]: netsock2.c:473 ast_sockaddr_is_ipv4: My address family should be: 2
[Oct 6 21:32:08] NOTICE[31965][C-00000002]: netsock2.c:474 ast_sockaddr_is_ipv4: My address length is: 16
[Oct 6 21:32:08] NOTICE[31965][C-00000002]: netsock2.c:475 ast_sockaddr_is_ipv4: My address length should be: 16
-- <SIP/test-00000001> Playing 'demo-abouttotry.gsm' (language 'en')
Got RTCP from 87.69.126.26:4001
PT: 200(Sender Report)
Reception reports: 0
SSRC of sender: 4121665413
NTP timestamp: 1475789527.2756153344
RTP timestamp: 1866069119
SPC: 2 SOC: 17
Got RTCP from 87.69.126.26:4001
PT: 202(Unknown)
Reception reports: 1
SSRC of sender: 4121665413
Received an SDES from 87.69.126.26:4001
[Oct 6 21:32:08] NOTICE[31870]: netsock2.c:472 ast_sockaddr_is_ipv4: My address family is: 2
[Oct 6 21:32:08] NOTICE[31870]: netsock2.c:473 ast_sockaddr_is_ipv4: My address family should be: 2
[Oct 6 21:32:08] NOTICE[31870]: netsock2.c:474 ast_sockaddr_is_ipv4: My address length is: 16
[Oct 6 21:32:08] NOTICE[31870]: netsock2.c:475 ast_sockaddr_is_ipv4: My address length should be: 16
[Oct 6 21:32:08] NOTICE[31870]: netsock2.c:472 ast_sockaddr_is_ipv4: My address family is: 10
[Oct 6 21:32:08] NOTICE[31870]: netsock2.c:473 ast_sockaddr_is_ipv4: My address family should be: 2
[Oct 6 21:32:08] NOTICE[31870]: netsock2.c:474 ast_sockaddr_is_ipv4: My address length is: 28
[Oct 6 21:32:08] NOTICE[31870]: netsock2.c:475 ast_sockaddr_is_ipv4: My address length should be: 16
[Oct 6 21:32:08] NOTICE[31870]: res_hep.c:466 hep_queue_cb: Unable to send packet: Address Family mismatch between source/destination
[Oct 6 21:32:08] NOTICE[31870]: netsock2.c:472 ast_sockaddr_is_ipv4: My address family is: 2
[Oct 6 21:32:08] NOTICE[31870]: netsock2.c:473 ast_sockaddr_is_ipv4: My address family should be: 2
[Oct 6 21:32:08] NOTICE[31870]: netsock2.c:474 ast_sockaddr_is_ipv4: My address length is: 16
[Oct 6 21:32:08] NOTICE[31870]: netsock2.c:475 ast_sockaddr_is_ipv4: My address length should be: 16
[Oct 6 21:32:08] NOTICE[31870]: res_hep.c:467 hep_queue_cb: Sending from: 1
[Oct 6 21:32:08] NOTICE[31870]: netsock2.c:472 ast_sockaddr_is_ipv4: My address family is: 10
[Oct 6 21:32:08] NOTICE[31870]: netsock2.c:473 ast_sockaddr_is_ipv4: My address family should be: 2
[Oct 6 21:32:08] NOTICE[31870]: netsock2.c:474 ast_sockaddr_is_ipv4: My address length is: 28
[Oct 6 21:32:08] NOTICE[31870]: netsock2.c:475 ast_sockaddr_is_ipv4: My address length should be: 16
[Oct 6 21:32:08] NOTICE[31870]: res_hep.c:468 hep_queue_cb: To server: 0
[Oct 6 21:32:08] NOTICE[31870]: res_hep.c:469 hep_queue_cb: Sending from: 87.69.126.26:4001
[Oct 6 21:32:08] NOTICE[31870]: res_hep.c:470 hep_queue_cb: To server: [::1]:10645
* Sent RTCP SR to 87.69.126.26:4001
Our SSRC: 1545079116
Sent(NTP): 1475789533.3833950208
Sent(RTP): 240000
Sent packets: 250
Sent octets: 30021
Report block:
Their SSRC: 4121665413
Fraction lost: 0
Cumulative loss: 0
Highest seq no: 25233
IA jitter: 0.0066
Their last SR: 1096264780
DLSR: 4.9930 (sec)
[Oct 6 21:32:13] NOTICE[31870]: netsock2.c:472 ast_sockaddr_is_ipv4: My address family is: 10
[Oct 6 21:32:13] NOTICE[31870]: netsock2.c:473 ast_sockaddr_is_ipv4: My address family should be: 2
[Oct 6 21:32:13] NOTICE[31870]: netsock2.c:474 ast_sockaddr_is_ipv4: My address length is: 28
[Oct 6 21:32:13] NOTICE[31870]: netsock2.c:475 ast_sockaddr_is_ipv4: My address length should be: 16
[Oct 6 21:32:13] NOTICE[31870]: netsock2.c:472 ast_sockaddr_is_ipv4: My address family is: 2
[Oct 6 21:32:13] NOTICE[31870]: netsock2.c:473 ast_sockaddr_is_ipv4: My address family should be: 2
[Oct 6 21:32:13] NOTICE[31870]: netsock2.c:474 ast_sockaddr_is_ipv4: My address length is: 16
[Oct 6 21:32:13] NOTICE[31870]: netsock2.c:475 ast_sockaddr_is_ipv4: My address length should be: 16
[Oct 6 21:32:13] NOTICE[31870]: res_hep.c:466 hep_queue_cb: Unable to send packet: Address Family mismatch between source/destination
[Oct 6 21:32:13] NOTICE[31870]: netsock2.c:472 ast_sockaddr_is_ipv4: My address family is: 10
[Oct 6 21:32:13] NOTICE[31870]: netsock2.c:473 ast_sockaddr_is_ipv4: My address family should be: 2
[Oct 6 21:32:13] NOTICE[31870]: netsock2.c:474 ast_sockaddr_is_ipv4: My address length is: 28
[Oct 6 21:32:13] NOTICE[31870]: netsock2.c:475 ast_sockaddr_is_ipv4: My address length should be: 16
[Oct 6 21:32:13] NOTICE[31870]: res_hep.c:467 hep_queue_cb: Sending from: 0
[Oct 6 21:32:13] NOTICE[31870]: netsock2.c:472 ast_sockaddr_is_ipv4: My address family is: 2
[Oct 6 21:32:13] NOTICE[31870]: netsock2.c:473 ast_sockaddr_is_ipv4: My address family should be: 2
[Oct 6 21:32:13] NOTICE[31870]: netsock2.c:474 ast_sockaddr_is_ipv4: My address length is: 16
[Oct 6 21:32:13] NOTICE[31870]: netsock2.c:475 ast_sockaddr_is_ipv4: My address length should be: 16
[Oct 6 21:32:13] NOTICE[31870]: res_hep.c:468 hep_queue_cb: To server: 1
[Oct 6 21:32:13] NOTICE[31870]: res_hep.c:469 hep_queue_cb: Sending from: [::1]:10645
[Oct 6 21:32:13] NOTICE[31870]: res_hep.c:470 hep_queue_cb: To server: 87.69.126.26:4001
{noformat}
It would appear that Asterisk identifies itself using the IPv6 local address, while it identifies the remote UA as an IPv4
address correctly.
> res_hep: will fail, when an IPv6 interface is enabled on the installed server
> -----------------------------------------------------------------------------
>
> Key: ASTERISK-26430
> URL: https://issues.asterisk.org/jira/browse/ASTERISK-26430
> Project: Asterisk
> Issue Type: Bug
> Security Level: None
> Components: Resources/res_hep
> Affects Versions: GIT
> Reporter: Nir Simionovich (GreenfieldTech - Israel)
> Assignee: Nir Simionovich (GreenfieldTech - Israel)
>
> When trying to utilize res_hep, while the server has an IPv6 IP address defined, the HEP report will fail, notifying the console:
> [Oct 1 13:56:37] NOTICE[14719]: res_hep.c:466 hep_queue_cb: Unable to send packet: Address Family mismatch between source/destination
> Additional information:
> In order to investigate, I've added a couple of ast_log entries, in order to ascertain the actual discrepancy. The following is observed when the issue arises:
> {noformat}
> [Oct 1 13:56:37] NOTICE[14719]: netsock2.c:472 ast_sockaddr_is_ipv4: My address family is: 2
> [Oct 1 13:56:37] NOTICE[14719]: netsock2.c:473 ast_sockaddr_is_ipv4: My address family should be: 2
> [Oct 1 13:56:37] NOTICE[14719]: netsock2.c:474 ast_sockaddr_is_ipv4: My address length is: 16
> [Oct 1 13:56:37] NOTICE[14719]: netsock2.c:475 ast_sockaddr_is_ipv4: My address length should be: 16
> [Oct 1 13:56:37] NOTICE[14719]: res_hep.c:467 hep_queue_cb: Sending from: 1
> [Oct 1 13:56:37] NOTICE[14719]: netsock2.c:472 ast_sockaddr_is_ipv4: My address family is: 10
> [Oct 1 13:56:37] NOTICE[14719]: netsock2.c:473 ast_sockaddr_is_ipv4: My address family should be: 2
> [Oct 1 13:56:37] NOTICE[14719]: netsock2.c:474 ast_sockaddr_is_ipv4: My address length is: 28
> [Oct 1 13:56:37] NOTICE[14719]: netsock2.c:475 ast_sockaddr_is_ipv4: My address length should be: 16
> [Oct 1 13:56:37] NOTICE[14719]: res_hep.c:468 hep_queue_cb: To server: 0
> {noformat}
> The above was generated using:
> {code:java|borderStyle=solid}
> int ast_sockaddr_is_ipv4(const struct ast_sockaddr *addr)
> {
> ast_log(AST_LOG_NOTICE, "My address family is: %d\n", addr->ss.ss_family);
> ast_log(AST_LOG_NOTICE, "My address family should be: %d\n", AF_INET);
> ast_log(AST_LOG_NOTICE, "My address length is: %d\n", addr->len);
> ast_log(AST_LOG_NOTICE, "My address length should be: %u\n", sizeof(struct sockaddr_in));
> return addr->ss.ss_family == AF_INET &&
> addr->len == sizeof(struct sockaddr_in);
> }
> {code}
> Now, if I disable IPv6 on the machine, using the following:
> {noformat}
> sysctl -w net.ipv6.conf.all.disable_ipv6=1
> sysctl -w net.ipv6.conf.default.disable_ipv6=1
> {noformat}
> Now, the Asterisk output is as following:
> {noformat}
> [Oct 1 14:07:25] NOTICE[14975]: netsock2.c:472 ast_sockaddr_is_ipv4: My address family is: 2
> [Oct 1 14:07:25] NOTICE[14975]: netsock2.c:473 ast_sockaddr_is_ipv4: My address family should be: 2
> [Oct 1 14:07:25] NOTICE[14975]: netsock2.c:474 ast_sockaddr_is_ipv4: My address length is: 16
> [Oct 1 14:07:25] NOTICE[14975]: netsock2.c:475 ast_sockaddr_is_ipv4: My address length should be: 16
> [Oct 1 14:07:25] NOTICE[14975]: netsock2.c:472 ast_sockaddr_is_ipv4: My address family is: 2
> [Oct 1 14:07:25] NOTICE[14975]: netsock2.c:473 ast_sockaddr_is_ipv4: My address family should be: 2
> [Oct 1 14:07:25] NOTICE[14975]: netsock2.c:474 ast_sockaddr_is_ipv4: My address length is: 16
> [Oct 1 14:07:25] NOTICE[14975]: netsock2.c:475 ast_sockaddr_is_ipv4: My address length should be: 16
> {noformat}
> So, this is somewhat of an issue, as most cloud providers these day will enable by-default IPv6 addressing on the servers, making the module unusable till it's disabled - which is somewhat counter productive.
> In order to validate potential configuration issues, I've tried changing my HEP server from IP:PORT combo, to only IP address - that caused Asterisk to go completely nuts. Recommendation, separate host ip and port to two separate configuration items, to avoid confusion.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
More information about the asterisk-bugs
mailing list