diff options
| author | Chirag Shah <chirag@cumulusnetworks.com> | 2019-08-09 16:12:55 -0700 |
|---|---|---|
| committer | Chirag Shah <chirag@cumulusnetworks.com> | 2019-08-27 08:48:50 -0700 |
| commit | b90d4580f004e8c424908ce89b461425a5818c1b (patch) | |
| tree | 1c40d8d485d40649ba88c14be6161429395833fd /bgpd/bgp_evpn.c | |
| parent | dd7c9169522725614a05c50cb3209c0787b9be30 (diff) | |
bgpd: fix evpn ecommunity auto rts
Evpn extended communities like auto rts (import/export) should
check if its present in list before adding it, to avoid duplicate
addition.
L3vni_add callback from zebra to bgp may see updates to vnis.
The auto import/export rt derivation may call multiple times.
Testing Done:
Before:
TORC11# show bgp l2vpn evpn vni 4001
VNI: 4001 (known to the kernel)
Type: L3
Tenant VRF: vrf1
RD: 45.0.2.2:3
...
Import Route Target:
5546:4001
5546:4001
Export Route Target:
5546:4001
5546:4001
After:
VNI: 4001 (known to the kernel)
Type: L3
Tenant VRF: vrf1
RD: 45.0.2.2:3
...
Import Route Target:
5546:4001
Export Route Target:
5546:4001
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
Diffstat (limited to 'bgpd/bgp_evpn.c')
| -rw-r--r-- | bgpd/bgp_evpn.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 3bc3d74de6..1f8ea48389 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -505,7 +505,9 @@ static void unmap_vni_from_rt(struct bgp *bgp, struct bgpevpn *vpn, static void form_auto_rt(struct bgp *bgp, vni_t vni, struct list *rtl) { struct ecommunity_val eval; - struct ecommunity *ecomadd; + struct ecommunity *ecomadd, *ecom; + bool ecom_found = false; + struct listnode *node; if (bgp->advertise_autort_rfc8365) vni |= EVPN_AUTORT_VXLAN; @@ -513,7 +515,12 @@ static void form_auto_rt(struct bgp *bgp, vni_t vni, struct list *rtl) ecomadd = ecommunity_new(); ecommunity_add_val(ecomadd, &eval); - listnode_add_sort(rtl, ecomadd); + for (ALL_LIST_ELEMENTS_RO(rtl, node, ecom)) + if (ecommunity_cmp(ecomadd, ecom)) + ecom_found = true; + + if (!ecom_found) + listnode_add_sort(rtl, ecomadd); } /* |
