/src/frr/bgpd/bgp_mplsvpn.h
Line | Count | Source |
1 | | // SPDX-License-Identifier: GPL-2.0-or-later |
2 | | /* MPLS-VPN |
3 | | * Copyright (C) 2000 Kunihiro Ishiguro <kunihiro@zebra.org> |
4 | | * |
5 | | * This file is part of GxNU Zebra. |
6 | | */ |
7 | | |
8 | | #ifndef _QUAGGA_BGP_MPLSVPN_H |
9 | | #define _QUAGGA_BGP_MPLSVPN_H |
10 | | |
11 | | #include "bgpd/bgp_attr.h" |
12 | | #include "bgpd/bgp_route.h" |
13 | | #include "bgpd/bgp_rd.h" |
14 | | #include "bgpd/bgp_zebra.h" |
15 | | #include "bgpd/bgp_vty.h" |
16 | | |
17 | | #define MPLS_LABEL_IS_SPECIAL(label) ((label) <= MPLS_LABEL_EXTENSION) |
18 | | #define MPLS_LABEL_IS_NULL(label) \ |
19 | 0 | ((label) == MPLS_LABEL_IPV4_EXPLICIT_NULL \ |
20 | 0 | || (label) == MPLS_LABEL_IPV6_EXPLICIT_NULL \ |
21 | 0 | || (label) == MPLS_LABEL_IMPLICIT_NULL) |
22 | | |
23 | | #define BGP_VPNVX_HELP_STR BGP_AF_STR BGP_AF_STR |
24 | | |
25 | | #define V4_HEADER \ |
26 | 0 | " Network Next Hop Metric LocPrf Weight Path\n" |
27 | 0 | #define V4_HEADER_TAG " Network Next Hop In tag/Out tag\n" |
28 | | #define V4_HEADER_OVERLAY \ |
29 | 0 | " Network Next Hop EthTag Overlay Index RouterMac\n" |
30 | | |
31 | 0 | #define BGP_PREFIX_SID_SRV6_MAX_FUNCTION_LENGTH 20 |
32 | | |
33 | | extern void bgp_mplsvpn_init(void); |
34 | | extern void bgp_mplsvpn_path_nh_label_unlink(struct bgp_path_info *pi); |
35 | | extern int bgp_nlri_parse_vpn(struct peer *, struct attr *, struct bgp_nlri *); |
36 | | extern uint32_t decode_label(mpls_label_t *); |
37 | | extern void encode_label(mpls_label_t, mpls_label_t *); |
38 | | |
39 | | extern int argv_find_and_parse_vpnvx(struct cmd_token **argv, int argc, |
40 | | int *index, afi_t *afi); |
41 | | extern int bgp_show_mpls_vpn(struct vty *vty, afi_t afi, struct prefix_rd *prd, |
42 | | enum bgp_show_type type, void *output_arg, |
43 | | int tags, bool use_json); |
44 | | |
45 | | extern void vpn_leak_from_vrf_update(struct bgp *to_bgp, struct bgp *from_bgp, |
46 | | struct bgp_path_info *path_vrf); |
47 | | |
48 | | extern void vpn_leak_from_vrf_withdraw(struct bgp *to_bgp, struct bgp *from_bgp, |
49 | | struct bgp_path_info *path_vrf); |
50 | | |
51 | | extern void vpn_leak_from_vrf_withdraw_all(struct bgp *to_bgp, |
52 | | struct bgp *from_bgp, afi_t afi); |
53 | | |
54 | | extern void vpn_leak_from_vrf_update_all(struct bgp *to_bgp, |
55 | | struct bgp *from_bgp, afi_t afi); |
56 | | |
57 | | extern void vpn_leak_to_vrf_withdraw_all(struct bgp *to_bgp, afi_t afi); |
58 | | |
59 | | extern void vpn_leak_to_vrf_update_all(struct bgp *to_bgp, struct bgp *from_bgp, |
60 | | afi_t afi); |
61 | | |
62 | | extern bool vpn_leak_to_vrf_update(struct bgp *from_bgp, |
63 | | struct bgp_path_info *path_vpn, |
64 | | struct prefix_rd *prd); |
65 | | |
66 | | extern void vpn_leak_to_vrf_withdraw(struct bgp_path_info *path_vpn); |
67 | | |
68 | | extern void vpn_leak_zebra_vrf_label_update(struct bgp *bgp, afi_t afi); |
69 | | extern void vpn_leak_zebra_vrf_label_withdraw(struct bgp *bgp, afi_t afi); |
70 | | extern void vpn_leak_zebra_vrf_sid_update(struct bgp *bgp, afi_t afi); |
71 | | extern void vpn_leak_zebra_vrf_sid_update_per_af(struct bgp *bgp, afi_t afi); |
72 | | extern void vpn_leak_zebra_vrf_sid_update_per_vrf(struct bgp *bgp); |
73 | | extern void vpn_leak_zebra_vrf_sid_withdraw(struct bgp *bgp, afi_t afi); |
74 | | extern void vpn_leak_zebra_vrf_sid_withdraw_per_af(struct bgp *bgp, afi_t afi); |
75 | | extern void vpn_leak_zebra_vrf_sid_withdraw_per_vrf(struct bgp *bgp); |
76 | | extern int vpn_leak_label_callback(mpls_label_t label, void *lblid, bool alloc); |
77 | | extern void ensure_vrf_tovpn_sid(struct bgp *vpn, struct bgp *vrf, afi_t afi); |
78 | | extern void delete_vrf_tovpn_sid(struct bgp *vpn, struct bgp *vrf, afi_t afi); |
79 | | extern void delete_vrf_tovpn_sid_per_af(struct bgp *vpn, struct bgp *vrf, |
80 | | afi_t afi); |
81 | | extern void delete_vrf_tovpn_sid_per_vrf(struct bgp *vpn, struct bgp *vrf); |
82 | | extern void ensure_vrf_tovpn_sid_per_af(struct bgp *vpn, struct bgp *vrf, |
83 | | afi_t afi); |
84 | | extern void ensure_vrf_tovpn_sid_per_vrf(struct bgp *vpn, struct bgp *vrf); |
85 | | extern void transpose_sid(struct in6_addr *sid, uint32_t label, uint8_t offset, |
86 | | uint8_t size); |
87 | | extern void vrf_import_from_vrf(struct bgp *to_bgp, struct bgp *from_bgp, |
88 | | afi_t afi, safi_t safi); |
89 | | void vrf_unimport_from_vrf(struct bgp *to_bgp, struct bgp *from_bgp, |
90 | | afi_t afi, safi_t safi); |
91 | | |
92 | | static inline bool is_bgp_vrf_mplsvpn(struct bgp *bgp) |
93 | 0 | { |
94 | 0 | afi_t afi; |
95 | 0 |
|
96 | 0 | if (bgp->inst_type == BGP_INSTANCE_TYPE_VRF) |
97 | 0 | for (afi = 0; afi < AFI_MAX; ++afi) { |
98 | 0 | if (CHECK_FLAG(bgp->af_flags[afi][SAFI_UNICAST], |
99 | 0 | BGP_CONFIG_VRF_TO_MPLSVPN_EXPORT) |
100 | 0 | || CHECK_FLAG(bgp->af_flags[afi][SAFI_UNICAST], |
101 | 0 | BGP_CONFIG_MPLSVPN_TO_VRF_IMPORT)) |
102 | 0 | return true; |
103 | 0 | } |
104 | 0 | return false; |
105 | 0 | } Unexecuted instantiation: bgp_main.c:is_bgp_vrf_mplsvpn Unexecuted instantiation: bgp_debug.c:is_bgp_vrf_mplsvpn Unexecuted instantiation: bgp_evpn.c:is_bgp_vrf_mplsvpn Unexecuted instantiation: bgp_evpn_mh.c:is_bgp_vrf_mplsvpn Unexecuted instantiation: bgp_evpn_vty.c:is_bgp_vrf_mplsvpn Unexecuted instantiation: bgp_mplsvpn.c:is_bgp_vrf_mplsvpn Unexecuted instantiation: bgp_nexthop.c:is_bgp_vrf_mplsvpn Unexecuted instantiation: bgp_nht.c:is_bgp_vrf_mplsvpn Unexecuted instantiation: bgp_packet.c:is_bgp_vrf_mplsvpn Unexecuted instantiation: bgp_pbr.c:is_bgp_vrf_mplsvpn Unexecuted instantiation: bgp_route.c:is_bgp_vrf_mplsvpn Unexecuted instantiation: bgp_routemap.c:is_bgp_vrf_mplsvpn Unexecuted instantiation: bgp_updgrp_adv.c:is_bgp_vrf_mplsvpn Unexecuted instantiation: bgp_updgrp_packet.c:is_bgp_vrf_mplsvpn Unexecuted instantiation: bgp_vpn.c:is_bgp_vrf_mplsvpn Unexecuted instantiation: bgp_vty.c:is_bgp_vrf_mplsvpn Unexecuted instantiation: bgp_zebra.c:is_bgp_vrf_mplsvpn Unexecuted instantiation: bgpd.c:is_bgp_vrf_mplsvpn Unexecuted instantiation: bgp_rfapi_cfg.c:is_bgp_vrf_mplsvpn Unexecuted instantiation: rfapi_import.c:is_bgp_vrf_mplsvpn Unexecuted instantiation: rfapi.c:is_bgp_vrf_mplsvpn Unexecuted instantiation: rfapi_ap.c:is_bgp_vrf_mplsvpn Unexecuted instantiation: rfapi_rib.c:is_bgp_vrf_mplsvpn Unexecuted instantiation: rfapi_vty.c:is_bgp_vrf_mplsvpn Unexecuted instantiation: vnc_import_bgp.c:is_bgp_vrf_mplsvpn Unexecuted instantiation: bgp_advertise.c:is_bgp_vrf_mplsvpn |
106 | | |
107 | | static inline int vpn_leak_to_vpn_active(struct bgp *bgp_vrf, afi_t afi, |
108 | | const char **pmsg) |
109 | 0 | { |
110 | 0 | if (bgp_vrf->inst_type != BGP_INSTANCE_TYPE_VRF |
111 | 0 | && bgp_vrf->inst_type != BGP_INSTANCE_TYPE_DEFAULT) { |
112 | |
|
113 | 0 | if (pmsg) |
114 | 0 | *pmsg = "source bgp instance neither vrf nor default"; |
115 | 0 | return 0; |
116 | 0 | } |
117 | | |
118 | | /* Is vrf configured to export to vpn? */ |
119 | 0 | if (!CHECK_FLAG(bgp_vrf->af_flags[afi][SAFI_UNICAST], |
120 | 0 | BGP_CONFIG_VRF_TO_MPLSVPN_EXPORT) |
121 | 0 | && !CHECK_FLAG(bgp_vrf->af_flags[afi][SAFI_UNICAST], |
122 | 0 | BGP_CONFIG_VRF_TO_VRF_EXPORT)) { |
123 | 0 | if (pmsg) |
124 | 0 | *pmsg = "export not set"; |
125 | 0 | return 0; |
126 | 0 | } |
127 | | |
128 | | /* Is there an RT list set? */ |
129 | 0 | if (!bgp_vrf->vpn_policy[afi].rtlist[BGP_VPN_POLICY_DIR_TOVPN]) { |
130 | 0 | if (pmsg) |
131 | 0 | *pmsg = "rtlist tovpn not defined"; |
132 | 0 | return 0; |
133 | 0 | } |
134 | | |
135 | | /* Is there an RD set? */ |
136 | 0 | if (!CHECK_FLAG(bgp_vrf->vpn_policy[afi].flags, |
137 | 0 | BGP_VPN_POLICY_TOVPN_RD_SET)) { |
138 | 0 | if (pmsg) |
139 | 0 | *pmsg = "rd not defined"; |
140 | 0 | return 0; |
141 | 0 | } |
142 | | |
143 | | /* Is a route-map specified, but not defined? */ |
144 | 0 | if (bgp_vrf->vpn_policy[afi].rmap_name[BGP_VPN_POLICY_DIR_TOVPN] && |
145 | 0 | !bgp_vrf->vpn_policy[afi].rmap[BGP_VPN_POLICY_DIR_TOVPN]) { |
146 | 0 | if (pmsg) |
147 | 0 | *pmsg = "route-map tovpn named but not defined"; |
148 | 0 | return 0; |
149 | 0 | } |
150 | | |
151 | | /* Is there an "auto" export label that isn't allocated yet? */ |
152 | 0 | if (CHECK_FLAG(bgp_vrf->vpn_policy[afi].flags, |
153 | 0 | BGP_VPN_POLICY_TOVPN_LABEL_AUTO) && |
154 | 0 | (bgp_vrf->vpn_policy[afi].tovpn_label == MPLS_LABEL_NONE)) { |
155 | |
|
156 | 0 | if (pmsg) |
157 | 0 | *pmsg = "auto label not allocated"; |
158 | 0 | return 0; |
159 | 0 | } |
160 | | |
161 | 0 | return 1; |
162 | 0 | } Unexecuted instantiation: bgp_main.c:vpn_leak_to_vpn_active Unexecuted instantiation: bgp_debug.c:vpn_leak_to_vpn_active Unexecuted instantiation: bgp_evpn.c:vpn_leak_to_vpn_active Unexecuted instantiation: bgp_evpn_mh.c:vpn_leak_to_vpn_active Unexecuted instantiation: bgp_evpn_vty.c:vpn_leak_to_vpn_active Unexecuted instantiation: bgp_mplsvpn.c:vpn_leak_to_vpn_active Unexecuted instantiation: bgp_nexthop.c:vpn_leak_to_vpn_active Unexecuted instantiation: bgp_nht.c:vpn_leak_to_vpn_active Unexecuted instantiation: bgp_packet.c:vpn_leak_to_vpn_active Unexecuted instantiation: bgp_pbr.c:vpn_leak_to_vpn_active Unexecuted instantiation: bgp_route.c:vpn_leak_to_vpn_active Unexecuted instantiation: bgp_routemap.c:vpn_leak_to_vpn_active Unexecuted instantiation: bgp_updgrp_adv.c:vpn_leak_to_vpn_active Unexecuted instantiation: bgp_updgrp_packet.c:vpn_leak_to_vpn_active Unexecuted instantiation: bgp_vpn.c:vpn_leak_to_vpn_active Unexecuted instantiation: bgp_vty.c:vpn_leak_to_vpn_active Unexecuted instantiation: bgp_zebra.c:vpn_leak_to_vpn_active Unexecuted instantiation: bgpd.c:vpn_leak_to_vpn_active Unexecuted instantiation: bgp_rfapi_cfg.c:vpn_leak_to_vpn_active Unexecuted instantiation: rfapi_import.c:vpn_leak_to_vpn_active Unexecuted instantiation: rfapi.c:vpn_leak_to_vpn_active Unexecuted instantiation: rfapi_ap.c:vpn_leak_to_vpn_active Unexecuted instantiation: rfapi_rib.c:vpn_leak_to_vpn_active Unexecuted instantiation: rfapi_vty.c:vpn_leak_to_vpn_active Unexecuted instantiation: vnc_import_bgp.c:vpn_leak_to_vpn_active Unexecuted instantiation: bgp_advertise.c:vpn_leak_to_vpn_active |
163 | | |
164 | | static inline int vpn_leak_from_vpn_active(struct bgp *bgp_vrf, afi_t afi, |
165 | | const char **pmsg) |
166 | 0 | { |
167 | 0 | if (bgp_vrf->inst_type != BGP_INSTANCE_TYPE_VRF |
168 | 0 | && bgp_vrf->inst_type != BGP_INSTANCE_TYPE_DEFAULT) { |
169 | |
|
170 | 0 | if (pmsg) |
171 | 0 | *pmsg = "destination bgp instance neither vrf nor default"; |
172 | 0 | return 0; |
173 | 0 | } |
174 | | |
175 | 0 | if (bgp_vrf->vrf_id == VRF_UNKNOWN) { |
176 | 0 | if (pmsg) |
177 | 0 | *pmsg = "destination bgp instance vrf is VRF_UNKNOWN"; |
178 | 0 | return 0; |
179 | 0 | } |
180 | | |
181 | | /* Is vrf configured to import from vpn? */ |
182 | 0 | if (!CHECK_FLAG(bgp_vrf->af_flags[afi][SAFI_UNICAST], |
183 | 0 | BGP_CONFIG_MPLSVPN_TO_VRF_IMPORT) |
184 | 0 | && !CHECK_FLAG(bgp_vrf->af_flags[afi][SAFI_UNICAST], |
185 | 0 | BGP_CONFIG_VRF_TO_VRF_IMPORT)) { |
186 | 0 | if (pmsg) |
187 | 0 | *pmsg = "import not set"; |
188 | 0 | return 0; |
189 | 0 | } |
190 | | |
191 | | /* Is there an RT list set? */ |
192 | 0 | if (!bgp_vrf->vpn_policy[afi].rtlist[BGP_VPN_POLICY_DIR_FROMVPN]) { |
193 | 0 | if (pmsg) |
194 | 0 | *pmsg = "rtlist fromvpn not defined"; |
195 | 0 | return 0; |
196 | 0 | } |
197 | | |
198 | | /* Is a route-map specified, but not defined? */ |
199 | 0 | if (bgp_vrf->vpn_policy[afi].rmap_name[BGP_VPN_POLICY_DIR_FROMVPN] && |
200 | 0 | !bgp_vrf->vpn_policy[afi].rmap[BGP_VPN_POLICY_DIR_FROMVPN]) { |
201 | 0 | if (pmsg) |
202 | 0 | *pmsg = "route-map fromvpn named but not defined"; |
203 | 0 | return 0; |
204 | 0 | } |
205 | 0 | return 1; |
206 | 0 | } Unexecuted instantiation: bgp_main.c:vpn_leak_from_vpn_active Unexecuted instantiation: bgp_debug.c:vpn_leak_from_vpn_active Unexecuted instantiation: bgp_evpn.c:vpn_leak_from_vpn_active Unexecuted instantiation: bgp_evpn_mh.c:vpn_leak_from_vpn_active Unexecuted instantiation: bgp_evpn_vty.c:vpn_leak_from_vpn_active Unexecuted instantiation: bgp_mplsvpn.c:vpn_leak_from_vpn_active Unexecuted instantiation: bgp_nexthop.c:vpn_leak_from_vpn_active Unexecuted instantiation: bgp_nht.c:vpn_leak_from_vpn_active Unexecuted instantiation: bgp_packet.c:vpn_leak_from_vpn_active Unexecuted instantiation: bgp_pbr.c:vpn_leak_from_vpn_active Unexecuted instantiation: bgp_route.c:vpn_leak_from_vpn_active Unexecuted instantiation: bgp_routemap.c:vpn_leak_from_vpn_active Unexecuted instantiation: bgp_updgrp_adv.c:vpn_leak_from_vpn_active Unexecuted instantiation: bgp_updgrp_packet.c:vpn_leak_from_vpn_active Unexecuted instantiation: bgp_vpn.c:vpn_leak_from_vpn_active Unexecuted instantiation: bgp_vty.c:vpn_leak_from_vpn_active Unexecuted instantiation: bgp_zebra.c:vpn_leak_from_vpn_active Unexecuted instantiation: bgpd.c:vpn_leak_from_vpn_active Unexecuted instantiation: bgp_rfapi_cfg.c:vpn_leak_from_vpn_active Unexecuted instantiation: rfapi_import.c:vpn_leak_from_vpn_active Unexecuted instantiation: rfapi.c:vpn_leak_from_vpn_active Unexecuted instantiation: rfapi_ap.c:vpn_leak_from_vpn_active Unexecuted instantiation: rfapi_rib.c:vpn_leak_from_vpn_active Unexecuted instantiation: rfapi_vty.c:vpn_leak_from_vpn_active Unexecuted instantiation: vnc_import_bgp.c:vpn_leak_from_vpn_active Unexecuted instantiation: bgp_advertise.c:vpn_leak_from_vpn_active |
207 | | |
208 | | static inline void vpn_leak_prechange(enum vpn_policy_direction direction, |
209 | | afi_t afi, struct bgp *bgp_vpn, |
210 | | struct bgp *bgp_vrf) |
211 | 0 | { |
212 | | /* Detect when default bgp instance is not (yet) defined by config */ |
213 | 0 | if (!bgp_vpn) |
214 | 0 | return; |
215 | | |
216 | 0 | if ((direction == BGP_VPN_POLICY_DIR_FROMVPN) && |
217 | 0 | vpn_leak_from_vpn_active(bgp_vrf, afi, NULL)) { |
218 | |
|
219 | 0 | vpn_leak_to_vrf_withdraw_all(bgp_vrf, afi); |
220 | 0 | } |
221 | 0 | if ((direction == BGP_VPN_POLICY_DIR_TOVPN) && |
222 | 0 | vpn_leak_to_vpn_active(bgp_vrf, afi, NULL)) { |
223 | |
|
224 | 0 | vpn_leak_from_vrf_withdraw_all(bgp_vpn, bgp_vrf, afi); |
225 | 0 | } |
226 | 0 | } Unexecuted instantiation: bgp_main.c:vpn_leak_prechange Unexecuted instantiation: bgp_debug.c:vpn_leak_prechange Unexecuted instantiation: bgp_evpn.c:vpn_leak_prechange Unexecuted instantiation: bgp_evpn_mh.c:vpn_leak_prechange Unexecuted instantiation: bgp_evpn_vty.c:vpn_leak_prechange Unexecuted instantiation: bgp_mplsvpn.c:vpn_leak_prechange Unexecuted instantiation: bgp_nexthop.c:vpn_leak_prechange Unexecuted instantiation: bgp_nht.c:vpn_leak_prechange Unexecuted instantiation: bgp_packet.c:vpn_leak_prechange Unexecuted instantiation: bgp_pbr.c:vpn_leak_prechange Unexecuted instantiation: bgp_route.c:vpn_leak_prechange Unexecuted instantiation: bgp_routemap.c:vpn_leak_prechange Unexecuted instantiation: bgp_updgrp_adv.c:vpn_leak_prechange Unexecuted instantiation: bgp_updgrp_packet.c:vpn_leak_prechange Unexecuted instantiation: bgp_vpn.c:vpn_leak_prechange Unexecuted instantiation: bgp_vty.c:vpn_leak_prechange Unexecuted instantiation: bgp_zebra.c:vpn_leak_prechange Unexecuted instantiation: bgpd.c:vpn_leak_prechange Unexecuted instantiation: bgp_rfapi_cfg.c:vpn_leak_prechange Unexecuted instantiation: rfapi_import.c:vpn_leak_prechange Unexecuted instantiation: rfapi.c:vpn_leak_prechange Unexecuted instantiation: rfapi_ap.c:vpn_leak_prechange Unexecuted instantiation: rfapi_rib.c:vpn_leak_prechange Unexecuted instantiation: rfapi_vty.c:vpn_leak_prechange Unexecuted instantiation: vnc_import_bgp.c:vpn_leak_prechange Unexecuted instantiation: bgp_advertise.c:vpn_leak_prechange |
227 | | |
228 | | static inline void vpn_leak_postchange(enum vpn_policy_direction direction, |
229 | | afi_t afi, struct bgp *bgp_vpn, |
230 | | struct bgp *bgp_vrf) |
231 | 0 | { |
232 | | /* Detect when default bgp instance is not (yet) defined by config */ |
233 | 0 | if (!bgp_vpn) |
234 | 0 | return; |
235 | | |
236 | 0 | if (direction == BGP_VPN_POLICY_DIR_FROMVPN) { |
237 | | /* trigger a flush to re-sync with ADJ-RIB-in */ |
238 | 0 | if (!CHECK_FLAG(bgp_vpn->af_flags[afi][SAFI_MPLS_VPN], |
239 | 0 | BGP_VPNVX_RETAIN_ROUTE_TARGET_ALL)) |
240 | 0 | bgp_clear_soft_in(bgp_vpn, afi, SAFI_MPLS_VPN); |
241 | 0 | else |
242 | 0 | vpn_leak_to_vrf_update_all(bgp_vrf, bgp_vpn, afi); |
243 | 0 | } |
244 | 0 | if (direction == BGP_VPN_POLICY_DIR_TOVPN) { |
245 | |
|
246 | 0 | if (bgp_vrf->vpn_policy[afi].tovpn_label != |
247 | 0 | bgp_vrf->vpn_policy[afi] |
248 | 0 | .tovpn_zebra_vrf_label_last_sent) { |
249 | 0 | vpn_leak_zebra_vrf_label_update(bgp_vrf, afi); |
250 | 0 | } |
251 | |
|
252 | 0 | if (bgp_vrf->vpn_policy[afi].tovpn_sid_index == 0 && |
253 | 0 | !CHECK_FLAG(bgp_vrf->vpn_policy[afi].flags, |
254 | 0 | BGP_VPN_POLICY_TOVPN_SID_AUTO) && |
255 | 0 | bgp_vrf->tovpn_sid_index == 0 && |
256 | 0 | !CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_TOVPN_SID_AUTO)) |
257 | 0 | delete_vrf_tovpn_sid(bgp_vpn, bgp_vrf, afi); |
258 | |
|
259 | 0 | if (!bgp_vrf->vpn_policy[afi].tovpn_sid && !bgp_vrf->tovpn_sid) |
260 | 0 | ensure_vrf_tovpn_sid(bgp_vpn, bgp_vrf, afi); |
261 | |
|
262 | 0 | if ((!bgp_vrf->vpn_policy[afi].tovpn_sid && |
263 | 0 | bgp_vrf->vpn_policy[afi].tovpn_zebra_vrf_sid_last_sent) || |
264 | 0 | (!bgp_vrf->tovpn_sid && |
265 | 0 | bgp_vrf->tovpn_zebra_vrf_sid_last_sent)) |
266 | 0 | vpn_leak_zebra_vrf_sid_withdraw(bgp_vrf, afi); |
267 | |
|
268 | 0 | if (bgp_vrf->vpn_policy[afi].tovpn_sid) { |
269 | 0 | if (sid_diff(bgp_vrf->vpn_policy[afi].tovpn_sid, |
270 | 0 | bgp_vrf->vpn_policy[afi] |
271 | 0 | .tovpn_zebra_vrf_sid_last_sent)) { |
272 | 0 | vpn_leak_zebra_vrf_sid_update(bgp_vrf, afi); |
273 | 0 | } |
274 | 0 | } else if (bgp_vrf->tovpn_sid) { |
275 | 0 | if (sid_diff(bgp_vrf->tovpn_sid, |
276 | 0 | bgp_vrf->tovpn_zebra_vrf_sid_last_sent)) { |
277 | 0 | vpn_leak_zebra_vrf_sid_update(bgp_vrf, afi); |
278 | 0 | } |
279 | 0 | } |
280 | |
|
281 | 0 | vpn_leak_from_vrf_update_all(bgp_vpn, bgp_vrf, afi); |
282 | 0 | } |
283 | 0 | } Unexecuted instantiation: bgp_main.c:vpn_leak_postchange Unexecuted instantiation: bgp_debug.c:vpn_leak_postchange Unexecuted instantiation: bgp_evpn.c:vpn_leak_postchange Unexecuted instantiation: bgp_evpn_mh.c:vpn_leak_postchange Unexecuted instantiation: bgp_evpn_vty.c:vpn_leak_postchange Unexecuted instantiation: bgp_mplsvpn.c:vpn_leak_postchange Unexecuted instantiation: bgp_nexthop.c:vpn_leak_postchange Unexecuted instantiation: bgp_nht.c:vpn_leak_postchange Unexecuted instantiation: bgp_packet.c:vpn_leak_postchange Unexecuted instantiation: bgp_pbr.c:vpn_leak_postchange Unexecuted instantiation: bgp_route.c:vpn_leak_postchange Unexecuted instantiation: bgp_routemap.c:vpn_leak_postchange Unexecuted instantiation: bgp_updgrp_adv.c:vpn_leak_postchange Unexecuted instantiation: bgp_updgrp_packet.c:vpn_leak_postchange Unexecuted instantiation: bgp_vpn.c:vpn_leak_postchange Unexecuted instantiation: bgp_vty.c:vpn_leak_postchange Unexecuted instantiation: bgp_zebra.c:vpn_leak_postchange Unexecuted instantiation: bgpd.c:vpn_leak_postchange Unexecuted instantiation: bgp_rfapi_cfg.c:vpn_leak_postchange Unexecuted instantiation: rfapi_import.c:vpn_leak_postchange Unexecuted instantiation: rfapi.c:vpn_leak_postchange Unexecuted instantiation: rfapi_ap.c:vpn_leak_postchange Unexecuted instantiation: rfapi_rib.c:vpn_leak_postchange Unexecuted instantiation: rfapi_vty.c:vpn_leak_postchange Unexecuted instantiation: vnc_import_bgp.c:vpn_leak_postchange Unexecuted instantiation: bgp_advertise.c:vpn_leak_postchange |
284 | | |
285 | | /* Flag if the route is injectable into VPN. This would be either a |
286 | | * non-imported route or a non-VPN imported route. |
287 | | */ |
288 | | static inline bool is_route_injectable_into_vpn(struct bgp_path_info *pi) |
289 | 0 | { |
290 | 0 | struct bgp_path_info *parent_pi; |
291 | 0 | struct bgp_table *table; |
292 | 0 | struct bgp_dest *dest; |
293 | |
|
294 | 0 | if (pi->sub_type != BGP_ROUTE_IMPORTED || |
295 | 0 | !pi->extra || |
296 | 0 | !pi->extra->parent) |
297 | 0 | return true; |
298 | | |
299 | 0 | parent_pi = (struct bgp_path_info *)pi->extra->parent; |
300 | 0 | dest = parent_pi->net; |
301 | 0 | if (!dest) |
302 | 0 | return true; |
303 | 0 | table = bgp_dest_table(dest); |
304 | 0 | if (table && |
305 | 0 | (table->afi == AFI_IP || table->afi == AFI_IP6) && |
306 | 0 | table->safi == SAFI_MPLS_VPN) |
307 | 0 | return false; |
308 | 0 | return true; |
309 | 0 | } Unexecuted instantiation: bgp_main.c:is_route_injectable_into_vpn Unexecuted instantiation: bgp_debug.c:is_route_injectable_into_vpn Unexecuted instantiation: bgp_evpn.c:is_route_injectable_into_vpn Unexecuted instantiation: bgp_evpn_mh.c:is_route_injectable_into_vpn Unexecuted instantiation: bgp_evpn_vty.c:is_route_injectable_into_vpn Unexecuted instantiation: bgp_mplsvpn.c:is_route_injectable_into_vpn Unexecuted instantiation: bgp_nexthop.c:is_route_injectable_into_vpn Unexecuted instantiation: bgp_nht.c:is_route_injectable_into_vpn Unexecuted instantiation: bgp_packet.c:is_route_injectable_into_vpn Unexecuted instantiation: bgp_pbr.c:is_route_injectable_into_vpn Unexecuted instantiation: bgp_route.c:is_route_injectable_into_vpn Unexecuted instantiation: bgp_routemap.c:is_route_injectable_into_vpn Unexecuted instantiation: bgp_updgrp_adv.c:is_route_injectable_into_vpn Unexecuted instantiation: bgp_updgrp_packet.c:is_route_injectable_into_vpn Unexecuted instantiation: bgp_vpn.c:is_route_injectable_into_vpn Unexecuted instantiation: bgp_vty.c:is_route_injectable_into_vpn Unexecuted instantiation: bgp_zebra.c:is_route_injectable_into_vpn Unexecuted instantiation: bgpd.c:is_route_injectable_into_vpn Unexecuted instantiation: bgp_rfapi_cfg.c:is_route_injectable_into_vpn Unexecuted instantiation: rfapi_import.c:is_route_injectable_into_vpn Unexecuted instantiation: rfapi.c:is_route_injectable_into_vpn Unexecuted instantiation: rfapi_ap.c:is_route_injectable_into_vpn Unexecuted instantiation: rfapi_rib.c:is_route_injectable_into_vpn Unexecuted instantiation: rfapi_vty.c:is_route_injectable_into_vpn Unexecuted instantiation: vnc_import_bgp.c:is_route_injectable_into_vpn Unexecuted instantiation: bgp_advertise.c:is_route_injectable_into_vpn |
310 | | |
311 | | /* Flag if the route path's family is VPN. */ |
312 | | static inline bool is_pi_family_vpn(struct bgp_path_info *pi) |
313 | 0 | { |
314 | 0 | return (is_pi_family_matching(pi, AFI_IP, SAFI_MPLS_VPN) || |
315 | 0 | is_pi_family_matching(pi, AFI_IP6, SAFI_MPLS_VPN)); |
316 | 0 | } Unexecuted instantiation: bgp_main.c:is_pi_family_vpn Unexecuted instantiation: bgp_debug.c:is_pi_family_vpn Unexecuted instantiation: bgp_evpn.c:is_pi_family_vpn Unexecuted instantiation: bgp_evpn_mh.c:is_pi_family_vpn Unexecuted instantiation: bgp_evpn_vty.c:is_pi_family_vpn Unexecuted instantiation: bgp_mplsvpn.c:is_pi_family_vpn Unexecuted instantiation: bgp_nexthop.c:is_pi_family_vpn Unexecuted instantiation: bgp_nht.c:is_pi_family_vpn Unexecuted instantiation: bgp_packet.c:is_pi_family_vpn Unexecuted instantiation: bgp_pbr.c:is_pi_family_vpn Unexecuted instantiation: bgp_route.c:is_pi_family_vpn Unexecuted instantiation: bgp_routemap.c:is_pi_family_vpn Unexecuted instantiation: bgp_updgrp_adv.c:is_pi_family_vpn Unexecuted instantiation: bgp_updgrp_packet.c:is_pi_family_vpn Unexecuted instantiation: bgp_vpn.c:is_pi_family_vpn Unexecuted instantiation: bgp_vty.c:is_pi_family_vpn Unexecuted instantiation: bgp_zebra.c:is_pi_family_vpn Unexecuted instantiation: bgpd.c:is_pi_family_vpn Unexecuted instantiation: bgp_rfapi_cfg.c:is_pi_family_vpn Unexecuted instantiation: rfapi_import.c:is_pi_family_vpn Unexecuted instantiation: rfapi.c:is_pi_family_vpn Unexecuted instantiation: rfapi_ap.c:is_pi_family_vpn Unexecuted instantiation: rfapi_rib.c:is_pi_family_vpn Unexecuted instantiation: rfapi_vty.c:is_pi_family_vpn Unexecuted instantiation: vnc_import_bgp.c:is_pi_family_vpn Unexecuted instantiation: bgp_advertise.c:is_pi_family_vpn |
317 | | |
318 | | extern void vpn_policy_routemap_event(const char *rmap_name); |
319 | | |
320 | | extern vrf_id_t get_first_vrf_for_redirect_with_rt(struct ecommunity *eckey); |
321 | | |
322 | | extern void vpn_leak_postchange_all(void); |
323 | | extern void vpn_handle_router_id_update(struct bgp *bgp, bool withdraw, |
324 | | bool is_config); |
325 | | extern void bgp_vpn_leak_unimport(struct bgp *from_bgp); |
326 | | extern void bgp_vpn_leak_export(struct bgp *from_bgp); |
327 | | extern void sid_unregister(struct bgp *bgp, const struct in6_addr *sid); |
328 | | |
329 | | #endif /* _QUAGGA_BGP_MPLSVPN_H */ |