]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospfd: handling of OSPF_AREA_RANGE_ADVERTISE flag
authorSarita Patra <saritap@vmware.com>
Tue, 25 Sep 2018 04:44:23 +0000 (21:44 -0700)
committerSarita Patra <saritap@vmware.com>
Tue, 25 Sep 2018 04:46:16 +0000 (21:46 -0700)
Issue: # https://github.com/FRRouting/frr/issues/1836

Issue 1: if the router ospf current configuration is "area 0.0.0.2
range 1.0.0.0/24 cost 23" and user try to configure "area 0.0.0.2
range 1.0.0.0/24 not-advertise", the existing o/p is "area 0.0.0.2
range 1.0.0.0/24 cost 23 not-advertise". The keywords "not-advertise"
& "cost" are multually exclusive, so they should not come together.
The vice versa way configuration is working fine.

Fix: When ospf area range "not-advertise", the cost should be initialized
to OSPF_AREA_RANGE_COST_UNSPEC.

Issue 2: if the router ospf current configuration "area 0.0.0.2 range
1.0.0.0/24 substitute 2.0.0.0/24" and user try to configure "area 0.0.0.2
range 1.0.0.0/24 not-advertise" the existing o/p is "area 0.0.0.2 range
1.0.0.0/24 not-advertise substitute 2.0.0.0/24". The keywords
"not-advertise" & "substiture" are multually exclusive, so they should
not come together. The vice versa way configuration is working fine.

Fix: When ospf area range "not-advertise" is configured,
ospf_area_range_substitute_unset() should be get called.

Issue 3: if the router ospf6 current configuration is "area 0.0.0.2
range 2001::/64 cost 23" and user try to configure "area 0.0.0.2 range
2001::/64 advertise", the existing o/p is area 0.0.0.2 range 2001::/64.
The keyword "cost 23" disappears.

Fix: When ospf area range "advertise" is configured and the range is not
NULL, the cost should not be modified.

Signed-off-by: Sarita Patra <saritap@vmware.com>
ospf6d/ospf6_area.c
ospfd/ospf_abr.c
ospfd/ospf_vty.c

index 2cab69aac221e1c2a1fcb11e56f586099104e6ed..f72ca63ff9f06c48c6f3a19fc3756b07d2815c9d 100644 (file)
@@ -441,6 +441,7 @@ DEFUN (area_range,
                        SET_FLAG(range->flag, OSPF6_ROUTE_DO_NOT_ADVERTISE);
                } else if (strmatch(argv[idx_type]->text, "advertise")) {
                        UNSET_FLAG(range->flag, OSPF6_ROUTE_DO_NOT_ADVERTISE);
+                       cost = range->path.u.cost_config;
                } else {
                        cost = strtoul(argv[5]->arg, NULL, 10);
                        UNSET_FLAG(range->flag, OSPF6_ROUTE_DO_NOT_ADVERTISE);
index 870037efc0ffc514f062142e2cfa56bc9554e727..c8b8b611efcbd9fdc06ac55af6223e2f50336920 100644 (file)
@@ -196,6 +196,8 @@ int ospf_area_range_set(struct ospf *ospf, struct in_addr area_id,
 
        range = ospf_area_range_lookup(area, p);
        if (range != NULL) {
+               if (!CHECK_FLAG(advertise, OSPF_AREA_RANGE_ADVERTISE))
+                       range->cost_config = OSPF_AREA_RANGE_COST_UNSPEC;
                if ((CHECK_FLAG(range->flags, OSPF_AREA_RANGE_ADVERTISE)
                     && !CHECK_FLAG(advertise, OSPF_AREA_RANGE_ADVERTISE))
                    || (!CHECK_FLAG(range->flags, OSPF_AREA_RANGE_ADVERTISE)
@@ -209,8 +211,10 @@ int ospf_area_range_set(struct ospf *ospf, struct in_addr area_id,
 
        if (CHECK_FLAG(advertise, OSPF_AREA_RANGE_ADVERTISE))
                SET_FLAG(range->flags, OSPF_AREA_RANGE_ADVERTISE);
-       else
+       else {
                UNSET_FLAG(range->flags, OSPF_AREA_RANGE_ADVERTISE);
+               range->cost_config = OSPF_AREA_RANGE_COST_UNSPEC;
+       }
 
        return 1;
 }
index e25d1a31dedf333b164a2708da6012f9ad1a25de..25d54a8553ed5e04f81fc9a09f6d1c84404ee434 100644 (file)
@@ -750,6 +750,7 @@ DEFUN (ospf_area_range_not_advertise,
        ospf_area_range_set(ospf, area_id, &p, 0);
        ospf_area_display_format_set(ospf, ospf_area_get(ospf, area_id),
                                     format);
+       ospf_area_range_substitute_unset(ospf, area_id, &p);
 
        return CMD_SUCCESS;
 }