]> git.proxmox.com Git - mirror_frr.git/blame - pimd/pim_nht.h
Merge pull request #10182 from mjstapp/fix_clang_break_opers
[mirror_frr.git] / pimd / pim_nht.h
CommitLineData
1bc98276
CS
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 *
896014f4
DL
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
1bc98276
CS
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. */
d62a17ae 33struct pim_nexthop_cache {
34 struct pim_rpf rpf;
35 /* IGP route's metric. */
d7c0a89a 36 uint32_t metric;
d62a17ae 37 uint32_t distance;
38 /* Nexthop number and nexthop linked list. */
d7c0a89a 39 uint8_t nexthop_num;
d62a17ae 40 struct nexthop *nexthop;
41 int64_t last_update;
d7c0a89a 42 uint16_t flags;
1bc98276 43#define PIM_NEXTHOP_VALID (1 << 0)
2cb7234f 44#define PIM_NEXTHOP_ANSWER_RECEIVED (1 << 1)
1bc98276 45
d62a17ae 46 struct list *rp_list;
7c591950 47 struct hash *upstream_hash;
4efdb9c6
DL
48
49 /* bsr_count won't currently go above 1 as we only have global_scope,
50 * but if anyone adds scope support multiple scopes may NHT-track the
51 * same BSR
4533b847 52 */
4efdb9c6 53 uint32_t bsr_count;
1bc98276
CS
54};
55
121f9dee 56int pim_parse_nexthop_update(ZAPI_CALLBACK_ARGS);
25bdac42
DS
57int pim_find_or_track_nexthop(struct pim_instance *pim, struct prefix *addr,
58 struct pim_upstream *up, struct rp_info *rp,
d62a17ae 59 struct pim_nexthop_cache *out_pnc);
d0a4f55d 60void pim_delete_tracked_nexthop(struct pim_instance *pim, struct prefix *addr,
4efdb9c6 61 struct pim_upstream *up, struct rp_info *rp);
d0a4f55d
DS
62struct pim_nexthop_cache *pim_nexthop_cache_find(struct pim_instance *pim,
63 struct pim_rpf *rpf);
d62a17ae 64uint32_t pim_compute_ecmp_hash(struct prefix *src, struct prefix *grp);
25b787a2 65int pim_ecmp_nexthop_lookup(struct pim_instance *pim,
b938537b
DS
66 struct pim_nexthop *nexthop, struct prefix *src,
67 struct prefix *grp, int neighbor_needed);
64c86530 68void pim_sendmsg_zebra_rnh(struct pim_instance *pim, struct zclient *zclient,
d62a17ae 69 struct pim_nexthop_cache *pnc, int command);
25b787a2 70int pim_ecmp_fib_lookup_if_vif_index(struct pim_instance *pim,
b938537b 71 struct prefix *src, struct prefix *grp);
640b8d93 72void pim_rp_nexthop_del(struct rp_info *rp_info);
4b936634 73
4efdb9c6
DL
74/* for RPF check on BSM message receipt */
75void pim_nht_bsr_add(struct pim_instance *pim, struct in_addr bsr_addr);
76void pim_nht_bsr_del(struct pim_instance *pim, struct in_addr bsr_addr);
77/* RPF(bsr_addr) == src_ip%src_ifp? */
78bool pim_nht_bsr_rpf_check(struct pim_instance *pim, struct in_addr bsr_addr,
79 struct interface *src_ifp, struct in_addr src_ip);
80
1bc98276 81#endif