-
Notifications
You must be signed in to change notification settings - Fork 42
RDKB-63599:Private LAN traffic on/off handling #247
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
Changes from all commits
0a3293d
18a8f27
9ec72c7
af6fb95
99fbc60
0ad0623
65c01cf
3caa07e
6440c35
241dcde
e3fcff2
62c3669
5893aed
72b32fb
0de112f
c3f88ae
b4546c7
52f8ccb
bda2d1f
165c493
8a068ed
9c80873
6d77542
3fe41ff
544aad8
b6216ee
54804d0
ad80856
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -12925,7 +12925,23 @@ static int prepare_subtables(FILE *raw_fp, FILE *mangle_fp, FILE *nat_fp, FILE * | |||||||||||||||||||||||||||||||||||||||
| #endif | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| /* | ||||||||||||||||||||||||||||||||||||||||
| * Check if LAN to WAN forwarding is enabled | ||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||
| 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) | ||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||
| fprintf(filter_fp, "-A lan2wan -i %s -j DROP\n", lan_ifname); | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
| 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"); |
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.
NOT ADDRESSED. We wan't block only private LAN if the wifi link status is non serviceable.
Copilot
AI
Feb 27, 2026
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.
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.
| 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); | |
| } |
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.
NOT ADDRESSED. We don't want to touch the previous implementation.
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.
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 usingatoi.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.
NOT ADDRESSED.
we are only setting the lan_wan_forwarding_enabled as "0" or "1"