Skip to content

RDKBWIFI-202: Implementation of Traffic Separation#972

Open
siddharth-nair-dtdl wants to merge 1 commit intordkcentral:developfrom
siddharth-nair-dtdl:RDKBWIFI-202
Open

RDKBWIFI-202: Implementation of Traffic Separation#972
siddharth-nair-dtdl wants to merge 1 commit intordkcentral:developfrom
siddharth-nair-dtdl:RDKBWIFI-202

Conversation

@siddharth-nair-dtdl
Copy link
Copy Markdown

Reason for change: Added traffic seperation TLV implementation via single bridge
Test Procedure: Verify build is successfull and check if traffic seperation is functional
Risks: Medium
Priority: P2

@siddharth-nair-dtdl siddharth-nair-dtdl requested a review from a team as a code owner March 16, 2026 10:25
@github-actions github-actions bot added the community contribution Contributions from community. label Mar 16, 2026
wifi_vap_info_t *vapInfo = NULL;
char str[128];
for(index = 0; index < getTotalNumberVAPs(); index++)
{
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.

not following the coding convention, the opening flower braces '{' should be in the same line as that of for and if. Please change

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Addressed .

wifi_util_info_print(WIFI_CTRL,"%s:%d: ssids_num =%d \n",__func__, __LINE__,data->em_config.traffic_separation_policy.ssids_num);

if(isVapPrivate(apIdx))
{
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.

not following the coding convention, the opening flower braces '{' should be in the same line as that of for and if. Please change


if(isVapPrivate(apIdx))
{
if((strncmp(vapInfo->u.bss_info.ssid,data->em_config.traffic_separation_policy.ssids[0].ssid,sizeof(data->em_config.traffic_separation_policy.ssids[0].ssid))==0)
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.

space after comma, move the 3rd parameter to a different line to avoid wrapping.
Also suggest to use snprintf which is more robust compared to strncmp.
Refer to recent merged PR - #967

{
continue;
}
strncpy(vapInfo->u.bss_info.ssid,data->em_config.traffic_separation_policy.ssids[0].ssid,sizeof(data->em_config.traffic_separation_policy.ssids[0].ssid));
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.

either space after comma or move the 2nd parameter to new line


if((data->em_config.traffic_separation_policy.ssids[0].vlan_id >= VLAN_MIN) && (data->em_config.traffic_separation_policy.ssids[0].vlan_id <= VLAN_MAX))
{
vapInfo->vlan_id = data->em_config.traffic_separation_policy.ssids[0].vlan_id;
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.

indentation is incorrect

strncpy(vapInfo->u.bss_info.ssid,data->em_config.traffic_separation_policy.ssids[0].ssid,sizeof(data->em_config.traffic_separation_policy.ssids[0].ssid));

if((data->em_config.traffic_separation_policy.ssids[0].vlan_id >= VLAN_MIN) && (data->em_config.traffic_separation_policy.ssids[0].vlan_id <= VLAN_MAX))
{
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.

braces not correct as per coding standard

if((data->em_config.traffic_separation_policy.ssids[0].vlan_id >= VLAN_MIN) && (data->em_config.traffic_separation_policy.ssids[0].vlan_id <= VLAN_MAX))
{
vapInfo->vlan_id = data->em_config.traffic_separation_policy.ssids[0].vlan_id;
v_secure_system("/etc/utopia/service.d/service_vlan_ts.sh stop");
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.

Will this work for all platform? Ideally there should be a platform dependent feature flag

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It should work for all platforms, and it should not be an issue.

}
else if(isVapMesh(apIdx))
{
if((strncmp(vapInfo->u.bss_info.ssid,data->em_config.traffic_separation_policy.ssids[3].ssid,sizeof(data->em_config.traffic_separation_policy.ssids[3].ssid))==0)
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.

same comment as above

if (traffic_sep_policy == NULL) {
wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d: [TRAFFIC_SEP] Traffic Separation Policy is NULL\n",
__func__, __LINE__);
return webconfig_error_decode;
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.

Returning error decode if traffic separation policy is not there would not work for legacy components which does not send traffic separation.

Copy link
Copy Markdown
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

Implements EasyMesh “Traffic Separation” policy support end-to-end in the webconfig pipeline, including schema additions, JSON encode/decode, EasyMesh translation, and applying resulting VLAN/SSID settings to VAP configuration.

Changes:

  • Added traffic_separation_policy structures to em_config_t.
  • Implemented JSON encoding/decoding for “Traffic Separation Policy” in the webconfig EM policy object.
  • Added translation from EasyMesh policy to internal EM config and applied VLAN/SSID values via a new EM subdoc apply path.

Reviewed changes

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

Show a summary per file
File Description
source/webconfig/wifi_encoder.c Encodes Traffic Separation policy into the EM “Policy” JSON.
source/webconfig/wifi_decoder.c Decodes Traffic Separation policy from EM “Policy” JSON into em_config_t.
source/webconfig/wifi_easymesh_translator.c Copies Traffic Separation policy from EasyMesh structures into internal policy config.
source/core/wifi_ctrl_webconfig.c Adds EM subdoc apply handler that updates VAP SSID/VLAN and syscfg + service restart.
include/wifi_base.h Introduces Traffic Separation policy structs/limits and wires them into em_config_t.

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

Comment on lines +2988 to +2999
param_obj = cJSON_CreateObject();
if (param_obj == NULL) {
wifi_util_dbg_print(WIFI_WEBCONFIG, "%s:%d:[TRAFFIC_SEP] json create object failed\n", __func__,
__LINE__);
}
cJSON_AddItemToObject(policy_obj, "Traffic Separation Policy", param_obj);
param_arr = cJSON_CreateArray();
if (param_arr == NULL) {
wifi_util_dbg_print(WIFI_WEBCONFIG, "%s:%d: [TRAFFIC_SEP] json create object failed\n", __func__,
__LINE__);
}
cJSON_AddItemToObject(param_obj, "Traffic Separation", param_arr);
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

cJSON_CreateObject() / cJSON_CreateArray() failures are logged but the function continues and immediately passes potentially-NULL pointers into cJSON_AddItemToObject() / cJSON_AddItemToArray(), which can lead to NULL dereference / corrupted JSON under low-memory conditions. Consider returning webconfig_error_encode (and/or cleaning up) when these allocations fail before adding items.

Copilot uses AI. Check for mistakes.
Comment on lines +3000 to +3002
wifi_util_dbg_print(WIFI_WEBCONFIG, "%s:%d [TRAFFIC_SEP] Traffic Separation num SSID %d\n", __func__, __LINE__,
em_config->traffic_separation_policy.ssids_num);
for (int i = 0; i < em_config->traffic_separation_policy.ssids_num; i++) {
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

The loop iterates to em_config->traffic_separation_policy.ssids_num without enforcing the compile-time limit (EM_MAX_TRAFFIC_SEP_POLICY). If ssids_num exceeds the array size, this will read past ssids[] and encode invalid memory. Please clamp/validate ssids_num (and ideally return an error when it exceeds the max).

Suggested change
wifi_util_dbg_print(WIFI_WEBCONFIG, "%s:%d [TRAFFIC_SEP] Traffic Separation num SSID %d\n", __func__, __LINE__,
em_config->traffic_separation_policy.ssids_num);
for (int i = 0; i < em_config->traffic_separation_policy.ssids_num; i++) {
int ssids_num = em_config->traffic_separation_policy.ssids_num;
if (ssids_num > EM_MAX_TRAFFIC_SEP_POLICY) {
wifi_util_dbg_print(WIFI_WEBCONFIG,
"%s:%d [TRAFFIC_SEP] ssids_num %d exceeds max %d, clamping to max\n",
__func__, __LINE__, ssids_num, EM_MAX_TRAFFIC_SEP_POLICY);
ssids_num = EM_MAX_TRAFFIC_SEP_POLICY;
}
wifi_util_dbg_print(WIFI_WEBCONFIG, "%s:%d [TRAFFIC_SEP] Traffic Separation num SSID %d\n",
__func__, __LINE__, ssids_num);
for (int i = 0; i < ssids_num; i++) {

Copilot uses AI. Check for mistakes.
Comment on lines +6259 to +6261
wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d: [TRAFFIC_SEP] Traffic Separation count: %d\n", __func__, __LINE__,
cJSON_GetArraySize(traffic_sep_array));
em_config->traffic_separation_policy.ssids_num = cJSON_GetArraySize(traffic_sep_array);
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

traffic_sep_array size is assigned directly to em_config->traffic_separation_policy.ssids_num and then used to index ssids[] without checking against EM_MAX_TRAFFIC_SEP_POLICY. A larger JSON array will overflow ssids[]. Please validate/clamp the array size before storing/looping.

Suggested change
wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d: [TRAFFIC_SEP] Traffic Separation count: %d\n", __func__, __LINE__,
cJSON_GetArraySize(traffic_sep_array));
em_config->traffic_separation_policy.ssids_num = cJSON_GetArraySize(traffic_sep_array);
int traffic_sep_count = cJSON_GetArraySize(traffic_sep_array);
wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d: [TRAFFIC_SEP] Traffic Separation count: %d\n", __func__, __LINE__,
traffic_sep_count);
if (traffic_sep_count > EM_MAX_TRAFFIC_SEP_POLICY) {
wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d: [TRAFFIC_SEP] Traffic Separation count %d exceeds max %d, clamping\n",
__func__, __LINE__, traffic_sep_count, EM_MAX_TRAFFIC_SEP_POLICY);
traffic_sep_count = EM_MAX_TRAFFIC_SEP_POLICY;
}
em_config->traffic_separation_policy.ssids_num = traffic_sep_count;

Copilot uses AI. Check for mistakes.
Comment on lines +6263 to +6268
unsigned char ssid_len;
traffic_sep_obj = cJSON_GetArrayItem(traffic_sep_array, i);
decode_param_allow_optional_string(traffic_sep_obj, "SSID Name", param);
ssid_len = strlen(param->valuestring);
em_config->traffic_separation_policy.ssids[i].ssid_len = ssid_len;
strncpy(em_config->traffic_separation_policy.ssids[i].ssid, param->valuestring, ssid_len);
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

decode_param_allow_optional_string() can set param to NULL; the new code then does strlen(param->valuestring) unconditionally, which can crash if "SSID Name" is missing or not a string. Also, ssid_len is not capped to EM_MAX_SSID_LEN-1, so strncpy(..., ssid_len) and writing the terminator at [ssid_len] can overflow the destination buffer. Please treat "SSID Name" as required (or handle NULL) and cap/copy safely.

Suggested change
unsigned char ssid_len;
traffic_sep_obj = cJSON_GetArrayItem(traffic_sep_array, i);
decode_param_allow_optional_string(traffic_sep_obj, "SSID Name", param);
ssid_len = strlen(param->valuestring);
em_config->traffic_separation_policy.ssids[i].ssid_len = ssid_len;
strncpy(em_config->traffic_separation_policy.ssids[i].ssid, param->valuestring, ssid_len);
size_t ssid_len;
traffic_sep_obj = cJSON_GetArrayItem(traffic_sep_array, i);
decode_param_allow_optional_string(traffic_sep_obj, "SSID Name", param);
/* "SSID Name" must be a valid string here; treat missing/invalid as decode error */
if ((param == NULL) || (cJSON_IsString(param) == false) || (param->valuestring == NULL)) {
wifi_util_error_print(WIFI_WEBCONFIG,"%s:%d: [TRAFFIC_SEP] Validation failed for key:%s\n", __func__, __LINE__, "SSID Name");
return webconfig_error_decode;
}
ssid_len = strlen(param->valuestring);
if (ssid_len >= EM_MAX_SSID_LEN) {
ssid_len = EM_MAX_SSID_LEN - 1;
}
em_config->traffic_separation_policy.ssids[i].ssid_len = (unsigned char)ssid_len;
memcpy(em_config->traffic_separation_policy.ssids[i].ssid, param->valuestring, ssid_len);

Copilot uses AI. Check for mistakes.
Comment on lines +2741 to +2752
policy_cfg->traffic_separation_policy.ssids_num = em_policy_cfg->traffic_separation_policy.ssids_num;
wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d: [TRAFFIC_SEP] Traffic Separation policy ssids_num=%d\n", __func__, __LINE__,
em_policy_cfg->traffic_separation_policy.ssids_num);
for ( int i = 0; i < policy_cfg->traffic_separation_policy.ssids_num; i++) {
int len = em_policy_cfg->traffic_separation_policy.ssids[i].ssid_len;
memcpy(policy_cfg->traffic_separation_policy.ssids[i].ssid,
em_policy_cfg->traffic_separation_policy.ssids[i].ssid, len);

policy_cfg->traffic_separation_policy.ssids[i].ssid[len] = '\0';
policy_cfg->traffic_separation_policy.ssids[i].ssid_len = len;

policy_cfg->traffic_separation_policy.ssids[i].vlan_id = em_policy_cfg->traffic_separation_policy.ssids[i].vlan_id;
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

ssids_num and ssid_len are trusted from em_policy_cfg without bounds checking. If ssids_num > EM_MAX_TRAFFIC_SEP_POLICY or ssid_len >= EM_MAX_SSID_LEN, the loop will write past ssids[] and/or overflow the ssid buffer. Please validate these fields (clamp or return an error) before memcpy() and before writing ssid[len] = '\0'.

Suggested change
policy_cfg->traffic_separation_policy.ssids_num = em_policy_cfg->traffic_separation_policy.ssids_num;
wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d: [TRAFFIC_SEP] Traffic Separation policy ssids_num=%d\n", __func__, __LINE__,
em_policy_cfg->traffic_separation_policy.ssids_num);
for ( int i = 0; i < policy_cfg->traffic_separation_policy.ssids_num; i++) {
int len = em_policy_cfg->traffic_separation_policy.ssids[i].ssid_len;
memcpy(policy_cfg->traffic_separation_policy.ssids[i].ssid,
em_policy_cfg->traffic_separation_policy.ssids[i].ssid, len);
policy_cfg->traffic_separation_policy.ssids[i].ssid[len] = '\0';
policy_cfg->traffic_separation_policy.ssids[i].ssid_len = len;
policy_cfg->traffic_separation_policy.ssids[i].vlan_id = em_policy_cfg->traffic_separation_policy.ssids[i].vlan_id;
int ssids_num = em_policy_cfg->traffic_separation_policy.ssids_num;
if (ssids_num > EM_MAX_TRAFFIC_SEP_POLICY) {
wifi_util_error_print(WIFI_WEBCONFIG,
"%s:%d: [TRAFFIC_SEP] ssids_num (%d) exceeds max (%d), clamping\n",
__func__, __LINE__, ssids_num, EM_MAX_TRAFFIC_SEP_POLICY);
ssids_num = EM_MAX_TRAFFIC_SEP_POLICY;
} else if (ssids_num < 0) {
wifi_util_error_print(WIFI_WEBCONFIG,
"%s:%d: [TRAFFIC_SEP] ssids_num (%d) is negative, setting to 0\n",
__func__, __LINE__, ssids_num);
ssids_num = 0;
}
policy_cfg->traffic_separation_policy.ssids_num = ssids_num;
wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d: [TRAFFIC_SEP] Traffic Separation policy ssids_num=%d\n",
__func__, __LINE__, ssids_num);
for (int i = 0; i < ssids_num; i++) {
int len = em_policy_cfg->traffic_separation_policy.ssids[i].ssid_len;
if (len >= EM_MAX_SSID_LEN) {
wifi_util_error_print(WIFI_WEBCONFIG,
"%s:%d: [TRAFFIC_SEP] SSID length (%d) exceeds max (%d), clamping\n",
__func__, __LINE__, len, EM_MAX_SSID_LEN - 1);
len = EM_MAX_SSID_LEN - 1;
} else if (len < 0) {
wifi_util_error_print(WIFI_WEBCONFIG,
"%s:%d: [TRAFFIC_SEP] SSID length (%d) is negative, setting to 0\n",
__func__, __LINE__, len);
len = 0;
}
memcpy(policy_cfg->traffic_separation_policy.ssids[i].ssid,
em_policy_cfg->traffic_separation_policy.ssids[i].ssid, len);
policy_cfg->traffic_separation_policy.ssids[i].ssid[len] = '\0';
policy_cfg->traffic_separation_policy.ssids[i].ssid_len = len;
policy_cfg->traffic_separation_policy.ssids[i].vlan_id =
em_policy_cfg->traffic_separation_policy.ssids[i].vlan_id;

Copilot uses AI. Check for mistakes.
Comment on lines +2057 to +2062
if(strncmp(vapInfo->u.bss_info.ssid,data->em_config.traffic_separation_policy.ssids[2].ssid,sizeof(data->em_config.traffic_separation_policy.ssids[2].ssid))==0)
{
continue;
}
strncpy(vapInfo->u.bss_info.ssid,data->em_config.traffic_separation_policy.ssids[2].ssid,sizeof(data->em_config.traffic_separation_policy.ssids[2].ssid));
vapInfo->vlan_id = data->em_config.traffic_separation_policy.ssids[2].vlan_id;
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

For LnF VAPs, the early-continue check only compares the SSID string and ignores VLAN ID. If the VLAN changes but the SSID stays the same, the function will continue and never apply the new VLAN. Please include VLAN ID in the comparison (like the other branches) and validate the VLAN range before assignment.

Suggested change
if(strncmp(vapInfo->u.bss_info.ssid,data->em_config.traffic_separation_policy.ssids[2].ssid,sizeof(data->em_config.traffic_separation_policy.ssids[2].ssid))==0)
{
continue;
}
strncpy(vapInfo->u.bss_info.ssid,data->em_config.traffic_separation_policy.ssids[2].ssid,sizeof(data->em_config.traffic_separation_policy.ssids[2].ssid));
vapInfo->vlan_id = data->em_config.traffic_separation_policy.ssids[2].vlan_id;
if((strncmp(vapInfo->u.bss_info.ssid, data->em_config.traffic_separation_policy.ssids[2].ssid, sizeof(data->em_config.traffic_separation_policy.ssids[2].ssid)) == 0)
&& (vapInfo->vlan_id == data->em_config.traffic_separation_policy.ssids[2].vlan_id))
{
continue;
}
strncpy(vapInfo->u.bss_info.ssid, data->em_config.traffic_separation_policy.ssids[2].ssid, sizeof(data->em_config.traffic_separation_policy.ssids[2].ssid));
if((data->em_config.traffic_separation_policy.ssids[2].vlan_id >= VLAN_MIN) && (data->em_config.traffic_separation_policy.ssids[2].vlan_id <= VLAN_MAX))
{
vapInfo->vlan_id = data->em_config.traffic_separation_policy.ssids[2].vlan_id;
}

Copilot uses AI. Check for mistakes.
Comment on lines +2066 to +2071
if(strncmp(vapInfo->u.bss_info.ssid,data->em_config.traffic_separation_policy.ssids[4].ssid,sizeof(data->em_config.traffic_separation_policy.ssids[4].ssid))==0)
{
continue;
}
strncpy(vapInfo->u.bss_info.ssid,data->em_config.traffic_separation_policy.ssids[4].ssid,sizeof(data->em_config.traffic_separation_policy.ssids[4].ssid));
vapInfo->vlan_id = data->em_config.traffic_separation_policy.ssids[4].vlan_id;
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

For Hotspot VAPs, the early-continue check only compares the SSID string and ignores VLAN ID. If the VLAN changes but the SSID stays the same, the new VLAN will not be applied. Please include VLAN ID in the comparison and consider validating the VLAN range (similar to the private/mesh/iot branches).

Suggested change
if(strncmp(vapInfo->u.bss_info.ssid,data->em_config.traffic_separation_policy.ssids[4].ssid,sizeof(data->em_config.traffic_separation_policy.ssids[4].ssid))==0)
{
continue;
}
strncpy(vapInfo->u.bss_info.ssid,data->em_config.traffic_separation_policy.ssids[4].ssid,sizeof(data->em_config.traffic_separation_policy.ssids[4].ssid));
vapInfo->vlan_id = data->em_config.traffic_separation_policy.ssids[4].vlan_id;
if ((strncmp(vapInfo->u.bss_info.ssid, data->em_config.traffic_separation_policy.ssids[4].ssid,
sizeof(data->em_config.traffic_separation_policy.ssids[4].ssid)) == 0) &&
(vapInfo->vlan_id == data->em_config.traffic_separation_policy.ssids[4].vlan_id))
{
continue;
}
strncpy(vapInfo->u.bss_info.ssid, data->em_config.traffic_separation_policy.ssids[4].ssid,
sizeof(data->em_config.traffic_separation_policy.ssids[4].ssid));
if ((data->em_config.traffic_separation_policy.ssids[4].vlan_id >= VLAN_MIN) &&
(data->em_config.traffic_separation_policy.ssids[4].vlan_id <= VLAN_MAX))
{
vapInfo->vlan_id = data->em_config.traffic_separation_policy.ssids[4].vlan_id;
}

Copilot uses AI. Check for mistakes.
Comment on lines +3280 to +3295
case webconfig_subdoc_type_em_config:
if (data->descriptor & webconfig_data_descriptor_encoded) {
if (ctrl->webconfig_state & radio_state_pending) {
ctrl->webconfig_state &= ~radio_state_pending;
ret = webconfig_bus_apply(ctrl, &data->u.encoded);
}
} else {
if (check_wifi_csa_sched_timeout_active_status(ctrl) == true) {
if (push_data_to_apply_pending_queue(data) != RETURN_OK) {
return webconfig_error_apply;
}
} else {
ctrl->webconfig_state |= radio_state_pending;
webconfig_analytic_event_data_to_hal_apply(data);
ret = webconfig_em_subdoc_config_apply(ctrl, &data->u.decoded);
}
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

radio_state_pending is used in the new webconfig_subdoc_type_em_config case (ctrl->webconfig_state & radio_state_pending, |= radio_state_pending) but it is not initialized/set for this case. This is undefined behavior and can cause incorrect state handling. Please define/set an appropriate pending-state flag for EM config (or reuse an existing explicit constant) before using it.

Copilot uses AI. Check for mistakes.
Comment on lines +1976 to +1983
UINT apIdx = 0, ret, index;
wifi_mgr_t *mgr = get_wifimgr_obj();
rdk_wifi_vap_info_t *rdk_vap_info;
wifi_vap_info_t *vapInfo = NULL;
char str[128];
for(index = 0; index < getTotalNumberVAPs(); index++)
{
int idx=0;
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

This new function introduces several unused variables (ret, idx, rdk_vap_info, and svc appears unused beyond the NULL check). The project builds with -Werror (e.g., source/core/Makefile.am), so these unused variables can fail the build. Please remove them or use them meaningfully (e.g., apply changes through the service).

Suggested change
UINT apIdx = 0, ret, index;
wifi_mgr_t *mgr = get_wifimgr_obj();
rdk_wifi_vap_info_t *rdk_vap_info;
wifi_vap_info_t *vapInfo = NULL;
char str[128];
for(index = 0; index < getTotalNumberVAPs(); index++)
{
int idx=0;
UINT apIdx = 0, index;
wifi_mgr_t *mgr = get_wifimgr_obj();
wifi_vap_info_t *vapInfo = NULL;
for(index = 0; index < getTotalNumberVAPs(); index++)
{

Copilot uses AI. Check for mistakes.
Comment on lines +2076 to +2080
continue;
}

v_secure_system("/etc/utopia/service.d/service_vlan_ts.sh start");
}
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

service_vlan_ts.sh stop is invoked inside the per-VAP branches while service_vlan_ts.sh start is invoked for every VAP iteration. If multiple VAPs are processed, this can repeatedly stop/start the service and create transient outages/flapping. Consider tracking whether any VLAN/SSID change occurred during the loop and stopping/starting the service once (outside the loop) only when needed.

Copilot uses AI. Check for mistakes.
Reason for change: Added traffic seperation TLV implementation via single bridge
Test Procedure: Verify build is successfull and check if traffic seperation is functional
Risks: Medium
Priority: P2
@sundaresh-k-oss
Copy link
Copy Markdown

Hi @amarnathhullur -We have made the changes suggested and replied to other comments.

    We have built the latest changes and OneWifi is crashing. After Factory reset, the box is recovered and OneWifi is not getting crashed (in some scenarios). The box is not consistent with each reboot. 

     For traffic separation TLV parsing, the agent is not getting parsed traffic separation properly. The issue is due to the vendor specific tlv parsing done in the file: src/em/policy_cfg/em_policy_cfg.cpp. We have commented the changes for vendor specific tlv and issue was resolved. That is due to adding the break as the vendor_tlv->num is zero in this case, control is coming out of while loop. Because of this, the control is coming out of TLV and some of the lines are not executed. 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community contribution Contributions from community.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants