]> git.puffer.fish Git - mirror/frr.git/commitdiff
Greg Troxel <gdt@ir.bbn.com>
authorpaul <paul>
Fri, 13 Dec 2002 20:56:48 +0000 (20:56 +0000)
committerpaul <paul>
Fri, 13 Dec 2002 20:56:48 +0000 (20:56 +0000)
[zebra 15715] FIX for ospf md5 authentication problem, finally!

fix copy of ospf packet buffer

ospfd/ospf_packet.c

index 95d184dc591e983de7a2c185f3ffb7d40c709c80..62b93fef2491f1a7083394c6040c943b609c011a 100644 (file)
@@ -226,7 +226,13 @@ 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 %d 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;
@@ -359,7 +365,12 @@ 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 %d ospf_packet %d",
+             stream_get_endp(op->s), op->length);
+  }
 
   return OSPF_AUTH_MD5_SIZE;
 }