From c4efd33d3692245463e0b73e36908ca066d87013 Mon Sep 17 00:00:00 2001 From: Don Slice Date: Wed, 28 Jun 2017 08:37:32 -0400 Subject: [PATCH] ospf6d: add buffer length check to ifmtu changes 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 --- ospf6d/ospf6_interface.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 4d07e24b88..991eb318d7 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -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; -- 2.39.5