Commit Graph

89 Commits

Author SHA1 Message Date
Patricio Whittingslow 568ef2854f refactor max tcp port config values to uint16 to better represent their valid space 2026-04-09 20:13:45 -03:00
Pat Whittingslow 8813ccef82 ICMP tests and various fixes (#68)
* various icmp fixes

* improve existing tests
2026-04-09 12:31:31 -03:00
Pat Whittingslow 80e4c59ae7 include tinygo into CI (#67)
* try to include tinygo into CI

* fix tinygo issues
2026-04-09 10:00:10 -03:00
Pat Whittingslow 63f7870fe5 Add round-robin implementation (#66)
* add handler.encapsulateNode

* implement round robin handler approach

* simplify round robin implementation

* leave TODO

* internet.node touch up

* fix conflict resolve f-up

* replace certain ErrShortBuffer with ErrTruncatedFrame error
2026-04-09 09:36:17 -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 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
Pat Whittingslow 376e1a0b4f Further reduce heap allocs (#56)
* work on tracking more heap allocations down

* write own heapless IP AppendFormatAddr functions

* remove potential Error method allocations

* more logging
2026-03-14 20:11:59 -03:00
Patricio Whittingslow f6e7801d8c heap: remove heap alloc in pcap of HTTP content type; more debugging logs 2026-02-28 17:46:08 -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 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
Patricio Whittingslow 76f896af40 use common internal logger among all implementations(debugheaplog build tag) 2026-02-26 17:06:47 -03:00
Pat Whittingslow be949d960c tcp: mss honoring; accept syn with ECE/CWR flags; add RSTQueue type (#41)
* tcp: mss honoring; accept syn with ECE/CWR flags; add RSTQueue type

* tcp: move option logic to own file

* remove prints in pcap

* add MSS send threshold inspired by linux/freebsd/lwip thresh
2026-02-25 12:58:55 -03:00
Patricio Whittingslow 58a9bf57e5 tcp: listener produces RST response when conns exhausted 2026-02-23 15:07:33 -03:00
Patricio Whittingslow 5221dc8248 improve HTTP body pcap formatting 2026-02-23 14:02:23 -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 c384641b7c arp: fix runt frames by extending at ethernet level; discard blocking ARP queries after success/failure 2026-02-21 23:52:27 -03:00
Pat Whittingslow bf2d07d9f0 HTTP server example and DHCP Server rewrite (#38)
* improvements to dhcpv4 server

* begin adding examples/httpserver

* add better VLAN tagging methods

* pcap: add error printing; fix bug in CRC

* ipv4: ToS and Flags construction and flag manipulation improvements

* add dhcp interception to httptap and improve httpserver example
2026-02-18 16:48:30 -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
soypat 0a19c6bfd8 add more icmpv4 packet capturing 2026-02-02 14:16:51 +01:00
ddirect 5e61b4600d Checksum fixes (#24)
* Checksum 0x0000 is returned as 0xFFFF (mandatory for UDP, common for TCP)

* Both checksum zero values (0x0000 and 0xFFFF) are accepted when receiving

* Rename parameter in VerifySum16 to expectedSum16

---------

Co-authored-by: Pat Whittingslow <graded.sp@gmail.com>
2026-01-26 17:22:54 -03:00
Pat Whittingslow 85f018a02c ethernet: MTU semantic meaning corrections, add FCS logic (#28) 2026-01-26 16:45:35 -03:00
Patricio Whittingslow 6a6097a9ac improve formatter example 2026-01-26 12:12:13 -03:00
Patricio Whittingslow e8afc09a73 pcap: add subfield formatting 2026-01-26 12:09:25 -03:00
Patricio Whittingslow 4cffe26c30 fix pcap.Formatter fallthrough logic in formatField 2026-01-25 23:43:02 -03:00
ddirect 91fea9ae58 Maximum segment size fixes (#25)
* Fixed MSS sent in SYN and SYN-ACK

* Fixed tests
2026-01-25 02:37:17 -03:00
Patricio Whittingslow 985e087842 refactor phy package 2026-01-19 10:29:15 -03:00
ddirect 1a6ce6b056 Ignoring packet padding for IPv4 capture (#21) 2026-01-18 14:04:28 -03:00
Patricio Whittingslow e49e3d96c1 slight changes to tinygo cbnode 2026-01-13 11:46:07 -03:00
Patricio Whittingslow 2e6e66e691 split out node callback between tinygo and go to avoid heap allocs 2026-01-13 10:38:21 -03:00
Pat Whittingslow 151133dfb4 HTTP and Listener improvements and bugfixes (#17)
* listener revamp

* improvements to conn lifetimes
2026-01-11 10:29:16 -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 3cbef6fa92 add FieldClassOperation to pcap and associated formatting changes 2025-12-31 18:54:21 -03:00
soypat dc374169dc use lneto.ErrDropPacket where appropiate; clean up examples/xnet output 2025-12-31 18:15:34 -03:00
soypat 7369ec0b7e add pcap printing to examples/xnet 2025-12-31 13:21:46 -03:00
Patricio Whittingslow 02ca576e14 fix bug in right aligned field extraction 2025-12-31 02:58:09 -03:00
Patricio Whittingslow 5f0edf62a9 add pcap formatting 2025-12-31 02:17:44 -03:00
Patricio Whittingslow 8307403c5c add subnet to StackAsync and add test for local arp resolving 2025-12-30 18:00:50 -03:00
Patricio Whittingslow f6bc73ee6c apply some of @ddirect suggestions 2025-12-22 18:41:14 -03:00
Patricio Whittingslow 5e631a1b3d StackPorts: set MAC destination when node has MAC 2025-12-19 01:04:18 -03:00
Patricio Whittingslow 1554b89a08 StackNode refactor: add offsetToIP argument to Encapsulate 2025-12-19 00:38:28 -03:00
Patricio Whittingslow eaa36a589a internet: further use handlers data structure 2025-12-18 19:16:35 -03:00
Patricio Whittingslow ac7f752447 internet: add handlers data structure 2025-12-18 18:44:50 -03:00
Patricio Whittingslow bb4053647d do not crash if no tcp connections are desired 2025-10-22 19:19:32 -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
Patricio Whittingslow d731106c51 add xnet stack tcp handshake test 2025-10-18 19:51:57 -03:00
soypat d28203e75f upload changes done on plane 2025-08-31 12:42:46 -03:00
soypat 9cf4e35d2e changes to TCP stack to enable xnet functionality 2025-08-16 15:17:46 -03:00
soypat 123d4d20cc begin adding icmpv4 2025-07-28 00:25:18 -03:00