From: Fred Morcos Date: Thu, 22 Sep 2022 15:22:52 +0000 (+0200) Subject: auth: Remove usage of parseService[4|6] and ServiceTuple X-Git-Tag: rec-4.9.0-alpha0~35^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F11989%2Fhead;p=thirdparty%2Fpdns.git auth: Remove usage of parseService[4|6] and ServiceTuple --- diff --git a/pdns/communicator.hh b/pdns/communicator.hh index 4ad9217182..b4e90f3bcb 100644 --- a/pdns/communicator.hh +++ b/pdns/communicator.hh @@ -84,12 +84,9 @@ public: bool removeIf(const ComboAddress& remote, uint16_t id, const DNSName& domain) { - ServiceTuple stRemote, stQueued; - parseService(remote, stRemote); - for (auto i = d_nqueue.begin(); i != d_nqueue.end(); ++i) { - parseService(i->ip, stQueued); - if (i->id == id && stQueued.host == stRemote.host && i->domain == domain) { + ComboAddress stQueued{i->ip}; + if (i->id == id && stQueued == remote && i->domain == domain) { d_nqueue.erase(i); return true; } diff --git a/pdns/mastercommunicator.cc b/pdns/mastercommunicator.cc index 7bbfd78d5f..bb511fcbe4 100644 --- a/pdns/mastercommunicator.cc +++ b/pdns/mastercommunicator.cc @@ -240,7 +240,7 @@ time_t CommunicatorClass::doNotifications(PacketHandler* P) g_log << Logger::Warning << "Received unsuccessful notification report for '" << p.qdomain << "' from " << from.toStringWithPort() << ", error: " << RCode::to_s(p.d.rcode) << endl; } - if (d_nq.removeIf(from.toStringWithPort(), p.d.id, p.qdomain)) { + if (d_nq.removeIf(from, p.d.id, p.qdomain)) { g_log << Logger::Notice << "Removed from notification list: '" << p.qdomain << "' to " << from.toStringWithPort() << " " << (p.d.rcode ? RCode::to_s(p.d.rcode) : "(was acknowledged)") << endl; } else { @@ -261,7 +261,7 @@ time_t CommunicatorClass::doNotifications(PacketHandler* P) ComboAddress remote(ip, 53); // default to 53 if ((d_nsock6 < 0 && remote.sin4.sin_family == AF_INET6) || (d_nsock4 < 0 && remote.sin4.sin_family == AF_INET)) { g_log << Logger::Warning << "Unable to notify " << remote.toStringWithPort() << " for domain '" << domain << "', address family is disabled. Is an IPv" << (remote.sin4.sin_family == AF_INET ? "4" : "6") << " address set in query-local-address?" << endl; - d_nq.removeIf(remote.toStringWithPort(), id, domain); // Remove, we'll never be able to notify + d_nq.removeIf(remote, id, domain); // Remove, we'll never be able to notify continue; // don't try to notify what we can't! } if (d_preventSelfNotification && AddressIsUs(remote)) {