]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_mplsvpn.h
Merge pull request #3367 from karamalla0406/frr3333
[mirror_frr.git] / bgpd / bgp_mplsvpn.h
index 384108dc0c475bc7af4ce81265705c146bfd3571..5b989e1853fd81fe1475d35914c40b3e87defd62 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);
@@ -151,6 +151,12 @@ static inline int vpn_leak_from_vpn_active(struct bgp *bgp_vrf, afi_t afi,
                return 0;
        }
 
+       if (bgp_vrf->vrf_id == VRF_UNKNOWN) {
+               if (pmsg)
+                       *pmsg = "destination bgp instance vrf is VRF_UNKNOWN";
+               return 0;
+       }
+
        /* Is vrf configured to import from vpn? */
        if (!CHECK_FLAG(bgp_vrf->af_flags[afi][SAFI_UNICAST],
                        BGP_CONFIG_MPLSVPN_TO_VRF_IMPORT)
@@ -182,6 +188,10 @@ static inline void vpn_leak_prechange(vpn_policy_direction_t direction,
                                      afi_t afi, struct bgp *bgp_vpn,
                                      struct bgp *bgp_vrf)
 {
+       /* Detect when default bgp instance is not (yet) defined by config */
+       if (!bgp_vpn)
+               return;
+
        if ((direction == BGP_VPN_POLICY_DIR_FROMVPN) &&
                vpn_leak_from_vpn_active(bgp_vrf, afi, NULL)) {
 
@@ -198,6 +208,10 @@ static inline void vpn_leak_postchange(vpn_policy_direction_t direction,
                                       afi_t afi, struct bgp *bgp_vpn,
                                       struct bgp *bgp_vrf)
 {
+       /* Detect when default bgp instance is not (yet) defined by config */
+       if (!bgp_vpn)
+               return;
+
        if (direction == BGP_VPN_POLICY_DIR_FROMVPN)
                vpn_leak_to_vrf_update_all(bgp_vrf, bgp_vpn, afi);
        if (direction == BGP_VPN_POLICY_DIR_TOVPN) {
@@ -216,4 +230,6 @@ 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);
+
 #endif /* _QUAGGA_BGP_MPLSVPN_H */