Summary:ASTERISK-18490: [patch] res_rtp_asterisk.c: ast_rtp_read: Bad address cast to IPv4
Reporter:Jacek Konieczny (jkonieczny)Labels:
Date Opened:2011-09-09 02:27:25Date Closed:2011-11-10 10:29:35.000-0600
Versions:1.8.3 Frequency of
Environment:IPv6 enabled Linux 2.6.39 SNOM 300 phonesAttachments:( 0) asterisk-bad_address_cast.patch
Description:When Asterisk is configured to listen on IPv6, then a call from a SNOM phone causes a following error message:

[Jun 10 11:17:35] ERROR[30274]: res_rtp_asterisk.c:2051 ast_rtp_read: Bad address cast to IPv4

I have examined the source code and it seems it happens because the request source IP address is converted to IPv4 struct sockaddr_in for some STUN processing (IPv6 for STUN doesn't make much sense, I guess). The problem is, that when the request is received on an IPv6 socket, it is an IPv4-mapped address which cannot be cast to IPv4 this way.
Comments:By: Jacek Konieczny (jkonieczny) 2011-09-12 02:21:22.060-0500

This patch fixes the problem for me. The error message is gone. I have not verified if the STUN functionality is still working, though,

By: Matthew Nicholson (mnicholson) 2011-11-10 10:29:27.007-0600

Fixed in 1.8 r344330, 10 r344334, and trunk r344335.