Skip Menu |

This queue is for tickets about the Net-DNS CPAN distribution.

Report information
The Basics
Id: 1488
Status: resolved
Priority: 0/
Queue: Net-DNS

People
Owner: rt-cpan [...] triv.org
Requestors: misiek [...] pld.ORG.PL
twilliams [...] tfcci.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.22
Fixed in: (no value)



Subject: Illegal division by zero
OS = Redhat 6.2 perl -v = This is perl, version 5.005_03 built for i386-linux uname -a = Linux buildbox62 2.2.19-6.2.12smp #1 SMP Fri Oct 26 12:55:05 EDT 2001 i586 unknown If a valid network connection is not reachable (example: ifdown ifcfg-eth1) and then you attempt to use Net::DNS to do a lookup, the Resolver fails and bails... Here is the error I received: Illegal division by zero at /usr/lib/perl5/site_perl/5.005/Net/DNS/Resolver.pm line 818. Not a real biggie, but thought you might like to know about it. Thanks! Todd
From: k.heinz.sep.zwei [...] onlinehome.de
[guest - Fri Aug 30 17:00:54 2002]: Show quoted text
> OS = Redhat 6.2
NetBSD/i386 1.5.2 here Show quoted text
> perl -v = This is perl, version 5.005_03 built for i386-linux > uname -a = Linux buildbox62 2.2.19-6.2.12smp #1 SMP Fri Oct 26 > 12:55:05 EDT 2001 i586 unknown
perl 5.6.1 and Net-DNS 0.28 Show quoted text
> Here is the error I received: > Illegal division by zero at > /usr/lib/perl5/site_perl/5.005/Net/DNS/Resolver.pm line 818.
Same situation here, the same error message. The error occurs in the expression $timeout = int($retrans / ($#ns + 1)) at line 820. The array @ns is modified inside the for-loop (which also modifies $#ns) to the point that sometimes @ns is empty and $#ns has the value -1, thus making $#ns+1 equal to zero -> boom. This only happens when my dialup line is down. Using $#ns+2 avoids the problem and confirms the root of the problem but is of course no real fix for it. The last version of Net-DNS I had (0.12) didn't show this behaviour and did _not_ modify @ns inside the for-loop. ciao Klaus Heinz
[guest - Fri Aug 30 17:00:54 2002]: Show quoted text
> OS = Redhat 6.2 > perl -v = This is perl, version 5.005_03 built for i386-linux > uname -a = Linux buildbox62 2.2.19-6.2.12smp #1 SMP Fri Oct 26 > 12:55:05 EDT 2001 i586 unknown > > If a valid network connection is not reachable (example: ifdown ifcfg- > eth1) and then you attempt to use Net::DNS to do a lookup, the > Resolver fails and bails... > > Here is the error I received: > Illegal division by zero at > /usr/lib/perl5/site_perl/5.005/Net/DNS/Resolver.pm line 818.
Thanks for the report, this will be fixed in the next CPAN release. Sorry it took so long to get back to you. -- Chris Reinhardt ctriv@dyndns.org Systems Architect Dynamic DNS Network Services http://www.dyndns.org/
Subject: broken resolving when all nameservers in resolv.conf are unreachavle (div by zero error)
Ok, the problem is div by zero error in 818 line of Resolv.pm using even example resolving code: # Perform each round of retries. for (my $i = 0; $i < $self->{'retry'}; ++$i, $retrans *= 2, $timeout = int($retrans / ($#ns + 1))) { $timeout = 1 if ($timeout < 1); When all nameservers in /etc/resolv.conf are unreachable we get that error. My simple fix attached.
diff -urN Net-DNS-0.28.org/lib/Net/DNS/Resolver.pm Net-DNS-0.28/lib/Net/DNS/Resolver.pm --- Net-DNS-0.28.org/lib/Net/DNS/Resolver.pm Fri Sep 13 12:02:07 2002 +++ Net-DNS-0.28/lib/Net/DNS/Resolver.pm Fri Sep 13 12:31:55 2002 @@ -817,7 +817,7 @@ # Perform each round of retries. for (my $i = 0; $i < $self->{'retry'}; - ++$i, $retrans *= 2, $timeout = int($retrans / ($#ns + 1))) { + ++$i, $retrans *= 2, $timeout = int($retrans / ((($#ns == -1) ? 0 : $#ns) + 1))) { $timeout = 1 if ($timeout < 1);
From: Arkadiusz Miskiewicz
[guest - Fri Sep 13 13:45:45 2002]: doh, that's already reported and commented ;\ Sorry for duplicate.