]> git.proxmox.com Git - mirror_frr.git/blame - pimd/pim_nht.h
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / pimd / pim_nht.h
CommitLineData
acddc0ed 1// SPDX-License-Identifier: GPL-2.0-or-later
1bc98276
CS
2/*
3 * PIM for Quagga
4 * Copyright (C) 2017 Cumulus Networks, Inc.
5 * Chirag Shah
1bc98276
CS
6 */
7#ifndef PIM_NHT_H
8#define PIM_NHT_H
9
10#include "prefix.h"
11#include <zebra.h>
12#include "zclient.h"
13#include "vrf.h"
14
15#include "pimd.h"
16#include "pim_rp.h"
17#include "pim_rpf.h"
18
19/* PIM nexthop cache value structure. */
d62a17ae 20struct pim_nexthop_cache {
21 struct pim_rpf rpf;
22 /* IGP route's metric. */
d7c0a89a 23 uint32_t metric;
d62a17ae 24 uint32_t distance;
25 /* Nexthop number and nexthop linked list. */
d7c0a89a 26 uint8_t nexthop_num;
d62a17ae 27 struct nexthop *nexthop;
28 int64_t last_update;
d7c0a89a 29 uint16_t flags;
1bc98276 30#define PIM_NEXTHOP_VALID (1 << 0)
2cb7234f 31#define PIM_NEXTHOP_ANSWER_RECEIVED (1 << 1)
1bc98276 32
d62a17ae 33 struct list *rp_list;
7c591950 34 struct hash *upstream_hash;
4efdb9c6
DL
35
36 /* bsr_count won't currently go above 1 as we only have global_scope,
37 * but if anyone adds scope support multiple scopes may NHT-track the
38 * same BSR
4533b847 39 */
4efdb9c6 40 uint32_t bsr_count;
1bc98276
CS
41};
42
12211791
SP
43struct pnc_hash_walk_data {
44 struct pim_instance *pim;
45 struct interface *ifp;
46};
47
121f9dee 48int pim_parse_nexthop_update(ZAPI_CALLBACK_ARGS);
e6e53006 49int pim_find_or_track_nexthop(struct pim_instance *pim, pim_addr addr,
25bdac42 50 struct pim_upstream *up, struct rp_info *rp,
d62a17ae 51 struct pim_nexthop_cache *out_pnc);
e6e53006 52void pim_delete_tracked_nexthop(struct pim_instance *pim, pim_addr addr,
4efdb9c6 53 struct pim_upstream *up, struct rp_info *rp);
d0a4f55d
DS
54struct pim_nexthop_cache *pim_nexthop_cache_find(struct pim_instance *pim,
55 struct pim_rpf *rpf);
d62a17ae 56uint32_t pim_compute_ecmp_hash(struct prefix *src, struct prefix *grp);
25b787a2 57int pim_ecmp_nexthop_lookup(struct pim_instance *pim,
e6e53006 58 struct pim_nexthop *nexthop, pim_addr src,
b938537b 59 struct prefix *grp, int neighbor_needed);
64c86530 60void pim_sendmsg_zebra_rnh(struct pim_instance *pim, struct zclient *zclient,
d62a17ae 61 struct pim_nexthop_cache *pnc, int command);
e6e53006 62int pim_ecmp_fib_lookup_if_vif_index(struct pim_instance *pim, pim_addr src,
6288ebcf 63 struct prefix *grp);
640b8d93 64void pim_rp_nexthop_del(struct rp_info *rp_info);
4b936634 65
4efdb9c6 66/* for RPF check on BSM message receipt */
53bbfd53 67void pim_nht_bsr_add(struct pim_instance *pim, pim_addr bsr_addr);
68void pim_nht_bsr_del(struct pim_instance *pim, pim_addr bsr_addr);
4efdb9c6 69/* RPF(bsr_addr) == src_ip%src_ifp? */
53bbfd53 70bool pim_nht_bsr_rpf_check(struct pim_instance *pim, pim_addr bsr_addr,
76bfa030 71 struct interface *src_ifp, pim_addr src_ip);
93d4f4f0 72void pim_upstream_nh_if_update(struct pim_instance *pim, struct interface *ifp);
1bc98276 73#endif