summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-10-12 19:58:26 +0200
committerGitHub <noreply@github.com>2018-10-12 19:58:26 +0200
commitb0ecf336f3f9ccecab9931dca02b7df4fae42cf8 (patch)
treeb819ce0e4c6a116023dc79be78b1f5ae8654d6cd /zebra
parentMerge pull request #3140 from vishaldhingra/b_2802 (diff)
parentisisd: Fix license header of bfd code (diff)
downloadfrr-b0ecf336f3f9ccecab9931dca02b7df4fae42cf8.tar.xz
frr-b0ecf336f3f9ccecab9931dca02b7df4fae42cf8.zip
Merge pull request #3137 from opensourcerouting/feature/isis-bfd
Feature: BFD for IS-IS
Diffstat (limited to 'zebra')
-rw-r--r--zebra/zebra_ptm.c30
-rw-r--r--zebra/zebra_ptm.h9
-rw-r--r--zebra/zebra_ptm_redistribute.c13
3 files changed, 15 insertions, 37 deletions
diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c
index b71124161..e4a4adba0 100644
--- a/zebra/zebra_ptm.c
+++ b/zebra/zebra_ptm.c
@@ -1030,8 +1030,7 @@ int zebra_ptm_bfd_client_deregister(struct zserv *client)
char tmp_buf[64];
int data_len = ZEBRA_PTM_SEND_MAX_SOCKBUF;
- if (proto != ZEBRA_ROUTE_OSPF && proto != ZEBRA_ROUTE_BGP
- && proto != ZEBRA_ROUTE_OSPF6 && proto != ZEBRA_ROUTE_PIM)
+ if (!IS_BFD_ENABLED_PROTOCOL(proto))
return 0;
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. */
for (ALL_LIST_ELEMENTS_RO(zebrad.client_list, node, client)) {
- switch (client->proto) {
- case ZEBRA_ROUTE_BGP:
- case ZEBRA_ROUTE_OSPF:
- case ZEBRA_ROUTE_OSPF6:
- case ZEBRA_ROUTE_PIM:
- break;
-
- default:
- /* NOTHING: skip this daemon. */
+ if (!IS_BFD_ENABLED_PROTOCOL(client->proto))
continue;
- }
zserv_send_message(client, msg);
@@ -1341,23 +1331,9 @@ static int _zebra_ptm_bfd_client_deregister(struct zserv *zs)
struct stream *msg;
struct ptm_process *pp;
- /* Filter daemons that must receive this treatment. */
- 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. */
+ if (!IS_BFD_ENABLED_PROTOCOL(zs->proto))
return 0;
- default:
- /* Unsupported daemon. */
- return 0;
- }
-
/* Find daemon pid by zebra connection pointer. */
pp = pp_lookup_byzs(zs);
if (pp == NULL) {
diff --git a/zebra/zebra_ptm.h b/zebra/zebra_ptm.h
index ada4f7b4f..d0cdaf0bc 100644
--- a/zebra/zebra_ptm.h
+++ b/zebra/zebra_ptm.h
@@ -59,6 +59,15 @@ struct zebra_ptm_cb {
#define ZEBRA_IF_PTM_ENABLE_ON 1
#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_ISIS || \
+ (protocol) == ZEBRA_ROUTE_PIM || \
+ (protocol) == ZEBRA_ROUTE_OPENFABRIC \
+)
+
void zebra_ptm_init(void);
void zebra_ptm_finish(void);
int zebra_ptm_connect(struct thread *t);
diff --git a/zebra/zebra_ptm_redistribute.c b/zebra/zebra_ptm_redistribute.c
index 815f61d15..420105198 100644
--- a/zebra/zebra_ptm_redistribute.c
+++ b/zebra/zebra_ptm_redistribute.c
@@ -24,6 +24,7 @@
#include "stream.h"
#include "zebra/zserv.h"
#include "zebra/zapi_msg.h"
+#include "zebra/zebra_ptm.h"
#include "zebra/zebra_ptm_redistribute.h"
#include "zebra/zebra_memory.h"
@@ -76,11 +77,7 @@ void zebra_interface_bfd_update(struct interface *ifp, struct prefix *dp,
struct zserv *client;
for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) {
- /* Supporting for OSPF, BGP and PIM */
- if (client->proto != ZEBRA_ROUTE_OSPF
- && client->proto != ZEBRA_ROUTE_BGP
- && client->proto != ZEBRA_ROUTE_OSPF6
- && client->proto != ZEBRA_ROUTE_PIM)
+ if (!IS_BFD_ENABLED_PROTOCOL(client->proto))
continue;
/* Notify to the protocol daemons. */
@@ -110,11 +107,7 @@ void zebra_bfd_peer_replay_req(void)
struct zserv *client;
for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) {
- /* Supporting for BGP */
- if ((client->proto != ZEBRA_ROUTE_BGP)
- && (client->proto != ZEBRA_ROUTE_OSPF)
- && (client->proto != ZEBRA_ROUTE_OSPF6)
- && (client->proto != ZEBRA_ROUTE_PIM))
+ if (!IS_BFD_ENABLED_PROTOCOL(client->proto))
continue;
/* Notify to the protocol daemons. */