]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
OSPF: Reject DBDES packets with non-matching MTU
authorOndrej Zajicek (work) <santiago@crfreenet.org>
Sun, 3 Feb 2019 14:45:43 +0000 (15:45 +0100)
committerOndrej Zajicek (work) <santiago@crfreenet.org>
Sun, 3 Feb 2019 14:45:43 +0000 (15:45 +0100)
As it is specified in RFC 2328. The old code just provided warning.

proto/ospf/dbdes.c

index 34665dad8539864796e50cfb0b0db5e76167cc6e..4d3bbe8c257451a58e30913f197aa8457931edbf 100644 (file)
@@ -342,6 +342,16 @@ ospf_receive_dbdes(struct ospf_packet *pkt, struct ospf_iface *ifa,
     rcv_ddseq = ntohl(ps->ddseq);
   }
 
+  /* Reject packets with non-matching MTU */
+  if ((ifa->type != OSPF_IT_VLINK) &&
+      (rcv_iface_mtu != ifa->iface->mtu) &&
+      (rcv_iface_mtu != 0) && (ifa->iface->mtu != 0))
+  {
+    LOG_PKT("MTU mismatch with nbr %R on %s (remote %d, local %d)",
+           n->rid, ifa->ifname, rcv_iface_mtu, ifa->iface->mtu);
+    return;
+  }
+
   switch (n->state)
   {
   case NEIGHBOR_DOWN:
@@ -357,13 +367,6 @@ ospf_receive_dbdes(struct ospf_packet *pkt, struct ospf_iface *ifa,
     /* fallthrough */
 
   case NEIGHBOR_EXSTART:
-    if ((ifa->type != OSPF_IT_VLINK) &&
-       (rcv_iface_mtu != ifa->iface->mtu) &&
-       (rcv_iface_mtu != 0) &&
-       (ifa->iface->mtu != 0))
-      LOG_PKT_WARN("MTU mismatch with nbr %R on %s (remote %d, local %d)",
-                  n->rid, ifa->ifname, rcv_iface_mtu, ifa->iface->mtu);
-
     if (((rcv_imms & DBDES_IMMS) == DBDES_IMMS) &&
        (n->rid > p->router_id) &&
        (plen == ospf_dbdes_hdrlen(p)))