summaryrefslogtreecommitdiff
path: root/lib/stream.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-05-02 11:38:06 -0400
committerGitHub <noreply@github.com>2017-05-02 11:38:06 -0400
commitb46be72b4aff1d413e89bc26a70a29934afe9d85 (patch)
treecd556a135211559b7e636db619dbf5257f874e86 /lib/stream.c
parent2a23cf9503bf2ff36d3c34308de78618b3196f35 (diff)
parentb2ab6b282ce1569ed348aebe17432094adfe7d24 (diff)
Merge branch 'master' into EIGRP
Diffstat (limited to 'lib/stream.c')
-rw-r--r--lib/stream.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/stream.c b/lib/stream.c
index 301ebc6275..32dde1ca0c 100644
--- a/lib/stream.c
+++ b/lib/stream.c
@@ -919,6 +919,31 @@ stream_put_prefix (struct stream *s, struct prefix *p)
return stream_put_prefix_addpath (s, p, 0, 0);
}
+/* Put NLRI with label */
+int
+stream_put_labeled_prefix (struct stream *s, struct prefix *p, u_char *label)
+{
+ size_t psize;
+
+ STREAM_VERIFY_SANE(s);
+
+ psize = PSIZE (p->prefixlen);
+
+ if (STREAM_WRITEABLE (s) < (psize + 3))
+ {
+ STREAM_BOUND_WARN (s, "put");
+ return 0;
+ }
+
+ stream_putc (s, (p->prefixlen + 24));
+ stream_putc(s, label[0]);
+ stream_putc(s, label[1]);
+ stream_putc(s, label[2]);
+ memcpy (s->data + s->endp, &p->u.prefix, psize);
+ s->endp += psize;
+
+ return (psize + 3);
+}
/* Read size from fd. */
int