summaryrefslogtreecommitdiff
path: root/proto/static
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2022-05-30 17:27:03 +0200
committerMaria Matejka <mq@ucw.cz>2022-05-30 17:27:03 +0200
commit7b0c89a47fa1f63248ceaa1e9c1b3948dd29a68d (patch)
treea1be538eeac144479ba65e8f67d25e396abcc937 /proto/static
parent41508ceac3cdd74ca705d3bfc6a79464bf38e0b5 (diff)
parentf2e725a76882ba6b75c3ce4fb3c760bd83462410 (diff)
Merge commit 'f2e725a76882ba6b75c3ce4fb3c760bd83462410' into haugesund
Diffstat (limited to 'proto/static')
-rw-r--r--proto/static/static.c28
-rw-r--r--proto/static/static.h2
2 files changed, 10 insertions, 20 deletions
diff --git a/proto/static/static.c b/proto/static/static.c
index f7eddedb..dffc4882 100644
--- a/proto/static/static.c
+++ b/proto/static/static.c
@@ -76,8 +76,8 @@ static_announce_rte(struct static_proto *p, struct static_route *r)
nh->weight = r2->weight;
if (r2->mls)
{
- nh->labels = r2->mls->len;
- memcpy(nh->label, r2->mls->stack, r2->mls->len * sizeof(u32));
+ nh->labels = r2->mls->length / sizeof(u32);
+ memcpy(nh->label, r2->mls->data, r2->mls->length);
}
nexthop_insert(&nhs, nh);
@@ -92,7 +92,11 @@ static_announce_rte(struct static_proto *p, struct static_route *r)
if (r->dest == RTDX_RECURSIVE)
{
rtable *tab = ipa_is_ip4(r->via) ? p->igp_table_ip4 : p->igp_table_ip6;
- rta_set_recursive_next_hop(p->p.main_channel->table, a, tab, r->via, IPA_NONE, r->mls);
+ if (r->mls)
+ ea_set_attr(&a->eattrs,
+ EA_LITERAL_DIRECT_ADATA(&ea_mpls_labels, 0, r->mls));
+
+ rta_set_recursive_next_hop(p->p.main_channel->table, a, tab, r->via, IPA_NONE);
}
/* Already announced */
@@ -303,31 +307,17 @@ static_same_dest(struct static_route *x, struct static_route *y)
(x->weight != y->weight) ||
(x->use_bfd != y->use_bfd) ||
(!x->mls != !y->mls) ||
- ((x->mls) && (y->mls) && (x->mls->len != y->mls->len)))
+ ((x->mls) && (y->mls) && adata_same(x->mls, y->mls)))
return 0;
-
- if (!x->mls)
- continue;
-
- for (uint i = 0; i < x->mls->len; i++)
- if (x->mls->stack[i] != y->mls->stack[i])
- return 0;
}
return !x && !y;
case RTDX_RECURSIVE:
if (!ipa_equal(x->via, y->via) ||
(!x->mls != !y->mls) ||
- ((x->mls) && (y->mls) && (x->mls->len != y->mls->len)))
+ ((x->mls) && (y->mls) && adata_same(x->mls, y->mls)))
return 0;
- if (!x->mls)
- return 1;
-
- for (uint i = 0; i < x->mls->len; i++)
- if (x->mls->stack[i] != y->mls->stack[i])
- return 0;
-
return 1;
default:
diff --git a/proto/static/static.h b/proto/static/static.h
index d99f7ebd..ea7ca33b 100644
--- a/proto/static/static.h
+++ b/proto/static/static.h
@@ -49,7 +49,7 @@ struct static_route {
byte weight; /* Multipath next hop weight */
byte use_bfd; /* Configured to use BFD */
struct bfd_request *bfd_req; /* BFD request, if BFD is used */
- mpls_label_stack *mls; /* MPLS label stack; may be NULL */
+ struct adata *mls; /* MPLS label stack; may be NULL */
};
/*