diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2023-03-08 01:13:53 +0100 |
---|---|---|
committer | Renato Westphal <renato@opensourcerouting.org> | 2023-04-01 00:28:15 +0200 |
commit | 4312d66f9f3dc948f1aa4716b5a6af4e3bbd861f (patch) | |
tree | 427cb768679507fd46a20086eed22b1ed8348959 /ospfd/ospf_abr.c | |
parent | ospfd: use the ospf_area_range_active() helper function more consistently (diff) | |
download | frr-4312d66f9f3dc948f1aa4716b5a6af4e3bbd861f.tar.xz frr-4312d66f9f3dc948f1aa4716b5a6af4e3bbd861f.zip |
ospfd: refactor range commands
* Update the "range" helpers to accept an area pointer instead of
an area ID;
* Always call ospf_area_display_format_set() after every "range"
command to ensure consistency.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ospfd/ospf_abr.c')
-rw-r--r-- | ospfd/ospf_abr.c | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/ospfd/ospf_abr.c b/ospfd/ospf_abr.c index 784496bac..72d231a31 100644 --- a/ospfd/ospf_abr.c +++ b/ospfd/ospf_abr.c @@ -169,16 +169,11 @@ static int ospf_area_actively_attached(struct ospf_area *area) return area->act_ints; } -int ospf_area_range_set(struct ospf *ospf, struct in_addr area_id, +int ospf_area_range_set(struct ospf *ospf, struct ospf_area *area, struct prefix_ipv4 *p, int advertise) { - struct ospf_area *area; struct ospf_area_range *range; - area = ospf_area_get(ospf, area_id); - if (area == NULL) - return 0; - range = ospf_area_range_lookup(area, p); if (range != NULL) { if (!CHECK_FLAG(advertise, OSPF_AREA_RANGE_ADVERTISE)) @@ -204,16 +199,11 @@ int ospf_area_range_set(struct ospf *ospf, struct in_addr area_id, return 1; } -int ospf_area_range_cost_set(struct ospf *ospf, struct in_addr area_id, +int ospf_area_range_cost_set(struct ospf *ospf, struct ospf_area *area, struct prefix_ipv4 *p, uint32_t cost) { - struct ospf_area *area; struct ospf_area_range *range; - area = ospf_area_get(ospf, area_id); - if (area == NULL) - return 0; - range = ospf_area_range_lookup(area, p); if (range == NULL) return 0; @@ -227,16 +217,11 @@ int ospf_area_range_cost_set(struct ospf *ospf, struct in_addr area_id, return 1; } -int ospf_area_range_unset(struct ospf *ospf, struct in_addr area_id, +int ospf_area_range_unset(struct ospf *ospf, struct ospf_area *area, struct prefix_ipv4 *p) { - struct ospf_area *area; struct route_node *rn; - area = ospf_area_lookup_by_area_id(ospf, area_id); - if (area == NULL) - return 0; - rn = route_node_lookup(area->ranges, (struct prefix *)p); if (rn == NULL) return 0; @@ -249,13 +234,11 @@ int ospf_area_range_unset(struct ospf *ospf, struct in_addr area_id, return 1; } -int ospf_area_range_substitute_set(struct ospf *ospf, struct in_addr area_id, +int ospf_area_range_substitute_set(struct ospf *ospf, struct ospf_area *area, struct prefix_ipv4 *p, struct prefix_ipv4 *s) { - struct ospf_area *area; struct ospf_area_range *range; - area = ospf_area_get(ospf, area_id); range = ospf_area_range_lookup(area, p); if (range != NULL) { @@ -276,16 +259,11 @@ int ospf_area_range_substitute_set(struct ospf *ospf, struct in_addr area_id, return 1; } -int ospf_area_range_substitute_unset(struct ospf *ospf, struct in_addr area_id, +int ospf_area_range_substitute_unset(struct ospf *ospf, struct ospf_area *area, struct prefix_ipv4 *p) { - struct ospf_area *area; struct ospf_area_range *range; - area = ospf_area_lookup_by_area_id(ospf, area_id); - if (area == NULL) - return 0; - range = ospf_area_range_lookup(area, p); if (range == NULL) return 0; |