summaryrefslogtreecommitdiffstats
path: root/proto
diff options
context:
space:
mode:
authorOndrej Filip <feela@network.cz>2003-08-26 12:41:02 +0200
committerOndrej Filip <feela@network.cz>2003-08-26 12:41:02 +0200
commitc11007bc423188872d37e277fe4637094a40d90f (patch)
treef758216e0b277c3e3498e219fc76db14a33be70b /proto
parent1d1a3c1c2a72ef91b785f5ed08ca5ab3f001b14e (diff)
downloadbird-c11007bc423188872d37e277fe4637094a40d90f.tar
bird-c11007bc423188872d37e277fe4637094a40d90f.zip
Endian-related bug fixes sent by Krzysztof Szuster <kszuster@polbox.com>
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 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
diff --git a/proto/ospf/ospf.h b/proto/ospf/ospf.h
index d04638b..d1085c4 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 {