From c9dc332811b0f98799411de6cbed66957c184188 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 25 Sep 2025 14:57:59 -0400 Subject: 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 --- src/dgram/dgram_subr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/dgram/dgram_subr.c') 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; } -- cgit v1.2.3