Subject: | Nameserver infinite loop with invalid bind address |
Date: | Mon, 26 Aug 2019 23:57:17 +0200 |
To: | bug-Net-DNS [...] rt.cpan.org |
From: | Tobias Mädel <t.maedel [...] alfeld.de> |
Hi,
when Net:DNS:Nameserver is used with an invalid address for the local
bind address, it will start running in an infinite loop and use 100% of
the available CPU power.
This is because in Nameserver.pm, errors while creating the UDP and TCP
sockets are only handled with a carp.
I'm not too familiar with Perl, but maybe "croak" would be more
appropriate? I don't think the program should be running after an
unsuccessful socket creation.
To test the bug, use the Nameserver example code and add
LocalAddr => [ "::1234" ],
to the array of parameters for the nameserver object.
After complaining about
"Couldn't create UDP socket: Cannot assign requested address at test.pl
line 36."
it will start writing "TCP connection closed by peer before we could
accept it.
Waiting for connections..." and use all available CPU.
System info if it's interesting:
perl5 (revision 5 version 30 subversion 0)
Net::DNS - 1.20
Tested on Arch & Debian
Thanks,
Tobias
@manawyrm