Commit Graph

60 Commits

Author SHA1 Message Date
Patricio Whittingslow 8807272494 documentation improvements to internal/slices.go and README 2026-04-10 12:16:21 -03:00
Pat Whittingslow ec44889896 Add ICMPv4 and lneto.StackNode and deprecate internet.StackNode (#65)
* begin adding icmp client

* rely on anon structs

* add tests

* tests passing

* icmp fleshed out

* rework icmp to include ip addr

* rename StackAsync.Demux/Encapsulate to RecvEthernet and SendEthernet

* remove legacy unreachable TCP tests

* remove uses of deprecated internet.StackNode in preference of lneto.StackNode

* documentation

* rename methods to signal no I/O happening
2026-04-09 09:07:16 -03:00
Pat Whittingslow 64b2647a5e tcp: retransmit logic rollback (#61)
* tcp: remove retransmit logic entirely; add duplicate ack counting to ControlBlock

* retransmit implemented in nice simple straightforward way

* narrow down retransmission cases

* remove old timing tests

* add ControlBlock retransmit test

* add failing handler test

* reworking payload length semantic meaning in code

* fix establish conn logic

* clean up tests and add TCB dupack generation and test it

* catch pending retransmit satisfy in test

* add fuzz test for control block

* bugfix: be more strict in what is considered dupack

* add IncomingIsDupACK docs

* limit queue of retransmits

* protect retransmit overflow from incorrectly updating nxt
2026-03-26 11:48:02 -03:00
Pat Whittingslow bd645b5e1e Add mdns package and Client implementation (#55)
* add mdns

* define mdns.Client

* fix some mdns stuff

* refine dns package for use with mdns

* remove Querier and Responder and replace with Client

* add record setting methods on dns.record to reuse record buffer

* protect against unbounded client answer growth

* round off sharp mdns edges; reduce allocs

* add mutlicast to stacks; add xnet tests for mdns

* fix documentation on acceptmulticast field

* mdns working
2026-03-16 15:48:17 -03:00
Patricio Whittingslow 02b4e71c2a gofmt: ran gofmt because noticed weird diffs in last commit, seemed OK though 2026-02-28 17:47:11 -03:00
Patricio Whittingslow 4f7635b216 debug: add free memory printing 2026-02-28 16:37:36 -03:00
Pat Whittingslow fa5ba918bb Error rewrites (#43)
* pcap: reuse Frame memory

* slog: reduce heap allocations of addresses; also prevent heap alloc of dhcp options in pcap

* dns: heapless improvement; add StackAsync buffer for more heapless operation; start thinking of errors

* errors: begin standardise errors in lneto

* errors: finish standardization of errors

* fix merge issues

* add more lneto errors to rest of package

* format errors.go
2026-02-28 16:18:27 -03:00
Pat Whittingslow 989bb6a0b9 Reduce heap allocs 2 (#46)
* reduce heap allocations in tcp logging; omit use of AppendFloat which allocates a metric sh*tton

* debugheaplog: better heap statistic logging

* heap: use string for pcap.Frame.Protocol

* add potential to eliminate Flags.String heap alloc, remove incorrect HEAP comments

* add StackAsync.DebugErr and httpraw.SetBytes

* many heap alloc reductions and replacement of bytes.Equal with internal.BytesEqual
2026-02-28 15:20:46 -03:00
Pat Whittingslow eab43c4653 tcp: Reject SYN on synchronized connections; fix maxSend underflow (#44)
* tcp: add test replicating bugs and 32bit panic with GOARCH=386

* tcp: reject SYN on synchronized connections; fix maxSend underflow
2026-02-27 12:38:46 -03:00
Pat Whittingslow f9748da94f Reduce heap allocations (#42)
* pcap: reuse Frame memory

* slog: reduce heap allocations of addresses; also prevent heap alloc of dhcp options in pcap

* dns: heapless improvement; add StackAsync buffer for more heapless operation; start thinking of errors

* reuse function for reclaiming frames among all protocols for lower memory usage

* remove extraneous code
2026-02-27 12:38:33 -03:00
Pat Whittingslow 7d323aae19 Tcp rst handling (#40)
* claude suggests a way forward

* add timing to capture printer

* add pcap.Flags

* fix ICMP CRC calculation and add test

* bugfix: still send data on half-close state(close-wait)

* fix pcap test
2026-02-23 09:50:13 -03:00
Patricio Whittingslow 1a07928ca8 ethernet: refactor VLAN API 2026-02-18 16:58:52 -03:00
ddirect 1694e71e0c Use backoff to wait until there is enough room in the TCP write buffer (#34) 2026-02-09 01:27:18 +01:00
ddirect fba97c990a Checksum simplification proposal (#29)
* Simplified checksum calculation and verification

* Fixed tests

* UDP: using NewBoundedFrame to create a Frame instance limited to the actual frame size.

* Minor: renamed some functions

* Commented and made more readable consecutive SetCRC calls.

* Fixed icmp checksum calculation after rebase

* Replaced NewBoundedFrame with explicit validation
2026-02-05 17:35:42 -03:00
ddirect 360628f1b8 Simplified implementation (#27)
Introduced minimum backoff time
Max TCP backoff increased to 5ms
2026-01-26 18:49:33 -03:00
Pat Whittingslow 85f018a02c ethernet: MTU semantic meaning corrections, add FCS logic (#28) 2026-01-26 16:45:35 -03:00
ddirect 3c6882b4b3 Repeating select call on Bridge when interrupted (#20)
* Repeating select if it is interrupted

* Restrict retries for syscall.EINTR to 10

Limit the number of retries on syscall.EINTR to 10.

---------

Co-authored-by: Pat Whittingslow <graded.sp@gmail.com>
2026-01-18 14:05:43 -03:00
Pat Whittingslow 7698b9fb81 do not rely on unspecified Go behaviour; fix TCP ring buffer bug (#16)
* do not rely on unspecified Go behaviour; fix TCP ring buffer bug

* even more stricter error handling on tcp connections

* stricter lock copying in tcp.Conn, even though likely not a problem

* add listener and tcp pool logging

* forgot reqAddr unused

* add logging to TCPConn and friends
2026-01-05 10:03:24 -03:00
Pat Whittingslow 018f9258ac Add tcp.Listener (#15)
* begin reviewing TCP listener

* begin adding listener tests

* adding TestExchange implementation

* split out legacy and Step tests

* move listener to tcp package

* fix up tcp tests taking very long

* add xnet.TCPPool and work on TCPPool semantics

* xnet: TCPPool only accepts established connections

* xnet: getting to bottom of panic in xnet.Listener

* xnet: improve listener tests

* fix several data races in testing fixtures

* fix more synchronization things in listener test

* finalize tcplistener test
2026-01-03 12:41:57 -03:00
Pat Whittingslow f8166aea05 Fix slow exchanges on linux by adding polling and other improvements (#14)
* add prints to investigate slowness

* add loop sleep for blocking Stack

* add connection close http attribute and detect end of HTML page

* add timeout to bridge read

* examples/xnet: add ntp timestamp to prints and show output in readme

* add polling to http tap interface

* more digits in ntp format

* prevent crashes on non-8 timestamp
2026-01-01 09:35:35 -03:00
soypat 243d1a720d fix httptap incorrectly capturing GRO frames 2025-12-31 17:08:53 -03:00
Patricio Whittingslow f6bc73ee6c apply some of @ddirect suggestions 2025-12-22 18:41:14 -03:00
Patricio Whittingslow f5157e7e4a huge fixes to ring buffer implementations and mostly passing tests 2025-11-05 19:21:30 -03:00
Patricio Whittingslow 5e5f21a2b8 rethinking ring buffer semantics and breaking everything in the process 2025-11-05 02:35:53 -03:00
soypat 407f4a08f1 enhance xnet StackAsync test and add non-linux stubs for Tap and Bridge 2025-10-21 21:46:44 -03:00
soypat d254f3ae80 dhcp subnet prefix fix 2025-08-20 19:25:08 -03:00
soypat 23212d8dc6 CopyFrom pattern for DNS and use it for Cookie 2025-06-25 09:32:35 -03:00
soypat 1fcde05284 begin touching up a DNS Client implementation; internal.GetIP/SetIP refactor 2025-06-21 01:29:38 -03:00
soypat 2133966a16 add dhcp failing test 2025-06-17 02:07:11 -03:00
soypat dcc7a95e62 huge tap/bridge overhaul; udp node; dhcp node; DHCP example 2025-06-15 18:01:04 -03:00
soypat 6b511999d1 begin testing tcp listener (not working) 2025-06-09 20:38:40 -03:00
soypat 9a60642283 mega refactor internet.TCPConn->tcp.Conn 2025-06-07 20:43:20 -03:00
soypat bc14ed395d tap program output much more readable 2025-06-04 01:13:26 -03:00
soypat 589c9d3013 update README with pcap and fix innaccuracies 2025-06-04 00:14:27 -03:00
soypat 7c5b427b14 refactor http packet capture 2025-06-03 23:48:51 -03:00
soypat 2d71907241 fix TCP flags not being extracted from capture correctly 2025-06-03 00:45:11 -03:00
soypat 55bc765d92 begin adding packet capture functionality 2025-06-01 13:04:43 -03:00
soypat a29bad9ac9 begin working on making response quicker (why is tap interface so slow?) 2025-06-01 01:29:07 -03:00
soypat 1ae8fab210 receive HTTP request success; still working on response 2025-05-31 14:08:32 -03:00
soypat 0008791bd8 fix ethernet gateway addr not being set; add IPID field; hardware addr support of tap; better tap interface 2025-05-31 12:47:09 -03:00
soypat a967f083cb add TCPConn Read+Write and ancilliary methods; looks like IP mux is broken 2025-05-25 18:30:55 -03:00
soypat 70a3bbbe2f add stackbasic test 2025-04-05 17:17:32 -03:00
soypat ba9124b079 fix basicstack example 2025-04-05 10:43:01 -03:00
soypat 39d5e4290e add TCPConn type 2025-04-04 19:16:26 -03:00
soypat d5d729b961 refactor lneto2->lneto package 2025-03-06 23:11:42 -03:00
soypat f86bb6f01a remove legacy remnants and move ip,udp,ethernet logic into subpackages 2025-02-20 16:00:55 -03:00
soypat 6e9aafc1e0 add ARP; add tap internal calls; more lneto2 additions 2025-02-17 23:49:37 -03:00
soypat 64a7102064 continue adding Handler logic; remove unused TxQueue tests 2025-02-09 23:43:30 -03:00
soypat 6a30268f83 done for today :) 2025-01-26 19:02:16 -03:00
soypat 94c59ee84e segment Ring tests more: add TwoWrite,Empty,NonEmpty 2025-01-26 12:19:29 -03:00