mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 14:34:22 +00:00
pbrd: be more selective about route updates
Given a received nexthop update, only send down an update to the relevant nexthop group. Avoid sending down superfluous updates Signed-off-by: Wesley Coakley <wcoakley@nvidia.com>
This commit is contained in:
parent
2e5b029865
commit
c59f754dd4
@ -715,7 +715,7 @@ struct pbr_nht_individual {
|
|||||||
|
|
||||||
static bool
|
static bool
|
||||||
pbr_nht_individual_nexthop_gw_update(struct pbr_nexthop_cache *pnhc,
|
pbr_nht_individual_nexthop_gw_update(struct pbr_nexthop_cache *pnhc,
|
||||||
const struct pbr_nht_individual *pnhi)
|
struct pbr_nht_individual *pnhi)
|
||||||
{
|
{
|
||||||
bool is_valid = pnhc->valid;
|
bool is_valid = pnhc->valid;
|
||||||
|
|
||||||
@ -736,6 +736,7 @@ pbr_nht_individual_nexthop_gw_update(struct pbr_nexthop_cache *pnhc,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pnhi->nhr_matched = true;
|
||||||
if (!pnhi->nhr->nexthop_num) {
|
if (!pnhi->nhr->nexthop_num) {
|
||||||
is_valid = false;
|
is_valid = false;
|
||||||
goto done;
|
goto done;
|
||||||
@ -767,8 +768,9 @@ done:
|
|||||||
return pnhc->valid;
|
return pnhc->valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool pbr_nht_individual_nexthop_interface_update(
|
static bool
|
||||||
struct pbr_nexthop_cache *pnhc, const struct pbr_nht_individual *pnhi)
|
pbr_nht_individual_nexthop_interface_update(struct pbr_nexthop_cache *pnhc,
|
||||||
|
struct pbr_nht_individual *pnhi)
|
||||||
{
|
{
|
||||||
bool is_valid = pnhc->valid;
|
bool is_valid = pnhc->valid;
|
||||||
|
|
||||||
@ -779,6 +781,7 @@ static bool pbr_nht_individual_nexthop_interface_update(
|
|||||||
!= pnhi->ifp->ifindex) /* Un-related interface */
|
!= pnhi->ifp->ifindex) /* Un-related interface */
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
|
pnhi->nhr_matched = true;
|
||||||
is_valid = !!if_is_up(pnhi->ifp);
|
is_valid = !!if_is_up(pnhi->ifp);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
@ -793,9 +796,8 @@ done:
|
|||||||
* If the update is un-related, the subroutines shoud just return their cached
|
* If the update is un-related, the subroutines shoud just return their cached
|
||||||
* valid state.
|
* valid state.
|
||||||
*/
|
*/
|
||||||
static void
|
static void pbr_nht_individual_nexthop_update(struct pbr_nexthop_cache *pnhc,
|
||||||
pbr_nht_individual_nexthop_update(struct pbr_nexthop_cache *pnhc,
|
struct pbr_nht_individual *pnhi)
|
||||||
const struct pbr_nht_individual *pnhi)
|
|
||||||
{
|
{
|
||||||
assert(pnhi->nhr || pnhi->ifp); /* Either nexthop or interface update */
|
assert(pnhi->nhr || pnhi->ifp); /* Either nexthop or interface update */
|
||||||
|
|
||||||
@ -870,9 +872,13 @@ static void pbr_nht_nexthop_update_lookup(struct hash_bucket *b, void *data)
|
|||||||
|
|
||||||
pnhi.nhr = (struct zapi_route *)data;
|
pnhi.nhr = (struct zapi_route *)data;
|
||||||
pnhi.valid = 0;
|
pnhi.valid = 0;
|
||||||
|
pnhi.nhr_matched = false;
|
||||||
hash_iterate(pnhgc->nhh, pbr_nht_individual_nexthop_update_lookup,
|
hash_iterate(pnhgc->nhh, pbr_nht_individual_nexthop_update_lookup,
|
||||||
&pnhi);
|
&pnhi);
|
||||||
|
|
||||||
|
if (!pnhi.nhr_matched)
|
||||||
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If any of the specified nexthops are valid we are valid
|
* If any of the specified nexthops are valid we are valid
|
||||||
*/
|
*/
|
||||||
|
@ -55,6 +55,7 @@ struct pbr_nexthop_cache {
|
|||||||
|
|
||||||
bool looked_at;
|
bool looked_at;
|
||||||
bool valid;
|
bool valid;
|
||||||
|
bool nhr_matched;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern void pbr_nht_write_table_range(struct vty *vty);
|
extern void pbr_nht_write_table_range(struct vty *vty);
|
||||||
|
Loading…
Reference in New Issue
Block a user