Repository navigation
fix(netprobe): count a ping attempt only when the probe sends it - #811
Conversation
The shared ping receiver passes every ICMPv4 packet the host receives to each ping probe, and the handler counted any echo request among them as an attempt. A ping to a local address comes back as its own request before the reply, so each probe counted two attempts and one success, and the looped-back request restarted the round-trip timer. Echo requests from a host pinging this one were counted as attempts on every ping target. Every ping probe on the pktvisor, in any policy, also handled the looped-back request and its reply under its own target name, which re-tagged the pending transaction: other targets were credited with attempts and successes they never made, or took the local target's success and round trip. The IPv4 receive path now skips echo requests. The ICMPv6 receiver already passes only echo replies, so IPv6 targets were not affected; the handler skips ICMPv6 echo requests too, as a defensive check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
|
/ai-review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
AI Code Review — risk tier: Advisory only. A human owns the merge decision. Summary — Net positive. The fix correctly restricts attempt-counting to the send path for ICMPv4/ICMPv6 echo requests, eliminating the double-counting of looped-back and foreign echo requests described in the PR. Both sub-reviewers traced the change through 🤖 AI Code Review · run · prompts: |
|
AI Code Review — risk tier: Advisory only. A human owns the merge decision. Summary — Net-positive, well-scoped fix: ping attempts are now only counted when the probe actually sends an ICMP echo request, correctly excluding received echo requests from the attempt count. No correctness or security issues found. 🤖 AI Code Review · run · prompts: |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
LCOV of commit
|
A netprobe ping policy that probes one target every 5 s reported 24 attempts per 60 s window instead of 12. The handler counted echo requests it received as attempts.
Cause
The process-wide IPv4 ping receiver (
src/inputs/netprobe/PingProbe.cpp) is a raw ICMP socket with no type filter. On Linux it gets every ICMP packet the host receives, and it passes each one to every ping probe.NetProbeStreamHandler::process_netprobe_icmpdecided by message type alone: anyICMP_ECHO_REQUESTstarted a transaction and counted an attempt, whether the probe had sent it or received it.127.0.0.1, or to any address the host owns, comes back throughloas its own request before the reply. Each probe counted two attempts and one success. The looped-back request also restarted the transaction, so the round trip was timed from it rather than from the send.The ICMPv6 receiver already passes only echo replies (
ICMP6_FILTERandbuild_icmpv6_reply_carrier), so IPv6 targets were not affected. macOS doesn't deliver echo requests to ICMP sockets, so it doesn't show the problem either.Measured on Linux before the fix
pktvisord from
netboxlabs/orb-agent:develop(pktvisor 4.5.0-develop-c3c5379), one container per case, exporting OTLP to a collector. The tap and policy were the ones orb-agent creates for a Fleet netprobe policy:test_type: ping,interval_msec: 5000, one target.127.0.0.1ping -i 2at this hostEach window was pushed once over OTLP, as a gauge with the same values as the REST API. Nothing downstream doubles it.
The fix
probe_signal_recvnow skips received ICMPv4 echo requests. It skips ICMPv6 echo requests too, as a defensive check. Attempts are counted only on the send path, as the TCP path already does; replies end transactions as before; a local target's round trip is timed from the send again.Tests (
src/handlers/netprobe/test_net_probe.cpp)They drive the input proxy's send and receive signals directly, so no sockets or root are needed.
localandremotein one policy, packets fanned out to bothlocalhas 2 attempts and 0 successes;remotegets metricslocalhas 1, 1 and 12000 µs;remotehas noneVerification
unit-tests-input-netprobefails the same way on develop: two TCP-timeout tests, which never reach the handler, expect connects to stall, and this host completes them. Linux CI is the reference for that target.Not changed
ICMP_FILTERwould save copying each foreign echo request to every probe, but correctness doesn't need it.packets_timeoutcounts late replies only. A ping that never gets a reply shows only as attempts minus successes, which is how the dashboards already compute availability.🤖 Generated with Claude Code