NetBinds: track service closes with debounce + transient labeling#822
Open
lacraig2 wants to merge 2 commits into
Open
NetBinds: track service closes with debounce + transient labeling#822lacraig2 wants to merge 2 commits into
lacraig2 wants to merge 2 commits into
Conversation
Collaborator
Author
|
Paired guest-side change: rehosting/igloo_driver#75 (only emit TCP releases for listening sockets). |
f860b43 to
694b95d
Compare
694b95d to
a9ec3bf
Compare
a9ec3bf to
b4fb610
Compare
…labeling NetBinds previously only persisted bind events; socket releases mutated an in-memory list that was never written out, so closes were invisible. Add a per-socket lifecycle state machine that records open/close/reopen with a configurable debounce window: a re-bind within `debounce_period` is a flap rather than a close, and a socket that flaps `transient_threshold` times is labelled transient (emitting a `transient` lifecycle event). Adds `debounce_period` and `transient_threshold` to the plugin Args, writes netbind_events.csv (open/flap/transient/close log) and netbinds_lifecycle.csv (per-socket summary). Existing netbinds.csv / netbinds_summary.csv output and the on_bind PPP event are unchanged. Also fixes two latent bugs: seen_binds permanently suppressing re-binds, and IPv6 keys never matching releases due to a bracket mismatch.
b4fb610 to
a7d5f0b
Compare
Add patches/tests/netbinds_lifecycle.yaml: a micropython scenario that binds,
listens, and closes a socket on 8401 three times (two flaps -> transient) and
cleanly closes 8402 once. Driving the lifecycle from one process with explicit
close()/bind() makes releases and re-binds deterministic regardless of
emulation speed -- unlike killing a background daemon, where under load the
port is not released before the next bind ("Address in use").
Verifier conditions cover netbind_events.csv (flap, transient) and
netbinds_lifecycle.csv (closed). Uses a large debounce_period so every re-bind
lands inside the window and counts as a flap.
a7d5f0b to
52c0ec4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Penguin tracks when guest services bind ports but not when they close — releases mutated an in-memory list that was never written out, so closes were invisible. Some firmware also opens/closes the same port in rapid succession. This adds a debounced socket lifecycle to NetBinds, plus the bug fixes and test-harness revival needed to exercise it.
Feature —
pyplugins/analysis/netbinds.py(ipvn, sock_type, ip, port)recording open/close/reopen with timestamps.debounce_period, default 2.0s): a release is held pending; a re-bind within the window is a flap, not a close. Pending closes finalize on later events and atuninit.transient_threshold, default 3): flap count >= threshold =>transient.netbind_events.csv(open/flap/close log) andnetbinds_lifecycle.csv(per-socket summary). Existingnetbinds.csv/netbinds_summary.csvand theon_bindPPP event are unchanged.seen_bindspermanently suppressing re-binds, and IPv6 keys never matching releases (bracket normalization).Pairs with rehosting/igloo_driver#75 (guest hook only emits TCP releases for listening sockets).
Drive-by fixes — explore was broken (uncaught due to bit-rotted suite)
common.py:int_to_hex_representerpassed a raw int torepresent_scalarfor values > 10, crashing every config dump with yamlcore (e.g. modes 73/493).graph_search.py: single-threadedWorker(...)omitted thetimeoutarg.utils.py:get_mitigation_providersonly caughtValueError; a missing flat plugin file raisesFileNotFoundError.Test + harness
tests/comprehensive/netbinds/— stable / flapping-transient / cleanly-closed listeners +assert_netbinds.makeImage.sh->penguin explore, modern project layout (base/+static/InitFinder.yaml),PENGUIN_IMAGEoverride, conditional TTY, forwardn_iters.Validation
linux_builderartifacts and synthetic-config boot bit-rot (/igloo/initshebang vs current preinit flow). Follow-up: rebuild a matched kernel+driver and finish reviving the harness.