summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-08-25 18:54:55 +0200
committerLennart Poettering <lennart@poettering.net>2015-08-25 18:54:55 +0200
commit069360a66a227606f4cf5e6ec05de61cd6ade76e (patch)
tree60181977f649faf8e3d730c0d51a108325a64f64 /src
parent4667e00a61c2f60922558bc5e33ac9d3073a482c (diff)
resolved: make packet flags logic more expressive again
This partially reverts 106784ebb7b303ae471851100a773ad2aebf5b80, ad readds separate DNS_PACKET_MAKE_FLAGS() invocations for the LLMNR and DNS case. This is important since SOme flags have different names and meanings on LLMNR and on DNS and we should clarify that via the comments and how we put things together.
Diffstat (limited to 'src')
-rw-r--r--src/resolve/resolved-dns-packet.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/src/resolve/resolved-dns-packet.c b/src/resolve/resolved-dns-packet.c
index 784d949cce..bebd1ee4a6 100644
--- a/src/resolve/resolved-dns-packet.c
+++ b/src/resolve/resolved-dns-packet.c
@@ -64,7 +64,7 @@ int dns_packet_new(DnsPacket **ret, DnsProtocol protocol, size_t mtu) {
int dns_packet_new_query(DnsPacket **ret, DnsProtocol protocol, size_t mtu) {
DnsPacket *p;
DnsPacketHeader *h;
- int r, rd;
+ int r;
assert(ret);
@@ -74,27 +74,26 @@ int dns_packet_new_query(DnsPacket **ret, DnsProtocol protocol, size_t mtu) {
h = DNS_PACKET_HEADER(p);
- switch (protocol) {
- case DNS_PROTOCOL_LLMNR:
- /* no recursion for link-local resolving protocols */
- rd = 0;
- break;
-
- default:
- /* ask for recursion */
- rd = 1;
- break;
- }
-
- h->flags = htobe16(DNS_PACKET_MAKE_FLAGS(0 /* qr */,
- 0 /* opcode */,
- 0 /* aa */,
- 0 /* tc */,
- rd /* rd */,
- 0 /* ra */,
- 0 /* ad */,
- 0 /* cd */,
- 0 /* rcode */));
+ if (protocol == DNS_PROTOCOL_LLMNR)
+ h->flags = htobe16(DNS_PACKET_MAKE_FLAGS(0 /* qr */,
+ 0 /* opcode */,
+ 0 /* c */,
+ 0 /* tc */,
+ 0 /* t */,
+ 0 /* ra */,
+ 0 /* ad */,
+ 0 /* cd */,
+ 0 /* rcode */));
+ else
+ h->flags = htobe16(DNS_PACKET_MAKE_FLAGS(0 /* qr */,
+ 0 /* opcode */,
+ 0 /* aa */,
+ 0 /* tc */,
+ 1 /* rd (ask for recursion) */,
+ 0 /* ra */,
+ 0 /* ad */,
+ 0 /* cd */,
+ 0 /* rcode */));
*ret = p;
return 0;