Skip to content

dnsdist: Add recvmmsg support for backend responses#16932

Draft
rgacogne wants to merge 1 commit intoPowerDNS:masterfrom
rgacogne:ddistrecvmmsg-from-backends
Draft

dnsdist: Add recvmmsg support for backend responses#16932
rgacogne wants to merge 1 commit intoPowerDNS:masterfrom
rgacogne:ddistrecvmmsg-from-backends

Conversation

@rgacogne
Copy link
Member

@rgacogne rgacogne commented Feb 25, 2026

Short description

Needs testing, especially performance testing, documentation and perhaps even a switch in the configuration.

Closes #16625

Checklist

I have:

  • read the CONTRIBUTING.md document
  • read and accepted the Developer Certificate of Origin document, including the AI Policy, and added a "Signed-off-by" to my commits
  • compiled this code
  • tested this code
  • included documentation (including possible behaviour changes)
  • documented the code
  • added or modified regression test(s)
  • added or modified unit test(s)

Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
for (size_t idx = 0; idx < vectSize; idx++) {
recvData[idx].packet.resize(initialBufferSize + 1);
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
fillMSGHdr(&msgVec[idx].msg_hdr, &recvData[idx].iov, &recvData[idx].cbuf, sizeof(recvData[idx].cbuf), reinterpret_cast<char*>(recvData[idx].packet.data()), initialBufferSize + 1, &recvData[idx].remote);

Check notice

Code scanning / CodeQL

Sizeof with side effects Note

A sizeof operator should not be used on expressions that contain side effects as the effect is confusing.
for (size_t idx = 0; idx < vectSize; idx++) {
recvData[idx].packet.resize(initialBufferSize + 1);
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
fillMSGHdr(&msgVec[idx].msg_hdr, &recvData[idx].iov, &recvData[idx].cbuf, sizeof(recvData[idx].cbuf), reinterpret_cast<char*>(recvData[idx].packet.data()), initialBufferSize + 1, &recvData[idx].remote);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bot complains that recvData[idx] is a function call in disguise. The following ought to silence it:

Suggested change
fillMSGHdr(&msgVec[idx].msg_hdr, &recvData[idx].iov, &recvData[idx].cbuf, sizeof(recvData[idx].cbuf), reinterpret_cast<char*>(recvData[idx].packet.data()), initialBufferSize + 1, &recvData[idx].remote);
fillMSGHdr(&msgVec[idx].msg_hdr, &recvData[idx].iov, &recvData[idx].cbuf, sizeof(cmsgbuf_aligned /*recvData[idx].cbuf*/), reinterpret_cast<char*>(recvData[idx].packet.data()), initialBufferSize + 1, &recvData[idx].remote);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use decltype?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, that ought to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dnsdist: Ponder using recvmmsg to receive UDP responses from backends

3 participants