]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospf6d: move prefix_options from _path to _route
authorDavid Lamparter <equinox@opensourcerouting.org>
Mon, 28 Jun 2021 13:18:29 +0000 (15:18 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Tue, 20 Jul 2021 09:22:21 +0000 (11:22 +0200)
Prefix options are per-prefix, not per-path.  As evident by the fact
that the field is never used on ECMP paths.  Move it where it belongs.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
ospf6d/ospf6_abr.c
ospf6d/ospf6_asbr.c
ospf6d/ospf6_intra.c
ospf6d/ospf6_nssa.c
ospf6d/ospf6_route.c
ospf6d/ospf6_route.h

index f289bf26b933279eb71250b2770d3b50bfb56296..f5bedc1a8c561339d35af696e071f4c676753171 100644 (file)
@@ -477,11 +477,11 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route,
                monotime(&summary->changed);
        }
 
+       summary->prefix_options = route->prefix_options;
        summary->path.router_bits = route->path.router_bits;
        summary->path.options[0] = route->path.options[0];
        summary->path.options[1] = route->path.options[1];
        summary->path.options[2] = route->path.options[2];
-       summary->path.prefix_options = route->path.prefix_options;
        summary->path.area_id = area->area_id;
        summary->path.type = OSPF6_PATH_TYPE_INTER;
        summary->path.subtype = route->path.subtype;
@@ -514,7 +514,7 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route,
                /* Fill Inter-Area-Prefix-LSA */
                OSPF6_ABR_SUMMARY_METRIC_SET(prefix_lsa, route->path.cost);
                prefix_lsa->prefix.prefix_length = route->prefix.prefixlen;
-               prefix_lsa->prefix.prefix_options = route->path.prefix_options;
+               prefix_lsa->prefix.prefix_options = route->prefix_options;
 
                /* set Prefix */
                memcpy(p, &route->prefix.u.prefix6,
@@ -1167,6 +1167,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
 
        route->type = type;
        route->prefix = prefix;
+       route->prefix_options = prefix_options;
        route->path.origin.type = lsa->header->type;
        route->path.origin.id = lsa->header->id;
        route->path.origin.adv_router = lsa->header->adv_router;
@@ -1174,7 +1175,6 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
        route->path.options[0] = options[0];
        route->path.options[1] = options[1];
        route->path.options[2] = options[2];
-       route->path.prefix_options = prefix_options;
        route->path.area_id = oa->area_id;
        route->path.type = OSPF6_PATH_TYPE_INTER;
        route->path.cost = abr_entry->path.cost + cost;
index 3e911a743a6813c68cfb25df3a1d1b9b9d6bb32c..84111e4b7dbcfc53b65a44c07519a4e131273378 100644 (file)
@@ -121,7 +121,7 @@ void ospf6_as_external_lsa_originate(struct ospf6_route *route,
        as_external_lsa->prefix.prefix_length = route->prefix.prefixlen;
 
        /* PrefixOptions */
-       as_external_lsa->prefix.prefix_options = route->path.prefix_options;
+       as_external_lsa->prefix.prefix_options = route->prefix_options;
 
        /* don't use refer LS-type */
        as_external_lsa->prefix.prefix_refer_lstype = htons(0);
@@ -589,12 +589,12 @@ void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa)
        route->prefix.prefixlen = external->prefix.prefix_length;
        ospf6_prefix_in6_addr(&route->prefix.u.prefix6, external,
                              &external->prefix);
+       route->prefix_options = external->prefix.prefix_options;
 
        route->path.area_id = asbr_entry->path.area_id;
        route->path.origin.type = lsa->header->type;
        route->path.origin.id = lsa->header->id;
        route->path.origin.adv_router = lsa->header->adv_router;
-       route->path.prefix_options = external->prefix.prefix_options;
        memcpy(&route->path.ls_prefix, &asbr_id, sizeof(struct prefix));
 
        if (CHECK_FLAG(external->bits_metric, OSPF6_ASBR_BIT_E)) {
index c971c6180e8536cfe5e6889d27869b8e43909266..1bcfc133f309c6addd0d394e12665e10ff7ff3f4 100644 (file)
@@ -826,7 +826,7 @@ int ospf6_link_lsa_originate(struct thread *thread)
             route && count < max_addr_count;
             route = ospf6_route_next(route), count++) {
                op->prefix_length = route->prefix.prefixlen;
-               op->prefix_options = route->path.prefix_options;
+               op->prefix_options = route->prefix_options;
                op->prefix_metric = htons(0);
                memcpy(OSPF6_PREFIX_BODY(op), &route->prefix.u.prefix6,
                       OSPF6_PREFIX_SPACE(op->prefix_length));
@@ -1193,7 +1193,7 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread)
                }
 
                op->prefix_length = route->prefix.prefixlen;
-               op->prefix_options = route->path.prefix_options;
+               op->prefix_options = route->prefix_options;
                op->prefix_metric = htons(route->path.cost);
                memcpy(OSPF6_PREFIX_BODY(op), &route->prefix.u.prefix6,
                       OSPF6_PREFIX_SPACE(op->prefix_length));
@@ -1356,6 +1356,7 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread)
                               sizeof(struct in6_addr));
                        memcpy(&route->prefix.u.prefix6, OSPF6_PREFIX_BODY(op),
                               OSPF6_PREFIX_SPACE(op->prefix_length));
+                       route->prefix_options = op->prefix_options;
 
                        route->path.origin.type = lsa->header->type;
                        route->path.origin.id = lsa->header->id;
@@ -1363,7 +1364,6 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread)
                        route->path.options[0] = link_lsa->options[0];
                        route->path.options[1] = link_lsa->options[1];
                        route->path.options[2] = link_lsa->options[2];
-                       route->path.prefix_options = op->prefix_options;
                        route->path.area_id = oi->area->area_id;
                        route->path.type = OSPF6_PATH_TYPE_INTRA;
 
@@ -1384,7 +1384,7 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread)
        for (route = ospf6_route_head(route_advertise); route;
             route = ospf6_route_best_next(route)) {
                op->prefix_length = route->prefix.prefixlen;
-               op->prefix_options = route->path.prefix_options;
+               op->prefix_options = route->prefix_options;
                op->prefix_metric = htons(0);
                memcpy(OSPF6_PREFIX_BODY(op), &route->prefix.u.prefix6,
                       OSPF6_PREFIX_SPACE(op->prefix_length));
@@ -1817,12 +1817,12 @@ void ospf6_intra_prefix_lsa_add(struct ospf6_lsa *lsa)
                route->prefix.prefixlen = op->prefix_length;
                ospf6_prefix_in6_addr(&route->prefix.u.prefix6,
                                      intra_prefix_lsa, op);
+               route->prefix_options = op->prefix_options;
 
                route->type = OSPF6_DEST_TYPE_NETWORK;
                route->path.origin.type = lsa->header->type;
                route->path.origin.id = lsa->header->id;
                route->path.origin.adv_router = lsa->header->adv_router;
-               route->path.prefix_options = op->prefix_options;
                route->path.area_id = oa->area_id;
                route->path.type = OSPF6_PATH_TYPE_INTRA;
                route->path.metric_type = 1;
index 9f8cdf8fb7be657736b329263c5cafab020d94c8..bd6fb308dd8297a80469a8031071000f6e17bd69 100644 (file)
@@ -1296,7 +1296,7 @@ void ospf6_nssa_lsa_originate(struct ospf6_route *route,
        as_external_lsa->prefix.prefix_length = route->prefix.prefixlen;
 
        /* PrefixOptions */
-       as_external_lsa->prefix.prefix_options = route->path.prefix_options;
+       as_external_lsa->prefix.prefix_options = route->prefix_options;
 
        /* Set the P bit */
        as_external_lsa->prefix.prefix_options |= OSPF6_PREFIX_OPTION_P;
index 0a026785f47ca689d842de4fbc4ac3181424ebb0..13efa22a981df5119361eb57f5bf0bb3c15d2e3e 100644 (file)
@@ -436,6 +436,7 @@ struct ospf6_route *ospf6_route_copy(struct ospf6_route *route)
        new = ospf6_route_create();
        new->type = route->type;
        memcpy(&new->prefix, &route->prefix, sizeof(struct prefix));
+       new->prefix_options = route->prefix_options;
        new->installed = route->installed;
        new->changed = route->changed;
        new->flag = route->flag;
index a791a82cd4b03260e56a80c3c7c2650f14c6973b..ecfb45d1ea0d023ed7859ca3b4215630d2ac2cdb 100644 (file)
@@ -79,9 +79,6 @@ struct ospf6_path {
        /* Optional Capabilities */
        uint8_t options[3];
 
-       /* Prefix Options */
-       uint8_t prefix_options;
-
        /* Associated Area */
        in_addr_t area_id;
 
@@ -147,6 +144,9 @@ struct ospf6_route {
        /* flag */
        uint8_t flag;
 
+       /* Prefix Options */
+       uint8_t prefix_options;
+
        /* route option */
        void *route_option;