]> git.proxmox.com Git - mirror_frr.git/commitdiff
ospf6d: add buffer length check to ifmtu changes
authorDon Slice <dslice@cumulusnetworks.com>
Wed, 28 Jun 2017 12:37:32 +0000 (08:37 -0400)
committerDon Slice <dslice@cumulusnetworks.com>
Wed, 28 Jun 2017 12:37:32 +0000 (08:37 -0400)
Previous fix was missing the possibility of having to modify the io
buffer size if the kernel reports an new mtu value.  This fix adds
that check.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
ospf6d/ospf6_interface.c

index 4d07e24b8821dbf4299ecc1ef9a4628c44c1c50f..991eb318d79b1f5434995c86ec2c754c6efff208 100644 (file)
@@ -380,6 +380,7 @@ void
 ospf6_interface_state_update (struct interface *ifp)
 {
   struct ospf6_interface *oi;
+  unsigned int iobuflen;
 
   oi = (struct ospf6_interface *) ifp->info;
   if (oi == NULL)
@@ -392,9 +393,19 @@ ospf6_interface_state_update (struct interface *ifp)
   /* Adjust the mtu values if the kernel told us something new */
   if (ifp->mtu6 != oi->ifmtu)
     {
-      /* If nothing configured, just accept it */
+      /* If nothing configured, accept it and check for buffer size */
       if (!oi->c_ifmtu)
-        oi->ifmtu = ifp->mtu6;
+        {
+          oi->ifmtu = ifp->mtu6;
+          iobuflen = ospf6_iobuf_size (ifp->mtu6);
+          if (oi->ifmtu > iobuflen)
+            {
+              if (IS_OSPF6_DEBUG_INTERFACE)
+                zlog_debug ("Interface %s: IfMtu is adjusted to I/O buffer size: %d.",
+                             ifp->name, iobuflen);
+              oi->ifmtu = iobuflen;
+            }
+        }
       else if (oi->c_ifmtu > ifp->mtu6)
         {
           oi->ifmtu = ifp->mtu6;