]>
Commit | Line | Data |
---|---|---|
d62a17ae | 1 | /* |
65efcfce LB |
2 | * |
3 | * Copyright 2009-2016, LabN Consulting, L.L.C. | |
4 | * | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or | |
7 | * modify it under the terms of the GNU General Public License | |
8 | * as published by the Free Software Foundation; either version 2 | |
9 | * of the License, or (at your option) any later version. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU 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 | |
65efcfce LB |
19 | */ |
20 | ||
21 | /* | |
22 | * File: rfapi_rib.h | |
23 | * Purpose: per-nve rib | |
24 | */ | |
25 | ||
26 | #ifndef QUAGGA_HGP_RFAPI_RIB_H | |
27 | #define QUAGGA_HGP_RFAPI_RIB_H | |
28 | ||
29 | /* | |
30 | * Key for indexing RIB and Pending RIB skiplists. For L3 RIBs, | |
31 | * the VN address is sufficient because it represents the actual next hop. | |
32 | * | |
33 | * For L2 RIBs, it is possible to have multiple routes to a given L2 | |
34 | * prefix via a given VN address, but each route having a unique aux_prefix. | |
35 | */ | |
d62a17ae | 36 | struct rfapi_rib_key { |
37 | struct prefix vn; | |
38 | struct prefix_rd rd; | |
39 | ||
40 | /* | |
41 | * for L2 routes: optional IP addr | |
42 | * .family == 0 means "none" | |
43 | */ | |
44 | struct prefix aux_prefix; | |
65efcfce | 45 | }; |
cedb5a71 LB |
46 | #include "rfapi.h" |
47 | ||
48 | /* | |
49 | * RFAPI Advertisement Data Block | |
50 | * | |
51 | * Holds NVE prefix advertisement information | |
52 | */ | |
d62a17ae | 53 | struct rfapi_adb { |
54 | union { | |
55 | struct { | |
56 | struct prefix prefix_ip; | |
57 | struct prefix_rd prd; | |
58 | struct prefix prefix_eth; | |
59 | } s; /* mainly for legacy use */ | |
60 | struct rfapi_rib_key key; | |
61 | } u; | |
62 | uint32_t lifetime; | |
63 | uint8_t cost; | |
64 | struct rfapi_l2address_option l2o; | |
cedb5a71 | 65 | }; |
65efcfce | 66 | |
d62a17ae | 67 | struct rfapi_info { |
68 | struct rfapi_rib_key rk; /* NVE VN addr + aux addr */ | |
69 | struct prefix un; | |
70 | uint8_t cost; | |
71 | uint32_t lifetime; | |
72 | time_t last_sent_time; | |
73 | uint32_t rsp_counter; /* dedup initial responses */ | |
74 | struct bgp_tea_options *tea_options; | |
75 | struct rfapi_un_option *un_options; | |
76 | struct rfapi_vn_option *vn_options; | |
77 | struct thread *timer; | |
65efcfce LB |
78 | }; |
79 | ||
80 | /* | |
81 | * Work item for updated responses queue | |
82 | */ | |
d62a17ae | 83 | struct rfapi_updated_responses_queue { |
84 | struct rfapi_descriptor *rfd; | |
85 | afi_t afi; | |
65efcfce LB |
86 | }; |
87 | ||
88 | ||
d62a17ae | 89 | extern void rfapiRibClear(struct rfapi_descriptor *rfd); |
65efcfce | 90 | |
d62a17ae | 91 | extern void rfapiRibFree(struct rfapi_descriptor *rfd); |
65efcfce | 92 | |
d62a17ae | 93 | extern void rfapiRibUpdatePendingNode(struct bgp *bgp, |
94 | struct rfapi_descriptor *rfd, | |
95 | struct rfapi_import_table *it, | |
fe08ba7e | 96 | struct agg_node *it_node, |
d62a17ae | 97 | uint32_t lifetime); |
65efcfce | 98 | |
d62a17ae | 99 | extern void rfapiRibUpdatePendingNodeSubtree(struct bgp *bgp, |
100 | struct rfapi_descriptor *rfd, | |
101 | struct rfapi_import_table *it, | |
fe08ba7e DS |
102 | struct agg_node *it_node, |
103 | struct agg_node *omit_subtree, | |
d62a17ae | 104 | uint32_t lifetime); |
105 | ||
fe08ba7e | 106 | extern int rfapiRibPreloadBi(struct agg_node *rfd_rib_node, |
d62a17ae | 107 | struct prefix *pfx_vn, struct prefix *pfx_un, |
40381db7 | 108 | uint32_t lifetime, struct bgp_path_info *bpi); |
65efcfce LB |
109 | |
110 | extern struct rfapi_next_hop_entry * | |
d62a17ae | 111 | rfapiRibPreload(struct bgp *bgp, struct rfapi_descriptor *rfd, |
112 | struct rfapi_next_hop_entry *response, int use_eth_resolution); | |
65efcfce | 113 | |
d62a17ae | 114 | extern void rfapiRibPendingDeleteRoute(struct bgp *bgp, |
115 | struct rfapi_import_table *it, afi_t afi, | |
fe08ba7e | 116 | struct agg_node *it_node); |
65efcfce | 117 | |
d62a17ae | 118 | extern void rfapiRibShowResponsesSummary(void *stream); |
65efcfce | 119 | |
d62a17ae | 120 | extern void rfapiRibShowResponsesSummaryClear(void); |
65efcfce | 121 | |
d62a17ae | 122 | extern void rfapiRibShowResponses(void *stream, struct prefix *pfx_match, |
123 | int show_removed); | |
65efcfce | 124 | |
d62a17ae | 125 | extern int rfapiRibFTDFilterRecentPrefix( |
126 | struct rfapi_descriptor *rfd, | |
fe08ba7e | 127 | struct agg_node *it_rn, /* import table node */ |
d62a17ae | 128 | struct prefix *pfx_target_original); /* query target */ |
65efcfce | 129 | |
d62a17ae | 130 | extern void rfapiFreeRfapiUnOptionChain(struct rfapi_un_option *p); |
65efcfce | 131 | |
d62a17ae | 132 | extern void rfapiFreeRfapiVnOptionChain(struct rfapi_vn_option *p); |
65efcfce LB |
133 | |
134 | extern void | |
d62a17ae | 135 | rfapiRibCheckCounts(int checkstats, /* validate rfd & global counts */ |
136 | unsigned int offset); /* number of ri's held separately */ | |
65efcfce LB |
137 | |
138 | /* enable for debugging; disable for performance */ | |
139 | #if 0 | |
140 | #define RFAPI_RIB_CHECK_COUNTS(checkstats, offset) rfapiRibCheckCounts(checkstats, offset) | |
141 | #else | |
142 | #define RFAPI_RIB_CHECK_COUNTS(checkstats, offset) | |
143 | #endif | |
144 | ||
d62a17ae | 145 | extern void rfapi_rib_key_init(struct prefix *prefix, /* may be NULL */ |
146 | struct prefix_rd *rd, /* may be NULL */ | |
147 | struct prefix *aux, /* may be NULL */ | |
148 | struct rfapi_rib_key *rk); | |
cedb5a71 | 149 | |
d62a17ae | 150 | extern int rfapi_rib_key_cmp(void *k1, void *k2); |
cedb5a71 | 151 | |
d62a17ae | 152 | extern void rfapiAdbFree(struct rfapi_adb *adb); |
cedb5a71 | 153 | |
65efcfce | 154 | #endif /* QUAGGA_HGP_RFAPI_RIB_H */ |