1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * Copyright 2009-2016, LabN Consulting, L.L.C.
10 * Purpose: per-nve rib
13 #ifndef QUAGGA_HGP_RFAPI_RIB_H
14 #define QUAGGA_HGP_RFAPI_RIB_H
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.
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.
23 struct rfapi_rib_key
{
28 * for L2 routes: optional IP addr
29 * .family == 0 means "none"
31 struct prefix aux_prefix
;
36 * RFAPI Advertisement Data Block
38 * Holds NVE prefix advertisement information
43 struct prefix prefix_ip
;
45 struct prefix prefix_eth
;
46 } s
; /* mainly for legacy use */
47 struct rfapi_rib_key key
;
51 struct rfapi_l2address_option l2o
;
55 struct rfapi_rib_key rk
; /* NVE VN addr + aux addr */
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
;
68 * Work item for updated responses queue
70 struct rfapi_updated_responses_queue
{
71 struct rfapi_descriptor
*rfd
;
76 extern void rfapiRibClear(struct rfapi_descriptor
*rfd
);
78 extern void rfapiRibFree(struct rfapi_descriptor
*rfd
);
80 extern void rfapiRibUpdatePendingNode(struct bgp
*bgp
,
81 struct rfapi_descriptor
*rfd
,
82 struct rfapi_import_table
*it
,
83 struct agg_node
*it_node
,
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
,
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
);
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
);
101 extern void rfapiRibPendingDeleteRoute(struct bgp
*bgp
,
102 struct rfapi_import_table
*it
, afi_t afi
,
103 struct agg_node
*it_node
);
105 extern void rfapiRibShowResponsesSummary(void *stream
);
107 extern void rfapiRibShowResponsesSummaryClear(void);
109 extern void rfapiRibShowResponses(void *stream
, struct prefix
*pfx_match
,
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 */
117 extern void rfapiFreeRfapiUnOptionChain(struct rfapi_un_option
*p
);
119 extern void rfapiFreeRfapiVnOptionChain(struct rfapi_vn_option
*p
);
122 rfapiRibCheckCounts(int checkstats
, /* validate rfd & global counts */
123 unsigned int offset
); /* number of ri's held separately */
125 /* enable for debugging; disable for performance */
127 #define RFAPI_RIB_CHECK_COUNTS(checkstats, offset) rfapiRibCheckCounts(checkstats, offset)
129 #define RFAPI_RIB_CHECK_COUNTS(checkstats, offset)
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
);
137 extern int rfapi_rib_key_cmp(const void *k1
, const void *k2
);
139 extern void rfapiAdbFree(struct rfapi_adb
*adb
);
141 #endif /* QUAGGA_HGP_RFAPI_RIB_H */