Skip to content

RDKB-63599:Private LAN traffic on/off handling#247

Merged
sshriv323 merged 28 commits intordkcentral:developfrom
Amaresh-Kotekal:develop
Feb 28, 2026
Merged

RDKB-63599:Private LAN traffic on/off handling#247
sshriv323 merged 28 commits intordkcentral:developfrom
Amaresh-Kotekal:develop

Conversation

@Amaresh-Kotekal
Copy link
Contributor

Reason for change: Private LAN traffic on/off based on wifi link status
Test Procedure: verify the logic and functionality
Risks: High
Priority: P1

Reason for change:Added the new entry for virual mta interface
Test Procedure: verify the logic and functionality
Risks: Low
Priority: P1
Reason for change:Added the new entry for virual mta interface
Test Procedure: verify the logic and functionality
Risks: Low
Priority: P1
Reason for change:Added the new entry for virual mta interface
Test Procedure: verify the logic and functionality
Risks: Low
Priority: P1
Reason for change:Added the new entry for mac vlan interface
Test Procedure: verify the logic and functionality
Risks: High
Priority: P1
Reason for change:Added the new entry for virual mta interface
Test Procedure: verify the logic and functionality
Risks: High
Priority: P1
Reason for change:Initializing the voice
Test Procedure: verify the voice is initialized or not
Risks: High
Priority: P1
Reason for change:Setting the syscfg variables based on partner json values
Test Procedure: verify the voice is initialized or not
Risks: High
Priority: P1
Reason for change:debug build
Test Procedure: verify the logic and functionality
Risks: High
Priority: P1
Reason for change:debug build
Test Procedure: verify the logic and functionality
Risks: High
Priority: P1
@Amaresh-Kotekal Amaresh-Kotekal requested a review from a team as a code owner February 27, 2026 00:49
Copilot AI review requested due to automatic review settings February 27, 2026 00:49
@Amaresh-Kotekal Amaresh-Kotekal requested a review from a team as a code owner February 27, 2026 00:49
Copy link
Contributor

Copilot AI 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 adds handling to disable LAN→WAN forwarding by reading a lan_wan_forwarding_enabled sysevent flag and injecting an iptables DROP rule into the lan2wan chain when forwarding is disabled.

Changes:

  • Read lan_wan_forwarding_enabled from sysevent during firewall rule generation.
  • When disabled, add a lan2wan chain rule to drop forwarded traffic from the LAN interface.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +12931 to +12940
char cEnabled[8] = {0};
sysevent_get(sysevent_fd, sysevent_token, "lan_wan_forwarding_enabled", cEnabled, sizeof(cEnabled));
if ('\0' != cEnabled[0])
{
if('\0' == lan_ifname[0])
snprintf(lan_ifname, sizeof(lan_ifname), "brlan0");

int iEnabled = atoi(cEnabled);
if (0 == iEnabled)
{
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

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

atoi(cEnabled) treats any non-numeric non-empty value (e.g., "true"/"false") as 0, which would disable forwarding unexpectedly. This file usually treats sysevent/syscfg boolean flags as enabled unless the value is empty or exactly "0" (e.g., ciscoconnect_guest_enable, lanhost_tracking_enabled). Consider parsing this flag the same way (explicitly check for "0") or validate that the value is strictly "0"/"1" before using atoi.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

NOT ADDRESSED.
we are only setting the lan_wan_forwarding_enabled as "0" or "1"

int iEnabled = atoi(cEnabled);
if (0 == iEnabled)
{
fprintf(filter_fp, "-A lan2wan -i %s -j DROP\n", lan_ifname);
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

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

The DROP rule is limited to -i lan_ifname, but there are other interfaces that also jump into lan2wan (e.g., ETH_MESH_BRIDGE, XHS_BRIDGE, LNF_BRIDGE in the MAPT/NAT46 block). With the current match, forwarding can remain possible for those paths even when lan_wan_forwarding_enabled is 0. If the intent is to disable all LAN→WAN forwarding handled by lan2wan, consider making the DROP unconditional within lan2wan (or covering all relevant ingress interfaces).

Suggested change
fprintf(filter_fp, "-A lan2wan -i %s -j DROP\n", lan_ifname);
/* Disable all LAN->WAN forwarding handled by the lan2wan chain,
* regardless of ingress interface.
*/
fprintf(filter_fp, "-A lan2wan -j DROP\n");

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

NOT ADDRESSED. We wan't block only private LAN if the wifi link status is non serviceable.

Comment on lines +12935 to +12941
if('\0' == lan_ifname[0])
snprintf(lan_ifname, sizeof(lan_ifname), "brlan0");

int iEnabled = atoi(cEnabled);
if (0 == iEnabled)
{
fprintf(filter_fp, "-A lan2wan -i %s -j DROP\n", lan_ifname);
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

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

lan_ifname is defaulted to "brlan0" here, but the variable has already been used earlier in this function to emit multiple iptables rules (e.g., FORWARD/OUTPUT jumps). If a default is needed when syscfg_get("lan_ifname") returns empty, it should be applied at initialization time so all generated rules are consistent; otherwise this late fallback only affects the new DROP rule and subsequent rules.

Suggested change
if('\0' == lan_ifname[0])
snprintf(lan_ifname, sizeof(lan_ifname), "brlan0");
int iEnabled = atoi(cEnabled);
if (0 == iEnabled)
{
fprintf(filter_fp, "-A lan2wan -i %s -j DROP\n", lan_ifname);
int iEnabled = atoi(cEnabled);
if (0 == iEnabled)
{
if ('\0' != lan_ifname[0])
{
fprintf(filter_fp, "-A lan2wan -i %s -j DROP\n", lan_ifname);
}

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

NOT ADDRESSED. We don't want to touch the previous implementation.

Copilot AI review requested due to automatic review settings February 28, 2026 01:28
@github-actions
Copy link


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


1 out of 2 committers have signed the CLA.
Amaresh-Kotekal
sshriv323
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@sshriv323 sshriv323 merged commit 6afc7d6 into rdkcentral:develop Feb 28, 2026
4 of 6 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Feb 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants