I've created a C program (attached) which demonstrates the issue. It can be compiled using the following command:
gcc dnsadtest.c -lresolv
This command generates an executable called "a.out".
If I run a.out on Ubuntu 18.04 (bionic) I get the following output:
length of answer = 251
id = 10740
opcode = 0
rcode = 0
rd flag = 1
tc flag = 0
aa flag = 0
qr flag = 1
cd flag = 0
ad flag = 1
ra flag = 1
qdcount = 256
ancount = 512
nscount = 0
arcount = 256
You can see that the output includes "ad flag = 1".
But if I run a.out on Ubuntu 20.04 (focal) I get the following output:
length of answer = 251
id = 48769
opcode = 0
rcode = 0
rd flag = 1
tc flag = 0
aa flag = 0
qr flag = 1
cd flag = 0
ad flag = 0
ra flag = 1
qdcount = 256
ancount = 512
nscount = 0
arcount = 256
And you can see that the output includes "ad flag = 0".
Based on this I believe there is a bug in the DNS resolver in Ubuntu 20.04.
Unfortunately my 18.04 server is 32-bit and by 20.04 server is 64-bit, but my testing gives the following results:
18.04 32-bit = libc6:i386 2.27-3ubuntu1 = works (ad flag = 1)
20.04 64-bit = libc6:amd64 2.31-0ubuntu9 = exhibits the issue (ad flag = 0)
20.04 32-bit* = libc6-i386 2.31-0ubuntu9 = exhibits the issue (ad flag = 0)
* = running a.out compiled on 32-bit machine
So it looks to me like the problem was introduced in the libc6 package somewhere between version 2.28 and 2.31 (inclusive).
I've created a C program (attached) which demonstrates the issue. It can be compiled using the following command:
gcc dnsadtest.c -lresolv
This command generates an executable called "a.out".
If I run a.out on Ubuntu 18.04 (bionic) I get the following output:
length of answer = 251
id = 10740
opcode = 0
rcode = 0
rd flag = 1
tc flag = 0
aa flag = 0
qr flag = 1
cd flag = 0
ad flag = 1
ra flag = 1
qdcount = 256
ancount = 512
nscount = 0
arcount = 256
You can see that the output includes "ad flag = 1".
But if I run a.out on Ubuntu 20.04 (focal) I get the following output:
length of answer = 251
id = 48769
opcode = 0
rcode = 0
rd flag = 1
tc flag = 0
aa flag = 0
qr flag = 1
cd flag = 0
ad flag = 0
ra flag = 1
qdcount = 256
ancount = 512
nscount = 0
arcount = 256
And you can see that the output includes "ad flag = 0".
Based on this I believe there is a bug in the DNS resolver in Ubuntu 20.04.
Unfortunately my 18.04 server is 32-bit and by 20.04 server is 64-bit, but my testing gives the following results:
18.04 32-bit = libc6:i386 2.27-3ubuntu1 = works (ad flag = 1)
20.04 64-bit = libc6:amd64 2.31-0ubuntu9 = exhibits the issue (ad flag = 0)
20.04 32-bit* = libc6-i386 2.31-0ubuntu9 = exhibits the issue (ad flag = 0)
* = running a.out compiled on 32-bit machine
So it looks to me like the problem was introduced in the libc6 package somewhere between version 2.28 and 2.31 (inclusive).
Can anyone corroborate my findings?
Thanks,
Nick.