mirror of
https://codeberg.org/1414codeforge/ubgpsuite.git
synced 2025-02-16 11:40:55 +01:00
[bgp/attribute] Fix NEXT_HOP iterator switch
This commit is contained in:
parent
2480f1fa75
commit
ac6c224f72
@ -824,6 +824,8 @@ Asn Bgp_NextAsPath(Aspathiter *it)
|
|||||||
|
|
||||||
static Boolean Bgp_SwitchNextHop(Nexthopiter *it)
|
static Boolean Bgp_SwitchNextHop(Nexthopiter *it)
|
||||||
{
|
{
|
||||||
|
Boolean res = FALSE; // iteration end, unless found otherwise
|
||||||
|
|
||||||
if (it->nextHop) {
|
if (it->nextHop) {
|
||||||
// Setup for read from NEXT_HOP
|
// Setup for read from NEXT_HOP
|
||||||
if (!BGP_CHKNEXTHOPLEN(it->nextHop)) {
|
if (!BGP_CHKNEXTHOPLEN(it->nextHop)) {
|
||||||
@ -838,9 +840,9 @@ static Boolean Bgp_SwitchNextHop(Nexthopiter *it)
|
|||||||
it->safi = SAFI_UNICAST;
|
it->safi = SAFI_UNICAST;
|
||||||
|
|
||||||
it->nextHop = NULL; // consume NEXT_HOP
|
it->nextHop = NULL; // consume NEXT_HOP
|
||||||
goto done;
|
res = TRUE;
|
||||||
}
|
|
||||||
if (it->mpReach) {
|
} else if (it->mpReach) {
|
||||||
// Setup for read from MP_REACH_NLRI
|
// Setup for read from MP_REACH_NLRI
|
||||||
Bgpmpnexthop *nh;
|
Bgpmpnexthop *nh;
|
||||||
|
|
||||||
@ -862,8 +864,11 @@ static Boolean Bgp_SwitchNextHop(Nexthopiter *it)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Bgpmpfam *fam = BGP_MPFAMILY(it->mpReach);
|
Bgpmpfam *fam = BGP_MPFAMILY(it->mpReach);
|
||||||
if (it->isRibv2 && (fam->afi != it->afiRibv2 || it->safi != it->safiRibv2))
|
if (it->isRibv2 && (fam->afi != it->afiRibv2 || it->safi != it->safiRibv2)) {
|
||||||
goto done; // discard MP_REACH_NLRI if it doesn't match with RIB AFI/SAFI
|
// discard MP_REACH_NLRI if it doesn't match with RIB AFI/SAFI
|
||||||
|
it->mpReach = NULL;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
nh = BGP_MPNEXTHOP(it->mpReach);
|
nh = BGP_MPNEXTHOP(it->mpReach);
|
||||||
it->afi = fam->afi;
|
it->afi = fam->afi;
|
||||||
@ -873,14 +878,14 @@ static Boolean Bgp_SwitchNextHop(Nexthopiter *it)
|
|||||||
it->base = (Uint8 *) nh;
|
it->base = (Uint8 *) nh;
|
||||||
it->ptr = nh->data;
|
it->ptr = nh->data;
|
||||||
it->lim = &nh->data[nh->len];
|
it->lim = &nh->data[nh->len];
|
||||||
|
|
||||||
it->mpReach = NULL; // consume MP_REACH_NLRI
|
it->mpReach = NULL; // consume MP_REACH_NLRI
|
||||||
goto done;
|
res = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Iteration over
|
|
||||||
done:
|
done:
|
||||||
Bgp_SetErrStat(BGPENOERR);
|
Bgp_SetErrStat(BGPENOERR);
|
||||||
return FALSE;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
Judgement Bgp_StartAllNextHops(Nexthopiter *it,
|
Judgement Bgp_StartAllNextHops(Nexthopiter *it,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user