diff options
author | Quentin Young <qlyoung@cumulusnetworks.com> | 2019-08-06 23:18:42 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2019-08-06 23:46:46 +0200 |
commit | ec15e1b5884d6b23a878aedcc6bcbda927022c96 (patch) | |
tree | 76eeb5451f84eefb9f9e28c64a3c649b4b648f02 /lib/stream.c | |
parent | Merge pull request #4792 from opensourcerouting/doc_libcap (diff) | |
download | frr-ec15e1b5884d6b23a878aedcc6bcbda927022c96.tar.xz frr-ec15e1b5884d6b23a878aedcc6bcbda927022c96.zip |
bgpd: tx addpath info for labeled unicast
Labeled unicast needs path IDs too!
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/stream.c')
-rw-r--r-- | lib/stream.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/stream.c b/lib/stream.c index 6c187bd35..c67bc3c99 100644 --- a/lib/stream.c +++ b/lib/stream.c @@ -904,20 +904,30 @@ int stream_put_prefix(struct stream *s, struct prefix *p) /* Put NLRI with label */ int stream_put_labeled_prefix(struct stream *s, struct prefix *p, - mpls_label_t *label) + mpls_label_t *label, int addpath_encode, + uint32_t addpath_tx_id) { size_t psize; + size_t psize_with_addpath; uint8_t *label_pnt = (uint8_t *)label; STREAM_VERIFY_SANE(s); psize = PSIZE(p->prefixlen); + psize_with_addpath = psize + (addpath_encode ? 4 : 0); - if (STREAM_WRITEABLE(s) < (psize + 3)) { + if (STREAM_WRITEABLE(s) < (psize_with_addpath + 3)) { STREAM_BOUND_WARN(s, "put"); return 0; } + if (addpath_encode) { + s->data[s->endp++] = (uint8_t)(addpath_tx_id >> 24); + s->data[s->endp++] = (uint8_t)(addpath_tx_id >> 16); + s->data[s->endp++] = (uint8_t)(addpath_tx_id >> 8); + s->data[s->endp++] = (uint8_t)addpath_tx_id; + } + stream_putc(s, (p->prefixlen + 24)); stream_putc(s, label_pnt[0]); stream_putc(s, label_pnt[1]); |