Commit Graph

26 Commits

Author SHA1 Message Date
Pat Whittingslow 97b625de47 fix(xnet): allow installing a retransmission timer on TCP connections (rebased) (#199)
* fix(xnet): install a retransmission timer on TCP connections

No connection created through x/xnet had one. Neither NewTCPPool nor the
dial path in StackGo set ConnConfig.LossRecovery and ConnConfig.Nanotime,
so tcp.Handler ran with loss recovery disabled: nothing noticed a lost
segment, and the connection simply stopped: the sender waiting for an
ACK that cannot arrive, the receiver for data nobody will resend.

TCPPoolConfig.NanoTime already documents itself as "passed to each
tcp.Conn for retransmission timing (RFC 6298)", including the
time.Now fallback when it is nil; this makes that true. Each connection
gets its own tcp.RTO, which shadows that connection's send sequence space
and so cannot be shared. That is 80 bytes per connection, allocated once
at pool construction, against buffers measured in kilobytes.

The test drops exactly one data segment and requires the byte to arrive
anyway. It depends on the FIN-WAIT-1 retransmission fix, since the server
closes after writing.

* merge main fixes

* claude: fix up test to use ltesto.Sched and enable ltesto.Sched multigoro

* move test and simplify top comment

---------

Co-authored-by: Derek den Haas <i.pestano@easyflor.nl>
2026-09-08 01:02:12 -07:00
Pat Whittingslow b795d6a437 use ltesto as package to contain scheduler/goroutine testing logic (#143)
* use ltesto as package to contain scheduler/goroutine testing logic

* add sched usage to another test

* testCloseTransmitsPending rewrite

* replace deadline with context
2026-06-27 10:37:46 -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
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
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 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 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
Pat Whittingslow 85f018a02c ethernet: MTU semantic meaning corrections, add FCS logic (#28) 2026-01-26 16:45:35 -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
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 bc14ed395d tap program output much more readable 2025-06-04 01:13:26 -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 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 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 b40927ebcd huge improvements to stack example 2025-01-24 17:30:23 -03:00
soypat f2ce6312d3 round most of stack example 2025-01-21 10:33:00 -03:00