Skip to content

RDKB-64441: Redirect only XDNS clients to dnsmasq instead of all LAN clients - #462

Open
rajkamal-cv wants to merge 1 commit into
developfrom
bug/RDKB-64441
Open

rajkamal-cv wants to merge 1 commit into
developfrom
bug/RDKB-64441

Conversation

@rajkamal-cv

@rajkamal-cv rajkamal-cv commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

RDKB-64441: Redirect only XDNS clients to dnsmasq instead of all LAN clients

Reason for change: All DNS traffic was redirected to dnsmasq when XDNS was enabled, so one flooding client could hit dnsmasq's 150-query forward limit and block DNS for all other clients. Test Procedure: Configure per-client and global XDNS, verify only intended clients are redirected.
Risks: Low
Priority: P1
Signed-off-by: rajkamal_cv@comcast.com

Related PR - rdkcentral/xdns#33

…clients

Reason for change: All DNS traffic was redirected to dnsmasq when XDNS
was enabled, so one flooding client could hit dnsmasq's 150-query
forward limit and block DNS for all other clients.
Test Procedure: Configure per-client and global XDNS, verify only
intended clients are redirected.
Risks: Low
Priority: P1
Signed-off-by: rajkamal_cv@comcast.com
@rajkamal-cv
rajkamal-cv requested review from a team as code owners October 23, 2026 15:23
Copilot AI balanced review requested due to automatic review settings October 23, 2026 15:23
@github-actions

Copy link
Copy Markdown

📋 PR Format Reminder

  • Description missing:
    • Test Procedure

Expected:

TICKET-123 : brief description

Reason for change: why
Test Procedure: how to verify
Risks: Low / Medium / High
Priority: P0 / P1 / P2

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Malformed PUMA7 protocol options prevent NAT updates, and incorrect WAN resolver detection can preserve unintended all-client redirection.

2 open issues
What changed in this PR

This PR narrows firewall DNS redirection to XDNS-configured clients, aiming to prevent non-XDNS traffic from exhausting dnsmasq’s forwarding queue while preserving global XDNS behavior.

Changes:

  • Parses dnsoverride entries to generate MAC-specific IPv4 and IPv6 redirects.
  • Adds default-resolver classification to determine when all-client redirection is needed.
  • Centralizes redirect rule generation and reports redirect counts.
File Description
source/​firewall/​firewall.c Adds XDNS configuration parsing and selective DNS redirect generation.

Review effort: Balanced

Comment on lines +9071 to +9082
fprintf(nat_fp, "-A prerouting_fromlan -i %s ! -s 169.254.0.0/16 %sp udp --dport 53 -j DNAT --to-destination %s\n",lan_ifname,mac_match,dns_dest);
fprintf(nat_fp, "-A prerouting_fromlan -i %s ! -s 169.254.0.0/16 %sp tcp --dport 53 -j DNAT --to-destination %s\n",lan_ifname,mac_match,dns_dest);
#else
fprintf(nat_fp, "-A prerouting_fromlan -i %s %s-p udp --dport 53 -j DNAT --to-destination %s\n",lan_ifname,mac_match,dns_dest);
fprintf(nat_fp, "-A prerouting_fromlan -i %s %s-p tcp --dport 53 -j DNAT --to-destination %s\n",lan_ifname,mac_match,dns_dest);
#endif
}
else
{
#if defined (INTEL_PUMA7)
fprintf(nat_fp, "-A PREROUTING -i %s ! -s 2603:2000::/20 %sp udp --dport 53 -j DNAT --to-destination %s\n",lan_ifname,mac_match,dns_dest);
fprintf(nat_fp, "-A PREROUTING -i %s ! -s 2603:2000::/20 %sp tcp --dport 53 -j DNAT --to-destination %s\n",lan_ifname,mac_match,dns_dest);
if (iptype == 4)
{
int i;
const char *ns_keys[3] = {"dhcp_nameserver_1", "dhcp_nameserver_2", "dhcp_nameserver_3"};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants