diff options
| author | Jafar Al-Gharaibeh <jafar@atcorp.com> | 2023-03-30 22:36:13 -0500 | 
|---|---|---|
| committer | Jafar Al-Gharaibeh <jafar@atcorp.com> | 2023-04-18 00:21:05 -0500 | 
| commit | 6af89f8f033b61217322ca1e8fca324f813a1ef5 (patch) | |
| tree | 626c01046012a628a44314d6d61e446ef61977ee /ospfd/ospf_asbr.h | |
| parent | be574cf987311bf299de018b71084e69eb08f5fc (diff) | |
ospfd: use rib metric as the base for set metric +/-
When using route maps with external routes in OSPF as follows:
```
   set metric +10
 ```
The current behavior is to use the default ospf metric as the base and then add
to 10 to it. The behavior isn't useful as-is. A value 30 (20 dfeault + 10) can
be set directly instead. the behavior is also not consistent with bgp. bgp does
use the rib metric in this case as the base. The current behavior also doesn't
allow the metric to accumulate when crossing different routing domains such as
vrfs causing the metric to reset every time the route enters a new vrf with a new
ospf network.
This PR changes the behavior such that the rib metric is used as a base for
ospf exteral routes when used with `set metric -/+`
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
Diffstat (limited to 'ospfd/ospf_asbr.h')
| -rw-r--r-- | ospfd/ospf_asbr.h | 11 | 
1 files changed, 6 insertions, 5 deletions
diff --git a/ospfd/ospf_asbr.h b/ospfd/ospf_asbr.h index 6b427c5fd2..256a6c8b5b 100644 --- a/ospfd/ospf_asbr.h +++ b/ospfd/ospf_asbr.h @@ -36,6 +36,8 @@ struct external_info {  	/* Actual tag received from zebra*/  	route_tag_t orig_tag; +	uint32_t metric; +  	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 @@ -99,11 +101,10 @@ extern struct external_info *ospf_external_info_new(struct ospf *, uint8_t,  extern void ospf_reset_route_map_set_values(struct route_map_set_values *);  extern int ospf_route_map_set_compare(struct route_map_set_values *,  				      struct route_map_set_values *); -extern struct external_info *ospf_external_info_add(struct ospf *, uint8_t, -						    unsigned short, -						    struct prefix_ipv4, -						    ifindex_t, struct in_addr, -						    route_tag_t); +extern struct external_info * +ospf_external_info_add(struct ospf *, uint8_t, unsigned short, +		       struct prefix_ipv4, ifindex_t, struct in_addr, +		       route_tag_t, uint32_t metric);  extern void ospf_external_info_delete(struct ospf *, uint8_t, unsigned short,  				      struct prefix_ipv4);  extern struct external_info *ospf_external_info_lookup(struct ospf *, uint8_t,  | 
