Adding extra logs for debugging#318
Conversation
There was a problem hiding this comment.
Pull request overview
Adds diagnostic logging around routed/zebra startup and LAN handler events to aid future triage of the reported selfheal zebra restart marker.
Changes:
- Added service_routed logs for entry points, LAN/WAN readiness, bridge mode, and zebra startup.
- Added LAN handler logs around IPv4 status handling, LAN status transitions, and lan-init completion.
- Cleaned up one duplicate LAN handler log and corrected a typo.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
source/service_routed/service_routed.c |
Adds routed/zebra startup and readiness debug logging. |
source/scripts/init/service.d/lan_handler.sh |
Adds LAN event/status debug logging and minor log cleanup. |
Comments suppressed due to low confidence (1)
source/service_routed/service_routed.c:2426
- This new success-path log write has the same
logfptrvalidity assumption as the WAN-ready log above. Direct callers ofserv_routed_initin the unit tests do not open the global logger, so a LAN-started response can dereference a null or staleFILE *.
fprintf(logfptr, "%s: LAN is ready and value = %d\n", __FUNCTION__, sr->lan_ready);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
73b6622 to
32197e2
Compare
Coverity Issue - Dereference after null checkPassing null pointer "logfptr" to "fprintf", which dereferences it. Medium Impact, CWE-476 Issue locationThis issue was discovered outside the diff for this Pull Request. You can find it at: |
Signed-off-by: aj970 <akshaya_j@comcast.com>
32197e2 to
74fae54
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (4)
source/service_routed/service_routed.c:2118
- This is another new unconditional
logfptrwrite in a path whereservice_routed_mainmay have continued after the log file failed to open. IfLOG_FILE_NAMEcannot be opened, reaching this diagnostic dereferences a nullFILE *instead of continuing the routing operation.
fprintf(logfptr, "%s: bridge_mode %s and LAN ready = %d \n", __FUNCTION__, aBridgeMode, sr->lan_ready);
source/service_routed/service_routed.c:2182
- This new log write also assumes
logfptris valid even though the program only prints an error and continues when opening the log file fails. Guard this write or make the log-open failure fatal so the diagnostic cannot crash a successful zebra-start path.
fprintf(logfptr, "%s: zebra started\n", __FUNCTION__);
source/service_routed/service_routed.c:2419
logfptris not guaranteed to be non-null here because the caller continues afterfopen(LOG_FILE_NAME, ...)fails. Whenwan-statusis alreadystarted, this new diagnostic can crash service initialization before any command is handled.
fprintf(logfptr, "%s: WAN is ready and value = %d\n", __FUNCTION__, sr->wan_ready);
source/service_routed/service_routed.c:2426
- This new initialization log has the same null-
logfptrfailure mode: if the log file could not be opened andlan-statusisstarted,fprintfdereferences a nullFILE *during startup. Guard the write or stop execution when the log open fails.
fprintf(logfptr, "%s: LAN is ready and value = %d\n", __FUNCTION__, sr->lan_ready);
RDKB-63899 : Zebra restart marker observed in selfheal
Reason for change: Adding logs for tracking the issue in future if reproduced
Test Procedure: None
Risks: Low
Priority: P1