ipset: add per-set scheduling, backoff, per-host caching, and size limits - #42
Draft
struanb wants to merge 1 commit into
Conversation
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.
Motivation
Description
_env_intand new bounds-controlled env vars:IPSET_MAX_HOSTNAMES,IPSET_MAX_ENTRIES,IPSET_FAILURE_BACKOFF_MAX, andIPSET_REFRESH_JITTER_PCT, and replace ad-hoc int parsing with bounded values.IpsetDefwithmax_entries, addvalidate()and wire validation intoConfig.from_files, and includemax_entriesin serialization.IpsetManagerto maintain per-ipset scheduling and state (_last_attempt,_last_success,_last_error,_failure_count,_next_refresh,_host_ips), add jittered scheduling, exponential backoff on failures, deterministic truncation tomax_entries, and per-host caches to preserve previously-seen IPs on partial DNS failures.maxelem, make refresh logic preserve cached host answers on failures, and expose an operator-facingstatus_snapshot()with per-ipset details; preserve legacyipsetslive-IP listing and addipset_detailstostatus.refreshto the management socket mutating actions, ensure thread-safety around refresh scheduling, and cleanup/deregister state when ipsets are removed.Testing
pytest) and linters locally; all tests passed.refreshvia the management socket, and verifiedipset_detailsand truncation behavior under simulated large DNS fan-out; smoke tests succeeded.Codex Task