wg pyroute2 read - #511
Draft
goodboy wants to merge 19 commits into
Draft
Conversation
goodboy
force-pushed
the
wkt/addr_unpacking
branch
from
August 28, 2026 19:18
5d92595 to
7d0b84e
Compare
goodboy
force-pushed
the
wkt/wg_pyroute2_read
branch
2 times, most recently
from
August 30, 2026 02:00
1ee980f to
a834487
Compare
goodboy
force-pushed
the
wkt/addr_unpacking
branch
from
August 30, 2026 02:01
7d0b84e to
5b606ba
Compare
Add async `read_wg_pubkey()` and `read_wg_peers()` helpers which offload `WireGuard.info()` calls to a `trio` worker thread. Deats, - add the Linux-only `wg` extra and pin `pyroute2` - pass `flags=0` so a read never creates a named netns - normalize multipart replies, validate keys and de-dup peers - always close the netlink client, including error paths - test thread offload, netns forwarding and client cleanup Prompt-IO: ai/prompt-io/opencode/20260821T233204Z_5d92595f_prompt_io.md (this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))
Add a candidate Layer-C architecture where a private, eagerly spawned manager owns pyroute2 and tunnel provisioning for a simple WG-enabled actor tree. Deats, - overlap manager reconciliation with sibling process startup - contain `AsyncWireGuard` in an infected-asyncio child - limit requests and capabilities by bindspace security domain - define readiness, crash, restart and teardown semantics - retain pre-provisioned and multi-manager escape hatches (this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))
Validate a declared tunnel key against one `pyroute2` snapshot containing the iface's own key and configured peers. Deats, - share worker offload across all WireGuard key readers - forward `WGTunnelSpec.iface` and `.netns` to the read - reject malformed declarations before netlink I/O - export the async helper and cover local, peer and absent keys - replace multihost's `wg show` subprocess probe Prompt-IO: ai/prompt-io/opencode/20260822T023226Z_59a8ecfd_prompt_io.md (this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))
Make `TCPAddress` and `UDSAddress` explicitly satisfy `Address.namespace`, then retain each original listener declaration beside its peeled, resolved transport address. Deats, - remove `TunnelledAddress`'s attribute fallback - add required `Endpoint.declared_addr` metadata - report declaration namespaces in endpoint/server formatting - preserve concrete `Endpoint.addr` for transport reflection - cover plain and tunneled namespace visibility Prompt-IO: ai/prompt-io/opencode/20260822T032520Z_d35c802b_prompt_io.md (this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))
Separate serializable `BindspaceSpec` and `BindspaceIdentity` values from a process-local `BindspaceHandle` carrying FD and ownership authority. Deats, - add global `ProcessLocal` wire guards for local handle structs - derive valid kinds and ownership from their `Literal` aliases - require a positive inode while keeping the mutable name optional - pin supplied FDs to identity inodes with `fstat()` - cover round trips, nested encoding and stale capabilities Caught-during: review remediation Found-via: `/run-tests` test_bindspace_handle_pins_local_capability Prompt-IO: ai/prompt-io/opencode/20260822T042026Z_29141f0b_prompt_io.md (this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))
Add `attach_netns()` to pin a current or named Linux netns in a borrowed `BindspaceHandle` without creating or entering it. Deats, - name the current-namespace default `CURRENT_NETNS` - derive stable identity from the opened FD with `fstat()` - open descriptors with `O_CLOEXEC` and close them on context exit - constrain named lookup beneath the standard iproute2 run directory - report field-specific validation and missing-resource errors Prompt-IO: ai/prompt-io/opencode/20260825T045557Z_fdccfd7e_prompt_io.md (this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))
Add `open_netns()` to create a named Linux netns through pyroute2, pin its identity and yield an owned `BindspaceHandle`. Deats, - run synchronous creation and removal in Trio worker threads - shield both privileged side effects from caller cancellation - reuse `attach_netns()` to pin identity and manage the FD - close the FD before removing the owned namespace - fake privileged operations while testing ordering and cancellation Prompt-IO: ai/prompt-io/opencode/20260825T190529Z_e1007547_prompt_io.md (this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))
Add serialized `BindspaceSpec.lifecycle` policy and dispatch it through `open_bindspace()` without inferring ownership from transport role. Deats, - distinguish borrowed `attach` from owned `open` policy - validate handle ownership against the declared lifecycle - share policy-neutral FD pinning between both netns contexts - reject unsupported lifecycle values before side effects - exercise both dispatcher branches and owned cancellation cleanup Prompt-IO: ai/prompt-io/opencode/20260825T191845Z_5b2a064a_prompt_io.md (this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))
Add process-local `WGInterfaceConfig` for key material, interface addresses and peer-routing policy required by future provisioning. Deats, - redact private and preshared keys from representation - block config from default actor-IPC encoding via `ProcessLocal` - validate keys, interface CIDRs, allowed CIDRs and bounded integers - keep public endpoint and peer identity in `WGTunnelSpec` - move allowed-IP policy out of the serializable tunnel declaration Prompt-IO: ai/prompt-io/opencode/20260825T234631Z_b973e78c_prompt_io.md (this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))
Add process-local `WGPeerConfig` entries and make `WGInterfaceConfig` own a unique peer tuple for listener and dial provisioning. Deats, - carry peer public keys, allowed CIDRs and optional endpoints - redact per-peer preshared keys while blocking wire encoding - validate peer routes, endpoint ports and keepalive intervals - reject duplicate peers before future kernel mutation - support multi-peer listeners without overloading tunnel identity Prompt-IO: ai/prompt-io/opencode/20260826T001442Z_dcdf4d82_prompt_io.md (this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))
Add `open_wg_iface()` to create, configure and remove one WireGuard interface inside a pinned bindspace through pyroute2. Deats, - validate listen/dial bearer policy before kernel side effects - configure local addresses, private key, listen port and peers - fill an omitted dial endpoint from the selected tunnel bearer - clean partial synchronous failures before returning to Trio - shield owned interface creation and teardown from cancellation Prompt-IO: ai/prompt-io/opencode/20260826T003430Z_6dd39da0_prompt_io.md (this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))
Add `open_wg_bindspace()` to enter one declared bindspace and an ordered WireGuard interface stack as one async lifetime. Deats, - snapshot caller layer ordering before the first checkpoint - enter interfaces outermost-first through `AsyncExitStack` - unwind interfaces before releasing the namespace capability - yield the live `BindspaceHandle` for endpoint allocation - test mutable input and cancellation ordering with lifecycle fakes Prompt-IO: ai/prompt-io/opencode/20260826T022434Z_2245f094_prompt_io.md (this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))
Replace the unshipped `BindspaceIdentity` and `BindspaceHandle` names with `BindspaceRef` and `Bindspace` across existing lifecycle APIs. Deats, - define refs as wire-safe, host-local and non-owning records - reserve `Bindspace` for the live FD-backed capability - rename the capability's realized-resource field to `.ref` - update lifecycle tests and active design contracts - omit compatibility aliases for the unshipped model names Prompt-IO: ai/prompt-io/opencode/20260827T211115Z_d130431c_prompt_io.md (this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))
Add `TunnelledAddress.with_bindspace_ref()` to annotate frozen tunnel declarations with stable, serializable namespace metadata. Deats, - omit absent refs from the existing msgspec shape - reject declared and realized namespace-name mismatches - report the declared key before realization and inode afterward - keep transport peeling free of live bindspace capability state - expose realized refs through real listener diagnostics Prompt-IO: ai/prompt-io/opencode/20260826T030534Z_d130431c_prompt_io.md (this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))
Record native tagged encoding for complete `TunnelledAddress` graphs as a deferred design follow-up. Deats, - cover concrete overlay-address and tunnel-spec unions - preserve optional `BindspaceRef` metadata through decoding - replace untyped payload inspection with typed roundtrip tests (this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))
Add private `enter_netns()` bootstrap validation before actor runtime integration. Deats, - verify the inherited FD against its expected namespace inode - constrain `setns()` to Linux network namespaces - verify `/proc/self/ns/net` after the entry syscall - leave inherited FD ownership to the future spawn caller - exercise guards with real FDs and unprivileged syscall fakes Prompt-IO: ai/prompt-io/opencode/20260827T232500Z_d067505a_prompt_io.md (this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))
Consume an optional child-owned `(fd, inode)` capability before multiprocessing or Trio child bootstrap begins runtime setup. Deats, - enter the netns before Trio patching and actor construction - close the inherited FD before actor runtime startup - preserve entry errors when descriptor cleanup also fails - reject malformed FD values without closing unrelated descriptors - cover multiprocessing and Trio ordering with real stand-in FDs Prompt-IO: ai/prompt-io/opencode/20260828T012205Z_9ae7cd86_prompt_io.md (this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))
Race the initial peer handshake against process exit during Trio child bootstrap so a dead child cannot park its spawning task. Restore and harden the design originally implemented in `3b0724eb`. Deats, - register peer events before provisional nursery publication - raise `ActorFailure` with child status when process death wins - prioritize observed death over a simultaneous handshake - preserve waiter exceptions without `ExceptionGroup` wrapping - log expected losing-waiter cancellation at debug level - remove exact failed-startup peer events during backend cleanup - cover controlled schedules and full Trio backend cleanup Based-on: 3b0724e Prompt-IO: ai/prompt-io/opencode/20260828T045119Z_fb6d81d3_prompt_io.md (this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))
Thread an optional live `Bindspace` through actor spawn APIs and give each Trio exec child an inherited namespace descriptor before runtime bootstrap. Deats, - duplicate the namespace FD without changing parent ownership - preserve caller `pass_fds` and process options - send the `(fd, inode)` pair through the `_child` CLI - close the parent duplicate on success, failure and cancellation - reject MP backends until descriptor reduction is implemented - avoid cleanup before child publication - exercise real E2E namespace relay through handshake and RPC - verify parent FD-table cleanup after successful child spawn Prompt-IO: ai/prompt-io/opencode/20260828T172943Z_2ca8c570_prompt_io.md (this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))
goodboy
force-pushed
the
wkt/wg_pyroute2_read
branch
from
August 30, 2026 02:03
a834487 to
b1f6ade
Compare
goodboy
force-pushed
the
wkt/addr_unpacking
branch
from
August 30, 2026 02:03
5b606ba to
51f4e31
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.
No description provided.