mirror of
https://github.com/soypat/lneto.git
synced 2026-08-22 23:49:08 +00:00
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
This commit is contained in:
@@ -140,12 +140,6 @@ func (tfrm Frame) Segment(payloadSize int) Segment {
|
||||
}
|
||||
}
|
||||
|
||||
func (tfrm Frame) CRCWrite(crc *lneto.CRC791) {
|
||||
// Write excluding CRC
|
||||
crc.Write(tfrm.buf[:16])
|
||||
crc.Write(tfrm.buf[18:])
|
||||
}
|
||||
|
||||
// SetSegment sets the sequence, acknowledgment, offset, window and flag fields of the TCP header from the the [Segment].
|
||||
// Offset, like in [Frame.SetOffset], is expressed in words with minimum being 5.
|
||||
func (tfrm Frame) SetSegment(seg Segment, offset uint8) {
|
||||
|
||||
Reference in New Issue
Block a user