DnsResponse
Description
Parsed DNS message. id echoes the client-supplied transaction id from the matching query so the resolver can pair responses.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Dns.h:98:
DnsRecords authority;
DnsRecords additional;
} DnsResponse;
#include <Misra/Parsers/Dns/Private.h>- In
Dns.h:146:
/// `DnsResponseDeinit`.
///
bool DnsParseResponse(DnsResponse *out, const u8 *buf, u64 len, Allocator *alloc);
///
- In
Dns.h:156:
/// TAGS: Dns, Parser, Deinit, Lifecycle
///
void DnsResponseDeinit(DnsResponse *self);
///
- In
Dns.c:537:
}
DnsResponse resp = {0};
// DnsParseResponse takes `Allocator *` -- legitimate erasure
// boundary; pass at the call site, no intermediate variable.
- In
Dns.c:270:
}
bool DnsParseResponse(DnsResponse *out, const u8 *buf, u64 len, Allocator *alloc) {
if (!out || !buf || !alloc) {
return false;- In
Dns.c:339:
}
void DnsResponseDeinit(DnsResponse *self) {
if (!self) {
return;- In
Dns.c:154:
};
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, sizeof(wire), a);- In
Dns.c:220:
};
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, sizeof(wire), a);
bool match = ok && resp.rcode == DNS_RCODE_NXDOMAIN && VecLen(&resp.answers) == 0;- In
Dns.c:291:
};
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, sizeof(wire), a);
bool match = ok && VecLen(&resp.answers) == 1;- In
Dns.c:562:
};
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, sizeof(wire), a);
bool match = ok && VecLen(&resp.answers) == 1;- In
Dns.c:617:
};
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, sizeof(wire), a);
bool match = ok && resp.id == 0x0005;- In
Dns.c:657:
wire[p++] = 0x01;
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, p, a);
bool match = ok && resp.id == 0x0009;- In
Dns.c:737:
wire[p++] = 0x04;
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, p, a);
bool match = ok && q2_off == 256 && VecLen(&resp.answers) == 1;- In
Dns.c:804:
};
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, sizeof(wire), a);
bool match = ok && VecLen(&resp.answers) == 1;- In
Dns.c:849:
};
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, sizeof(wire), a);
bool match = !ok; // must be rejected
- In
Dns.c:889:
};
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, sizeof(wire), a);
bool match = !ok; // self pointer must be rejected
- In
Dns.c:915:
static const u8 wire[] = {0xab, 0xcd, 0x81, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, sizeof(wire), a);
bool match = ok && resp.id == 0xABCD && VecLen(&resp.answers) == 0 && VecLen(&resp.authority) == 0 &&- In
Dns.c:933:
static const u8 wire[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, sizeof(wire), a);- In
Dns.c:959:
static const u8 wire[] = {0x11, 0x22, 0x85, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, sizeof(wire), a);
bool match = ok && resp.id == 0x1122 && resp.is_response == true && resp.authoritative == true &&- In
Dns.c:981:
static const u8 wire[] = {0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, sizeof(wire), a);
bool match = ok && resp.is_response == false && resp.authoritative == false && resp.truncated == true &&- In
Dns.c:1000:
static const u8 wire[] = {0x00, 0x01, 0x81, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, sizeof(wire), a);
bool match = ok && resp.rcode == DNS_RCODE_NXDOMAIN;- In
Dns.c:1078:
};
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, sizeof(wire), a);
bool match = ok && VecLen(&resp.answers) == 2;- In
Dns.c:1106:
0x00, 0x01, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x01, 0x02, 0x03, 0x04};
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, sizeof(wire), a);
bool match = ok && VecLen(&resp.answers) == 1;- In
Dns.c:1131:
0x00, 0x04, 0x7f, 0x00, 0x00, 0x01};
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, sizeof(wire), a);
bool match = ok && VecLen(&resp.answers) == 1;- In
Dns.c:1217:
};
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, sizeof(wire), a);
bool match = ok && VecLen(&resp.answers) == 2;- In
Dns.c:1302:
};
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, sizeof(wire), a);
bool match = ok && VecLen(&resp.answers) == 2;- In
Dns.c:1398:
};
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, sizeof(wire), a);
bool match = ok && VecLen(&resp.answers) == 1 && VecLen(&resp.authority) == 1 && VecLen(&resp.additional) == 1;- In
Dns.c:1465:
};
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, sizeof(wire), a);
bool match = ok && VecLen(&resp.answers) == 1;- In
Dns.c:1517:
};
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, sizeof(wire), a);
bool match = ok && VecLen(&resp.answers) == 1;- In
Dns.c:1547:
};
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, sizeof(wire), a);- In
Dns.c:1566:
};
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, sizeof(wire), a);- In
Dns.c:1658:
wire[p++] = 0x01;
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, p, a);
bool match = !ok; // real code rejects: 191 + 1 + 62 = 254 > 253.
- In
Dns.c:1695:
wire[p++] = 0x01;
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, p, a);
bool match = ok && resp.id == 0x000a;- In
Dns.c:1766:
// Mutant: 90 - 40 = 50, not > 94 -> accept (over-reads 40 garbage bytes).
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, p, a);
bool match = !ok; // real code rejects the truncated rdata.
- In
Dns.c:1824:
};
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, sizeof(wire), a);
bool match = ok && VecLen(&resp.answers) == 1;- In
Dns.c:1874:
0x0a, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 0x14};
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, sizeof(wire), a);
DnsResponseDeinit(&resp);- In
Dns.c:1897:
0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06};
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, sizeof(wire), a);
DnsResponseDeinit(&resp);- In
Dns.c:1921:
static const u8 wire[] = {0x00, 0x01, 0x81, 0x80, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0};
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, sizeof(wire), a);
DnsResponseDeinit(&resp);- In
Dns.c:2044:
u64 len = build_hop_chain(wire, 63); // 64 hops total
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, len, a);
bool match = ok && VecLen(&resp.answers) == 1;- In
Dns.c:2081:
0x05, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x02, 0xc0, 0x10};
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, sizeof(wire), adbg);
ok = ok && (VecLen(&resp.answers) == 1);- In
Dns.c:2152:
p = leak_put_a_record(wire, p, 'n');
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, p, adbg);
ok = ok && (VecLen(&resp.authority) == 1);- In
Dns.c:2180:
p = leak_put_a_record(wire, p, 'd');
DnsResponse resp = {0};
bool ok = DnsParseResponse(&resp, wire, p, adbg);
ok = ok && (VecLen(&resp.additional) == 1);
Last updated on