Commit Graph

318 Commits

Author SHA1 Message Date
Pat Whittingslow ef279863a9 Incorporate strict test timing for TestStackGoTCPDialRetriesPendingControl (#135)
* rewrite tinygo failing test to be more real-time

* use channels to scheduler stack

* fix flakiness by increasing timeout and move implementation to top of file
2026-06-24 13:07:19 -03:00
TuteMthCD d5ea2efdf4 Retransmit active-open SYN after RTO (#130)
* added: sync packet retransmission

* test: sync packet retransmission

* refactor: remove packet time from tcppool

* fix: return comment

* refactor: move retrying to stackRetrying

* added: retries & timeout to stackGoConfig

* test: test retries stack

* refactor: move StackRetrying to stackBlocking

* fix: line gofmt

---------

Co-authored-by: Pat Whittingslow <graded.sp@gmail.com>
2026-06-23 00:19:16 -03:00
Marvin Drees a0a5336108 Add xcurl port and debug flag (#129)
* feat: add xcurl port and debug flag

Update the docs and add new flags to xcurl to aid debugging under an OS
like Linux.

Signed-off-by: Marvin Drees <marvin.drees@9elements.com>

* drop debugtcp flag from xcurl again

Signed-off-by: Marvin Drees <marvin.drees@9elements.com>

---------

Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
2026-06-22 18:32:50 -03:00
Pat Whittingslow 28addf329a try to fix fmt msg (#133)
* try to fix fmt msg

* fix CI
2026-06-22 18:16:29 -03:00
Marvin Drees 860d6d00bb Add atomic id guard to prevent TOCTOU (#131)
* add atomic id guard to prevent TOCTOU

Signed-off-by: Marvin Drees <marvin.drees@9elements.com>

* implement review feedback to tcp conn guard

Signed-off-by: Marvin Drees <marvin.drees@9elements.com>

---------

Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
2026-06-22 09:56:38 -03:00
Pat Whittingslow 8f9d765cb0 Ack dropping - fix for #50 (#127)
* fix for #50

* fix remaining test

* revert changes and instead approach problem on full-duplex case

* fix merge messup

* fix @MDr164 note and upgrade documentation while at it

* gate full buffer exit on rx shutdown since no risk of full buffer error

* add log line to note issue is hit

* document CloseRead relationship with Close
2026-06-19 18:43:13 -03:00
Pat Whittingslow 6f5acd1948 persist issue #57 fix in test (#128)
* persist issue 57 fix in test

* have go fix output error on CI

* apply go fix required fix

* test no || for go fix command

* test no || for go fix command complete, it is needed

* forgot to fix
2026-06-18 18:23:15 -03:00
Marvin Drees e0ef681085 feat: add RFC 3927 support (#114)
Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
2026-06-18 10:21:25 -03:00
Pat Whittingslow bef2137bad add zero os docs (#126)
* add zero os docs

* mention scheduling
2026-06-18 10:08:49 -03:00
Patricio Whittingslow 059f761856 CapturePrinter expose Ethernet and IP printers 2026-06-17 16:42:38 -03:00
Pat Whittingslow 5a674a4ad1 fix for #124 (#125) 2026-06-17 15:16:55 -03:00
Pat Whittingslow 60098ad8d0 More IPv6 support and race condition fixes (#123)
* changes in preparation of wireguard impl

* suggestions by @MDr164
2026-06-17 15:10:25 -03:00
Pat Whittingslow 813b7b5e57 Lay out device/stack interfaces - Netdev/Netlink (#92)
* good code today

* add netdev.Runner

* round off APIs more

* better interface method documentation

* improve DHCP netstack API

* add pico w netdev example

* remove temp file

* keep thinking about this. this is hard :/

* fix ci

* small fixer

* working dhcp

* fix rebase API mismatches

* begin adding espradio example

* keep working on espradio, icmp not working

* fix icmp by fixing dhcp
2026-06-17 14:18:08 -03:00
Marvin Drees 5f8ca45859 feat(x/nts): add NTS support (#88)
Implement NTS (RFC 8915) with KERecord zero-copy frame, PerformKE
(TLS 1.3 + ExportKeyingMaterial), DeriveKeys, and Client state
machine implementing lneto.StackNode. Client handles cookie pool
management, auth body codec with nonce/ciphertext, and two-exchange
NTP flow with UniqueID verification and AEAD authentication.

Add NTS Server wrapping ntp.Server with AEAD verification/sealing,
and HandleKE for server-side NTS Key Exchange over TLS 1.3.

Use internal.LogAttrs for non-allocating structured logging
throughout the NTS client, matching existing conventions.

Generated with LLM assistance.

Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
2026-06-15 11:42:10 -03:00
Marvin Drees 856ac373d5 docs: update README to aid Linux debugging (#122)
Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
2026-06-15 11:02:49 -03:00
Patricio Whittingslow 82f9461548 add missing backoffs 2026-06-09 14:33:50 -03:00
Pat Whittingslow 6ba06acdcb lneto rework: Require explicit BackoffStrategy in all APIs (#116)
* make backoff explicit API

* fix tests to use explicit backoff

* fix examples with explicit tcp
2026-06-09 10:20:40 -03:00
Pat Whittingslow 3b82cefec3 exclude stringers.go files from code coverage (#119) 2026-06-09 10:13:55 -03:00
Pat Whittingslow 24d5d303bc modifications to xnet stacks in preparation of wireguard integration (#113)
* modifications to xnet stacks in preparation of wireguard integration

* gofmt files
2026-05-27 13:53:57 -03:00
Marvin Drees 46d4c06b9f fix: clean up misc TODO comments and improve UDP source filtering (#89)
- http/httpraw: cap header slice growth to pre-allocated capacity, fix
  benchmark to reuse Header across iterations (0 allocs/op)
- internal/ring: replace TODO panic comments with invariant explanations
- tcp/conn: document truncated-frame offset check
- tcp/handler: replace TODO with net.ErrClosed on RST-closed connection
- internet/stack-udpport: filter incoming packets by remote IP address
  when configured via SetStackNode; skip filter for IPv4 multicast
  destinations (class D) so mDNS and similar protocols work correctly

Generated with LLM assistance.

Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
2026-05-20 14:29:09 -03:00
Patricio Whittingslow edf302baf8 normalize net.Addr parsing in Gostack 2026-05-14 18:06:38 -03:00
Patricio Whittingslow 8efd810610 more API touch ups 2026-05-14 13:15:16 -03:00
Patricio Whittingslow d010e6a7e9 API touch ups 2026-05-14 12:59:57 -03:00
Pat Whittingslow 9fcb7e9b52 Add udp.PacketConn (#112)
* update README table and begin planning udp.PacketConn

* first attempt at packetconn implementation

* add udp.PacketConn to StackAsync and implement SocketNetip iface

* add tests for PacketConn
2026-05-14 12:48:07 -03:00
Pat Whittingslow b95eb03aa5 fix CI and rework package structure (#111) 2026-05-13 15:44:30 -03:00
Pat Whittingslow a2970b923d add ipv6 to xnet.StackAsync (#107)
* add ipv6 to xnet.StackAsync

* dns improvements

* improve DNS workings of StackAsync

* add tentative ICMPv6

* work on prefixes and fix some small bugs, plan UDP/TCP6

* fix bugs in StackAsync and ipv4.Prefix.Contains

* update arpsubtable

* completely remove legacy internet.StackIP for StackIPv4/v6

* ipv4/ipv6 tcp/udp

* add TCP6/UDP6 dialing APIs

* add xnet.Stack6 interface

* more ipv6 integration into StackAsync; various tweaks to lneto and documentation+TODOs

* add stack6 tests

* replace netip.Prefix with ipv4.Prefix where it makes sense
2026-05-13 15:31:18 -03:00
Pat Whittingslow 7d5830d7ab V2 Netbird integration - UDP MIMO/SIMO, ICMPv6, DHCPv6 implementations (#106)
* begin adding udp.MuxHandler

* add udp MuxHandlerSIMO/MIMO

* add tcp rx shutdown

* icmpv6 client

* icmpv6 Client shared NDP/Echo preparation

* icmpv6 client ndp/echo split

* icmpv6 client ndp/echo split done

* icmpv6 adjustments

* add dhcpv6 stubs

* dhcpv4 preliminary revision

* add dns.NextLabel

* dns label name tweaks

* dns begin work on TCP client

* add dnstcp package

* apply gofmt changes

* add udp mux tests

* clean up, remove StackBig for now

* remove dnstcp so as to merged confident parts and we continue dnstcp work elsewhere
2026-05-10 12:16:30 -03:00
Pat Whittingslow bdbd38ab44 ipv6: StackIP and StackAsync.Addr refactor (#105)
* apply StackIP changes and internet package test passing

* fix tests and examples

* remove old Reset method on StackIP

* use encapsulate for ipv6

* add TCP over IPv6 tests
2026-05-09 16:11:31 -03:00
Marvin Drees a430f6c40a remove trailing whitespaces and add support matrix (#102)
Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
2026-04-27 13:52:22 -03:00
Marvin Drees bba913751a feat(ntp): add two-exchange client, server handler, and extension fields (#101)
Implement full two-exchange NTP client state machine (RFC 5905 §8).
First exchange stores offset/RTT, second averages both for improved
accuracy. Client places T1 in TransmitTime per RFC 5905 §8; server
echoes it as OriginTime in the response.

Add NTP extension field codec (RFC 7822) with NextExtField iterator
and AppendExtField builder. Add NTS extension type constants from
RFC 8915.

Add NTP Server (StackNode) that receives client requests via Demux
and builds server responses via Encapsulate with configurable
stratum, precision, reference ID, and pending request queue.

Add Frame accessor methods: RawData(), ExtensionFields(),
ValidateSize(), and Timestamp.Uint64().

Add ntp-client and ntp-server example programs with
CalculateSystemPrecision, retry limits, and backoff.

Use internal.LogAttrs pattern for non-allocating structured logging
in the client, matching the tcp/debug.go convention.

Generated with Claude assistance.

Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
2026-04-27 13:27:08 -03:00
Patricio Whittingslow cf94767133 seeded fuzz test adjustment 2026-04-26 12:23:24 -03:00
Pat Whittingslow aa77403a2b passive MAC learning and ARP cache revamp (#96)
* begin working on arp cache

* fix little things

* rework arp cache priority

* fix test

* keep working on ARP

* push changes before thinking about ip prefix issue

* add passive peer MAC setting

* patch egress mac with correct ethernet CRCs

* consolidate subnet learning in subnetTable type

* add tests and fix subnet table bug
2026-04-24 23:34:53 -03:00
Patricio Whittingslow 67c42aa136 add log warning to httptap 2026-04-24 23:30:50 -03:00
Pat Whittingslow 198db3789b Add DNS support to pcap (#100)
* begin adding dns pcap functionality

* improve question formatting

* work on capturing answers as well

* finalize DNS printing

* increase subfield limits

* add FlagContainer type

* prettier DNS printing
2026-04-24 19:41:10 -03:00
Joel Wetzell b2c3d11c4c cleanup connect function and combine connection slices (#94)
* combine conns into single slice

* reuse logic in connect function

Co-authored-by: Copilot <copilot@github.com>

* correct comment

---------

Co-authored-by: Copilot <copilot@github.com>
2026-04-24 09:21:09 -03:00
Joel Wetzell a46e40580c add basic support for connect and send for UDP sockfd's (#93)
Co-authored-by: Copilot <copilot@github.com>
2026-04-23 19:38:48 -03:00
Marvin Drees 34bbaa6eb4 chore: bump upload-artifact action version (#91)
I noticed some warning around Node v20 usage from the old version
so I bumped to the currently latest one (v7 moved to Node v24).

Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
2026-04-20 10:36:08 -03:00
Pat Whittingslow 363bec6793 fixes for CI (#90) 2026-04-17 15:58:55 -03:00
Patricio Whittingslow 6d0ffcf0ad add extra info to README 2026-04-17 15:42:21 -03:00
Patricio Whittingslow c020795303 add gvisor-mwe and add binary sizes to README 2026-04-17 15:41:17 -03:00
Marvin Drees f87761f777 chore: bump minimum Go version to 1.24 (#85)
Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
2026-04-16 17:21:23 -03:00
Marvin Drees 9d436c1d86 ci: replace go.yml with comprehensive ci.yaml (#84)
- Rename go.yml to ci.yaml
- Pin all actions to full commit SHAs (checkout v6.0.2, setup-go v6.4.0,
  codecov v6.0.0, setup-tinygo v2.0.1, github-action-benchmark v1.22.0)
- Add dedicated benchmark job with regression detection via
  benchmark-action/github-action-benchmark (120% alert threshold)
- Set workflow-level permissions: read-all with per-job write grants

Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
2026-04-16 13:58:55 -03:00
Pat Whittingslow 16c2c3de36 Stack backoff rework (#83)
* huge Stack backoff rework

* lneto bump: huge Stack backoff rework
v0.1.0
2026-04-14 21:05:02 -03:00
Pat Whittingslow 75a812a8d7 Tcp buffer bug fix (#79)
* start working on tracking down tcp buffer bug

* mtu refactor

* modularize test

* more precise testing

* tests fail, but is it the failure we are looking for?

* fix typo in espradio link (#76)

* implement a new backoff abstraction (#75)

* rewrite backoff api

* rewrite tcp.Conn.Write

* keep fixing small things

* much better Conn.Read implementation

* fix critical overflow bug in internal.ConnRWBackoff

---------

Co-authored-by: Joel Wetzell <jwetzell@yahoo.com>
2026-04-14 19:11:29 -03:00
Pat Whittingslow 5bde7a9979 implement a new backoff abstraction (#75) 2026-04-14 16:11:03 -03:00
jwetzell 191b8ee4cc fix typo in espradio link (#76) 2026-04-13 17:49:31 -03:00
Patricio Whittingslow 9e4da57335 abort on ControlBlock return net.ErrClosed in challenge ack case 2026-04-11 20:02:16 -03:00
Patricio Whittingslow 70f2fe66b9 fix tinygo build; add tinygo test to test pipeline if available 2026-04-11 19:13:13 -03:00
Pat Whittingslow 54bc52d9d8 Fuzz fixes (#73)
* remove old fuzz corpus and stick to using PCG for seeding fuzz test

* polish up drain logic and reduce action search space

* improve fuzzing debug prints

* more fuzz fixes also formatter capture printer fixes

* refactor StackSeeded test

* fix challenge ack infinite packet bug

* more expressive challenge satisfy

* remove printing
2026-04-11 18:01:05 -03:00
Pat Whittingslow 66a1aec593 Add fuzz tests, rename fuzz tests and fix panic found by fuzzing (#72)
* begin adding better fuzz test

* finish adding working fuzzer

* implement mutateipv4

* fuzzer finds a panic in ICMP client on receive empty payload

* rename fuzz tests to reflect fuzz methodology
2026-04-11 11:09:51 -03:00