From 3d1482a9451039d94dce91f25dac8334354e1f92 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Tue, 27 Jul 2021 16:12:04 +0200 Subject: [PATCH] ospf6d: option to disable multicast hellos With the configured neighbor list, unicast hellos can be sent. Allow disabling multicast hellos for that scenario. Signed-off-by: David Lamparter --- ospf6d/ospf6_interface.c | 33 +++++++++++++++++++++++++++++++++ ospf6d/ospf6_interface.h | 2 ++ ospf6d/ospf6_message.c | 11 +++++++---- 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 0fef0c95d4..2cd7ba5638 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -2673,6 +2673,33 @@ DEFPY (ipv6_ospf6_p2xp_only_cfg_neigh, return CMD_SUCCESS; } +DEFPY (ipv6_ospf6_p2xp_no_multicast_hello, + ipv6_ospf6_p2xp_no_multicast_hello_cmd, + "[no] ipv6 ospf6 p2p-p2mp disable-multicast-hello", + NO_STR + IP6_STR + OSPF6_STR + "Point-to-point and Point-to-Multipoint parameters\n" + "Do not send multicast hellos\n") +{ + VTY_DECLVAR_CONTEXT(interface, ifp); + struct ospf6_interface *oi = ifp->info; + + if (no) { + if (!oi) + return CMD_SUCCESS; + + oi->p2xp_no_multicast_hello = false; + return CMD_SUCCESS; + } + + if (!oi) + oi = ospf6_interface_create(ifp); + + oi->p2xp_no_multicast_hello = true; + return CMD_SUCCESS; +} + static int config_write_ospf6_interface(struct vty *vty, struct vrf *vrf) { @@ -2746,6 +2773,10 @@ static int config_write_ospf6_interface(struct vty *vty, struct vrf *vrf) vty_out(vty, " ipv6 ospf6 p2p-p2mp config-neighbors-only\n"); + if (oi->p2xp_no_multicast_hello) + vty_out(vty, + " ipv6 ospf6 p2p-p2mp disable-multicast-hello\n"); + ospf6_bfd_write_config(vty, oi); ospf6_auth_write_config(vty, &oi->at_data); @@ -2871,6 +2902,8 @@ void ospf6_interface_init(void) install_element(INTERFACE_NODE, &no_ipv6_ospf6_network_cmd); install_element(INTERFACE_NODE, &ipv6_ospf6_p2xp_only_cfg_neigh_cmd); + install_element(INTERFACE_NODE, + &ipv6_ospf6_p2xp_no_multicast_hello_cmd); /* reference bandwidth commands */ install_element(OSPF6_NODE, &auto_cost_reference_bandwidth_cmd); diff --git a/ospf6d/ospf6_interface.h b/ospf6d/ospf6_interface.h index aeb16216c1..a627bb3db0 100644 --- a/ospf6d/ospf6_interface.h +++ b/ospf6d/ospf6_interface.h @@ -70,6 +70,8 @@ struct ospf6_interface { /* P2P/P2MP behavior: */ + /* disable hellos on standard multicast? */ + bool p2xp_no_multicast_hello; /* only allow explicitly configured neighbors? */ bool p2xp_only_cfg_neigh; diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index 7a855d1af5..f7b1bf3b04 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -2284,6 +2284,13 @@ void ospf6_hello_send(struct event *thread) return; } + event_add_timer(master, ospf6_hello_send, oi, oi->hello_interval, + &oi->thread_send_hello); + + if (oi->state == OSPF6_INTERFACE_POINTTOPOINT + && oi->p2xp_no_multicast_hello) + return 0; + op = ospf6_packet_new(oi->ifmtu); ospf6_make_header(OSPF6_MESSAGE_TYPE_HELLO, oi, op->s); @@ -2311,10 +2318,6 @@ void ospf6_hello_send(struct event *thread) */ ospf6_packet_add_top(oi, op); - /* set next thread */ - event_add_timer(master, ospf6_hello_send, oi, oi->hello_interval, - &oi->thread_send_hello); - OSPF6_MESSAGE_WRITE_ON(oi); }