diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-01-21 16:11:50 -0500 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-01-22 11:55:22 -0500 |
| commit | 8ecdb26ec08cc66ade06e3d325fceaae7bed76f2 (patch) | |
| tree | 4b057889f07c7e04293f3529d5c2a22f6f320d3d /lib | |
| parent | 8602ad3a4ce480aaffc326f10b5a9dc45ef2535b (diff) | |
lib, zebra: Rename and place appropriately the label stack
Fix and rename the label stack to be better named.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/mpls.h | 6 | ||||
| -rw-r--r-- | lib/nexthop.c | 6 | ||||
| -rw-r--r-- | lib/nexthop.h | 9 |
3 files changed, 10 insertions, 11 deletions
diff --git a/lib/mpls.h b/lib/mpls.h index bf98eecd81..6ef00375e8 100644 --- a/lib/mpls.h +++ b/lib/mpls.h @@ -81,6 +81,12 @@ typedef unsigned int mpls_lse_t; /* MPLS label value as a 32-bit (mostly we only care about the label value). */ typedef unsigned int mpls_label_t; +struct mpls_label_stack { + uint8_t num_labels; + uint8_t reserved[3]; + mpls_label_t label[0]; /* 1 or more labels */ +}; + /* The MPLS explicit-null label is 0 which means when you memset a mpls_label_t * to zero you have set that variable to explicit-null which was probably not * your intent. The work-around is to use one bit to indicate if the diff --git a/lib/nexthop.c b/lib/nexthop.c index f6b2c9788d..f531f27302 100644 --- a/lib/nexthop.c +++ b/lib/nexthop.c @@ -124,7 +124,7 @@ const char *nexthop_type_to_str(enum nexthop_types_t nh_type) */ int nexthop_labels_match(struct nexthop *nh1, struct nexthop *nh2) { - struct nexthop_label *nhl1, *nhl2; + struct mpls_label_stack *nhl1, *nhl2; nhl1 = nh1->nh_label; nhl2 = nh2->nh_label; @@ -210,12 +210,12 @@ void nexthops_free(struct nexthop *nexthop) void nexthop_add_labels(struct nexthop *nexthop, enum lsp_types_t type, u_int8_t num_labels, mpls_label_t *label) { - struct nexthop_label *nh_label; + struct mpls_label_stack *nh_label; int i; nexthop->nh_label_type = type; nh_label = XCALLOC(MTYPE_NH_LABEL, - sizeof(struct nexthop_label) + sizeof(struct mpls_label_stack) + num_labels * sizeof(mpls_label_t)); nh_label->num_labels = num_labels; for (i = 0; i < num_labels; i++) diff --git a/lib/nexthop.h b/lib/nexthop.h index a727f37057..753e66643d 100644 --- a/lib/nexthop.h +++ b/lib/nexthop.h @@ -55,13 +55,6 @@ enum blackhole_type { ((type) == NEXTHOP_TYPE_IFINDEX || (type) == NEXTHOP_TYPE_BLACKHOLE) \ ? (type) : ((type) | 1) -/* Nexthop label structure. */ -struct nexthop_label { - u_int8_t num_labels; - u_int8_t reserved[3]; - mpls_label_t label[0]; /* 1 or more labels. */ -}; - /* Nexthop structure. */ struct nexthop { struct nexthop *next; @@ -107,7 +100,7 @@ struct nexthop { enum lsp_types_t nh_label_type; /* Label(s) associated with this nexthop. */ - struct nexthop_label *nh_label; + struct mpls_label_stack *nh_label; }; /* The following for loop allows to iterate over the nexthop |
