-
-
Notifications
You must be signed in to change notification settings - Fork 925
[client] Redirect dns forwarder port 5353 to new listening port 22054 #4707
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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 adds DNS port forwarding functionality by redirecting traffic from port 5353 to 22054 using DNAT rules. The implementation introduces constant definitions for client and server ports, updates the DNS forwarder to use the new ports, and removes the dynamic port configuration logic that was previously managed through the network map.
Key Changes
- Introduced
ForwarderClientPort(5353) andForwarderServerPort(22054) as package constants - Implemented inbound DNAT rules to redirect DNS traffic from client port to server port
- Simplified DNS forwarder initialization by removing dynamic port updates
- Deprecated the
ForwarderPortfield in the protobuf definition
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| shared/management/proto/management.proto | Deprecated ForwarderPort field in DNSConfig |
| management/server/dns.go | Updated to use new port constants from dns package |
| dns/dns.go | Added ForwarderClientPort and ForwarderServerPort constants |
| client/internal/routemanager/dnsinterceptor/handler.go | Updated to use ForwarderClientPort constant |
| client/internal/netflow/logger/logger.go | Updated DNS port filtering to include both client and server ports |
| client/internal/engine.go | Removed dynamic port management and simplified DNS forwarder updates |
| client/internal/dnsfwd/manager.go | Added DNAT rule management and environment variable support for custom port |
| client/firewall/uspfilter/tracer_test.go | Updated test expectations to include new DNAT stages |
| client/firewall/uspfilter/tracer.go | Added port DNAT and 1:1 NAT tracing stages |
| client/firewall/uspfilter/nat_test.go | Added tests for inbound port DNAT functionality |
| client/firewall/uspfilter/nat.go | Implemented port-specific DNAT translation logic |
| client/firewall/uspfilter/log/log.go | Added support for 7 and 8 argument trace logging |
| client/firewall/uspfilter/filter.go | Integrated port DNAT translation into packet filtering |
| client/firewall/nftables/router_linux.go | Implemented AddInboundDNAT and RemoveInboundDNAT for nftables |
| client/firewall/nftables/manager_linux.go | Added manager methods for inbound DNAT operations |
| client/firewall/manager/firewall.go | Added AddInboundDNAT and RemoveInboundDNAT to Manager interface |
| client/firewall/iptables/router_linux.go | Implemented AddInboundDNAT and RemoveInboundDNAT for iptables |
| client/firewall/iptables/manager_linux.go | Added manager methods for inbound DNAT operations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
94749fd to
1315966
Compare
|

Describe your changes
Example tracer output
Issue ticket number and link
Stack
Checklist
Documentation
Select exactly one:
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/__