From 28eb669e04c516c67629db4a0d5d9b18fa72b823 Mon Sep 17 00:00:00 2001 From: Peter van Dijk Date: Thu, 18 Jul 2024 19:48:26 +0200 Subject: [PATCH] print scope if available --- pdns/pdnsutil.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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) { -- 2.47.2