]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_mplsvpn.h
Merge pull request #5703 from ton31337/feature/limit_outgoing_prefixes
[mirror_frr.git] / bgpd / bgp_mplsvpn.h
index 122ae9e905b16afb37c1c0ebed9bca463fac27e2..3234f7fc9db284559016a480c4a6a430200eea86 100644 (file)
@@ -50,13 +50,13 @@ extern int argv_find_and_parse_vpnvx(struct cmd_token **argv, int argc,
                                     int *index, afi_t *afi);
 extern int bgp_show_mpls_vpn(struct vty *vty, afi_t afi, struct prefix_rd *prd,
                             enum bgp_show_type type, void *output_arg,
-                            int tags, uint8_t use_json);
+                            int tags, bool use_json);
 
 extern void vpn_leak_from_vrf_update(struct bgp *bgp_vpn, struct bgp *bgp_vrf,
-                                    struct bgp_info *info_vrf);
+                                    struct bgp_path_info *path_vrf);
 
 extern void vpn_leak_from_vrf_withdraw(struct bgp *bgp_vpn, struct bgp *bgp_vrf,
-                                      struct bgp_info *info_vrf);
+                                      struct bgp_path_info *path_vrf);
 
 extern void vpn_leak_from_vrf_withdraw_all(struct bgp *bgp_vpn,
                                           struct bgp *bgp_vrf, afi_t afi);
@@ -70,10 +70,10 @@ extern void vpn_leak_to_vrf_update_all(struct bgp *bgp_vrf, struct bgp *bgp_vpn,
                                       afi_t afi);
 
 extern void vpn_leak_to_vrf_update(struct bgp *bgp_vpn,
-                                  struct bgp_info *info_vpn);
+                                  struct bgp_path_info *path_vpn);
 
 extern void vpn_leak_to_vrf_withdraw(struct bgp *bgp_vpn,
-                                    struct bgp_info *info_vpn);
+                                    struct bgp_path_info *path_vpn);
 
 extern void vpn_leak_zebra_vrf_label_update(struct bgp *bgp, afi_t afi);
 extern void vpn_leak_zebra_vrf_label_withdraw(struct bgp *bgp, afi_t afi);
@@ -226,10 +226,47 @@ static inline void vpn_leak_postchange(vpn_policy_direction_t direction,
        }
 }
 
+/* Flag if the route is injectable into VPN. This would be either a
+ * non-imported route or a non-VPN imported route.
+ */
+static inline bool is_route_injectable_into_vpn(struct bgp_path_info *pi)
+{
+       struct bgp_path_info *parent_pi;
+       struct bgp_table *table;
+       struct bgp_node *rn;
+
+       if (pi->sub_type != BGP_ROUTE_IMPORTED ||
+           !pi->extra ||
+           !pi->extra->parent)
+               return true;
+
+       parent_pi = (struct bgp_path_info *)pi->extra->parent;
+       rn = parent_pi->net;
+       if (!rn)
+               return true;
+       table = bgp_node_table(rn);
+       if (table &&
+           (table->afi == AFI_IP || table->afi == AFI_IP6) &&
+           table->safi == SAFI_MPLS_VPN)
+               return false;
+       return true;
+}
+
+/* Flag if the route path's family is VPN. */
+static inline bool is_pi_family_vpn(struct bgp_path_info *pi)
+{
+       return (is_pi_family_matching(pi, AFI_IP, SAFI_MPLS_VPN) ||
+               is_pi_family_matching(pi, AFI_IP6, SAFI_MPLS_VPN));
+}
+
 extern void vpn_policy_routemap_event(const char *rmap_name);
 
 extern vrf_id_t get_first_vrf_for_redirect_with_rt(struct ecommunity *eckey);
 
 extern void vpn_leak_postchange_all(void);
+extern void vpn_handle_router_id_update(struct bgp *bgp, bool withdraw,
+                                       bool is_config);
+extern int bgp_vpn_leak_unimport(struct bgp *from_bgp, struct vty *vty);
+extern void bgp_vpn_leak_export(struct bgp *from_bgp);
 
 #endif /* _QUAGGA_BGP_MPLSVPN_H */