From: Ondrej Zajicek (work) Date: Sun, 3 Feb 2019 20:27:02 +0000 (+0100) Subject: OSPF: Reject DBDES packets with non-matching MTU X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2bbd72863f1e33a99d66e92ec594cccb41c6775d;p=thirdparty%2Fbird.git OSPF: Reject DBDES packets with non-matching MTU As it is specified in RFC 2328. The old code just provided warning. --- diff --git a/proto/ospf/dbdes.c b/proto/ospf/dbdes.c index 67a75f8eb..e74baa823 100644 --- a/proto/ospf/dbdes.c +++ b/proto/ospf/dbdes.c @@ -340,6 +340,17 @@ 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); + STATS2(bad_dbdes, dropped); + return; + } + switch (n->state) { case NEIGHBOR_DOWN: @@ -355,13 +366,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)))