]>
Commit | Line | Data |
---|---|---|
ac4d0be5 | 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 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program; if not, write to the Free Software | |
18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
19 | * | |
20 | */ | |
21 | ||
22 | /* | |
23 | * File: rfapi_rib.h | |
24 | * Purpose: per-nve rib | |
25 | */ | |
26 | ||
27 | #ifndef QUAGGA_HGP_RFAPI_RIB_H | |
28 | #define QUAGGA_HGP_RFAPI_RIB_H | |
29 | ||
30 | /* | |
31 | * Key for indexing RIB and Pending RIB skiplists. For L3 RIBs, | |
32 | * the VN address is sufficient because it represents the actual next hop. | |
33 | * | |
34 | * For L2 RIBs, it is possible to have multiple routes to a given L2 | |
35 | * prefix via a given VN address, but each route having a unique aux_prefix. | |
36 | */ | |
ac4d0be5 | 37 | struct rfapi_rib_key { |
38 | struct prefix vn; | |
39 | struct prefix_rd rd; | |
40 | ||
41 | /* | |
42 | * for L2 routes: optional IP addr | |
43 | * .family == 0 means "none" | |
44 | */ | |
45 | struct prefix aux_prefix; | |
65efcfce | 46 | }; |
cedb5a71 LB |
47 | #include "rfapi.h" |
48 | ||
49 | /* | |
50 | * RFAPI Advertisement Data Block | |
51 | * | |
52 | * Holds NVE prefix advertisement information | |
53 | */ | |
ac4d0be5 | 54 | struct rfapi_adb { |
55 | union { | |
56 | struct { | |
57 | struct prefix prefix_ip; | |
58 | struct prefix_rd prd; | |
59 | struct prefix prefix_eth; | |
60 | } s; /* mainly for legacy use */ | |
61 | struct rfapi_rib_key key; | |
62 | } u; | |
63 | uint32_t lifetime; | |
64 | uint8_t cost; | |
65 | struct rfapi_l2address_option l2o; | |
cedb5a71 | 66 | }; |
65efcfce | 67 | |
ac4d0be5 | 68 | struct rfapi_info { |
69 | struct rfapi_rib_key rk; /* NVE VN addr + aux addr */ | |
70 | struct prefix un; | |
71 | uint8_t cost; | |
72 | uint32_t lifetime; | |
73 | time_t last_sent_time; | |
74 | uint32_t rsp_counter; /* dedup initial responses */ | |
75 | struct bgp_tea_options *tea_options; | |
76 | struct rfapi_un_option *un_options; | |
77 | struct rfapi_vn_option *vn_options; | |
78 | void *timer; | |
65efcfce LB |
79 | }; |
80 | ||
81 | /* | |
82 | * Work item for updated responses queue | |
83 | */ | |
ac4d0be5 | 84 | struct rfapi_updated_responses_queue { |
85 | struct rfapi_descriptor *rfd; | |
86 | afi_t afi; | |
65efcfce LB |
87 | }; |
88 | ||
89 | ||
ac4d0be5 | 90 | extern void rfapiRibClear(struct rfapi_descriptor *rfd); |
65efcfce | 91 | |
ac4d0be5 | 92 | extern void rfapiRibFree(struct rfapi_descriptor *rfd); |
65efcfce | 93 | |
ac4d0be5 | 94 | extern void rfapiRibUpdatePendingNode(struct bgp *bgp, |
95 | struct rfapi_descriptor *rfd, | |
96 | struct rfapi_import_table *it, | |
97 | struct route_node *it_node, | |
98 | uint32_t lifetime); | |
65efcfce | 99 | |
ac4d0be5 | 100 | extern void rfapiRibUpdatePendingNodeSubtree(struct bgp *bgp, |
101 | struct rfapi_descriptor *rfd, | |
102 | struct rfapi_import_table *it, | |
103 | struct route_node *it_node, | |
104 | struct route_node *omit_subtree, | |
105 | uint32_t lifetime); | |
106 | ||
107 | extern int rfapiRibPreloadBi(struct route_node *rfd_rib_node, | |
108 | struct prefix *pfx_vn, struct prefix *pfx_un, | |
109 | uint32_t lifetime, struct bgp_info *bi); | |
65efcfce LB |
110 | |
111 | extern struct rfapi_next_hop_entry * | |
ac4d0be5 | 112 | rfapiRibPreload(struct bgp *bgp, struct rfapi_descriptor *rfd, |
113 | struct rfapi_next_hop_entry *response, int use_eth_resolution); | |
65efcfce | 114 | |
ac4d0be5 | 115 | extern void rfapiRibPendingDeleteRoute(struct bgp *bgp, |
116 | struct rfapi_import_table *it, afi_t afi, | |
117 | struct route_node *it_node); | |
65efcfce | 118 | |
ac4d0be5 | 119 | extern void rfapiRibShowResponsesSummary(void *stream); |
65efcfce | 120 | |
ac4d0be5 | 121 | extern void rfapiRibShowResponsesSummaryClear(void); |
65efcfce | 122 | |
ac4d0be5 | 123 | extern void rfapiRibShowResponses(void *stream, struct prefix *pfx_match, |
124 | int show_removed); | |
65efcfce | 125 | |
ac4d0be5 | 126 | extern int rfapiRibFTDFilterRecentPrefix( |
127 | struct rfapi_descriptor *rfd, | |
128 | struct route_node *it_rn, /* import table node */ | |
129 | struct prefix *pfx_target_original); /* query target */ | |
65efcfce | 130 | |
ac4d0be5 | 131 | extern void rfapiFreeRfapiUnOptionChain(struct rfapi_un_option *p); |
65efcfce | 132 | |
ac4d0be5 | 133 | extern void rfapiFreeRfapiVnOptionChain(struct rfapi_vn_option *p); |
65efcfce LB |
134 | |
135 | extern void | |
ac4d0be5 | 136 | rfapiRibCheckCounts(int checkstats, /* validate rfd & global counts */ |
137 | unsigned int offset); /* number of ri's held separately */ | |
65efcfce LB |
138 | |
139 | /* enable for debugging; disable for performance */ | |
140 | #if 0 | |
141 | #define RFAPI_RIB_CHECK_COUNTS(checkstats, offset) rfapiRibCheckCounts(checkstats, offset) | |
142 | #else | |
143 | #define RFAPI_RIB_CHECK_COUNTS(checkstats, offset) | |
144 | #endif | |
145 | ||
ac4d0be5 | 146 | extern void rfapi_rib_key_init(struct prefix *prefix, /* may be NULL */ |
147 | struct prefix_rd *rd, /* may be NULL */ | |
148 | struct prefix *aux, /* may be NULL */ | |
149 | struct rfapi_rib_key *rk); | |
cedb5a71 | 150 | |
ac4d0be5 | 151 | extern int rfapi_rib_key_cmp(void *k1, void *k2); |
cedb5a71 | 152 | |
ac4d0be5 | 153 | extern void rfapiAdbFree(struct rfapi_adb *adb); |
cedb5a71 | 154 | |
65efcfce | 155 | #endif /* QUAGGA_HGP_RFAPI_RIB_H */ |