diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/mpls.h | 9 | ||||
| -rw-r--r-- | lib/stream.c | 9 | ||||
| -rw-r--r-- | lib/stream.h | 3 |
3 files changed, 14 insertions, 7 deletions
diff --git a/lib/mpls.h b/lib/mpls.h index c963e55087..20315df7d6 100644 --- a/lib/mpls.h +++ b/lib/mpls.h @@ -80,8 +80,13 @@ 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; -#define MPLS_NO_LABEL 0xFFFFFFFF -#define MPLS_INVALID_LABEL 0xFFFFFFFF +/* 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 + * mpls_label_t has been set by the user. MPLS_INVALID_LABEL has this bit clear + * so that we can use MPLS_INVALID_LABEL to initialize mpls_label_t variables. + */ +#define MPLS_INVALID_LABEL 0xFFFDFFFF /* LSP types. */ enum lsp_types_t diff --git a/lib/stream.c b/lib/stream.c index e8320a8fa1..6163a5b3ec 100644 --- a/lib/stream.c +++ b/lib/stream.c @@ -920,9 +920,10 @@ stream_put_prefix (struct stream *s, struct prefix *p) /* Put NLRI with label */ int -stream_put_labeled_prefix (struct stream *s, struct prefix *p, u_char *label) +stream_put_labeled_prefix (struct stream *s, struct prefix *p, mpls_label_t *label) { size_t psize; + u_char *label_pnt = (u_char *) label; STREAM_VERIFY_SANE(s); @@ -935,9 +936,9 @@ stream_put_labeled_prefix (struct stream *s, struct prefix *p, u_char *label) } stream_putc (s, (p->prefixlen + 24)); - stream_putc(s, label[0]); - stream_putc(s, label[1]); - stream_putc(s, label[2]); + stream_putc(s, label_pnt[0]); + stream_putc(s, label_pnt[1]); + stream_putc(s, label_pnt[2]); memcpy (s->data + s->endp, &p->u.prefix, psize); s->endp += psize; diff --git a/lib/stream.h b/lib/stream.h index dd6aae677d..c012cc4593 100644 --- a/lib/stream.h +++ b/lib/stream.h @@ -22,6 +22,7 @@ #ifndef _ZEBRA_STREAM_H #define _ZEBRA_STREAM_H +#include "mpls.h" #include "prefix.h" /* @@ -181,7 +182,7 @@ extern int stream_put_prefix_addpath (struct stream *, struct prefix *, u_int32_t addpath_tx_id); extern int stream_put_prefix (struct stream *, struct prefix *); extern int stream_put_labeled_prefix (struct stream *, struct prefix *, - u_char *); + mpls_label_t *); extern void stream_get (void *, struct stream *, size_t); extern void stream_get_from (void *, struct stream *, size_t, size_t); extern u_char stream_getc (struct stream *); |
