]>
Commit | Line | Data |
---|---|---|
acddc0ed | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
d62a17ae | 2 | /* |
65efcfce LB |
3 | * |
4 | * Copyright 2009-2016, LabN Consulting, L.L.C. | |
5 | * | |
65efcfce LB |
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 | */ | |
d62a17ae | 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; | |
65efcfce | 32 | }; |
cedb5a71 LB |
33 | #include "rfapi.h" |
34 | ||
35 | /* | |
36 | * RFAPI Advertisement Data Block | |
37 | * | |
38 | * Holds NVE prefix advertisement information | |
39 | */ | |
d62a17ae | 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; | |
cedb5a71 | 52 | }; |
65efcfce | 53 | |
d62a17ae | 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; | |
e6685141 | 64 | struct event *timer; |
65efcfce LB |
65 | }; |
66 | ||
67 | /* | |
68 | * Work item for updated responses queue | |
69 | */ | |
d62a17ae | 70 | struct rfapi_updated_responses_queue { |
71 | struct rfapi_descriptor *rfd; | |
72 | afi_t afi; | |
65efcfce LB |
73 | }; |
74 | ||
75 | ||
d62a17ae | 76 | extern void rfapiRibClear(struct rfapi_descriptor *rfd); |
65efcfce | 77 | |
d62a17ae | 78 | extern void rfapiRibFree(struct rfapi_descriptor *rfd); |
65efcfce | 79 | |
d62a17ae | 80 | extern void rfapiRibUpdatePendingNode(struct bgp *bgp, |
81 | struct rfapi_descriptor *rfd, | |
82 | struct rfapi_import_table *it, | |
fe08ba7e | 83 | struct agg_node *it_node, |
d62a17ae | 84 | uint32_t lifetime); |
65efcfce | 85 | |
d62a17ae | 86 | extern void rfapiRibUpdatePendingNodeSubtree(struct bgp *bgp, |
87 | struct rfapi_descriptor *rfd, | |
88 | struct rfapi_import_table *it, | |
fe08ba7e DS |
89 | struct agg_node *it_node, |
90 | struct agg_node *omit_subtree, | |
d62a17ae | 91 | uint32_t lifetime); |
92 | ||
fe08ba7e | 93 | extern int rfapiRibPreloadBi(struct agg_node *rfd_rib_node, |
d62a17ae | 94 | struct prefix *pfx_vn, struct prefix *pfx_un, |
40381db7 | 95 | uint32_t lifetime, struct bgp_path_info *bpi); |
65efcfce LB |
96 | |
97 | extern struct rfapi_next_hop_entry * | |
d62a17ae | 98 | rfapiRibPreload(struct bgp *bgp, struct rfapi_descriptor *rfd, |
99 | struct rfapi_next_hop_entry *response, int use_eth_resolution); | |
65efcfce | 100 | |
d62a17ae | 101 | extern void rfapiRibPendingDeleteRoute(struct bgp *bgp, |
102 | struct rfapi_import_table *it, afi_t afi, | |
fe08ba7e | 103 | struct agg_node *it_node); |
65efcfce | 104 | |
d62a17ae | 105 | extern void rfapiRibShowResponsesSummary(void *stream); |
65efcfce | 106 | |
d62a17ae | 107 | extern void rfapiRibShowResponsesSummaryClear(void); |
65efcfce | 108 | |
d62a17ae | 109 | extern void rfapiRibShowResponses(void *stream, struct prefix *pfx_match, |
110 | int show_removed); | |
65efcfce | 111 | |
d62a17ae | 112 | extern int rfapiRibFTDFilterRecentPrefix( |
113 | struct rfapi_descriptor *rfd, | |
fe08ba7e | 114 | struct agg_node *it_rn, /* import table node */ |
d62a17ae | 115 | struct prefix *pfx_target_original); /* query target */ |
65efcfce | 116 | |
d62a17ae | 117 | extern void rfapiFreeRfapiUnOptionChain(struct rfapi_un_option *p); |
65efcfce | 118 | |
d62a17ae | 119 | extern void rfapiFreeRfapiVnOptionChain(struct rfapi_vn_option *p); |
65efcfce LB |
120 | |
121 | extern void | |
d62a17ae | 122 | rfapiRibCheckCounts(int checkstats, /* validate rfd & global counts */ |
123 | unsigned int offset); /* number of ri's held separately */ | |
65efcfce LB |
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 | ||
d62a17ae | 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); | |
cedb5a71 | 136 | |
1a4189d4 | 137 | extern int rfapi_rib_key_cmp(const void *k1, const void *k2); |
cedb5a71 | 138 | |
d62a17ae | 139 | extern void rfapiAdbFree(struct rfapi_adb *adb); |
cedb5a71 | 140 | |
65efcfce | 141 | #endif /* QUAGGA_HGP_RFAPI_RIB_H */ |