Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Proper EDNS handling and cleaner NOERROR response in DNSSERVER#11411

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
me-no-dev merged 9 commits intoespressif:masterfromKolkman:DNSServer-EDNS
Jun 20, 2025

Conversation

Kolkman
Copy link
Contributor

Description of Change

Bugs

The code solves two bugs:

  • BUG 1: When trouble shooting a dnsserver with the 'dig' (one of the main DNS troubleshooting tools) the server doesn't answer because it doesn't handle EDNS (OPT records in the additional section).

    That has been fixed, the additional section in the query can safely be ignored.
    (mostly change around line 123)

  • BUG 2: The code also returns an A record when the QUERY Type not 'A' (or 'ANY').

    This has been fixed too. For an A and ANY query type the server returns an A record.
    (mostly change around line 114)

Feature

The code continues to return a 'SERVFAIL' when no match with QNAME occurs. However, with the fix of bug 2 we created a proper 'No Data' response, (RFC2308 2.2) for queries that have a match for the name, but not for the type. The function DNSServer::replyWithNoAnsw implements that functionality.

The server now behaves somewhat more conform the DNS protocl specifications.

(most of the code changes)

Tests scenarios

I tested this code on an ESP32 and WireShark as protocol analyzer - there is no reason to suspect that it does not work on other platforms (to which I have no access).

Related links

@CLAassistant
Copy link

CLAassistant commentedMay 30, 2025
edited
Loading

CLA assistant check
All committers have signed the CLA.

@github-actionsGitHub Actions
Copy link
Contributor

github-actionsbot commentedMay 30, 2025
edited
Loading

Warnings
⚠️

Some issues found for the commit messages in this PR:

  • the commit message"Proper EDNS handling and cleaner NOERROR response":
    • summary looks empty
    • type/action looks empty
  • the commit message"Removing commented out code fragments":
    • summary looks empty
    • type/action looks empty
  • the commit message"Spelling Corrected and minor clarification in comments":
    • summary looks empty
    • type/action looks empty
  • the commit message"fix(pr): Fix typo":
    • summary looks too short

Please fix these commit messages - here are some basic tips:

  • followConventional Commits style
  • correct format of commit message should be:<type/action>(<scope/component>): <summary>, for examplefix(esp32): Fixed startup timeout issue
  • allowed types are:change,ci,docs,feat,fix,refactor,remove,revert,test
  • sufficiently descriptive message summary should be between 10 to 72 characters and start with upper case letter
  • avoid Jira references in commit messages (unavailable/irrelevant for our customers)

TIP: Install pre-commit hooks and run this check when committing (uses theConventional Precommit Linter).

⚠️

The source branch"DNSServer-EDNS" incorrect format:

  • contains uppercase letters. This can cause troubles on case-insensitive file systems (macOS).
    Please rename your branch.

👋Hello Kolkman, we appreciate your contribution to this project!


📘 Please review the project'sContributions Guide for key guidelines on code, documentation, testing, and more.

🖊️ Please also make sure you haveread and signed theContributor License Agreement for this project.

Click to see more instructions ...


This automated output is generated by thePR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with eachpush event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger isnot a substitute for human code reviews; it's still important to request a code review from your colleagues.
-Resolve all warnings (⚠️ ) before requesting a review from human reviewers - they will appreciate it.
- To manuallyretry these Danger checks, please navigate to theActions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the GitHub PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫dangerJS againsta28c02b

@lucasssvazlucasssvaz added the Area: LibrariesIssue is related to Library support. labelMay 30, 2025
@@ -1,5 +1,5 @@
name=DNSServer
version=3.2.0
version=3.3.0
Copy link
Member

Choose a reason for hiding this comment

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

this version is updated with every new release. Please revert

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Reverted the change withnew commit

@@ -9,6 +9,23 @@
#define DNS_OFFSET_DOMAIN_NAME DNS_HEADER_SIZE // Offset in bytes to reach the domain name labels in the DNS message
#define DNS_DEFAULT_PORT 53

#define DNS_SOA_MNAME_LABEL "ns"
#define DNS_SOA_RNAME_LABEL "esp32"
Copy link
Member

Choose a reason for hiding this comment

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

what are MNAME and RNAME? How are their values chosen?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

MNAME and RNAME are values defined inRFC1035 section 3.1.13.

Tne MNAME is the name of the primary nameserver the request came from - that value is only used in the context of dynamic DNS updatesRFC 2136. In this contexts it is purely informational. I chose the 'ns' label as that is sort of customary for nameservers.

The RNAME is used to construct the email address of the administrator for the zone. The way things are coded now that is esp32@local. There nothing in the DNS protocol that uses that value, it is only for network administrator information siganling purpose.

reverting version number update - as it is done automatically
@me-no-devme-no-dev added the Status: Pending MergePull Request is ready to be merged labelJun 4, 2025
@me-no-devme-no-dev requested a review fromCopilotJune 4, 2025 13:22
@pre-commit-ci-litepre-commit-ci-litebot requested a review froma team as acode ownerJune 4, 2025 13:23
@me-no-dev
Copy link
Member

@Kolkman small typo reported by the CI:https://github.com/espressif/arduino-esp32/actions/runs/15443489960/job/43466846177?pr=11411#step:9:29

Kolkman reacted with thumbs up emoji

Copy link
Contributor

@CopilotCopilotAI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the DNSServer to properly ignore EDNS OPT records and return an RFC-compliant "No Data" (NODATA) response with an SOA record when the queried name exists but the type does not match.

  • Ignore the additional section (EDNS OPT) by zeroingARCount so queries with OPT still match.
  • Branch_handleUDP to callreplyWithNoAnsw for non-A/ANY queries, implementing NODATA per RFC2308.
  • Introduce SOA constants and implementreplyWithNoAnsw to emit an authority SOA RR with minimal TTL.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

FileDescription
libraries/DNSServer/src/DNSServer.hAdded SOA‐related macros and declaredreplyWithNoAnsw method.
libraries/DNSServer/src/DNSServer.cppUpdated_handleUDP logic, ignore EDNS inrequestIncludesOnlyQuestion, implementedreplyWithNoAnsw.
Comments suppressed due to low confidence (2)

libraries/DNSServer/src/DNSServer.h:199

  • [nitpick] The method namereplyWithNoAnsw is abbreviated and may be unclear; consider renaming toreplyWithNoAnswer orreplyWithNoData for clarity.
inline void replyWithNoAnsw(AsyncUDPPacket &req, DNSHeader &dnsHeader, DNSQuestion &dnsQuestion);

libraries/DNSServer/src/DNSServer.cpp:128

  • [nitpick] Add a unit or integration test to verify that queries with an OPT record (non-zero ARCount) are correctly ignored and still receive a response.
dnsHeader.ARCount = 0;  // We assume that if ARCount !=0 there is a EDNS OPT packet, just ignore

@me-no-devme-no-dev removed the Status: Pending MergePull Request is ready to be merged labelJun 4, 2025
@github-actionsGitHub Actions
Copy link
Contributor

github-actionsbot commentedJun 4, 2025
edited
Loading

Test Results

 76 files   76 suites   12m 46s ⏱️
 38 tests  38 ✅ 0 💤 0 ❌
241 runs  241 ✅ 0 💤 0 ❌

Results for commita28c02b.

♻️ This comment has been updated with latest results.

@me-no-devme-no-dev added the Status: Pending MergePull Request is ready to be merged labelJun 10, 2025
@me-no-dev
Copy link
Member

@github-actionsGitHub Actions
Copy link
Contributor

Memory usage test (comparing PR against master branch)

The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.

MemoryFLASH [bytes]FLASH [%]RAM [bytes]RAM [%]
TargetDECINCDECINCDECINCDECINC
ESP32P40⚠️ +7340.00⚠️ +0.10000.000.00
ESP32S30⚠️ +8120.00⚠️ +0.09000.000.00
ESP32S20⚠️ +8160.00⚠️ +0.09000.000.00
ESP32C30⚠️ +7360.00⚠️ +0.08000.000.00
ESP32C60⚠️ +7400.00⚠️ +0.08000.000.00
ESP320⚠️ +8480.00⚠️ +0.09000.000.00
Click to expand the detailed deltas report [usage change in BYTES]
TargetESP32P4ESP32S3ESP32S2ESP32C3ESP32C6ESP32
ExampleFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAM
libraries/DNSServer/examples/CaptivePortal⚠️ +7340⚠️ +8120⚠️ +8160⚠️ +7360⚠️ +7400⚠️ +8480

@me-no-devme-no-dev merged commit23c6abc intoespressif:masterJun 20, 2025
41 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

Copilot code reviewCopilotCopilot left review comments

@me-no-devme-no-devme-no-dev approved these changes

Assignees
No one assigned
Labels
Area: LibrariesIssue is related to Library support.Status: Pending MergePull Request is ready to be merged
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@Kolkman@CLAassistant@me-no-dev@lucasssvaz

[8]ページ先頭

©2009-2025 Movatter.jp