From c11007bc423188872d37e277fe4637094a40d90f Mon Sep 17 00:00:00 2001 From: Ondrej Filip Date: Tue, 26 Aug 2003 10:41:02 +0000 Subject: Endian-related bug fixes sent by Krzysztof Szuster --- proto/ospf/lsalib.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'proto/ospf/lsalib.c') diff --git a/proto/ospf/lsalib.c b/proto/ospf/lsalib.c index e79c015..c12c5bd 100644 --- a/proto/ospf/lsalib.c +++ b/proto/ospf/lsalib.c @@ -337,11 +337,11 @@ lsasum_check(struct ospf_lsa_header *h,void *body,struct proto_ospf *po) u8 *sp, *ep, *p, *q, *b; int c0 = 0, c1 = 0; int x, y; - u16 length,chsum; + u16 length; - b=body; + b = body; sp = (char *) &h->options; - length=ntohs(h->length)-2; + length = ntohs(h->length)-2; h->checksum = 0; for (ep = sp + length; sp < ep; sp = q) @@ -376,9 +376,9 @@ lsasum_check(struct ospf_lsa_header *h,void *body,struct proto_ospf *po) y = 510 - c0 - x; if (y > 255) y -= 255; - chsum= x + (y << 8); - h->checksum = chsum; - return chsum; + ((u8*)&h->checksum)[0] = x; + ((u8*)&h->checksum)[1] = y; + return h->checksum; } int -- cgit v1.2.3