Merge pull request #6423 from rgirada/ospf_tag

ospfd: Route-tag is not set to external routes when applied using route maps
This commit is contained in:
Donald Sharp 2020-05-21 12:43:23 -04:00 committed by GitHub
commit 4244e5484f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 1 deletions

View File

@ -149,6 +149,7 @@ ospf_external_info_add(struct ospf *ospf, uint8_t type, unsigned short instance,
new->ifindex = ifindex;
new->nexthop = nexthop;
new->tag = tag;
new->orig_tag = tag;
/* we don't unlock rn from the get() because we're attaching the info */
if (rn)

View File

@ -46,6 +46,9 @@ struct external_info {
/* Additional Route tag. */
route_tag_t tag;
/* Actual tag received from zebra*/
route_tag_t orig_tag;
struct route_map_set_values route_map_set;
#define ROUTEMAP_METRIC(E) (E)->route_map_set.metric
#define ROUTEMAP_METRIC_TYPE(E) (E)->route_map_set.metric_type

View File

@ -696,6 +696,7 @@ int ospf_redistribute_check(struct ospf *ospf, struct external_info *ei,
struct ospf_redist *red;
uint8_t type = is_prefix_default(&ei->p) ? DEFAULT_ROUTE : ei->type;
unsigned short instance = is_prefix_default(&ei->p) ? 0 : ei->instance;
route_tag_t saved_tag = 0;
if (changed)
*changed = 0;
@ -726,6 +727,10 @@ int ospf_redistribute_check(struct ospf *ospf, struct external_info *ei,
save_values = ei->route_map_set;
ospf_reset_route_map_set_values(&ei->route_map_set);
saved_tag = ei->tag;
/* Resetting with original route tag */
ei->tag = ei->orig_tag;
/* apply route-map if needed */
red = ospf_redist_lookup(ospf, type, instance);
if (red && ROUTEMAP_NAME(red)) {
@ -747,9 +752,13 @@ int ospf_redistribute_check(struct ospf *ospf, struct external_info *ei,
}
/* check if 'route-map set' changed something */
if (changed)
if (changed) {
*changed = !ospf_route_map_set_compare(
&ei->route_map_set, &save_values);
/* check if tag is modified */
*changed |= (saved_tag != ei->tag);
}
}
return 1;