From: Peter van Dijk Date: Thu, 18 Jul 2024 17:48:26 +0000 (+0200) Subject: print scope if available X-Git-Tag: rec-5.2.0-alpha1~156^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=28eb669e04c516c67629db4a0d5d9b18fa72b823;p=thirdparty%2Fpdns.git print scope if available --- diff --git a/pdns/pdnsutil.cc b/pdns/pdnsutil.cc index f84a31b24f..346a47362b 100644 --- a/pdns/pdnsutil.cc +++ b/pdns/pdnsutil.cc @@ -4257,8 +4257,9 @@ try DNSName name{cmds.at(2)}; DNSPacket queryPacket(true); + Netmask clientNetmask; if (cmds.size() > 4) { - Netmask clientNetmask(cmds.at(4)); + clientNetmask = cmds.at(4); queryPacket.setRealRemote(clientNetmask); } @@ -4267,7 +4268,12 @@ try bool found = false; DNSZoneRecord resultZoneRecord; while (matchingBackend->get(resultZoneRecord)) { - cout << resultZoneRecord.dr.d_name.toString() << "\t" << std::to_string(resultZoneRecord.dr.d_ttl) << "\t" << QClass(resultZoneRecord.dr.d_class).toString() << "\t" << DNSRecordContent::NumberToType(resultZoneRecord.dr.d_type, resultZoneRecord.dr.d_class) << "\t" << resultZoneRecord.dr.getContent()->getZoneRepresentation() << endl; + cout << resultZoneRecord.dr.d_name.toString() << "\t" << std::to_string(resultZoneRecord.dr.d_ttl) << "\t" << QClass(resultZoneRecord.dr.d_class).toString() << "\t" << DNSRecordContent::NumberToType(resultZoneRecord.dr.d_type, resultZoneRecord.dr.d_class) << "\t" << resultZoneRecord.dr.getContent()->getZoneRepresentation(); + if (resultZoneRecord.scopeMask > 0) { + clientNetmask.setBits(resultZoneRecord.scopeMask); + cout << "\t" << "; " << clientNetmask.toString(); + } + cout << endl; found = true; } if (!found) {