Refactor Log_Enable API for improved validation and thread safety#1005
Open
coveyjorjet wants to merge 1 commit intordkcentral:developfrom
Open
Refactor Log_Enable API for improved validation and thread safety#1005coveyjorjet wants to merge 1 commit intordkcentral:developfrom
coveyjorjet wants to merge 1 commit intordkcentral:developfrom
Conversation
d1f542d to
2ef5991
Compare
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
2ef5991 to
9306557
Compare
Reason for change: The existing Log_Enable implementation had several issues: - Limited to only 12 debug modules (expanded to 31) - Used unsafe strtok() which is not thread-safe - Lacked comprehensive input validation - No enable/disable reconciliation logic Changes: - Add shared wifi_dbg_flags[] array with 31 debug modules - Add isValidLogModule() helper for module name validation - Add validateLogEnable() with comprehensive input validation - Implement CosaDmlWiFi_getLogEnable() with buffer overflow protection - Implement CosaDmlWiFi_setLogEnable() with enable/disable reconciliation - Replace unsafe strtok() with thread-safe strtok_r() - Refactor cosa_wifi_dml.c to use new API functions Test Procedure: Set and get Log_Enable via dmcli and verify debug modules are enabled/disabled correctly in /nvram/ Risks: Low Signed-off-by: Covey Jorjet De Luna <cjdeluna1423@gmail.com>
9306557 to
27f83d2
Compare
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
This PR refactors the
Log_EnableTR-181 parameter implementation to improve validation, thread safety, and expand the supported debug modules from 12 to 31.Reason for change
The existing
Log_Enableimplementation had several areas for improvement:strtok()which is not thread-safe; replaced withstrtok_r()Changes
wifi_dbg_flags[]array with 31 debug modulesisValidLogModule()helper for module name validationvalidateLogEnable()with comprehensive input validationCosaDmlWiFi_getLogEnable()with buffer overflow protectionCosaDmlWiFi_setLogEnable()with enable/disable reconciliationstrtok()with thread-safestrtok_r()cosa_wifi_dml.cto use new API functionsTest Procedure
Log_Enablevia dmcli:```
dmcli eRT setv Device.WiFi.Log_Enable string "wifiCtrlDbg,wifiMgrDbg"
```
/nvram/:```
ls /nvram/wifiCtrlDbg /nvram/wifiMgrDbg
```
Log_Enablevia dmcli and confirm the enabled modules are returned:```
dmcli eRT getv Device.WiFi.Log_Enable
```
Risks
Low - Changes are isolated to Log_Enable functionality with no impact on core WiFi operations.
Thank you for reviewing! 🙏