diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-07-16 18:03:46 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-07-16 18:03:46 +0200 |
commit | 3cb10d3a0b1b6a7c44f307f2abb5215104e16941 (patch) | |
tree | b6e20ffbbbb982bdff0766e69304866a5004c72e /src/resolve/resolved-dns-packet.c | |
parent | acbc5016027950efd543e0b054e6370a8a4e17f9 (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.c | 11 |
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 = {}; |