mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-30 17:05:23 +00:00
Merge pull request #868 from LabNConsulting/working/master/patch-set/rfapi-lib+
Restore rfapi and encap attribute, broken by some recent changes
This commit is contained in:
commit
713cb249d1
@ -2039,7 +2039,7 @@ static int bgp_attr_encap(uint8_t type, struct peer *peer, /* IN */
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
stlv_last->next = tlv;
|
stlv_last = tlv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BGP_ATTR_ENCAP == type) {
|
if (BGP_ATTR_ENCAP == type) {
|
||||||
|
@ -135,10 +135,10 @@ struct rfapi_nve_group_cfg *bgp_rfapi_cfg_match_group(struct rfapi_cfg *hc,
|
|||||||
|
|
||||||
switch (vn->family) {
|
switch (vn->family) {
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
rt_vn = &(hc->nve_groups_vn[AFI_IP]);
|
rt_vn = hc->nve_groups_vn[AFI_IP];
|
||||||
break;
|
break;
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
rt_vn = &(hc->nve_groups_vn[AFI_IP6]);
|
rt_vn = hc->nve_groups_vn[AFI_IP6];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -146,10 +146,10 @@ struct rfapi_nve_group_cfg *bgp_rfapi_cfg_match_group(struct rfapi_cfg *hc,
|
|||||||
|
|
||||||
switch (un->family) {
|
switch (un->family) {
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
rt_un = &(hc->nve_groups_un[AFI_IP]);
|
rt_un = hc->nve_groups_un[AFI_IP];
|
||||||
break;
|
break;
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
rt_un = &(hc->nve_groups_un[AFI_IP6]);
|
rt_un = hc->nve_groups_un[AFI_IP6];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -2503,7 +2503,7 @@ DEFUN (vnc_nve_group_prefix,
|
|||||||
VTY_DECLVAR_CONTEXT(bgp, bgp);
|
VTY_DECLVAR_CONTEXT(bgp, bgp);
|
||||||
VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg);
|
VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg);
|
||||||
struct prefix p;
|
struct prefix p;
|
||||||
int afi;
|
afi_t afi;
|
||||||
struct route_table *rt;
|
struct route_table *rt;
|
||||||
struct route_node *rn;
|
struct route_node *rn;
|
||||||
int is_un_prefix = 0;
|
int is_un_prefix = 0;
|
||||||
@ -2527,10 +2527,10 @@ DEFUN (vnc_nve_group_prefix,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (argv[1]->arg[0] == 'u') {
|
if (argv[1]->arg[0] == 'u') {
|
||||||
rt = &(bgp->rfapi_cfg->nve_groups_un[afi]);
|
rt = bgp->rfapi_cfg->nve_groups_un[afi];
|
||||||
is_un_prefix = 1;
|
is_un_prefix = 1;
|
||||||
} else {
|
} else {
|
||||||
rt = &(bgp->rfapi_cfg->nve_groups_vn[afi]);
|
rt = bgp->rfapi_cfg->nve_groups_vn[afi];
|
||||||
}
|
}
|
||||||
|
|
||||||
rn = route_node_get(rt, &p); /* NB locks node */
|
rn = route_node_get(rt, &p); /* NB locks node */
|
||||||
@ -3830,7 +3830,7 @@ void bgp_rfapi_cfg_init(void)
|
|||||||
struct rfapi_cfg *bgp_rfapi_cfg_new(struct rfapi_rfp_cfg *cfg)
|
struct rfapi_cfg *bgp_rfapi_cfg_new(struct rfapi_rfp_cfg *cfg)
|
||||||
{
|
{
|
||||||
struct rfapi_cfg *h;
|
struct rfapi_cfg *h;
|
||||||
int afi;
|
afi_t afi;
|
||||||
|
|
||||||
h = (struct rfapi_cfg *)XCALLOC(MTYPE_RFAPI_CFG,
|
h = (struct rfapi_cfg *)XCALLOC(MTYPE_RFAPI_CFG,
|
||||||
sizeof(struct rfapi_cfg));
|
sizeof(struct rfapi_cfg));
|
||||||
@ -3838,14 +3838,9 @@ struct rfapi_cfg *bgp_rfapi_cfg_new(struct rfapi_rfp_cfg *cfg)
|
|||||||
|
|
||||||
h->nve_groups_sequential = list_new();
|
h->nve_groups_sequential = list_new();
|
||||||
assert(h->nve_groups_sequential);
|
assert(h->nve_groups_sequential);
|
||||||
|
|
||||||
for (afi = AFI_IP; afi < AFI_MAX; afi++) {
|
for (afi = AFI_IP; afi < AFI_MAX; afi++) {
|
||||||
/* ugly, to deal with addition of delegates, part of 0.99.24.1
|
h->nve_groups_vn[afi] = route_table_init();
|
||||||
* merge */
|
h->nve_groups_un[afi] = route_table_init();
|
||||||
h->nve_groups_vn[afi].delegate =
|
|
||||||
route_table_get_default_delegate();
|
|
||||||
h->nve_groups_un[afi].delegate =
|
|
||||||
route_table_get_default_delegate();
|
|
||||||
}
|
}
|
||||||
h->default_response_lifetime =
|
h->default_response_lifetime =
|
||||||
BGP_VNC_DEFAULT_RESPONSE_LIFETIME_DEFAULT;
|
BGP_VNC_DEFAULT_RESPONSE_LIFETIME_DEFAULT;
|
||||||
@ -3885,6 +3880,7 @@ struct rfapi_cfg *bgp_rfapi_cfg_new(struct rfapi_rfp_cfg *cfg)
|
|||||||
|
|
||||||
void bgp_rfapi_cfg_destroy(struct bgp *bgp, struct rfapi_cfg *h)
|
void bgp_rfapi_cfg_destroy(struct bgp *bgp, struct rfapi_cfg *h)
|
||||||
{
|
{
|
||||||
|
afi_t afi;
|
||||||
if (h == NULL)
|
if (h == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -3901,6 +3897,10 @@ void bgp_rfapi_cfg_destroy(struct bgp *bgp, struct rfapi_cfg *h)
|
|||||||
ecommunity_free(&h->default_rt_import_list);
|
ecommunity_free(&h->default_rt_import_list);
|
||||||
if (h->default_rfp_cfg)
|
if (h->default_rfp_cfg)
|
||||||
XFREE(MTYPE_RFAPI_RFP_GROUP_CFG, h->default_rfp_cfg);
|
XFREE(MTYPE_RFAPI_RFP_GROUP_CFG, h->default_rfp_cfg);
|
||||||
|
for (afi = AFI_IP; afi < AFI_MAX; afi++) {
|
||||||
|
route_table_finish(h->nve_groups_vn[afi]);
|
||||||
|
route_table_finish(h->nve_groups_un[afi]);
|
||||||
|
}
|
||||||
XFREE(MTYPE_RFAPI_CFG, h);
|
XFREE(MTYPE_RFAPI_CFG, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4571,7 +4571,8 @@ int bgp_rfapi_cfg_write(struct vty *vty, struct bgp *bgp)
|
|||||||
void bgp_rfapi_show_summary(struct bgp *bgp, struct vty *vty)
|
void bgp_rfapi_show_summary(struct bgp *bgp, struct vty *vty)
|
||||||
{
|
{
|
||||||
struct rfapi_cfg *hc = bgp->rfapi_cfg;
|
struct rfapi_cfg *hc = bgp->rfapi_cfg;
|
||||||
int afi, type, redist = 0;
|
afi_t afi;
|
||||||
|
int type, redist = 0;
|
||||||
char tmp[40];
|
char tmp[40];
|
||||||
if (hc == NULL)
|
if (hc == NULL)
|
||||||
return;
|
return;
|
||||||
|
@ -135,8 +135,8 @@ struct rfapi_cfg {
|
|||||||
struct list *l2_groups; /* rfapi_l2_group_cfg list */
|
struct list *l2_groups; /* rfapi_l2_group_cfg list */
|
||||||
/* three views into the same collection of rfapi_nve_group_cfg */
|
/* three views into the same collection of rfapi_nve_group_cfg */
|
||||||
struct list *nve_groups_sequential;
|
struct list *nve_groups_sequential;
|
||||||
struct route_table nve_groups_vn[AFI_MAX];
|
struct route_table *nve_groups_vn[AFI_MAX];
|
||||||
struct route_table nve_groups_un[AFI_MAX];
|
struct route_table *nve_groups_un[AFI_MAX];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For Single VRF export to ordinary routing protocols. This is
|
* For Single VRF export to ordinary routing protocols. This is
|
||||||
|
@ -205,7 +205,7 @@ static int rfapi_find_node(struct bgp *bgp, struct rfapi_ip_addr *vn_addr,
|
|||||||
struct prefix p;
|
struct prefix p;
|
||||||
struct route_node *rn;
|
struct route_node *rn;
|
||||||
int rc;
|
int rc;
|
||||||
int afi;
|
afi_t afi;
|
||||||
|
|
||||||
if (!bgp) {
|
if (!bgp) {
|
||||||
return ENXIO;
|
return ENXIO;
|
||||||
@ -224,7 +224,7 @@ static int rfapi_find_node(struct bgp *bgp, struct rfapi_ip_addr *vn_addr,
|
|||||||
if ((rc = rfapiRaddr2Qprefix(un_addr, &p)))
|
if ((rc = rfapiRaddr2Qprefix(un_addr, &p)))
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
rn = route_node_lookup(&h->un[afi], &p);
|
rn = route_node_lookup(h->un[afi], &p);
|
||||||
|
|
||||||
if (!rn)
|
if (!rn)
|
||||||
return ENOENT;
|
return ENOENT;
|
||||||
@ -1415,7 +1415,7 @@ int rfapi_init_and_open(struct bgp *bgp, struct rfapi_descriptor *rfd,
|
|||||||
assert(afi_vn && afi_un);
|
assert(afi_vn && afi_un);
|
||||||
assert(!rfapiRaddr2Qprefix(&rfd->un_addr, &pfx_un));
|
assert(!rfapiRaddr2Qprefix(&rfd->un_addr, &pfx_un));
|
||||||
|
|
||||||
rn = route_node_get(&(h->un[afi_un]), &pfx_un);
|
rn = route_node_get(h->un[afi_un], &pfx_un);
|
||||||
assert(rn);
|
assert(rn);
|
||||||
rfd->next = rn->info;
|
rfd->next = rn->info;
|
||||||
rn->info = rfd;
|
rn->info = rfd;
|
||||||
@ -2367,7 +2367,7 @@ int rfapi_register(void *handle, struct rfapi_ip_prefix *prefix,
|
|||||||
struct prefix p;
|
struct prefix p;
|
||||||
struct prefix *pfx_ip = NULL;
|
struct prefix *pfx_ip = NULL;
|
||||||
struct prefix_rd prd;
|
struct prefix_rd prd;
|
||||||
int afi;
|
afi_t afi;
|
||||||
struct prefix pfx_mac_buf;
|
struct prefix pfx_mac_buf;
|
||||||
struct prefix *pfx_mac = NULL;
|
struct prefix *pfx_mac = NULL;
|
||||||
struct prefix pfx_vn_buf;
|
struct prefix pfx_vn_buf;
|
||||||
|
@ -4248,7 +4248,7 @@ static void rfapiBgpTableFilteredImport(struct bgp *bgp,
|
|||||||
struct rfapi *bgp_rfapi_new(struct bgp *bgp)
|
struct rfapi *bgp_rfapi_new(struct bgp *bgp)
|
||||||
{
|
{
|
||||||
struct rfapi *h;
|
struct rfapi *h;
|
||||||
int afi;
|
afi_t afi;
|
||||||
struct rfapi_rfp_cfg *cfg = NULL;
|
struct rfapi_rfp_cfg *cfg = NULL;
|
||||||
struct rfapi_rfp_cb_methods *cbm = NULL;
|
struct rfapi_rfp_cb_methods *cbm = NULL;
|
||||||
|
|
||||||
@ -4257,9 +4257,7 @@ struct rfapi *bgp_rfapi_new(struct bgp *bgp)
|
|||||||
h = (struct rfapi *)XCALLOC(MTYPE_RFAPI, sizeof(struct rfapi));
|
h = (struct rfapi *)XCALLOC(MTYPE_RFAPI, sizeof(struct rfapi));
|
||||||
|
|
||||||
for (afi = AFI_IP; afi < AFI_MAX; afi++) {
|
for (afi = AFI_IP; afi < AFI_MAX; afi++) {
|
||||||
/* ugly, to deal with addition of delegates, part of 0.99.24.1
|
h->un[afi] = route_table_init();
|
||||||
* merge */
|
|
||||||
h->un[afi].delegate = route_table_get_default_delegate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -4292,6 +4290,8 @@ struct rfapi *bgp_rfapi_new(struct bgp *bgp)
|
|||||||
|
|
||||||
void bgp_rfapi_destroy(struct bgp *bgp, struct rfapi *h)
|
void bgp_rfapi_destroy(struct bgp *bgp, struct rfapi *h)
|
||||||
{
|
{
|
||||||
|
afi_t afi;
|
||||||
|
|
||||||
if (bgp == NULL || h == NULL)
|
if (bgp == NULL || h == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -4327,6 +4327,11 @@ void bgp_rfapi_destroy(struct bgp *bgp, struct rfapi *h)
|
|||||||
|
|
||||||
if (h->rfp != NULL)
|
if (h->rfp != NULL)
|
||||||
rfp_stop(h->rfp);
|
rfp_stop(h->rfp);
|
||||||
|
|
||||||
|
for (afi = AFI_IP; afi < AFI_MAX; afi++) {
|
||||||
|
route_table_finish(h->un[afi]);
|
||||||
|
}
|
||||||
|
|
||||||
XFREE(MTYPE_RFAPI_IMPORTTABLE, h->it_ce);
|
XFREE(MTYPE_RFAPI_IMPORTTABLE, h->it_ce);
|
||||||
XFREE(MTYPE_RFAPI, h);
|
XFREE(MTYPE_RFAPI, h);
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,7 @@ struct rfapi_global_stats {
|
|||||||
* check vn address to get exact match.
|
* check vn address to get exact match.
|
||||||
*/
|
*/
|
||||||
struct rfapi {
|
struct rfapi {
|
||||||
struct route_table un[AFI_MAX];
|
struct route_table *un[AFI_MAX];
|
||||||
struct rfapi_import_table *imports; /* IPv4, IPv6 */
|
struct rfapi_import_table *imports; /* IPv4, IPv6 */
|
||||||
struct list descriptors; /* debug & resolve-nve imports */
|
struct list descriptors; /* debug & resolve-nve imports */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user