diff options
author | Don Slice <dslice@cumulusnetworks.com> | 2017-03-09 15:54:20 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-04-06 16:32:07 +0200 |
commit | cd1964ff38bdbd2b5d36d0a0d89890e9d1bb2a50 (patch) | |
tree | 204d8be9bf9c213e4a895b1d335fafc8cc4c7d3f /lib/stream.c | |
parent | bgpd: labeled unicast config (diff) | |
download | frr-cd1964ff38bdbd2b5d36d0a0d89890e9d1bb2a50.tar.xz frr-cd1964ff38bdbd2b5d36d0a0d89890e9d1bb2a50.zip |
bgpd: labeled unicast processing
Implement support for negotiating IPv4 or IPv6 labeled-unicast address
family, exchanging prefixes and installing them in the routing table, as
well as interactions with Zebra for FEC registration. This is the
implementation of RFC 3107.
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
Diffstat (limited to 'lib/stream.c')
-rw-r--r-- | lib/stream.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/stream.c b/lib/stream.c index 301ebc627..32dde1ca0 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 |