laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-pcap/+/42839?usp=email )

Change subject: client: fix off-by-one in wrapped pcap stats counter
......................................................................

client: fix off-by-one in wrapped pcap stats counter

When a libpcap stats counter (ps_recv/ps_drop/ps_ifdrop) wraps around
UINT_MAX, get_psbl_wrapped_ctr() computed the delta as
(UINT_MAX - old_val) + new_val, omitting the single increment that
takes the counter from UINT_MAX through zero.  Add the missing +1 so
the reported delta matches the real number of increments.

Change-Id: I66581910dbd1e955831a6ff913042059ad4994a7
AI-Assisted: yes (Claude)
---
M src/osmo_client_core.c
1 file changed, 1 insertion(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved




diff --git a/src/osmo_client_core.c b/src/osmo_client_core.c
index daa5fd6..dbc2588 100644
--- a/src/osmo_client_core.c
+++ b/src/osmo_client_core.c
@@ -204,6 +204,7 @@
        */
        if (old_val > new_val) {
                ret = P_CAP_UINT_MAX() - old_val;
+               ret += 1; /* the wrap from UINT_MAX through zero is one 
increment */
                ret += new_val;
                return ret;
        }

--
To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/42839?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: osmo-pcap
Gerrit-Branch: master
Gerrit-Change-Id: I66581910dbd1e955831a6ff913042059ad4994a7
Gerrit-Change-Number: 42839
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to