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
This commit is contained in:
Pat Whittingslow
2026-02-23 13:50:13 +01:00
committed by GitHub
parent 08423d0dba
commit 7d323aae19
10 changed files with 386 additions and 46 deletions
+3 -4
View File
@@ -98,7 +98,7 @@ func (sb *StackIP) Demux(carrierData []byte, offset int) error {
totalLen := ifrm.TotalLength()
proto := ifrm.Protocol()
if proto == lneto.IPProtoICMP {
return sb.recvicmp(ifrm.RawData(), ifrm.HeaderLength())
return sb.recvicmp(ifrm.Payload())
}
node := sb.handlers.nodeByProto(uint16(proto))
// nodeIdx := getNodeByProto(sb.handlers, uint16(proto))
@@ -205,10 +205,9 @@ func (sb *StackIP) Register(h StackNode) error {
return sb.handlers.registerByPortProto(nodeFromStackNode(h, h.LocalPort(), proto, nil))
}
func (sb *StackIP) recvicmp(carrierData []byte, offset int) error {
frameData := carrierData[offset:]
func (sb *StackIP) recvicmp(icmpData []byte) error {
var crc lneto.CRC791
if crc.PayloadSum16(frameData) != 0 {
if crc.PayloadSum16(icmpData) != 0 {
return errors.New("ICMP CRC mismatch")
}
return nil