forked from Mirror/frr
bgpd: tx addpath info for labeled unicast
Labeled unicast needs path IDs too! Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
parent
edc2457546
commit
ec15e1b588
|
@ -2956,7 +2956,8 @@ void bgp_packet_mpattr_prefix(struct stream *s, afi_t afi, safi_t safi,
|
|||
addpath_encode, addpath_tx_id);
|
||||
} else if (safi == SAFI_LABELED_UNICAST) {
|
||||
/* Prefix write with label. */
|
||||
stream_put_labeled_prefix(s, p, label);
|
||||
stream_put_labeled_prefix(s, p, label, addpath_encode,
|
||||
addpath_tx_id);
|
||||
} else if (safi == SAFI_FLOWSPEC) {
|
||||
if (PSIZE (p->prefixlen)+2 < FLOWSPEC_NLRI_SIZELIMIT)
|
||||
stream_putc(s, PSIZE (p->prefixlen)+2);
|
||||
|
|
14
lib/stream.c
14
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]);
|
||||
|
|
|
@ -199,7 +199,8 @@ extern int stream_put_prefix_addpath(struct stream *, struct prefix *,
|
|||
uint32_t addpath_tx_id);
|
||||
extern int stream_put_prefix(struct stream *, struct prefix *);
|
||||
extern int stream_put_labeled_prefix(struct stream *, struct prefix *,
|
||||
mpls_label_t *);
|
||||
mpls_label_t *, int addpath_encode,
|
||||
uint32_t addpath_tx_id);
|
||||
extern void stream_get(void *, struct stream *, size_t);
|
||||
extern bool stream_get2(void *data, struct stream *s, size_t size);
|
||||
extern void stream_get_from(void *, struct stream *, size_t, size_t);
|
||||
|
|
Loading…
Reference in a new issue