From a92706bb830b89f2a7d988b59471cd670f0452de Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jakub=20Urba=C5=84czyk?= Date: Wed, 19 Aug 2020 14:19:19 +0200 Subject: [PATCH] ospfd: make proactive ARP configurable MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit OSPFD sends ARP proactively to speed up convergence for /32 networks on a p2p connection. It is only an optimization, so it can be disabled. It is enabled by default. Signed-off-by: Jakub Urbańczyk --- ospfd/ospf_packet.c | 2 +- ospfd/ospf_vty.c | 37 +++++++++++++++++++++++++++++++++++++ ospfd/ospfd.c | 2 ++ ospfd/ospfd.h | 4 ++++ yang/frr-ospfd.yang | 7 +++++++ 5 files changed, 51 insertions(+), 1 deletion(-) diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c index 49cd42d030..61aae695b3 100644 --- a/ospfd/ospf_packet.c +++ b/ospfd/ospf_packet.c @@ -4322,7 +4322,7 @@ void ospf_ls_ack_send_delayed(struct ospf_interface *oi) */ void ospf_proactively_arp(struct ospf_neighbor *nbr) { - if (!nbr) + if (!nbr || !nbr->oi->ospf->proactive_arp) return; ospf_zebra_send_arp(nbr->oi->ifp, &nbr->address); diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index e8cc50c8d0..8be7748c87 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -8925,6 +8925,31 @@ DEFUN (no_ospf_max_metric_router_lsa_shutdown, return CMD_SUCCESS; } +DEFUN (ospf_proactive_arp, + ospf_proactive_arp_cmd, + "proactive-arp", + "Allow sending ARP requests proactively\n") +{ + VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf); + + ospf->proactive_arp = true; + + return CMD_SUCCESS; +} + +DEFUN (no_ospf_proactive_arp, + no_ospf_proactive_arp_cmd, + "no proactive-arp", + NO_STR + "Disallow sending ARP requests proactively\n") +{ + VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf); + + ospf->proactive_arp = false; + + return CMD_SUCCESS; +} + static void config_write_stub_router(struct vty *vty, struct ospf *ospf) { struct listnode *ln; @@ -10415,6 +10440,14 @@ static int ospf_config_write_one(struct vty *vty, struct ospf *ospf) if (ospf->passive_interface_default == OSPF_IF_PASSIVE) vty_out(vty, " passive-interface default\n"); + /* proactive-arp print. */ + if (ospf->proactive_arp != OSPF_PROACTIVE_ARP_DEFAULT) { + if (ospf->proactive_arp) + vty_out(vty, " proactive-arp\n"); + else + vty_out(vty, " no proactive-arp\n"); + } + FOR_ALL_INTERFACES (vrf, ifp) if (OSPF_IF_PARAM_CONFIGURED(IF_DEF_PARAMS(ifp), passive_interface) @@ -10871,6 +10904,10 @@ void ospf_vty_init(void) install_element(OSPF_NODE, &no_ospf_write_multiplier_cmd); install_element(OSPF_NODE, &no_write_multiplier_cmd); + /* "proactive-arp" commands. */ + install_element(OSPF_NODE, &ospf_proactive_arp_cmd); + install_element(OSPF_NODE, &no_ospf_proactive_arp_cmd); + /* Init interface related vty commands. */ ospf_vty_if_init(); diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index f9cc474d5c..31d8417eb6 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -305,6 +305,8 @@ static struct ospf *ospf_new(unsigned short instance, const char *name) new->oi_write_q = list_new(); new->write_oi_count = OSPF_WRITE_INTERFACE_COUNT_DEFAULT; + new->proactive_arp = OSPF_PROACTIVE_ARP_DEFAULT; + QOBJ_REG(new, ospf); new->fd = -1; diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h index cdeaa38dc0..230c10e44f 100644 --- a/ospfd/ospfd.h +++ b/ospfd/ospfd.h @@ -312,6 +312,10 @@ struct ospf { * update to neighbors immediatly */ uint8_t inst_shutdown; + /* Enable or disable sending proactive ARP requests. */ + bool proactive_arp; +#define OSPF_PROACTIVE_ARP_DEFAULT true + /* Redistributed external information. */ struct list *external[ZEBRA_ROUTE_MAX + 1]; #define EXTERNAL_INFO(E) (E->external_info) diff --git a/yang/frr-ospfd.yang b/yang/frr-ospfd.yang index 324b66dd98..466dd42ce4 100644 --- a/yang/frr-ospfd.yang +++ b/yang/frr-ospfd.yang @@ -346,6 +346,13 @@ module frr-ospfd { "The reference bandwidth in terms of Mbits per second."; } + leaf use-arp { + type boolean; + default "true"; + description + "ARP for neighbor table entry."; + } + leaf capability-opaque { type boolean; default "false"; -- 2.39.5