Bug 13252 Allow for IPv6 formatted addresses in Port definition

The SIP config has allowed you to specify an interface ip as
part of the listeners/service/port attributei
 e. g.  as port="127.0.0.1:6001/tcp"
with IPv6 the equivalent would normally be
   as port="[::1]:5001/tcp"
However in this case incoming connections will get rejected because
Configuration constructs a string without the brackets
This patch makes tests both formats on incoming connections so that
they are accepted as they were previously

In future the best course is not to include a port identifier in the
port definition then if the server has ipv6 it will bind to all
interfaces and accept both IPv4 and IPv6 traffic

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Colin Campbell 2014-11-27 16:07:23 +00:00 committed by Tomas Cohen Arazi
parent a5c9947f43
commit ee02bcb14f
1 changed files with 1 additions and 1 deletions

View File

@ -71,7 +71,7 @@ sub accounts {
sub find_service {
my ($self, $sockaddr, $port, $proto) = @_;
my $portstr;
foreach my $addr ('', '*:', "$sockaddr:") {
foreach my $addr ('', '*:', "$sockaddr:", "[$sockaddr]:") {
$portstr = sprintf("%s%s/%s", $addr, $port, lc $proto);
Sys::Syslog::syslog("LOG_DEBUG", "Configuration::find_service: Trying $portstr");
last if (exists(($self->{listeners})->{$portstr}));