cerr << "Syntax: sdig IP-ADDRESS-OR-DOH-URL PORT QNAME QTYPE "
"[dnssec] [ednssubnet SUBNET/MASK] [hidesoadetails] [hidettl] [recurse] [showflags] "
"[tcp] [dot] [insecure] [fastOpen] [subjectName name] [caStore file] [tlsProvider openssl|gnutls] "
- "[xpf XPFDATA] [class CLASSNUM] "
"[proxy UDP(0)/TCP(1) SOURCE-IP-ADDRESS-AND-PORT DESTINATION-IP-ADDRESS-AND-PORT] "
"[dumpluaraw] [opcode OPNUM]"
<< endl;
static void fillPacket(vector<uint8_t>& packet, const string& q, const string& t,
bool dnssec, const boost::optional<Netmask>& ednsnm,
- bool recurse, uint16_t xpfcode, uint16_t xpfversion,
- uint64_t xpfproto, char* xpfsrc, char* xpfdst,
- QClass qclass, uint8_t opcode, uint16_t qid)
+ bool recurse, QClass qclass, uint8_t opcode, uint16_t qid)
{
DNSPacketWriter pw(packet, DNSName(q), DNSRecordContent::TypeToNumber(t), qclass, opcode);
pw.commit();
}
- if (xpfcode) {
- ComboAddress src(xpfsrc), dst(xpfdst);
- pw.startRecord(g_rootdnsname, xpfcode, 0, QClass::IN, DNSResourceRecord::ADDITIONAL);
- // xpf->toPacket(pw);
- pw.xfr8BitInt(xpfversion);
- pw.xfr8BitInt(xpfproto);
- pw.xfrCAWithoutPort(xpfversion, src);
- pw.xfrCAWithoutPort(xpfversion, dst);
- pw.xfrCAPort(src);
- pw.xfrCAPort(dst);
- pw.commit();
- }
-
if (recurse) {
pw.getHeader()->rd = true;
}
bool insecureDoT = false;
bool fromstdin = false;
boost::optional<Netmask> ednsnm;
- uint16_t xpfcode = 0, xpfversion = 0, xpfproto = 0;
- char *xpfsrc = NULL, *xpfdst = NULL;
QClass qclass = QClass::IN;
uint8_t opcode = 0;
string proxyheader;
}
ednsnm = Netmask(argv[++i]);
}
- else if (strcmp(argv[i], "xpf") == 0) {
- if (argc < i + 6) {
- cerr << "xpf needs five arguments" << endl;
- exit(EXIT_FAILURE);
- }
- xpfcode = atoi(argv[++i]);
- xpfversion = atoi(argv[++i]);
- xpfproto = atoi(argv[++i]);
- xpfsrc = argv[++i];
- xpfdst = argv[++i];
- }
else if (strcmp(argv[i], "class") == 0) {
if (argc < i+2) {
cerr << "class needs an argument"<<endl;
#ifdef HAVE_LIBCURL
vector<uint8_t> packet;
s_expectedIDs.insert(0);
- fillPacket(packet, name, type, dnssec, ednsnm, recurse, xpfcode, xpfversion,
- xpfproto, xpfsrc, xpfdst, qclass, opcode, 0);
+ fillPacket(packet, name, type, dnssec, ednsnm, recurse, qclass, opcode, 0);
MiniCurl mc;
MiniCurl::MiniCurlHeaders mch;
mch.emplace("Content-Type", "application/dns-message");
for (const auto& it : questions) {
vector<uint8_t> packet;
s_expectedIDs.insert(counter);
- fillPacket(packet, it.first, it.second, dnssec, ednsnm, recurse, xpfcode,
- xpfversion, xpfproto, xpfsrc, xpfdst, qclass, opcode, counter);
+ fillPacket(packet, it.first, it.second, dnssec, ednsnm, recurse, qclass, opcode, counter);
counter++;
// Prefer to do a single write, so that fastopen can send all the data on SYN
{
vector<uint8_t> packet;
s_expectedIDs.insert(0);
- fillPacket(packet, name, type, dnssec, ednsnm, recurse, xpfcode, xpfversion,
- xpfproto, xpfsrc, xpfdst, qclass, opcode, 0);
+ fillPacket(packet, name, type, dnssec, ednsnm, recurse, qclass, opcode, 0);
string question(packet.begin(), packet.end());
Socket sock(dest.sin4.sin_family, SOCK_DGRAM);
question = proxyheader + question;