Catch bad DNS queries and reduce exception logging

This commit is contained in:
2023-10-04 15:50:24 +11:00
parent 0fcb628c11
commit d82f8ac8b3
2 changed files with 11 additions and 5 deletions

View File

@@ -104,7 +104,14 @@ final class DNS extends BaseProtocol
{
Log::debug(sprintf('%s:+ DNS Query',self::LOGKEY));
$this->query = new BaseProtocol\DNS\Query($this->client->read(0,512));
try {
$this->query = new BaseProtocol\DNS\Query($this->client->read(0,512));
} catch (\Exception $e) {
Log::error(sprintf('%s:! Ignoring bad DNS query (%s)',self::LOGKEY,$e->getMessage()));
return FALSE;
}
Log::info(sprintf('%s:= DNS Query from [%s] for [%s]',self::LOGKEY,$this->client->address_remote,$this->query->domain));