]> git.proxmox.com Git - mirror_frr.git/blob - bgpd/rfapi/rfapi_rib.h
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / bgpd / rfapi / rfapi_rib.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 *
4 * Copyright 2009-2016, LabN Consulting, L.L.C.
5 *
6 */
7
8 /*
9 * File: rfapi_rib.h
10 * Purpose: per-nve rib
11 */
12
13 #ifndef QUAGGA_HGP_RFAPI_RIB_H
14 #define QUAGGA_HGP_RFAPI_RIB_H
15
16 /*
17 * Key for indexing RIB and Pending RIB skiplists. For L3 RIBs,
18 * the VN address is sufficient because it represents the actual next hop.
19 *
20 * For L2 RIBs, it is possible to have multiple routes to a given L2
21 * prefix via a given VN address, but each route having a unique aux_prefix.
22 */
23 struct rfapi_rib_key {
24 struct prefix vn;
25 struct prefix_rd rd;
26
27 /*
28 * for L2 routes: optional IP addr
29 * .family == 0 means "none"
30 */
31 struct prefix aux_prefix;
32 };
33 #include "rfapi.h"
34
35 /*
36 * RFAPI Advertisement Data Block
37 *
38 * Holds NVE prefix advertisement information
39 */
40 struct rfapi_adb {
41 union {
42 struct {
43 struct prefix prefix_ip;
44 struct prefix_rd prd;
45 struct prefix prefix_eth;
46 } s; /* mainly for legacy use */
47 struct rfapi_rib_key key;
48 } u;
49 uint32_t lifetime;
50 uint8_t cost;
51 struct rfapi_l2address_option l2o;
52 };
53
54 struct rfapi_info {
55 struct rfapi_rib_key rk; /* NVE VN addr + aux addr */
56 struct prefix un;
57 uint8_t cost;
58 uint32_t lifetime;
59 time_t last_sent_time;
60 uint32_t rsp_counter; /* dedup initial responses */
61 struct bgp_tea_options *tea_options;
62 struct rfapi_un_option *un_options;
63 struct rfapi_vn_option *vn_options;
64 struct thread *timer;
65 };
66
67 /*
68 * Work item for updated responses queue
69 */
70 struct rfapi_updated_responses_queue {
71 struct rfapi_descriptor *rfd;
72 afi_t afi;
73 };
74
75
76 extern void rfapiRibClear(struct rfapi_descriptor *rfd);
77
78 extern void rfapiRibFree(struct rfapi_descriptor *rfd);
79
80 extern void rfapiRibUpdatePendingNode(struct bgp *bgp,
81 struct rfapi_descriptor *rfd,
82 struct rfapi_import_table *it,
83 struct agg_node *it_node,
84 uint32_t lifetime);
85
86 extern void rfapiRibUpdatePendingNodeSubtree(struct bgp *bgp,
87 struct rfapi_descriptor *rfd,
88 struct rfapi_import_table *it,
89 struct agg_node *it_node,
90 struct agg_node *omit_subtree,
91 uint32_t lifetime);
92
93 extern int rfapiRibPreloadBi(struct agg_node *rfd_rib_node,
94 struct prefix *pfx_vn, struct prefix *pfx_un,
95 uint32_t lifetime, struct bgp_path_info *bpi);
96
97 extern struct rfapi_next_hop_entry *
98 rfapiRibPreload(struct bgp *bgp, struct rfapi_descriptor *rfd,
99 struct rfapi_next_hop_entry *response, int use_eth_resolution);
100
101 extern void rfapiRibPendingDeleteRoute(struct bgp *bgp,
102 struct rfapi_import_table *it, afi_t afi,
103 struct agg_node *it_node);
104
105 extern void rfapiRibShowResponsesSummary(void *stream);
106
107 extern void rfapiRibShowResponsesSummaryClear(void);
108
109 extern void rfapiRibShowResponses(void *stream, struct prefix *pfx_match,
110 int show_removed);
111
112 extern int rfapiRibFTDFilterRecentPrefix(
113 struct rfapi_descriptor *rfd,
114 struct agg_node *it_rn, /* import table node */
115 struct prefix *pfx_target_original); /* query target */
116
117 extern void rfapiFreeRfapiUnOptionChain(struct rfapi_un_option *p);
118
119 extern void rfapiFreeRfapiVnOptionChain(struct rfapi_vn_option *p);
120
121 extern void
122 rfapiRibCheckCounts(int checkstats, /* validate rfd & global counts */
123 unsigned int offset); /* number of ri's held separately */
124
125 /* enable for debugging; disable for performance */
126 #if 0
127 #define RFAPI_RIB_CHECK_COUNTS(checkstats, offset) rfapiRibCheckCounts(checkstats, offset)
128 #else
129 #define RFAPI_RIB_CHECK_COUNTS(checkstats, offset)
130 #endif
131
132 extern void rfapi_rib_key_init(struct prefix *prefix, /* may be NULL */
133 struct prefix_rd *rd, /* may be NULL */
134 struct prefix *aux, /* may be NULL */
135 struct rfapi_rib_key *rk);
136
137 extern int rfapi_rib_key_cmp(const void *k1, const void *k2);
138
139 extern void rfapiAdbFree(struct rfapi_adb *adb);
140
141 #endif /* QUAGGA_HGP_RFAPI_RIB_H */