summaryrefslogtreecommitdiffstats
path: root/ospfd/ospf_packet.c
diff options
context:
space:
mode:
authorpaul <paul>2003-02-03 16:31:14 +0000
committerpaul <paul>2003-02-03 16:31:14 +0000
commiteff4c4aa6e56e3f6727c97b8ebb16a10e66e0a15 (patch)
treed0a078f97b10b8fda0e99c9c7c3657fc49c1bb74 /ospfd/ospf_packet.c
parent47e64cb1fb3ba81f535654fc3bfc9d10c6726d62 (diff)
downloadquagga-eff4c4aa6e56e3f6727c97b8ebb16a10e66e0a15.tar.bz2
quagga-eff4c4aa6e56e3f6727c97b8ebb16a10e66e0a15.tar.xz
Import of Zebra CVS 20030203-16:30zebra.org.20030203
Diffstat (limited to 'ospfd/ospf_packet.c')
-rw-r--r--ospfd/ospf_packet.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c
index 2156ce33..89878c92 100644
--- a/ospfd/ospf_packet.c
+++ b/ospfd/ospf_packet.c
@@ -226,7 +226,12 @@ ospf_packet_dup (struct ospf_packet *op)
{
struct ospf_packet *new;
- new = ospf_packet_new (op->length);
+ if (stream_get_endp(op->s) != op->length)
+ zlog_warn ("ospf_packet_dup stream %ld ospf_packet %d size mismatch",
+ STREAM_SIZE(op->s), op->length);
+
+ /* Reserve space for MD5 authentication that may be added later. */
+ new = ospf_packet_new (stream_get_endp(op->s) + OSPF_AUTH_MD5_SIZE);
ospf_stream_copy (new->s, op->s);
new->dst = op->dst;
@@ -356,7 +361,10 @@ ospf_make_md5_digest (struct ospf_interface *oi, struct ospf_packet *op)
stream_set_putp (op->s, oldputp);
/* We do *NOT* increment the OSPF header length. */
- op->length += OSPF_AUTH_MD5_SIZE;
+ op->length = ntohs (ospfh->length) + OSPF_AUTH_MD5_SIZE;
+
+ if (stream_get_endp(op->s) != op->length)
+ zlog_warn("ospf_make_md5_digest: length mismatch stream %ld ospf_packet %d", stream_get_endp(op->s), op->length);
return OSPF_AUTH_MD5_SIZE;
}