#include "stream.h"
#include "hash.h"
#include "jhash.h"
-#include "bitfield.h"
#include "zclient.h"
#include "bgpd/bgp_attr_evpn.h"
*/
void bgp_evpn_derive_auto_rd_for_vrf(struct bgp *bgp)
{
- char buf[100];
-
- bgp->vrf_prd.family = AF_UNSPEC;
- bgp->vrf_prd.prefixlen = 64;
- sprintf(buf, "%s:%hu", inet_ntoa(bgp->router_id), bgp->vrf_rd_id);
- (void)str2prefix_rd(buf, &bgp->vrf_prd);
+ form_auto_rd(bgp->router_id, bgp->vrf_rd_id, &bgp->vrf_prd);
}
/*
list_delete_and_null(&bgp->vrf_export_rtl);
if (bgp->l2vnis)
list_delete_and_null(&bgp->l2vnis);
- bf_release_index(bm->rd_idspace, bgp->vrf_rd_id);
}
/*
* Create
* VNI hash table
* hash for RT to VNI
- * assign a unique rd id for auto derivation of vrf_prd
*/
void bgp_evpn_init(struct bgp *bgp)
{
(int (*)(void *, void *))evpn_route_target_cmp;
bgp->l2vnis = list_new();
bgp->l2vnis->cmp = (int (*)(void *, void *))vni_hash_cmp;
- bf_assign_index(bm->rd_idspace, bgp->vrf_rd_id);
}
void bgp_evpn_vrf_delete(struct bgp *bgp_vrf)
snprintf(buf, size, "Unknown Type: %d", type);
return buf;
}
+
+void form_auto_rd(struct in_addr router_id,
+ uint16_t rd_id,
+ struct prefix_rd *prd)
+{
+ char buf[100];
+
+ prd->family = AF_UNSPEC;
+ prd->prefixlen = 64;
+ sprintf(buf, "%s:%hu", inet_ntoa(router_id), rd_id);
+ str2prefix_rd(buf, prd);
+}
extern int str2prefix_rd(const char *, struct prefix_rd *);
extern char *prefix_rd2str(struct prefix_rd *, char *, size_t);
+extern void form_auto_rd(struct in_addr router_id, uint16_t rd_id,
+ struct prefix_rd *prd);
#endif /* _QUAGGA_BGP_RD_H */
#include "table.h"
#include "lib/json.h"
#include "frr_pthread.h"
+#include "bitfield.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_table.h"
QOBJ_REG(bgp, bgp);
update_bgp_group_init(bgp);
+
+ /* assign a unique rd id for auto derivation of vrf's RD */
+ bf_assign_index(bm->rd_idspace, bgp->vrf_rd_id);
+
bgp_evpn_init(bgp);
return bgp;
}
bgp_address_destroy(bgp);
bgp_tip_hash_destroy(bgp);
+ /* release the auto RD id */
+ bf_release_index(bm->rd_idspace, bgp->vrf_rd_id);
+
bgp_evpn_cleanup(bgp);
if (bgp->name)
/* unique ID for auto derivation of RD for this vrf */
uint16_t vrf_rd_id;
+ /* Automatically derived RD for this VRF */
+ struct prefix_rd vrf_prd_auto;
+
/* RD for this VRF */
struct prefix_rd vrf_prd;