summaryrefslogtreecommitdiffstats
path: root/proto
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2011-05-19 01:20:00 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2011-05-19 01:20:00 +0200
commit1155c79209b6a670d0e1f85b2603363ba1132ae0 (patch)
treee56fc951c2d401ec942955849189864c104a034d /proto
parentb54ad333b3c8b486b059f6c0e1afc8c35b64ebea (diff)
downloadbird-1155c79209b6a670d0e1f85b2603363ba1132ae0.tar
bird-1155c79209b6a670d0e1f85b2603363ba1132ae0.zip
Fixes compatibility with Mikrotik.
Diffstat (limited to 'proto')
-rw-r--r--proto/ospf/packet.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/proto/ospf/packet.c b/proto/ospf/packet.c
index d156474..3076297 100644
--- a/proto/ospf/packet.c
+++ b/proto/ospf/packet.c
@@ -60,12 +60,16 @@ ospf_pkt_finalize(struct ospf_iface *ifa, struct ospf_packet *pkt)
struct MD5Context ctxt;
char password[OSPF_AUTH_CRYPT_SIZE];
+ pkt->checksum = 0;
pkt->autype = htons(ifa->autype);
+ bzero(&pkt->u, sizeof(union ospf_auth));
+
+ /* Compatibility note: pkt->u may contain anything if autype is
+ none, but nonzero values do not work with Mikrotik OSPF */
switch(ifa->autype)
{
case OSPF_AUTH_SIMPLE:
- bzero(&pkt->u, sizeof(union ospf_auth));
passwd = password_find(ifa->passwords, 1);
if (!passwd)
{
@@ -74,7 +78,6 @@ ospf_pkt_finalize(struct ospf_iface *ifa, struct ospf_packet *pkt)
}
password_cpy(pkt->u.password, passwd->password, sizeof(union ospf_auth));
case OSPF_AUTH_NONE:
- pkt->checksum = 0;
pkt->checksum = ipsum_calculate(pkt, sizeof(struct ospf_packet) -
sizeof(union ospf_auth), (pkt + 1),
ntohs(pkt->length) -
@@ -88,8 +91,6 @@ ospf_pkt_finalize(struct ospf_iface *ifa, struct ospf_packet *pkt)
return;
}
- pkt->checksum = 0;
-
/* Perhaps use random value to prevent replay attacks after
reboot when system does not have independent RTC? */
if (!ifa->csn)