3 * Copyright 2009-2016, LabN Consulting, L.L.C.
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.
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.
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
23 * Purpose: per-nve rib
26 #ifndef QUAGGA_HGP_RFAPI_RIB_H
27 #define QUAGGA_HGP_RFAPI_RIB_H
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.
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.
36 struct rfapi_rib_key
{
41 * for L2 routes: optional IP addr
42 * .family == 0 means "none"
44 struct prefix aux_prefix
;
49 * RFAPI Advertisement Data Block
51 * Holds NVE prefix advertisement information
56 struct prefix prefix_ip
;
58 struct prefix prefix_eth
;
59 } s
; /* mainly for legacy use */
60 struct rfapi_rib_key key
;
64 struct rfapi_l2address_option l2o
;
68 struct rfapi_rib_key rk
; /* NVE VN addr + aux addr */
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
;
81 * Work item for updated responses queue
83 struct rfapi_updated_responses_queue
{
84 struct rfapi_descriptor
*rfd
;
89 extern void rfapiRibClear(struct rfapi_descriptor
*rfd
);
91 extern void rfapiRibFree(struct rfapi_descriptor
*rfd
);
93 extern void rfapiRibUpdatePendingNode(struct bgp
*bgp
,
94 struct rfapi_descriptor
*rfd
,
95 struct rfapi_import_table
*it
,
96 struct agg_node
*it_node
,
99 extern void rfapiRibUpdatePendingNodeSubtree(struct bgp
*bgp
,
100 struct rfapi_descriptor
*rfd
,
101 struct rfapi_import_table
*it
,
102 struct agg_node
*it_node
,
103 struct agg_node
*omit_subtree
,
106 extern int rfapiRibPreloadBi(struct agg_node
*rfd_rib_node
,
107 struct prefix
*pfx_vn
, struct prefix
*pfx_un
,
108 uint32_t lifetime
, struct bgp_path_info
*bpi
);
110 extern struct rfapi_next_hop_entry
*
111 rfapiRibPreload(struct bgp
*bgp
, struct rfapi_descriptor
*rfd
,
112 struct rfapi_next_hop_entry
*response
, int use_eth_resolution
);
114 extern void rfapiRibPendingDeleteRoute(struct bgp
*bgp
,
115 struct rfapi_import_table
*it
, afi_t afi
,
116 struct agg_node
*it_node
);
118 extern void rfapiRibShowResponsesSummary(void *stream
);
120 extern void rfapiRibShowResponsesSummaryClear(void);
122 extern void rfapiRibShowResponses(void *stream
, struct prefix
*pfx_match
,
125 extern int rfapiRibFTDFilterRecentPrefix(
126 struct rfapi_descriptor
*rfd
,
127 struct agg_node
*it_rn
, /* import table node */
128 struct prefix
*pfx_target_original
); /* query target */
130 extern void rfapiFreeRfapiUnOptionChain(struct rfapi_un_option
*p
);
132 extern void rfapiFreeRfapiVnOptionChain(struct rfapi_vn_option
*p
);
135 rfapiRibCheckCounts(int checkstats
, /* validate rfd & global counts */
136 unsigned int offset
); /* number of ri's held separately */
138 /* enable for debugging; disable for performance */
140 #define RFAPI_RIB_CHECK_COUNTS(checkstats, offset) rfapiRibCheckCounts(checkstats, offset)
142 #define RFAPI_RIB_CHECK_COUNTS(checkstats, offset)
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
);
150 extern int rfapi_rib_key_cmp(const void *k1
, const void *k2
);
152 extern void rfapiAdbFree(struct rfapi_adb
*adb
);
154 #endif /* QUAGGA_HGP_RFAPI_RIB_H */