From: Aki Tuomi Date: Mon, 21 Oct 2019 07:30:51 +0000 (+0300) Subject: global: Normalize isIpv4 to isIPv4 X-Git-Tag: auth-4.3.0-alpha1~21^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d14121a8d88d59f587fef53ba3ee36f8485b2224;p=thirdparty%2Fpdns.git global: Normalize isIpv4 to isIPv4 --- diff --git a/pdns/calidns.cc b/pdns/calidns.cc index c4584c1c46..39796e5f71 100644 --- a/pdns/calidns.cc +++ b/pdns/calidns.cc @@ -335,7 +335,7 @@ try ecsRange = Netmask(g_vm["ecs"].as()); if (!ecsRange.empty()) { - if (!ecsRange.isIpv4()) { + if (!ecsRange.isIPv4()) { cerr<<"Only IPv4 ranges are supported for ECS at the moment!"<writeFunction("newNetmask", [](const string& s) { return Netmask(s); }); d_lw->registerFunction("getNetwork", [](const Netmask& nm) { return nm.getNetwork(); } ); // const reference makes this necessary d_lw->registerFunction("getMaskedNetwork", [](const Netmask& nm) { return nm.getMaskedNetwork(); } ); - d_lw->registerFunction("isIpv4", &Netmask::isIpv4); + d_lw->registerFunction("isIpv4", &Netmask::isIPv4); + d_lw->registerFunction("isIPv4", &Netmask::isIPv4); d_lw->registerFunction("isIpv6", &Netmask::isIPv6); d_lw->registerFunction("isIPv6", &Netmask::isIPv6); d_lw->registerFunction("getBits", &Netmask::getBits); diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 7cdc320494..52cadda8c1 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -817,7 +817,7 @@ static void protobufLogQuery(uint8_t maskV4, uint8_t maskV6, const boost::uuids: const ComboAddress& requestor = requestorNM.getMaskedNetwork(); RecProtoBufMessage message(DNSProtoBufMessage::Query, uniqueId, &requestor, &local, qname, qtype, qclass, id, tcp, len); message.setServerIdentity(SyncRes::s_serverID); - message.setEDNSSubnet(ednssubnet, ednssubnet.isIpv4() ? maskV4 : maskV6); + message.setEDNSSubnet(ednssubnet, ednssubnet.isIPv4() ? maskV4 : maskV6); message.setRequestorId(requestorId); message.setDeviceId(deviceId); message.setDeviceName(deviceName); @@ -1187,7 +1187,7 @@ static void startDoResolve(void *p) const ComboAddress& requestor = requestorNM.getMaskedNetwork(); pbMessage = RecProtoBufMessage(RecProtoBufMessage::Response, dc->d_uuid, &requestor, &dc->d_destination, dc->d_mdp.d_qname, dc->d_mdp.d_qtype, dc->d_mdp.d_qclass, dc->d_mdp.d_header.id, dc->d_tcp, 0); pbMessage->setServerIdentity(SyncRes::s_serverID); - pbMessage->setEDNSSubnet(dc->d_ednssubnet.source, dc->d_ednssubnet.source.isIpv4() ? luaconfsLocal->protobufMaskV4 : luaconfsLocal->protobufMaskV6); + pbMessage->setEDNSSubnet(dc->d_ednssubnet.source, dc->d_ednssubnet.source.isIPv4() ? luaconfsLocal->protobufMaskV4 : luaconfsLocal->protobufMaskV6); } #endif /* HAVE_PROTOBUF */ @@ -2383,7 +2383,7 @@ static string* doProcessUDPQuestion(const std::string& question, const ComboAddr Netmask requestorNM(source, source.sin4.sin_family == AF_INET ? luaconfsLocal->protobufMaskV4 : luaconfsLocal->protobufMaskV6); const ComboAddress& requestor = requestorNM.getMaskedNetwork(); pbMessage->update(uniqueId, &requestor, &destination, false, dh->id); - pbMessage->setEDNSSubnet(ednssubnet.source, ednssubnet.source.isIpv4() ? luaconfsLocal->protobufMaskV4 : luaconfsLocal->protobufMaskV6); + pbMessage->setEDNSSubnet(ednssubnet.source, ednssubnet.source.isIPv4() ? luaconfsLocal->protobufMaskV4 : luaconfsLocal->protobufMaskV6); if (g_useKernelTimestamp && tv.tv_sec) { pbMessage->setQueryTime(tv.tv_sec, tv.tv_usec); } diff --git a/pdns/syncres.cc b/pdns/syncres.cc index 457fabdf65..527bb3abd7 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -2784,7 +2784,7 @@ RCode::rcodes_ SyncRes::updateCacheFromRecords(unsigned int depth, LWResult& lwr if (i->first.place == DNSResourceRecord::ANSWER && ednsmask) { // If ednsmask is relevant, we do not want to cache if the scope prefix length is large and TTL is small if (SyncRes::s_ecscachelimitttl > 0) { - bool manyMaskBits = (ednsmask->isIpv4() && ednsmask->getBits() > SyncRes::s_ecsipv4cachelimit) || + bool manyMaskBits = (ednsmask->isIPv4() && ednsmask->getBits() > SyncRes::s_ecsipv4cachelimit) || (ednsmask->isIPv6() && ednsmask->getBits() > SyncRes::s_ecsipv6cachelimit); if (manyMaskBits) { @@ -3141,7 +3141,7 @@ bool SyncRes::doResolveAtThisIP(const std::string& prefix, const DNSName& qname, s_ecsresponses++; LOG(prefix<toString()<<" on response"<getBits() > 0) { - if (ednsmask->isIpv4()) { + if (ednsmask->isIPv4()) { ++SyncRes::s_ecsResponsesBySubnetSize4.at(ednsmask->getBits()-1); } else { @@ -3556,7 +3556,7 @@ void SyncRes::setQuerySource(const ComboAddress& requestor, boost::optionalsource.getBits() > 0) { d_cacheRemote = incomingECS->source.getMaskedNetwork(); - uint8_t bits = std::min(incomingECS->source.getBits(), (incomingECS->source.isIpv4() ? s_ecsipv4limit : s_ecsipv6limit)); + uint8_t bits = std::min(incomingECS->source.getBits(), (incomingECS->source.isIPv4() ? s_ecsipv4limit : s_ecsipv6limit)); ComboAddress trunc = incomingECS->source.getNetwork(); trunc.truncate(bits); d_outgoingECSNetwork = boost::optional(Netmask(trunc, bits)); diff --git a/pdns/test-iputils_hh.cc b/pdns/test-iputils_hh.cc index 97b5ccb48e..ac7288646a 100644 --- a/pdns/test-iputils_hh.cc +++ b/pdns/test-iputils_hh.cc @@ -177,14 +177,14 @@ BOOST_AUTO_TEST_CASE(test_Netmask) { BOOST_CHECK(nm.getBits() == 24); BOOST_CHECK(nm.match(local)); BOOST_CHECK(!nm.match(remote)); - BOOST_CHECK(nm.isIpv4()); + BOOST_CHECK(nm.isIPv4()); BOOST_CHECK(!nm.isIPv6()); Netmask nm6("fe80::92fb:a6ff:fe4a:51da/64"); BOOST_CHECK(nm6.getBits() == 64); BOOST_CHECK(nm6.match("fe80::92fb:a6ff:fe4a:51db")); BOOST_CHECK(!nm6.match("fe81::92fb:a6ff:fe4a:51db")); - BOOST_CHECK(!nm6.isIpv4()); + BOOST_CHECK(!nm6.isIPv4()); BOOST_CHECK(nm6.isIPv6()); Netmask nmp("130.161.252.29/32");