]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: vpn_policy_getafi can return AFI_MAX
authorDonald Sharp <sharpd@nvidia.com>
Tue, 30 May 2023 23:47:32 +0000 (19:47 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Thu, 1 Jun 2023 12:58:16 +0000 (08:58 -0400)
Let's account for vpn_policy_getafi having a failure
situation and back out of the whole thing gracefully.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd/bgp_vty.c

index 89a5333a2ca8aeefd2abc57c63753559437a8705..04bdba13454bb26c7987e42468be464cabd51f70 100644 (file)
@@ -9199,6 +9199,8 @@ DEFPY(af_label_vpn_export_allocation_mode,
        bool old_per_nexthop, new_per_nexthop;
 
        afi = vpn_policy_getafi(vty, bgp, false);
+       if (afi == AFI_MAX)
+               return CMD_WARNING_CONFIG_FAILED;
 
        old_per_nexthop = !!CHECK_FLAG(bgp->vpn_policy[afi].flags,
                                       BGP_VPN_POLICY_TOVPN_LABEL_PER_NEXTHOP);