ospfd: send ARP requests using zebra

Signed-off-by: Jakub Urbańczyk <xthaid@gmail.com>
This commit is contained in:
Jakub Urbańczyk 2020-08-06 13:36:22 +02:00
parent da187b7705
commit aa530b627d
3 changed files with 11 additions and 12 deletions

View File

@ -53,6 +53,7 @@
#include "ospfd/ospf_flood.h"
#include "ospfd/ospf_dump.h"
#include "ospfd/ospf_errors.h"
#include "ospfd/ospf_zebra.h"
/*
* OSPF Fragmentation / fragmented writes
@ -4319,21 +4320,10 @@ void ospf_ls_ack_send_delayed(struct ospf_interface *oi)
* punt-to-CPU set on them. This may overload the CPU control path that
* can be avoided if the MAC was known apriori.
*/
#define OSPF_PING_NBR_STR_MAX (BUFSIZ)
void ospf_proactively_arp(struct ospf_neighbor *nbr)
{
char ping_nbr[OSPF_PING_NBR_STR_MAX];
int ret;
if (!nbr)
return;
snprintf(ping_nbr, sizeof(ping_nbr),
"ping -c 1 -I %s %s > /dev/null 2>&1 &", nbr->oi->ifp->name,
inet_ntoa(nbr->address.u.prefix4));
ret = system(ping_nbr);
if (IS_DEBUG_OSPF_EVENT)
zlog_debug("Executed %s %s", ping_nbr,
((ret == 0) ? "successfully" : "but failed"));
ospf_zebra_send_arp(nbr->oi->ifp, &nbr->address);
}

View File

@ -1741,3 +1741,8 @@ void ospf_zebra_init(struct thread_master *master, unsigned short instance)
prefix_list_add_hook(ospf_prefix_list_update);
prefix_list_delete_hook(ospf_prefix_list_update);
}
void ospf_zebra_send_arp(const struct interface *ifp, const struct prefix *p)
{
zclient_send_neigh_discovery_req(zclient, ifp, p);
}

View File

@ -41,6 +41,7 @@ struct ospf_distance {
};
/* Prototypes */
struct ospf_route;
extern void ospf_zebra_add(struct ospf *ospf, struct prefix_ipv4 *,
struct ospf_route *);
extern void ospf_zebra_delete(struct ospf *ospf, struct prefix_ipv4 *,
@ -98,4 +99,7 @@ bool ospf_external_default_routemap_apply_walk(
int ospf_external_info_apply_default_routemap(struct ospf *ospf,
struct external_info *ei,
struct external_info *default_ei);
extern void ospf_zebra_send_arp(const struct interface *ifp,
const struct prefix *p);
#endif /* _ZEBRA_OSPF_ZEBRA_H */