diff options
| author | Mark Stapp <mjs@voltanet.io> | 2019-08-12 08:51:36 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-08-12 08:51:36 -0400 |
| commit | 595ad74b772ef1e32a1c238e6bc8ae7eb447cd27 (patch) | |
| tree | e0705cd29d73db5e3df71a57d03ec350af936905 /lib/stream.c | |
| parent | 3a6a0888f0806beb5003ae216555701de177918d (diff) | |
| parent | ec15e1b5884d6b23a878aedcc6bcbda927022c96 (diff) | |
Merge pull request #4793 from qlyoung/fix-bgp-labeled-unicast-addpath
bgpd: tx addpath info for labeled unicast
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 6c187bd359..c67bc3c993 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]); |
