Endian-related bug fixes sent by Krzysztof Szuster <kszuster@polbox.com>
This commit is contained in:
parent
1d1a3c1c2a
commit
c11007bc42
2 changed files with 13 additions and 6 deletions
|
@ -337,7 +337,7 @@ lsasum_check(struct ospf_lsa_header *h,void *body,struct proto_ospf *po)
|
||||||
u8 *sp, *ep, *p, *q, *b;
|
u8 *sp, *ep, *p, *q, *b;
|
||||||
int c0 = 0, c1 = 0;
|
int c0 = 0, c1 = 0;
|
||||||
int x, y;
|
int x, y;
|
||||||
u16 length,chsum;
|
u16 length;
|
||||||
|
|
||||||
b = body;
|
b = body;
|
||||||
sp = (char *) &h->options;
|
sp = (char *) &h->options;
|
||||||
|
@ -376,9 +376,9 @@ lsasum_check(struct ospf_lsa_header *h,void *body,struct proto_ospf *po)
|
||||||
y = 510 - c0 - x;
|
y = 510 - c0 - x;
|
||||||
if (y > 255) y -= 255;
|
if (y > 255) y -= 255;
|
||||||
|
|
||||||
chsum= x + (y << 8);
|
((u8*)&h->checksum)[0] = x;
|
||||||
h->checksum = chsum;
|
((u8*)&h->checksum)[1] = y;
|
||||||
return chsum;
|
return h->checksum;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -178,10 +178,17 @@ struct ospf_hello_packet {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct immsb {
|
struct immsb {
|
||||||
|
#ifdef _BIG_ENDIAN
|
||||||
|
u8 padding:5;
|
||||||
|
u8 i:1;
|
||||||
|
u8 m:1;
|
||||||
|
u8 ms:1;
|
||||||
|
#else
|
||||||
u8 ms:1;
|
u8 ms:1;
|
||||||
u8 m:1;
|
u8 m:1;
|
||||||
u8 i:1;
|
u8 i:1;
|
||||||
u8 padding:5;
|
u8 padding:5;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
union imms {
|
union imms {
|
||||||
|
|
Loading…
Reference in a new issue