]> git.proxmox.com Git - mirror_frr.git/blob - pimd/pim_nht.h
Merge remote-tracking branch 'origin/stable/3.0'
[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 {
35 struct pim_rpf rpf;
36 /* IGP route's metric. */
37 u_int32_t metric;
38 uint32_t distance;
39 /* Nexthop number and nexthop linked list. */
40 u_char nexthop_num;
41 struct nexthop *nexthop;
42 int64_t last_update;
43 u_int16_t flags;
44 #define PIM_NEXTHOP_VALID (1 << 0)
45
46 struct list *rp_list;
47 struct list *upstream_list;
48 };
49
50 int pim_parse_nexthop_update (int command, struct zclient *zclient,
51 zebra_size_t length, vrf_id_t vrf_id);
52 int pim_find_or_track_nexthop (struct prefix *addr, struct pim_upstream *up,
53 struct rp_info *rp, struct pim_nexthop_cache *out_pnc);
54 void pim_delete_tracked_nexthop (struct prefix *addr, struct pim_upstream *up,
55 struct rp_info *rp);
56 struct pim_nexthop_cache *pim_nexthop_cache_add (struct pim_rpf *rpf_addr);
57 struct pim_nexthop_cache *pim_nexthop_cache_find (struct pim_rpf *rpf);
58 uint32_t pim_compute_ecmp_hash (struct prefix *src, struct prefix *grp);
59 int pim_ecmp_nexthop_search (struct pim_nexthop_cache * pnc,
60 struct pim_nexthop *nexthop, struct prefix *src,
61 struct prefix *grp, int neighbor_needed);
62 int pim_ecmp_nexthop_lookup (struct pim_nexthop *nexthop, struct in_addr addr,
63 struct prefix *src, struct prefix *grp,
64 int neighbor_needed);
65 void pim_sendmsg_zebra_rnh (struct zclient *zclient, struct pim_nexthop_cache *pnc,
66 int command);
67 int pim_update_rp_nh (struct pim_nexthop_cache *pnc);
68 void pim_resolve_upstream_nh (struct prefix *nht_p);
69 int pim_ecmp_fib_lookup_if_vif_index(struct in_addr addr,
70 struct prefix *src, struct prefix *grp);
71 #endif