mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 17:02:54 +00:00
zebra_ptm: Introduce IS_BFD_ENABLED_PROTOCOL macro
Unify the check if a client supports BFD into one location. Signed-off-by: Christian Franke <chris@opensourcerouting.org>
This commit is contained in:
parent
78230371e9
commit
4943f243b5
@ -1030,8 +1030,7 @@ int zebra_ptm_bfd_client_deregister(struct zserv *client)
|
|||||||
char tmp_buf[64];
|
char tmp_buf[64];
|
||||||
int data_len = ZEBRA_PTM_SEND_MAX_SOCKBUF;
|
int data_len = ZEBRA_PTM_SEND_MAX_SOCKBUF;
|
||||||
|
|
||||||
if (proto != ZEBRA_ROUTE_OSPF && proto != ZEBRA_ROUTE_BGP
|
if (!IS_BFD_ENABLED_PROTOCOL(proto))
|
||||||
&& proto != ZEBRA_ROUTE_OSPF6 && proto != ZEBRA_ROUTE_PIM)
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (IS_ZEBRA_DEBUG_EVENT)
|
if (IS_ZEBRA_DEBUG_EVENT)
|
||||||
@ -1310,17 +1309,8 @@ static void zebra_ptm_send_clients(struct stream *msg)
|
|||||||
|
|
||||||
/* Send message to all running client daemons. */
|
/* Send message to all running client daemons. */
|
||||||
for (ALL_LIST_ELEMENTS_RO(zebrad.client_list, node, client)) {
|
for (ALL_LIST_ELEMENTS_RO(zebrad.client_list, node, client)) {
|
||||||
switch (client->proto) {
|
if (!IS_BFD_ENABLED_PROTOCOL(client->proto))
|
||||||
case ZEBRA_ROUTE_BGP:
|
|
||||||
case ZEBRA_ROUTE_OSPF:
|
|
||||||
case ZEBRA_ROUTE_OSPF6:
|
|
||||||
case ZEBRA_ROUTE_PIM:
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
/* NOTHING: skip this daemon. */
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
zserv_send_message(client, msg);
|
zserv_send_message(client, msg);
|
||||||
|
|
||||||
@ -1341,23 +1331,9 @@ static int _zebra_ptm_bfd_client_deregister(struct zserv *zs)
|
|||||||
struct stream *msg;
|
struct stream *msg;
|
||||||
struct ptm_process *pp;
|
struct ptm_process *pp;
|
||||||
|
|
||||||
/* Filter daemons that must receive this treatment. */
|
if (!IS_BFD_ENABLED_PROTOCOL(zs->proto))
|
||||||
switch (zs->proto) {
|
|
||||||
case ZEBRA_ROUTE_BGP:
|
|
||||||
case ZEBRA_ROUTE_OSPF:
|
|
||||||
case ZEBRA_ROUTE_OSPF6:
|
|
||||||
case ZEBRA_ROUTE_PIM:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ZEBRA_ROUTE_BFD:
|
|
||||||
/* Don't try to send BFDd messages to itself. */
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
default:
|
|
||||||
/* Unsupported daemon. */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Find daemon pid by zebra connection pointer. */
|
/* Find daemon pid by zebra connection pointer. */
|
||||||
pp = pp_lookup_byzs(zs);
|
pp = pp_lookup_byzs(zs);
|
||||||
if (pp == NULL) {
|
if (pp == NULL) {
|
||||||
|
@ -59,6 +59,13 @@ struct zebra_ptm_cb {
|
|||||||
#define ZEBRA_IF_PTM_ENABLE_ON 1
|
#define ZEBRA_IF_PTM_ENABLE_ON 1
|
||||||
#define ZEBRA_IF_PTM_ENABLE_UNSPEC 2
|
#define ZEBRA_IF_PTM_ENABLE_UNSPEC 2
|
||||||
|
|
||||||
|
#define IS_BFD_ENABLED_PROTOCOL(protocol) ( \
|
||||||
|
(protocol) == ZEBRA_ROUTE_BGP || \
|
||||||
|
(protocol) == ZEBRA_ROUTE_OSPF || \
|
||||||
|
(protocol) == ZEBRA_ROUTE_OSPF6 || \
|
||||||
|
(protocol) == ZEBRA_ROUTE_PIM \
|
||||||
|
)
|
||||||
|
|
||||||
void zebra_ptm_init(void);
|
void zebra_ptm_init(void);
|
||||||
void zebra_ptm_finish(void);
|
void zebra_ptm_finish(void);
|
||||||
int zebra_ptm_connect(struct thread *t);
|
int zebra_ptm_connect(struct thread *t);
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "stream.h"
|
#include "stream.h"
|
||||||
#include "zebra/zserv.h"
|
#include "zebra/zserv.h"
|
||||||
#include "zebra/zapi_msg.h"
|
#include "zebra/zapi_msg.h"
|
||||||
|
#include "zebra/zebra_ptm.h"
|
||||||
#include "zebra/zebra_ptm_redistribute.h"
|
#include "zebra/zebra_ptm_redistribute.h"
|
||||||
#include "zebra/zebra_memory.h"
|
#include "zebra/zebra_memory.h"
|
||||||
|
|
||||||
@ -76,11 +77,7 @@ void zebra_interface_bfd_update(struct interface *ifp, struct prefix *dp,
|
|||||||
struct zserv *client;
|
struct zserv *client;
|
||||||
|
|
||||||
for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) {
|
for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) {
|
||||||
/* Supporting for OSPF, BGP and PIM */
|
if (!IS_BFD_ENABLED_PROTOCOL(client->proto))
|
||||||
if (client->proto != ZEBRA_ROUTE_OSPF
|
|
||||||
&& client->proto != ZEBRA_ROUTE_BGP
|
|
||||||
&& client->proto != ZEBRA_ROUTE_OSPF6
|
|
||||||
&& client->proto != ZEBRA_ROUTE_PIM)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Notify to the protocol daemons. */
|
/* Notify to the protocol daemons. */
|
||||||
@ -110,11 +107,7 @@ void zebra_bfd_peer_replay_req(void)
|
|||||||
struct zserv *client;
|
struct zserv *client;
|
||||||
|
|
||||||
for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) {
|
for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) {
|
||||||
/* Supporting for BGP */
|
if (!IS_BFD_ENABLED_PROTOCOL(client->proto))
|
||||||
if ((client->proto != ZEBRA_ROUTE_BGP)
|
|
||||||
&& (client->proto != ZEBRA_ROUTE_OSPF)
|
|
||||||
&& (client->proto != ZEBRA_ROUTE_OSPF6)
|
|
||||||
&& (client->proto != ZEBRA_ROUTE_PIM))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Notify to the protocol daemons. */
|
/* Notify to the protocol daemons. */
|
||||||
|
Loading…
Reference in New Issue
Block a user