Fixes a bug in OSPF on NBMA interfaces.

A very tricky bug. OSPF on NBMA interfaces probably never really worked.
When a packet was sent to multiple destinations, the checksum was
calculated multiple times from a packet with already filled checksum
field (from previous calculation). Therefore, many packets were sent
with an invalid checksum.
This commit is contained in:
Ondrej Zajicek 2010-04-11 10:19:54 +02:00
parent d759c1a6f8
commit 7969ea3b41

View file

@ -76,6 +76,7 @@ ospf_pkt_finalize(struct ospf_iface *ifa, struct ospf_packet *pkt)
} }
password_cpy(pkt->u.password, passwd->password, sizeof(union ospf_auth)); password_cpy(pkt->u.password, passwd->password, sizeof(union ospf_auth));
case OSPF_AUTH_NONE: case OSPF_AUTH_NONE:
pkt->checksum = 0;
pkt->checksum = ipsum_calculate(pkt, sizeof(struct ospf_packet) - pkt->checksum = ipsum_calculate(pkt, sizeof(struct ospf_packet) -
sizeof(union ospf_auth), (pkt + 1), sizeof(union ospf_auth), (pkt + 1),
ntohs(pkt->length) - ntohs(pkt->length) -