summaryrefslogtreecommitdiff
path: root/proto
diff options
context:
space:
mode:
Diffstat (limited to 'proto')
-rw-r--r--proto/ospf/lsalib.c12
-rw-r--r--proto/ospf/ospf.h7
2 files changed, 13 insertions, 6 deletions
diff --git a/proto/ospf/lsalib.c b/proto/ospf/lsalib.c
index e79c015d..c12c5bde 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
diff --git a/proto/ospf/ospf.h b/proto/ospf/ospf.h
index d04638b1..d1085c4d 100644
--- a/proto/ospf/ospf.h
+++ b/proto/ospf/ospf.h
@@ -178,10 +178,17 @@ struct ospf_hello_packet {
};
struct immsb {
+#ifdef _BIG_ENDIAN
+ u8 padding:5;
+ u8 i:1;
+ u8 m:1;
+ u8 ms:1;
+#else
u8 ms:1;
u8 m:1;
u8 i:1;
u8 padding:5;
+#endif
};
union imms {