bgpd: vpn_policy_getafi can return AFI_MAX

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>
This commit is contained in:
Donald Sharp 2023-05-30 19:47:32 -04:00
parent 6e233c77d8
commit c36bd47d76

View 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);