feat: Add FlushConntrackTable TR-181 parameter#76
Open
jayasrikadiyal wants to merge 1 commit into
Open
Conversation
Add new TR-181 boolean parameter FlushConntrackTable under X_RDKCENTRAL-COM_DeviceFingerPrint to flush the connection tracking table on demand. - Add parameter definition to TR181-AdvSecurity.xml - Add Get handler (trigger parameter, always returns FALSE) - Add Set handler (flushes conntrack table when set to TRUE) - Add CosaAdvSecFlushConntrackTable() using v_secure_system - Add unit tests for Get, Set(TRUE), and Set(FALSE) cases Resolves #75
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new TR-181 trigger parameter (Device.DeviceInfo.X_RDKCENTRAL-COM_DeviceFingerPrint.FlushConntrackTable) that allows flushing the conntrack table on-demand via the AdvSecurity DML layer.
Changes:
- Extended TR-181 data model with a writable boolean
FlushConntrackTableparameter underX_RDKCENTRAL-COM_DeviceFingerPrint. - Added DML Get/Set handling for the new parameter, treating it as a trigger (Get always returns
FALSE; Set(TRUE) triggers the action). - Implemented
CosaAdvSecFlushConntrackTable()usingv_secure_system("conntrack -F")and added unit tests for the new DML branches.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| config/TR181-AdvSecurity.xml | Adds the new TR-181 parameter definition under the DeviceFingerPrint object. |
| source/AdvSecurityDml/cosa_adv_security_dml.c | Implements Get/Set handling for FlushConntrackTable trigger behavior. |
| source/AdvSecurityDml/cosa_adv_security_internal.h | Declares CosaAdvSecFlushConntrackTable() for use by the DML layer. |
| source/AdvSecurityDml/cosa_adv_security_internal.c | Implements the conntrack flush action via v_secure_system. |
| source/test/CcspAdvSecurityDmlTest/CcspAdvSecurityDmlTest.cpp | Adds unit tests for Get and Set(TRUE/FALSE) paths and updates unsupported-param coverage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+3533
to
+3534
| if (!WIFEXITED(rc) || WEXITSTATUS(rc) != 0) | ||
| { |
Comment on lines
+2944
to
+2968
| TEST_F(CcspAdvSecurityDmlTestFixture, CheckDeviceFingerPrint_SetParamBoolValue_FlushConntrackTable_True) { | ||
| PCOSA_DATAMODEL_AGENT pMyObject = new COSA_DATAMODEL_AGENT; | ||
| g_pAdvSecAgent = pMyObject; | ||
|
|
||
| const char* ParamName = "FlushConntrackTable"; | ||
| BOOL bValue = TRUE; | ||
| int comparisonResult = 1; | ||
| int comparisonResultMatch = 0; | ||
|
|
||
| EXPECT_CALL(*g_safecLibMock, _strcmp_s_chk(StrEq("Enable"), strlen("Enable"), StrEq(ParamName), _, _, _)) | ||
| .Times(1) | ||
| .WillOnce(DoAll(SetArgPointee<3>(comparisonResult), Return(EOK))); | ||
|
|
||
| EXPECT_CALL(*g_safecLibMock, _strcmp_s_chk(StrEq("FlushConntrackTable"), strlen("FlushConntrackTable"), StrEq(ParamName), _, _, _)) | ||
| .Times(1) | ||
| .WillOnce(DoAll(SetArgPointee<3>(comparisonResultMatch), Return(EOK))); | ||
|
|
||
| EXPECT_CALL(*g_securewrapperMock, v_secure_system(HasSubstr("conntrack -F"), _)) | ||
| .Times(1) | ||
| .WillOnce(Return(0)); | ||
|
|
||
| BOOL result = DeviceFingerPrint_SetParamBoolValue(NULL, (char*)ParamName, bValue); | ||
|
|
||
| EXPECT_TRUE(result); | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new TR-181 boolean parameter
FlushConntrackTableunderX_RDKCENTRAL-COM_DeviceFingerPrintto flush the connection tracking table on demand.Resolves #75.
Changes
FlushConntrackTableboolean parameter definition underX_RDKCENTRAL-COM_DeviceFingerPrintFlushConntrackTableinDeviceFingerPrint_GetParamBoolValue(always returns FALSE as trigger) andDeviceFingerPrint_SetParamBoolValue(callsCosaAdvSecFlushConntrackTable()when set to TRUE)CosaAdvSecFlushConntrackTable()function declarationCosaAdvSecFlushConntrackTable()implementation usingv_secure_system("conntrack -F")Usage
Testing