[PR #5740] [client] Add DNS cache flush command #23791

Open
opened 2026-08-05 06:07:51 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/5740
Author: @agomerz
Created: 3/30/2026
Status: 🔄 Open

Base: mainHead: feat/dns-cache-flush


📝 Commits (1)

  • f084ad0 [client] Add DNS cache flush command

📊 Changes

14 files changed (+748 additions, -318 deletions)

View changed files

client/cmd/dns.go (+56 -0)
client/cmd/dns_test.go (+79 -0)
📝 client/cmd/root.go (+2 -0)
📝 client/internal/dnsfwd/cache.go (+7 -0)
📝 client/internal/dnsfwd/cache_test.go (+50 -11)
📝 client/internal/dnsfwd/forwarder.go (+9 -0)
📝 client/internal/dnsfwd/forwarder_test.go (+22 -0)
📝 client/internal/dnsfwd/manager.go (+8 -0)
📝 client/internal/engine.go (+15 -0)
📝 client/proto/daemon.pb.go (+207 -128)
📝 client/proto/daemon.proto (+7 -0)
📝 client/proto/daemon_grpc.pb.go (+261 -177)
📝 client/proto/generate.sh (+2 -2)
📝 client/server/server.go (+23 -0)

📄 Description

Describe your changes

Add netbird dns flush-cache command that clears the DNS forwarder cache in the running daemon without requiring a service restart.

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)
    The command is self-documenting via --help. No external docs changes needed.

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/__

Summary by CodeRabbit

  • New Features

    • Added a new CLI command "netbird dns flush-cache" to clear the daemon DNS cache on demand.
    • Added a remote RPC to trigger DNS cache flushing; daemon, engine, manager and forwarder now support flushing the DNS cache.
  • Tests

    • Added unit tests for cache flush behavior (including empty-cache cases) and CLI tests covering success, RPC errors, and invalid-argument handling.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/5740 **Author:** [@agomerz](https://github.com/agomerz) **Created:** 3/30/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/dns-cache-flush` --- ### 📝 Commits (1) - [`f084ad0`](https://github.com/netbirdio/netbird/commit/f084ad0e228c1807178fcb353b11b4ad48aa6eb0) [client] Add DNS cache flush command ### 📊 Changes **14 files changed** (+748 additions, -318 deletions) <details> <summary>View changed files</summary> ➕ `client/cmd/dns.go` (+56 -0) ➕ `client/cmd/dns_test.go` (+79 -0) 📝 `client/cmd/root.go` (+2 -0) 📝 `client/internal/dnsfwd/cache.go` (+7 -0) 📝 `client/internal/dnsfwd/cache_test.go` (+50 -11) 📝 `client/internal/dnsfwd/forwarder.go` (+9 -0) 📝 `client/internal/dnsfwd/forwarder_test.go` (+22 -0) 📝 `client/internal/dnsfwd/manager.go` (+8 -0) 📝 `client/internal/engine.go` (+15 -0) 📝 `client/proto/daemon.pb.go` (+207 -128) 📝 `client/proto/daemon.proto` (+7 -0) 📝 `client/proto/daemon_grpc.pb.go` (+261 -177) 📝 `client/proto/generate.sh` (+2 -2) 📝 `client/server/server.go` (+23 -0) </details> ### 📄 Description ## Describe your changes Add `netbird dns flush-cache` command that clears the DNS forwarder cache in the running daemon without requiring a service restart. ## Issue ticket number and link ## Stack <!-- branch-stack --> ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [x] Is a feature enhancement - [ ] It is a refactor - [x] Created tests that fail without the change (if possible) > By submitting this pull request, you confirm that you have read and agree to the terms of the [Contributor License Agreement](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT.md). ## Documentation Select exactly one: - [ ] I added/updated documentation for this change - [X] Documentation is **not needed** for this change (explain why) The command is self-documenting via `--help`. No external docs changes needed. ### Docs PR URL (required if "docs added" is checked) Paste the PR link from https://github.com/netbirdio/docs here: https://github.com/netbirdio/docs/pull/__ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a new CLI command "netbird dns flush-cache" to clear the daemon DNS cache on demand. * Added a remote RPC to trigger DNS cache flushing; daemon, engine, manager and forwarder now support flushing the DNS cache. * **Tests** * Added unit tests for cache flush behavior (including empty-cache cases) and CLI tests covering success, RPC errors, and invalid-argument handling. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 06:07:51 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#23791