Skip to content

Commit

Permalink
*: Remove route_map_object_t from the system
Browse files Browse the repository at this point in the history
The route_map_object_t was being used to track what protocol we were
being called against.  But each protocol was only ever calling itself.
So we had a variable that was only ever being passed in from route_map_apply
that had to be carried against and everyone was testing if that variable
was for their own stack.

Clean up this route_map_object_t from the entire system.  We should
speed some stuff up.  Yes I know not a bunch but this will add up.

Signed-off-by: Donald Sharp <[email protected]>
  • Loading branch information
donaldsharp committed Nov 14, 2020
1 parent 15675d0 commit 1782514
Show file tree
Hide file tree
Showing 23 changed files with 971 additions and 1,341 deletions.
3 changes: 1 addition & 2 deletions bgpd/bgp_attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1003,8 +1003,7 @@ struct attr *bgp_attr_aggregate_intern(

SET_FLAG(bgp->peer_self->rmap_type, PEER_RMAP_TYPE_AGGREGATE);

ret = route_map_apply(aggregate->rmap.map, p, RMAP_BGP,
&rmap_path);
ret = route_map_apply(aggregate->rmap.map, p, &rmap_path);

bgp->peer_self->rmap_type = 0;

Expand Down
4 changes: 2 additions & 2 deletions bgpd/bgp_conditional_adv.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ bgp_check_rmap_prefixes_in_bgp_table(struct bgp_table *table,

RESET_FLAG(dummy_attr.rmap_change_flags);

ret = route_map_apply(rmap, dest_p, RMAP_BGP, &path);
ret = route_map_apply(rmap, dest_p, &path);
if (ret != RMAP_PERMITMATCH)
bgp_attr_flush(&dummy_attr);
else {
Expand Down Expand Up @@ -112,7 +112,7 @@ static void bgp_conditional_adv_routes(struct peer *peer, afi_t afi,

RESET_FLAG(dummy_attr.rmap_change_flags);

if (route_map_apply(rmap, dest_p, RMAP_BGP, &path)
if (route_map_apply(rmap, dest_p, &path)
!= RMAP_PERMITMATCH) {
bgp_attr_flush(&dummy_attr);
continue;
Expand Down
2 changes: 1 addition & 1 deletion bgpd/bgp_evpn.c
Original file line number Diff line number Diff line change
Expand Up @@ -4201,7 +4201,7 @@ void bgp_evpn_advertise_type5_routes(struct bgp *bgp_vrf, afi_t afi,
bgp_vrf->adv_cmd_rmap[afi][safi]
.map,
bgp_dest_get_prefix(dest),
RMAP_BGP, &tmp_pi);
&tmp_pi);
if (ret == RMAP_DENYMATCH) {
bgp_attr_flush(&tmp_attr);
continue;
Expand Down
4 changes: 2 additions & 2 deletions bgpd/bgp_mplsvpn.c
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ void vpn_leak_from_vrf_update(struct bgp *bgp_vpn, /* to */
info.attr = &static_attr;
ret = route_map_apply(
bgp_vrf->vpn_policy[afi].rmap[BGP_VPN_POLICY_DIR_TOVPN],
p, RMAP_BGP, &info);
p, &info);
if (RMAP_DENYMATCH == ret) {
bgp_attr_flush(&static_attr); /* free any added parts */
if (debug)
Expand Down Expand Up @@ -1190,7 +1190,7 @@ vpn_leak_to_vrf_update_onevrf(struct bgp *bgp_vrf, /* to */
info.extra = path_vpn->extra; /* Used for source-vrf filter */
ret = route_map_apply(bgp_vrf->vpn_policy[afi]
.rmap[BGP_VPN_POLICY_DIR_FROMVPN],
p, RMAP_BGP, &info);
p, &info);
if (RMAP_DENYMATCH == ret) {
bgp_attr_flush(&static_attr); /* free any added parts */
if (debug)
Expand Down
24 changes: 10 additions & 14 deletions bgpd/bgp_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -1500,7 +1500,7 @@ static int bgp_input_modifier(struct peer *peer, const struct prefix *p,
SET_FLAG(peer->rmap_type, PEER_RMAP_TYPE_IN);

/* Apply BGP route map to the attribute. */
ret = route_map_apply(rmap, p, RMAP_BGP, &rmap_path);
ret = route_map_apply(rmap, p, &rmap_path);

peer->rmap_type = 0;

Expand Down Expand Up @@ -1551,7 +1551,7 @@ static int bgp_output_modifier(struct peer *peer, const struct prefix *p,
SET_FLAG(peer->rmap_type, PEER_RMAP_TYPE_OUT);

/* Apply BGP route map to the attribute. */
ret = route_map_apply(rmap, p, RMAP_BGP, &rmap_path);
ret = route_map_apply(rmap, p, &rmap_path);

peer->rmap_type = rmap_type;

Expand Down Expand Up @@ -2047,10 +2047,10 @@ bool subgroup_announce_check(struct bgp_dest *dest, struct bgp_path_info *pi,

if (bgp_path_suppressed(pi))
ret = route_map_apply(UNSUPPRESS_MAP(filter), p,
RMAP_BGP, &rmap_path);
&rmap_path);
else
ret = route_map_apply(ROUTE_MAP_OUT(filter), p,
RMAP_BGP, &rmap_path);
&rmap_path);

peer->rmap_type = 0;

Expand Down Expand Up @@ -2633,7 +2633,7 @@ static void bgp_process_evpn_route_injection(struct bgp *bgp, afi_t afi,
RESET_FLAG(dummy_attr.rmap_change_flags);

ret = route_map_apply(bgp->adv_cmd_rmap[afi][safi].map,
p, RMAP_BGP, &rmap_path);
p, &rmap_path);

if (ret == RMAP_DENYMATCH) {
bgp_attr_flush(&dummy_attr);
Expand Down Expand Up @@ -5215,8 +5215,7 @@ void bgp_static_update(struct bgp *bgp, const struct prefix *p,

SET_FLAG(bgp->peer_self->rmap_type, PEER_RMAP_TYPE_NETWORK);

ret = route_map_apply(bgp_static->rmap.map, p, RMAP_BGP,
&rmap_path);
ret = route_map_apply(bgp_static->rmap.map, p, &rmap_path);

bgp->peer_self->rmap_type = 0;

Expand Down Expand Up @@ -5535,8 +5534,7 @@ static void bgp_static_update_safi(struct bgp *bgp, const struct prefix *p,

SET_FLAG(bgp->peer_self->rmap_type, PEER_RMAP_TYPE_NETWORK);

ret = route_map_apply(bgp_static->rmap.map, p, RMAP_BGP,
&rmap_path);
ret = route_map_apply(bgp_static->rmap.map, p, &rmap_path);

bgp->peer_self->rmap_type = 0;

Expand Down Expand Up @@ -6387,7 +6385,7 @@ static bool aggr_suppress_map_test(struct bgp *bgp,
rmap_path.attr = &attr;

SET_FLAG(bgp->peer_self->rmap_type, PEER_RMAP_TYPE_AGGREGATE);
rmr = route_map_apply(aggregate->suppress_map, p, RMAP_BGP, &rmap_path);
rmr = route_map_apply(aggregate->suppress_map, p, &rmap_path);
bgp->peer_self->rmap_type = 0;

bgp_attr_flush(&attr);
Expand Down Expand Up @@ -7845,8 +7843,7 @@ void bgp_redistribute_add(struct bgp *bgp, struct prefix *p,
SET_FLAG(bgp->peer_self->rmap_type,
PEER_RMAP_TYPE_REDISTRIBUTE);

ret = route_map_apply(red->rmap.map, p, RMAP_BGP,
&rmap_path);
ret = route_map_apply(red->rmap.map, p, &rmap_path);

bgp->peer_self->rmap_type = 0;

Expand Down Expand Up @@ -10392,8 +10389,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
path.peer = pi->peer;
path.attr = &dummy_attr;

ret = route_map_apply(rmap, dest_p, RMAP_BGP,
&path);
ret = route_map_apply(rmap, dest_p, &path);
if (ret == RMAP_DENYMATCH)
continue;
}
Expand Down
Loading

0 comments on commit 1782514

Please sign in to comment.