diff options
author | Mitesh Kanjariya <mitesh@marvel-07.cumulusnetworks.com> | 2017-11-20 06:47:04 +0100 |
---|---|---|
committer | mitesh <mitesh@cumulusnetworks.com> | 2018-01-24 00:58:53 +0100 |
commit | 31310b25f20260b66ab7a4ce726f57d815424867 (patch) | |
tree | e6fe6c0c4f4f8d51c4e066096f0288f3f3d3bc10 /bgpd/bgp_evpn_vty.c | |
parent | bgpd: carry two MPLS labels in EVPN NLRIs (diff) | |
download | frr-31310b25f20260b66ab7a4ce726f57d815424867.tar.xz frr-31310b25f20260b66ab7a4ce726f57d815424867.zip |
bgpd: advertise VNI subnet
In EVPN symmetric routing, not all subnets are presents everywhere.
We have multiple scenarios where a host might not get learned locally.
1. GARP miss
2. SVI down/up
3. Silent host
We need a mechanism to resolve such hosts. In order to achieve this,
we will be advertising a subnet route from a box and that box will help
in resolving the ARP to such hosts.
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
Diffstat (limited to 'bgpd/bgp_evpn_vty.c')
-rw-r--r-- | bgpd/bgp_evpn_vty.c | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c index b463896c4..932046f7e 100644 --- a/bgpd/bgp_evpn_vty.c +++ b/bgpd/bgp_evpn_vty.c @@ -2272,6 +2272,32 @@ static void evpn_unset_advertise_default_gw(struct bgp *bgp, } /* + * evpn - enable advertisement of default g/w + */ +static void evpn_set_advertise_subnet(struct bgp *bgp, + struct bgpevpn *vpn) +{ + if (vpn->advertise_subnet) + return; + + vpn->advertise_subnet = 1; + bgp_zebra_advertise_subnet(bgp, vpn->advertise_subnet, vpn->vni); +} + +/* + * evpn - disable advertisement of default g/w + */ +static void evpn_unset_advertise_subnet(struct bgp *bgp, + struct bgpevpn *vpn) +{ + if (!vpn->advertise_subnet) + return; + + vpn->advertise_subnet = 0; + bgp_zebra_advertise_subnet(bgp, vpn->advertise_subnet, vpn->vni); +} + +/* * EVPN (VNI advertisement) enabled. Register with zebra. */ static void evpn_set_advertise_all_vni(struct bgp *bgp) @@ -2330,6 +2356,9 @@ static void write_vni_config(struct vty *vty, struct bgpevpn *vpn) if (vpn->advertise_gw_macip) vty_out(vty, " advertise-default-gw\n"); + if (vpn->advertise_subnet) + vty_out(vty, " advertise-subnet\n"); + vty_out(vty, " exit-vni\n"); } } @@ -2440,6 +2469,56 @@ DEFUN (no_bgp_evpn_advertise_all_vni, return CMD_SUCCESS; } +DEFUN (bgp_evpn_advertise_vni_subnet, + bgp_evpn_advertise_vni_subnet_cmd, + "advertise-subnet", + "Advertise the subnet corresponding to VNI\n") +{ + struct bgp *bgp_vrf = NULL; + struct bgp *bgp = VTY_GET_CONTEXT(bgp); + VTY_DECLVAR_CONTEXT_SUB(bgpevpn, vpn); + + if (!bgp) + return CMD_WARNING; + + if (!vpn) + return CMD_WARNING; + + bgp_vrf = bgp_lookup_by_vrf_id(vpn->tenant_vrf_id); + if (!bgp_vrf) + return CMD_WARNING; + + if (!(advertise_type5_routes(bgp_vrf, AFI_IP) || + advertise_type5_routes(bgp_vrf, AFI_IP6))) { + vty_out(vty, + "%%Please enable ip prefix advertisement under l2vpn evpn in %s", + vrf_id_to_name(bgp_vrf->vrf_id)); + return CMD_WARNING; + } + + evpn_set_advertise_subnet(bgp, vpn); + return CMD_SUCCESS; +} + +DEFUN (no_bgp_evpn_advertise_vni_subnet, + no_bgp_evpn_advertise_vni_subnet_cmd, + "no advertise-subnet", + NO_STR + "Advertise All local VNIs\n") +{ + struct bgp *bgp = VTY_GET_CONTEXT(bgp); + VTY_DECLVAR_CONTEXT_SUB(bgpevpn, vpn); + + if (!bgp) + return CMD_WARNING; + + if (!vpn) + return CMD_WARNING; + + evpn_unset_advertise_subnet(bgp, vpn); + return CMD_SUCCESS; +} + DEFUN (bgp_evpn_advertise_type5, bgp_evpn_advertise_type5_cmd, "advertise " BGP_AFI_CMD_STR "" BGP_SAFI_CMD_STR, @@ -4118,5 +4197,8 @@ void bgp_ethernetvpn_init(void) &bgp_evpn_advertise_default_gw_vni_cmd); install_element(BGP_EVPN_VNI_NODE, &no_bgp_evpn_advertise_default_gw_vni_cmd); + install_element(BGP_EVPN_VNI_NODE, &bgp_evpn_advertise_vni_subnet_cmd); + install_element(BGP_EVPN_VNI_NODE, + &no_bgp_evpn_advertise_vni_subnet_cmd); #endif } |