summaryrefslogtreecommitdiff
path: root/src/resolve/resolved-dns-packet.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-07-16 18:03:46 +0200
committerLennart Poettering <lennart@poettering.net>2014-07-16 18:03:46 +0200
commit3cb10d3a0b1b6a7c44f307f2abb5215104e16941 (patch)
treeb6e20ffbbbb982bdff0766e69304866a5004c72e /src/resolve/resolved-dns-packet.c
parentacbc5016027950efd543e0b054e6370a8a4e17f9 (diff)
dns-domain: introduce macros for accessing all DNS header fields
Diffstat (limited to 'src/resolve/resolved-dns-packet.c')
-rw-r--r--src/resolve/resolved-dns-packet.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/resolve/resolved-dns-packet.c b/src/resolve/resolved-dns-packet.c
index a503b01506..9aa0734213 100644
--- a/src/resolve/resolved-dns-packet.c
+++ b/src/resolve/resolved-dns-packet.c
@@ -116,7 +116,6 @@ int dns_packet_validate(DnsPacket *p) {
}
int dns_packet_validate_reply(DnsPacket *p) {
- DnsPacketHeader *h;
int r;
assert(p);
@@ -125,14 +124,10 @@ int dns_packet_validate_reply(DnsPacket *p) {
if (r < 0)
return r;
- h = DNS_PACKET_HEADER(p);
-
- /* Check QR field */
- if ((be16toh(h->flags) & 1) == 0)
+ if (DNS_PACKET_QR(p) == 0)
return -EBADMSG;
- /* Check opcode field */
- if (((be16toh(h->flags) >> 1) & 15) != 0)
+ if (DNS_PACKET_OPCODE(p) != 0)
return -EBADMSG;
return 0;
@@ -699,7 +694,7 @@ int dns_packet_skip_question(DnsPacket *p) {
unsigned i, n;
assert(p);
- n = be16toh(DNS_PACKET_HEADER(p)->qdcount);
+ n = DNS_PACKET_QDCOUNT(p);
for (i = 0; i < n; i++) {
_cleanup_(dns_resource_key_free) DnsResourceKey key = {};