]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Endian-related bug fixes sent by Krzysztof Szuster <kszuster@polbox.com>
authorOndrej Filip <feela@network.cz>
Tue, 26 Aug 2003 10:41:02 +0000 (10:41 +0000)
committerOndrej Filip <feela@network.cz>
Tue, 26 Aug 2003 10:41:02 +0000 (10:41 +0000)
proto/ospf/lsalib.c
proto/ospf/ospf.h

index e79c015d2cda35835faad5e42590a8df1559c57c..c12c5bdee158523400cf593bb45c414775eb00c3 100644 (file)
@@ -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
index d04638b16273da223a34ef86d6da505c9e8602d5..d1085c4d0b5aa4708de7644dc643302119386873 100644 (file)
@@ -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 {