diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2019-02-03 15:45:43 +0100 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2019-02-03 15:45:43 +0100 |
commit | 267da8138d7f429941f2d829b44cf9bdd94a14d6 (patch) | |
tree | af78da44c316d042366728c554618b337adde9dd /proto/ospf/dbdes.c | |
parent | e1c275d87b26f35c29ec8bfab0a3265810463574 (diff) |
OSPF: Reject DBDES packets with non-matching MTU
As it is specified in RFC 2328. The old code just provided warning.
Diffstat (limited to 'proto/ospf/dbdes.c')
-rw-r--r-- | proto/ospf/dbdes.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/proto/ospf/dbdes.c b/proto/ospf/dbdes.c index 34665dad..4d3bbe8c 100644 --- a/proto/ospf/dbdes.c +++ b/proto/ospf/dbdes.c @@ -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))) |