]> git.proxmox.com Git - mirror_frr.git/blob - pimd/pim_nht.h
Merge pull request #5494 from opensourcerouting/mlag-module
[mirror_frr.git] / pimd / pim_nht.h
1 /*
2 * PIM for Quagga
3 * Copyright (C) 2017 Cumulus Networks, Inc.
4 * Chirag Shah
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20 #ifndef PIM_NHT_H
21 #define PIM_NHT_H
22
23 #include "prefix.h"
24 #include <zebra.h>
25 #include "zclient.h"
26 #include "vrf.h"
27
28 #include "pimd.h"
29 #include "pim_rp.h"
30 #include "pim_rpf.h"
31
32 /* PIM nexthop cache value structure. */
33 struct pim_nexthop_cache {
34 struct pim_rpf rpf;
35 /* IGP route's metric. */
36 uint32_t metric;
37 uint32_t distance;
38 /* Nexthop number and nexthop linked list. */
39 uint8_t nexthop_num;
40 struct nexthop *nexthop;
41 int64_t last_update;
42 uint16_t flags;
43 #define PIM_NEXTHOP_VALID (1 << 0)
44 #define PIM_NEXTHOP_ANSWER_RECEIVED (1 << 1)
45
46 struct list *rp_list;
47 struct hash *upstream_hash;
48 /* Ideally this has to be list of scope zone. But for now we can just
49 * have as a bool variable to say bsr_tracking.
50 * Later this variable can be changed as a list of scope zones for
51 * tracking same bsr for multiple scope zones.
52 */
53 bool bsr_tracking;
54 };
55
56 int pim_parse_nexthop_update(ZAPI_CALLBACK_ARGS);
57 int pim_find_or_track_nexthop(struct pim_instance *pim, struct prefix *addr,
58 struct pim_upstream *up, struct rp_info *rp,
59 bool bsr_track_needed,
60 struct pim_nexthop_cache *out_pnc);
61 void pim_delete_tracked_nexthop(struct pim_instance *pim, struct prefix *addr,
62 struct pim_upstream *up, struct rp_info *rp,
63 bool del_bsr_tracking);
64 struct pim_nexthop_cache *pim_nexthop_cache_find(struct pim_instance *pim,
65 struct pim_rpf *rpf);
66 uint32_t pim_compute_ecmp_hash(struct prefix *src, struct prefix *grp);
67 int pim_ecmp_nexthop_lookup(struct pim_instance *pim,
68 struct pim_nexthop *nexthop, struct prefix *src,
69 struct prefix *grp, int neighbor_needed);
70 void pim_sendmsg_zebra_rnh(struct pim_instance *pim, struct zclient *zclient,
71 struct pim_nexthop_cache *pnc, int command);
72 int pim_ecmp_fib_lookup_if_vif_index(struct pim_instance *pim,
73 struct prefix *src, struct prefix *grp);
74 void pim_rp_nexthop_del(struct rp_info *rp_info);
75 bool pim_nexthop_match(struct pim_instance *pim, struct in_addr addr,
76 struct in_addr ip_src);
77 bool pim_nexthop_match_nht_cache(struct pim_instance *pim, struct in_addr addr,
78 struct in_addr ip_src);
79
80 #endif