Skip to content

RDKEMW-21582: Network connection recovery script should handle IPv4-only/IPv6-only networks (#581) - #627

Merged
nhanasi merged 1 commit into
support/4.2.1.11_releasefrom
topic/RDKEMW-21582
Sep 24, 2026
Merged

nhanasi merged 1 commit into
support/4.2.1.11_releasefrom
topic/RDKEMW-21582

Conversation

@gururaajar

Copy link
Copy Markdown
Contributor
  • DELIA-70624: updated to reset counters only if gateway is available for ipv6.

  • DELIA-70624: Added debug in the script

  • DELIA-70624: networkConnectionRecovery: presence-aware packet-loss recovery trigger

Recovery now fires only when no routed IP stack has acceptable connectivity and at least one routed stack is at/above the reassociate tolerance. This fixes the IPv4-only / IPv6-only case where a stack with no default route left packetsLost at 0 and suppressed recovery.

Also folded in reliability/logging fixes:

  • clear stale gwIp on the V6 test-hook path
  • guard packet-loss comparisons against unparseable ping output
  • emit SYST_WARN_GW100PERC_PACKETLOSS to the logs file on every run
  • ping the IPv4 default-route interface explicitly (ping -I)
  • log total ipv4/ipv6 packet loss when above threshold
  • simplify the trigger to anyGood/anyBad classification
  • DELIA-70624: networkConnectionRecovery: add log() helper and per-call packet-loss fix
  • Introduce a log() helper that prepends the timestamp and appends to $logsFile, and convert the timestamped echo call sites to use it.
  • Rename packetsLostipv4/packetsLostipv6 globals to ipv4PacketLoss/ipv6PacketLoss for clarity.
  • Reset the per-call packetLoss to "" at the top of checkPacketLoss and guard the packet-loss telemetry block with [ -n "$packetLoss" ], so a routeless or unparseable ping no longer reuses the other family's value or triggers integer-comparison errors.
  • Fix a "[" spacing bug in checkWifiDrvErrors.

Telemetry markers and t2CountNotify calls are unchanged.

  • DELIA-70624: networkConnectionRecovery: log route/loss snapshot on state change

Emit a "network state changed" line with the per-stack route-present flags and packet-loss values only when the snapshot differs from the previous run (persisted in /tmp/.ncr_laststate), so field logs capture every transition without printing on every run. Debugging aid for customer-site triage.

  • DELIA-70624: remove debug logging and make script POSIX/busybox-sh safe
  • Drop the temporary DEBUG_NCR field-debug logging; retain the "network state changed" transition log (now unprefixed).
  • checkWifiDrvErrors(): $dir already holds the full debugfs path, so remove the duplicated /sys/kernel/debug/ieee80211/ prefix from the log messages, and capture the cat exit status so the failure log reports the real status instead of the enclosing test's result.
  • Replace bashisms with POSIX/busybox-ash equivalents: source -> ., [[ =~ ]] -> case, [[ ]] -> [ ], and {1..9} -> explicit list (the brace form never expands under busybox ash, which had left the WIFIV_WARN_PL_20..90PERC packet-loss markers non-functional on target).
  • Minor whitespace cleanup in checkDnsFile().
  • DELIA-70624: restore 100% packet-loss triage marker and fix marker case

Reinstate the field-triage log marker for 100% packet loss that was lost when checkPacketLoss() moved to a tolerance-based recovery decision. The new log-only marker "100% Packet loss is observed on all routed IP stacks" fires when every routed IP stack shows exactly 100% loss. It is independent of WifiReassociateTolerance and does not alter the recovery/return path, so recovery behaviour is unchanged. Unlike the legacy dual-stack "...for both ipv4 and ipv6" print, it is also emitted correctly on IPv4-only and IPv6-only networks. Triage associates the old and new strings to the same 100%-packet-loss marker for trend continuity across images.

Also capitalise the "Packet loss more than 10% observed" marker (was lowercase "packet loss ...") since triage marker matching is case-sensitive.


…nly/IPv6-only networks (#581)

* DELIA-70624: updated to reset counters only if gateway is available for ipv6.

Signed-off-by: Balaji Punnuru <Balaji_Punnuru@comcast.com>

* DELIA-70624: Added debug in the script

Signed-off-by: Balaji Punnuru <Balaji_Punnuru@comcast.com>

* DELIA-70624: networkConnectionRecovery: presence-aware packet-loss recovery trigger

Recovery now fires only when no routed IP stack has acceptable
connectivity and at least one routed stack is at/above the reassociate
tolerance. This fixes the IPv4-only / IPv6-only case where a stack with
no default route left packetsLost at 0 and suppressed recovery.

Also folded in reliability/logging fixes:
- clear stale gwIp on the V6 test-hook path
- guard packet-loss comparisons against unparseable ping output
- emit SYST_WARN_GW100PERC_PACKETLOSS to the logs file on every run
- ping the IPv4 default-route interface explicitly (ping -I)
- log total ipv4/ipv6 packet loss when above threshold
- simplify the trigger to anyGood/anyBad classification

* DELIA-70624: networkConnectionRecovery: add log() helper and per-call packet-loss fix

- Introduce a log() helper that prepends the timestamp and appends to
  $logsFile, and convert the timestamped echo call sites to use it.
- Rename packetsLostipv4/packetsLostipv6 globals to
  ipv4PacketLoss/ipv6PacketLoss for clarity.
- Reset the per-call packetLoss to "" at the top of checkPacketLoss and
  guard the packet-loss telemetry block with [ -n "$packetLoss" ], so a
  routeless or unparseable ping no longer reuses the other family's value
  or triggers integer-comparison errors.
- Fix a "[" spacing bug in checkWifiDrvErrors.

Telemetry markers and t2CountNotify calls are unchanged.

* DELIA-70624: networkConnectionRecovery: log route/loss snapshot on state change

Emit a "network state changed" line with the per-stack route-present flags
and packet-loss values only when the snapshot differs from the previous run
(persisted in /tmp/.ncr_laststate), so field logs capture every transition
without printing on every run. Debugging aid for customer-site triage.

* DELIA-70624: remove debug logging and make script POSIX/busybox-sh safe

- Drop the temporary DEBUG_NCR field-debug logging; retain the
  "network state changed" transition log (now unprefixed).
- checkWifiDrvErrors(): $dir already holds the full debugfs path, so remove
  the duplicated /sys/kernel/debug/ieee80211/ prefix from the log messages,
  and capture the cat exit status so the failure log reports the real status
  instead of the enclosing test's result.
- Replace bashisms with POSIX/busybox-ash equivalents: source -> .,
  [[ =~ ]] -> case, [[ ]] -> [ ], and {1..9} -> explicit list (the brace
  form never expands under busybox ash, which had left the
  WIFIV_WARN_PL_20..90PERC packet-loss markers non-functional on target).
- Minor whitespace cleanup in checkDnsFile().

* DELIA-70624: restore 100% packet-loss triage marker and fix marker case

Reinstate the field-triage log marker for 100% packet loss that was lost
when checkPacketLoss() moved to a tolerance-based recovery decision. The
new log-only marker "100% Packet loss is observed on all routed IP stacks"
fires when every routed IP stack shows exactly 100% loss. It is independent
of WifiReassociateTolerance and does not alter the recovery/return path, so
recovery behaviour is unchanged. Unlike the legacy dual-stack
"...for both ipv4 and ipv6" print, it is also emitted correctly on
IPv4-only and IPv6-only networks. Triage associates the old and new strings
to the same 100%-packet-loss marker for trend continuity across images.

Also capitalise the "Packet loss more than 10% observed" marker (was
lowercase "packet loss ...") since triage marker matching is case-sensitive.

---------

Signed-off-by: Balaji Punnuru <Balaji_Punnuru@comcast.com>
Co-authored-by: Balaji Punnuru <Balaji_Punnuru@comcast.com>
Copilot AI lite review requested due to automatic review settings September 24, 2026 19:15
@gururaajar
gururaajar requested a review from a team as a code owner September 24, 2026 19:15
@gururaajar
gururaajar changed the base branch from develop to support/4.2.1.11_release September 24, 2026 19:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Two moderate issues remain involving notification cadence and packet-loss value validation.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 2 Medium severity

Open (2)
What changed in this PR

Updates network recovery for IPv4-only and IPv6-only networks, with improved logging and POSIX/BusyBox shell compatibility.

Changes:

  • Adds route-aware packet-loss recovery decisions.
  • Improves packet-loss and state-transition telemetry.
  • Replaces non-POSIX shell constructs.

Review findings:

  • Retain the interval gate for t2CountNotify.
  • Validate packet-loss values as integers before comparisons.
File Summary
lib/​rdk/​networkConnectionRecovery.sh Implements network recovery, telemetry, and shell portability updates.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lib/rdk/networkConnectionRecovery.sh
Comment thread lib/rdk/networkConnectionRecovery.sh
@nhanasi
nhanasi merged commit d4c3690 into support/4.2.1.11_release Sep 24, 2026
6 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants