summaryrefslogtreecommitdiff
path: root/src/dgram
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-09-25 14:57:59 -0400
committerIan Moffett <ian@osmora.org>2025-09-25 14:59:19 -0400
commitc9dc332811b0f98799411de6cbed66957c184188 (patch)
tree63438a387b5d80299cf2347ed4ba49c2e75402c4 /src/dgram
parentafcdcf6ae6d95eb828733994c7de30f8ab095dcc (diff)
dgram: Put CRC32 at the end of the datagram hdr
This makes it easier to compute the checksum as we can simply subtract from the length of the header Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/dgram')
-rw-r--r--src/dgram/dgram_subr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/dgram/dgram_subr.c b/src/dgram/dgram_subr.c
index d79386f..fda8178 100644
--- a/src/dgram/dgram_subr.c
+++ b/src/dgram/dgram_subr.c
@@ -44,6 +44,6 @@ dgram_load(uint16_t length, uint8_t port, struct onet_dgram *res)
res->length = (length >> 8) & 0xFF;
res->length |= (length & 0xFF) << 8;
res->port = port;
- res->crc32 = crc32(res, sizeof(*res));
+ res->crc32 = crc32(res, sizeof(*res) - sizeof(res->crc32));
return 0;
}