summaryrefslogtreecommitdiff
path: root/ospfd/ospf_packet.c
diff options
context:
space:
mode:
Diffstat (limited to 'ospfd/ospf_packet.c')
-rw-r--r--ospfd/ospf_packet.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c
index 3bb3b79a6a..30f5a2a80e 100644
--- a/ospfd/ospf_packet.c
+++ b/ospfd/ospf_packet.c
@@ -148,7 +148,7 @@ void ospf_packet_free(struct ospf_packet *op)
XFREE(MTYPE_OSPF_PACKET, op);
}
-struct ospf_fifo *ospf_fifo_new()
+struct ospf_fifo *ospf_fifo_new(void)
{
struct ospf_fifo *new;
@@ -3309,6 +3309,16 @@ static int ospf_make_hello(struct ospf_interface *oi, struct stream *s)
.prefix4))
flag = 1;
+ /* Hello packet overflows interface MTU. */
+ if (length + sizeof(uint32_t)
+ > ospf_packet_max(oi)) {
+ flog_err(
+ EC_OSPF_LARGE_HELLO,
+ "Oversized Hello packet!"
+ " Larger than MTU. Not sending it out");
+ return 0;
+ }
+
stream_put_ipv4(
s,
nbr->router_id
@@ -3578,6 +3588,11 @@ static void ospf_hello_send_sub(struct ospf_interface *oi, in_addr_t addr)
/* Prepare OSPF Hello body. */
length += ospf_make_hello(oi, op->s);
+ if (length == OSPF_HEADER_SIZE) {
+ /* Hello overshooting MTU */
+ ospf_packet_free(op);
+ return;
+ }
/* Fill OSPF header. */
ospf_fill_header(oi, op->s, length);