Better checksum checking.
This commit is contained in:
parent
4c5f93d76b
commit
aba5e89f93
1 changed files with 3 additions and 1 deletions
|
@ -276,6 +276,7 @@ ospf_lsupd_rx(struct ospf_lsupd_packet *ps, struct proto *p,
|
||||||
struct top_hash_entry *lsadb;
|
struct top_hash_entry *lsadb;
|
||||||
u16 lenn;
|
u16 lenn;
|
||||||
int diff=((u8 *)lsa)-((u8 *)ps);
|
int diff=((u8 *)lsa)-((u8 *)ps);
|
||||||
|
u16 chsum;
|
||||||
|
|
||||||
if(((diff+sizeof(struct ospf_lsa_header))>=size) ||
|
if(((diff+sizeof(struct ospf_lsa_header))>=size) ||
|
||||||
((ntohs(lsa->length)+diff)>size))
|
((ntohs(lsa->length)+diff)>size))
|
||||||
|
@ -290,7 +291,8 @@ ospf_lsupd_rx(struct ospf_lsupd_packet *ps, struct proto *p,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* pg 143 (1) */
|
/* pg 143 (1) */
|
||||||
if(lsa->checksum!=lsasum_check(lsa,NULL,po))
|
chsum=lsa->checksum;
|
||||||
|
if(chsum!=lsasum_check(lsa,NULL,po))
|
||||||
{
|
{
|
||||||
log("Received bad lsa checksum from %I",n->rid);
|
log("Received bad lsa checksum from %I",n->rid);
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in a new issue