diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-02-01 00:24:06 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-02-09 02:31:37 +0100 |
commit | 70e98a7fe7296a1279c6b7142e57221f71ff3121 (patch) | |
tree | 77325f78eefb0c95c96d18f8f09fee296d55db35 /lib/mpls.h | |
parent | zebra: Cleanup mpls handling to allow a NEXTHOP_TYPE_IFINDEX (diff) | |
download | frr-70e98a7fe7296a1279c6b7142e57221f71ff3121.tar.xz frr-70e98a7fe7296a1279c6b7142e57221f71ff3121.zip |
*: Make code use a consisten definition of labels
Turns out we had 3 different ways to define labels
all of them overlapping with the same meanings.
Consolidate to 1. This one choosen is consistent
naming wise with what the *bsd and linux kernels
use.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'lib/mpls.h')
-rw-r--r-- | lib/mpls.h | 60 |
1 files changed, 29 insertions, 31 deletions
diff --git a/lib/mpls.h b/lib/mpls.h index 95882c26e..c6c0297ff 100644 --- a/lib/mpls.h +++ b/lib/mpls.h @@ -24,21 +24,27 @@ #include <arpa/inet.h> +#ifdef MPLS_LABEL_MAX +#undef MPLS_LABEL_MAX +#endif + /* Well-known MPLS label values (RFC 3032 etc). */ -#define MPLS_V4_EXP_NULL_LABEL 0 -#define MPLS_RA_LABEL 1 -#define MPLS_V6_EXP_NULL_LABEL 2 -#define MPLS_IMP_NULL_LABEL 3 -#define MPLS_ENTROPY_LABEL_INDICATOR 7 -#define MPLS_GAL_LABEL 13 -#define MPLS_OAM_ALERT_LABEL 14 -#define MPLS_EXTENSION_LABEL 15 +#define MPLS_LABEL_IPV4_EXPLICIT_NULL 0 /* [RFC3032] */ +#define MPLS_LABEL_ROUTER_ALERT 1 /* [RFC3032] */ +#define MPLS_LABEL_IPV6_EXPLICIT_NULL 2 /* [RFC3032] */ +#define MPLS_LABEL_IMPLICIT_NULL 3 /* [RFC3032] */ +#define MPLS_LABEL_ELI 7 /* [RFC6790] */ +#define MPLS_LABEL_GAL 13 /* [RFC5586] */ +#define MPLS_LABEL_OAM_ALERT 14 /* [RFC3429] */ +#define MPLS_LABEL_EXTENSION 15 /* [RFC7274] */ +#define MPLS_LABEL_MAX 1048575 +#define MPLS_LABEL_ILLEGAL 0xFFFFFFFF /* for internal use only */ /* Minimum and maximum label values */ -#define MPLS_MIN_RESERVED_LABEL 0 -#define MPLS_MAX_RESERVED_LABEL 15 -#define MPLS_MIN_UNRESERVED_LABEL 16 -#define MPLS_MAX_UNRESERVED_LABEL 1048575 +#define MPLS_LABEL_RESERVED_MIN 0 +#define MPLS_LABEL_RESERVED_MAX 15 +#define MPLS_LABEL_UNRESERVED_MIN 16 +#define MPLS_LABEL_UNRESERVED_MAX 1048575 /* Default min and max SRGB label range */ /* Even if the SRGB allows to manage different Label space between routers, @@ -56,11 +62,11 @@ #define MPLS_MAX_LABELS 16 #define IS_MPLS_RESERVED_LABEL(label) \ - (label >= MPLS_MIN_RESERVED_LABEL && label <= MPLS_MAX_RESERVED_LABEL) + (label >= MPLS_LABEL_RESERVED_MIN && label <= MPLS_LABEL_RESERVED_MAX) #define IS_MPLS_UNRESERVED_LABEL(label) \ - (label >= MPLS_MIN_UNRESERVED_LABEL \ - && label <= MPLS_MAX_UNRESERVED_LABEL) + (label >= MPLS_LABEL_UNRESERVED_MIN \ + && label <= MPLS_LABEL_UNRESERVED_MAX) /* Definitions for a MPLS label stack entry (RFC 3032). This encodes the * label, EXP, BOS and TTL fields. @@ -153,28 +159,28 @@ static inline void mpls_lse_decode(mpls_lse_t lse, mpls_label_t *label, static inline char *label2str(mpls_label_t label, char *buf, size_t len) { switch (label) { - case MPLS_V4_EXP_NULL_LABEL: + case MPLS_LABEL_IPV4_EXPLICIT_NULL: strlcpy(buf, "IPv4 Explicit Null", len); return (buf); - case MPLS_RA_LABEL: + case MPLS_LABEL_ROUTER_ALERT: strlcpy(buf, "Router Alert", len); return (buf); - case MPLS_V6_EXP_NULL_LABEL: + case MPLS_LABEL_IPV6_EXPLICIT_NULL: strlcpy(buf, "IPv6 Explict Null", len); return (buf); - case MPLS_IMP_NULL_LABEL: + case MPLS_LABEL_IMPLICIT_NULL: strlcpy(buf, "implicit-null", len); return (buf); - case MPLS_ENTROPY_LABEL_INDICATOR: + case MPLS_LABEL_ELI: strlcpy(buf, "Entropy Label Indicator", len); return (buf); - case MPLS_GAL_LABEL: + case MPLS_LABEL_GAL: strlcpy(buf, "Generic Associated Channel", len); return (buf); - case MPLS_OAM_ALERT_LABEL: + case MPLS_LABEL_OAM_ALERT: strlcpy(buf, "OAM Alert", len); return (buf); - case MPLS_EXTENSION_LABEL: + case MPLS_LABEL_EXTENSION: strlcpy(buf, "Extension", len); return (buf); default: @@ -186,13 +192,5 @@ static inline char *label2str(mpls_label_t label, char *buf, size_t len) } } -/* constants used by ldpd */ -#define MPLS_LABEL_IPV4NULL 0 /* IPv4 Explicit NULL Label */ -#define MPLS_LABEL_RTALERT 1 /* Router Alert Label */ -#define MPLS_LABEL_IPV6NULL 2 /* IPv6 Explicit NULL Label */ -#define MPLS_LABEL_IMPLNULL 3 /* Implicit NULL Label */ - /* MPLS_LABEL_RESERVED 4-15 */ /* Values 4-15 are reserved */ -#define MPLS_LABEL_RESERVED_MAX 15 -#define MPLS_LABEL_MAX ((1 << 20) - 1) #endif |