Skip to content

RDKCOM-5619: RDKBNETWOR-99 Implement Dynamic L2/L3 Packet Marking Framework - #396

Open
sherik-sensin wants to merge 1 commit into
rdkcentral:developfrom
sherik-sensin:RDKBNETWOR-99_qos
Open

RDKCOM-5619: RDKBNETWOR-99 Implement Dynamic L2/L3 Packet Marking Framework#396
sherik-sensin wants to merge 1 commit into
rdkcentral:developfrom
sherik-sensin:RDKBNETWOR-99_qos

Conversation

@sherik-sensin

Copy link
Copy Markdown

No description provided.

Copilot AI review requested due to automatic review settings August 5, 2026 11:30
@sherik-sensin
sherik-sensin requested review from a team as code owners August 5, 2026 11:30
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

📋 PR Format Reminder

  • Description missing:
    • Reason for change
    • Test Procedure
    • Risks (Low / Medium / High)
    • Priority (P0 / P1 / P2)

Expected:

TICKET-123 : brief description

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

Reason for change: Marking table should be created dynamically based on the virtual interface marking entry from WanManager.
                   Add L3 marking based on WanManager marking entries.

Test Procedure: Performed firewall Sanity test.
Risks: None.

Signed-off-by: Sherik Sensin A <sherik.a@telekom-digital.com>

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.

Pull request overview

This PR introduces WAN Manager–driven QoS marking rule generation in the firewall subsystem, emitting DSCP and CLASSIFY rules into the iptables mangle table for both IPv4 and IPv6 when the WAN service is ready.

Changes:

  • Adds a new add_qos_skb_mark(FILE*, int family) API (guarded by FEATURE_WANMGR_L2_MARKING) to build DSCP/CLASSIFY rules based on WanManager TR-181 marking entries.
  • Invokes the new QoS rule emission from the IPv4 mangle table setup and from the IPv6 filter path.
  • Introduces WanManager TR-181 parameter name constants and protocol-specific rule generation (DNS/NTP/HTTP/VoIP/IPTV/IGMP/MLD/etc.).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
source/firewall/firewall.h Declares the new add_qos_skb_mark API behind FEATURE_WANMGR_L2_MARKING.
source/firewall/firewall.c Implements WanManager-based DSCP/CLASSIFY rule generation and hooks it into IPv4 mangle table preparation.
source/firewall/firewall_ipv6.c Hooks the new rule generation into the IPv6 rule generation path.
Suppressed comments (4)

source/firewall/firewall.c:5504

  • strncpy(..., sizeof(dest)) may leave SKBMark without a null terminator when the source is long. Prefer a guaranteed-terminated copy.
                strncpy(SKBMark, acTmpReturnValue, sizeof(SKBMark));

source/firewall/firewall.c:5517

  • strncpy(..., sizeof(dest)) may leave DSCPMark without a null terminator when the source is long. Prefer a guaranteed-terminated copy.
                strncpy(DSCPMark, acTmpReturnValue, sizeof(DSCPMark));

source/firewall/firewall.c:5530

  • strncpy(..., sizeof(dest)) may leave MarkingName without a null terminator when the source is long, which can break the subsequent strcmp chain. Prefer a guaranteed-terminated copy.
                strncpy(MarkingName, acTmpReturnValue, sizeof(MarkingName));

source/firewall/firewall.c:5545

  • strncpy(..., sizeof(dest)) may leave WanVIfName without a null terminator when the source is long, which can result in malformed iptables rules. Prefer a guaranteed-terminated copy.
                    strncpy(WanVIfName, acTmpReturnValue, sizeof(WanVIfName));

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

return -1;
}

strncpy(WanVIfMarkingEntry, acTmpReturnValue, sizeof(WanVIfMarkingEntry));
Comment on lines +5402 to +5406
memset(acTmpReturnValue, 0, sizeof(acTmpReturnValue));
if (ANSC_STATUS_FAILURE == RdkBus_GetParamValues(WAN_COMPONENT_NAME, WAN_DBUS_PATH, WAN_IF_COUNT, acTmpReturnValue))
{
printf("[%s][%d]Failed to get WAN interface count\n", __FUNCTION__, __LINE__);
return -1;

strncpy(SKBMark, acTmpReturnValue, sizeof(SKBMark));

/* Get EthernetPriorityMark */
Comment on lines +5558 to +5561
fprintf(mangle_fp, "-A POSTROUTING -j DSCP -p udp --dport %d -o %s --set-dscp-class %s\n", dest_port, current_wan_ifname, DSCPMark);
fprintf(mangle_fp, "-A POSTROUTING -j DSCP -p tcp --dport %d -o %s --set-dscp-class %s\n", dest_port, current_wan_ifname, DSCPMark);
fprintf(mangle_fp, "-A POSTROUTING -j CLASSIFY -p udp --dport %d -o %s --set-class 0:%s\n", dest_port, current_wan_ifname, SKBMark);
fprintf(mangle_fp, "-A POSTROUTING -j CLASSIFY -p tcp --dport %d -o %s --set-class 0:%s\n", dest_port, current_wan_ifname, SKBMark);
Comment on lines +5573 to +5574
fprintf(mangle_fp, "-A POSTROUTING -p tcp --dport %d -m dscp --dscp-class cs3 -o %s -j DSCP --set-dscp-class %s\n", HTTP_PORT, current_wan_ifname, DSCPMark);
fprintf(mangle_fp, "-A POSTROUTING -p tcp --dport %d -m dscp --dscp-class %s -j CLASSIFY --set-class 0:%s\n", HTTP_PORT, DSCPMark, SKBMark);
@sherik-sensin sherik-sensin changed the title Rdkbnetwor 99 qos RDKBNETWOR-99 Implement Dynamic L2/L3 Packet Marking Framework Aug 5, 2026
@pradeeptakdas pradeeptakdas changed the title RDKBNETWOR-99 Implement Dynamic L2/L3 Packet Marking Framework RDKCOM-5625: RDKBNETWOR-99 Implement Dynamic L2/L3 Packet Marking Framework Aug 6, 2026
@pradeeptakdas pradeeptakdas changed the title RDKCOM-5625: RDKBNETWOR-99 Implement Dynamic L2/L3 Packet Marking Framework RDKCOM-5619: RDKBNETWOR-99 Implement Dynamic L2/L3 Packet Marking Framework Aug 6, 2026
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