RDKCOM-5613: RDKBNETWOR-98 untagged vlan - #40
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds special-case handling for VLAN entries using VLANId == -1 to represent a bridge-backed “untagged VLAN” by creating/deleting Linux bridges in the VLAN enable/disable paths.
Changes:
- In
Vlan_Enable(), create a bridge and add the base interface whenVLANId == -1. - In
Vlan_Disable(), bring down/delete the bridge and remove the base interface from it whenVLANId == -1.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| v_secure_system("brctl addbr %s", pEntry->Name); | ||
| v_secure_system("brctl addif %s %s", pEntry->Name, pEntry->BaseInterface); | ||
| v_secure_system("ifconfig %s up", pEntry->Name); |
|
As per component owner, all copilot review comments have to be addressed, if they are not valid, please add a reason and resolve it |
a394175 to
3f9a830
Compare
| if(strcmp(pEntry->BaseInterface, pEntry->Name)) | ||
| { | ||
| v_secure_system("ifconfig %s down", pEntry->Name); | ||
| v_secure_system("brctl delif %s %s", pEntry->Name, pEntry->BaseInterface); | ||
| v_secure_system("brctl delbr %s", pEntry->Name); | ||
| } |
| if(strcmp(pEntry->BaseInterface, pEntry->Name)) | ||
| { | ||
| v_secure_system("brctl addbr %s", pEntry->Name); | ||
| v_secure_system("brctl addif %s %s", pEntry->Name, pEntry->BaseInterface); | ||
| v_secure_system("ifconfig %s up", pEntry->Name); | ||
| } |
3f9a830 to
36047ab
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
source/TR-181/middle_layer_src/vlan_apis.c:709
pEntry->Statusis set toVLAN_IF_UPunconditionally at the end ofVlan_Enable(), which can overwrite an earlierVLAN_IF_ERROR(e.g., whenVlan_CreateTaggedInterface()fails). This also means the new bridge enable branch will report UP even if the setup failed.
long uptime = 0;
get_uptime(&uptime);
pEntry->LastChange = uptime;
}
36047ab to
d5eb54c
Compare
d5eb54c to
3305c41
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
source/TR-181/middle_layer_src/vlan_apis.c:687
- Bridge enable path calls
brctl addifeven whenBaseInterfaceis empty; this will invoke the command with a missing argument and can misconfigure the bridge. Mirror the disable path’s empty-string guard.
}
else if (pEntry->VLANId == -1)
{
| else if (pEntry->VLANId == -1) | ||
| { | ||
| /* If the VLANID = -1, the VLAN is a bridge, create the bridge and add the interface to the bridge */ | ||
| iif (strcmp(pEntry->BaseInterface, pEntry->Name) != 0) |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
source/TR-181/middle_layer_src/vlan_apis.c:689
iifis a typo and will not compile (should beif).
iif (strcmp(pEntry->BaseInterface, pEntry->Name) != 0)
source/TR-181/middle_layer_src/vlan_apis.c:694
brctl addifis executed even whenBaseInterfaceis an empty string; in the disable path this is guarded. Add the same guard here to avoid running an invalid command and relying on stderr redirection for control flow.
{
v_secure_system("ip link show %s > /dev/null 2>&1 || brctl addbr %s", pEntry->Name, pEntry->Name);
v_secure_system("brctl addif %s %s 2>/dev/null", pEntry->Name, pEntry->BaseInterface);
v_secure_system("ifconfig %s up", pEntry->Name);
}
3305c41 to
d3b9075
Compare
Reason for change: CPE should be able to support IP connectivity(Static/PPPoE/IPoE) over native interface. Test Procedure: Performed VlanManager Sanity test. Risks: None. Signed-off-by: Sherik Sensin A <sherik.a@telekom-digital.com>
d3b9075 to
16a2e81
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
source/TR-181/middle_layer_src/vlan_apis.c:687
- In the VLANId == -1 (bridge) enable path,
brctl addifis executed even whenBaseInterfaceis an empty string.Vlan_SetParamStringValue()/Vlan_Validate()do not enforce a non-emptyBaseInterface, so this can generate an invalid command and fail the bridge setup unnecessarily.
}
else if (pEntry->VLANId == -1)
{
source/TR-181/middle_layer_src/vlan_apis.c:716
- In
Vlan_Enable(), the function later forcespEntry->StatustoVLAN_IF_UPunconditionally, which can contradict the actualstatuscalculated in the VLANId>0 / VLANId==-1 paths (and can also overwriteVLAN_IF_ERRORwhen interface creation fails). This makes the datamodel status inconsistent with real interface state and with the WanManager notifications sent in the loops above.
CcspTraceInfo(("%s-%d: Interface Status(%d), retry-count=%d \n", __FUNCTION__, __LINE__, status, iIterator));
}
long uptime = 0;
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
source/TR-181/middle_layer_src/vlan_apis.c:693
- In the VLANId == -1 (bridge) enable path,
brctl addifis executed even whenBaseInterfaceis an empty string. This can generate an invalid command (missing interface argument) and still proceed to bring the bridge up, potentially reporting an "Up" status incorrectly.
v_secure_system("ip link show %s > /dev/null 2>&1 || brctl addbr %s", pEntry->Name, pEntry->Name);
v_secure_system("brctl addif %s %s 2>/dev/null", pEntry->Name, pEntry->BaseInterface);
v_secure_system("ifconfig %s up", pEntry->Name);
No description provided.