pdns icon indicating copy to clipboard operation
pdns copied to clipboard

dnsdist: Fix a bug in SetEDNSOptionAction

Open rgacogne opened this issue 3 years ago • 2 comments

Short description

The DNS parser has already converted the "TTL" of the OPT record to the host byte order before providing to us, and unfortunately we do not want that for the meta-OPT record, where the TTL is used to encode the extended rcode, the EDNS version and the DO bits, amongst other things. In other places we do parse the TTL from the DNS payload ourselves and thus do not need to worry about that conversion, but here we need to convert the value back to the network byte order.

Fixes #11728.

This PR needs unit and regression tests before being merged.

Checklist

I have:

  • [x] read the CONTRIBUTING.md document
  • [x] compiled this code
  • [x] tested this code
  • [ ] included documentation (including possible behaviour changes)
  • [ ] documented the code
  • [ ] added or modified regression test(s)
  • [ ] added or modified unit test(s)

rgacogne avatar Jun 28 '22 08:06 rgacogne

I just pushed unit and regression tests, plus a new DNSQuestion:setEDNSOption() binding which is usable from a Lua function.

rgacogne avatar Jul 02 '22 10:07 rgacogne

The current approach does not link, I will have to do things differently:

  • move the code dealing with the EDNS option to a different function in a different file
  • call that function from the Lua action and DNSQuestion method

rgacogne avatar Aug 10 '22 07:08 rgacogne

Finally found the time to do that, this PR should now be ready for review.

rgacogne avatar Aug 10 '22 16:08 rgacogne