Skip to content

Adding extra logs for debugging#318

Open
aj970-crypto wants to merge 1 commit into
developfrom
feature/bug_63899
Open

Adding extra logs for debugging#318
aj970-crypto wants to merge 1 commit into
developfrom
feature/bug_63899

Conversation

@aj970-crypto
Copy link
Copy Markdown
Contributor

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

Copilot AI review requested due to automatic review settings May 15, 2026 11:44
@aj970-crypto aj970-crypto requested review from a team as code owners May 15, 2026 11:44
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

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 logfptr validity assumption as the WAN-ready log above. Direct callers of serv_routed_init in the unit tests do not open the global logger, so a LAN-started response can dereference a null or stale FILE *.
        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.

Comment thread source/service_routed/service_routed.c Outdated
Comment thread source/service_routed/service_routed.c
Comment thread source/scripts/init/service.d/lan_handler.sh
Comment thread source/service_routed/service_routed.c
Comment thread source/scripts/init/service.d/lan_handler.sh
Comment thread source/scripts/init/service.d/lan_handler.sh
@rdkcmf-jenkins
Copy link
Copy Markdown
Contributor

Coverity Issue - Dereference after null check

Passing null pointer "logfptr" to "fprintf", which dereferences it.

Medium Impact, CWE-476
FORWARD_NULL

Issue location

This issue was discovered outside the diff for this Pull Request. You can find it at:
source/service_routed/service_routed.c:2783

Signed-off-by: aj970 <akshaya_j@comcast.com>
Copilot AI review requested due to automatic review settings May 18, 2026 06:22
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

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 logfptr write in a path where service_routed_main may have continued after the log file failed to open. If LOG_FILE_NAME cannot be opened, reaching this diagnostic dereferences a null FILE * 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 logfptr is 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

  • logfptr is not guaranteed to be non-null here because the caller continues after fopen(LOG_FILE_NAME, ...) fails. When wan-status is already started, 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-logfptr failure mode: if the log file could not be opened and lan-status is started, fprintf dereferences a null FILE * 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);

Comment thread source/service_routed/service_routed.c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants