]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib, zebra: Rename and place appropriately the label stack
authorDonald Sharp <sharpd@cumulusnetworks.com>
Sun, 21 Jan 2018 21:11:50 +0000 (16:11 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 22 Jan 2018 16:55:22 +0000 (11:55 -0500)
Fix and rename the label stack to be better named.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
lib/mpls.h
lib/nexthop.c
lib/nexthop.h
zebra/rt_netlink.c
zebra/rt_socket.c
zebra/zebra_mpls.c

index bf98eecd81615adafe8b22f4002579a3610ba18a..6ef00375e8acc479426657c1a720b3962e4605f3 100644 (file)
@@ -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
index f6b2c9788d50a4757649f76d12b593ad821cbcbb..f531f27302d772599f4b9919b6a367105eb12b39 100644 (file)
@@ -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++)
index a727f37057f3c9413f366f848671c4b8a5944c20..753e66643d14cd34cef6f8d0a27414af9391599e 100644 (file)
@@ -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
index a77814668d4518d179abf30db4d5ea2b3081678d..2dc3771b252565714db512210175384cdbca10e9 100644 (file)
@@ -803,7 +803,7 @@ static void _netlink_route_build_singlepath(const char *routedesc, int bytelen,
                                            struct rtmsg *rtmsg,
                                            size_t req_size, int cmd)
 {
-       struct nexthop_label *nh_label;
+       struct mpls_label_stack *nh_label;
        mpls_lse_t out_lse[MPLS_MAX_LABELS];
        char label_buf[256];
 
@@ -1003,7 +1003,7 @@ static void _netlink_route_build_multipath(const char *routedesc, int bytelen,
                                           struct rtmsg *rtmsg,
                                           union g_addr **src)
 {
-       struct nexthop_label *nh_label;
+       struct mpls_label_stack *nh_label;
        mpls_lse_t out_lse[MPLS_MAX_LABELS];
        char label_buf[256];
 
index 0c29f0650cbb6cfbd42318c035ca5dc9cbd3003b..09fdf0b2d38f64abeb65646c3a3f46939246c851 100644 (file)
@@ -67,7 +67,7 @@ static int sin_masklen(struct in_addr mask)
 #endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
 
 #ifdef __OpenBSD__
-static int kernel_rtm_add_labels(struct nexthop_label *nh_label,
+static int kernel_rtm_add_labels(struct mpls_label_stack *nh_label,
                                 struct sockaddr_mpls *smpls)
 {
        if (nh_label->num_labels > 1) {
index 4c6fb002dca301b069760dc228df4a3020164423..193aaa068a653d4b4f4dc4b8774b998c253495d7 100644 (file)
@@ -104,7 +104,7 @@ static zebra_nhlfe_t *nhlfe_add(zebra_lsp_t *lsp, enum lsp_types_t lsp_type,
                                ifindex_t ifindex, mpls_label_t out_label);
 static int nhlfe_del(zebra_nhlfe_t *snhlfe);
 static void nhlfe_out_label_update(zebra_nhlfe_t *nhlfe,
-                                  struct nexthop_label *nh_label);
+                                  struct mpls_label_stack *nh_label);
 static int mpls_lsp_uninstall_all(struct hash *lsp_table, zebra_lsp_t *lsp,
                                  enum lsp_types_t type);
 static int mpls_static_lsp_uninstall_all(struct zebra_vrf *zvrf,
@@ -1217,7 +1217,7 @@ static int nhlfe_del(zebra_nhlfe_t *nhlfe)
  * Update label for NHLFE entry.
  */
 static void nhlfe_out_label_update(zebra_nhlfe_t *nhlfe,
-                                  struct nexthop_label *nh_label)
+                                  struct mpls_label_stack *nh_label)
 {
        nhlfe->nexthop->nh_label->label[0] = nh_label->label[0];
 }