arduino-esp32 icon indicating copy to clipboard operation
arduino-esp32 copied to clipboard

Proper EDNS handling and cleaner NOERROR response in DNSSERVER

Open Kolkman opened this issue 5 months ago β€’ 6 comments
trafficstars

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

Kolkman avatar May 30 '25 08:05 Kolkman

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar May 30 '25 08:05 CLAassistant

Warnings
:warning:

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:

  • follow Conventional Commits style
  • correct format of commit message should be: <type/action>(<scope/component>): <summary>, for example fix(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 the Conventional Precommit Linter).

:warning:

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's Contributions Guide for key guidelines on code, documentation, testing, and more.

πŸ–ŠοΈ Please also make sure you have read and signed the Contributor License Agreement for this project.

Click to see more instructions ...


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

DangerJS is triggered with each push 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 is not 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 manually retry these Danger checks, please navigate to the Actions 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 :no_entry_sign: dangerJS against a28c02b824ff11c353c897000ab1f90f6c0e2b3e

github-actions[bot] avatar May 30 '25 08:05 github-actions[bot]

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

me-no-dev avatar Jun 04 '25 13:06 me-no-dev

Test Results

 76 files   76 suites   12m 46s ⏱️  38 tests  38 βœ…β€ƒ0 πŸ’€β€ƒ0 ❌ 241 runsβ€Šβ€ƒ241 βœ…β€ƒ0 πŸ’€β€ƒ0 ❌

Results for commit a28c02b8.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar Jun 04 '25 13:06 github-actions[bot]

@Kolkman small typo to fix: https://github.com/espressif/arduino-esp32/actions/runs/15553815702/job/43789936502?pr=11411#step:9:44

me-no-dev avatar Jun 10 '25 08:06 me-no-dev

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:warning: +7340.00:warning: +0.10000.000.00
ESP32S30:warning: +8120.00:warning: +0.09000.000.00
ESP32S20:warning: +8160.00:warning: +0.09000.000.00
ESP32C30:warning: +7360.00:warning: +0.08000.000.00
ESP32C60:warning: +7400.00:warning: +0.08000.000.00
ESP320:warning: +8480.00:warning: +0.09000.000.00
Click to expand the detailed deltas report [usage change in BYTES]
TargetESP32P4ESP32S3ESP32S2ESP32C3ESP32C6ESP32
ExampleFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAM
libraries/DNSServer/examples/CaptivePortal:warning: +7340:warning: +8120:warning: +8160:warning: +7360:warning: +7400:warning: +8480

github-actions[bot] avatar Jun 10 '25 08:06 github-actions[bot]