summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDaniel Walton <dwalton@cumulusnetworks.com>2015-11-05 18:29:43 +0100
committerDaniel Walton <dwalton@cumulusnetworks.com>2015-11-05 18:29:43 +0100
commitadbac85e10692e76c01e831d658958c9f269f18f (patch)
tree84eb4707a775d00bae3761e363a27e5455bdf69f /lib
parentdebian: Modify Quagga cumulus version in debian packaging (diff)
downloadfrr-adbac85e10692e76c01e831d658958c9f269f18f.tar.xz
frr-adbac85e10692e76c01e831d658958c9f269f18f.zip
BGP: support for addpath TX
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Vivek Venkataraman <vivek@cumulusnetworks.com Ticket: CM-8014 This implements addpath TX with the first feature to use it being "neighbor x.x.x.x addpath-tx-all-paths". One change to show output is 'show ip bgp x.x.x.x'. If no addpath-tx features are configured for any peers then everything looks the same as it is today in that "Advertised to" is at the top and refers to which peers the bestpath was advertise to. root@superm-redxp-05[quagga-stash5]# vtysh -c 'show ip bgp 1.1.1.1' BGP routing table entry for 1.1.1.1/32 Paths: (6 available, best #6, table Default-IP-Routing-Table) Advertised to non peer-group peers: r1(10.0.0.1) r2(10.0.0.2) r3(10.0.0.3) r4(10.0.0.4) r5(10.0.0.5) r6(10.0.0.6) r8(10.0.0.8) Local, (Received from a RR-client) 12.12.12.12 (metric 20) from r2(10.0.0.2) (10.0.0.2) Origin IGP, metric 0, localpref 100, valid, internal AddPath ID: RX 0, TX 8 Last update: Fri Oct 30 18:26:44 2015 [snip] but once you enable an addpath feature we must display "Advertised to" on a path-by-path basis: superm-redxp-05# show ip bgp 1.1.1.1/32 BGP routing table entry for 1.1.1.1/32 Paths: (6 available, best #6, table Default-IP-Routing-Table) Local, (Received from a RR-client) 12.12.12.12 (metric 20) from r2(10.0.0.2) (10.0.0.2) Origin IGP, metric 0, localpref 100, valid, internal AddPath ID: RX 0, TX 8 Advertised to: r8(10.0.0.8) Last update: Fri Oct 30 18:26:44 2015 Local, (Received from a RR-client) 34.34.34.34 (metric 20) from r3(10.0.0.3) (10.0.0.3) Origin IGP, metric 0, localpref 100, valid, internal AddPath ID: RX 0, TX 7 Advertised to: r8(10.0.0.8) Last update: Fri Oct 30 18:26:39 2015 Local, (Received from a RR-client) 56.56.56.56 (metric 20) from r6(10.0.0.6) (10.0.0.6) Origin IGP, metric 0, localpref 100, valid, internal AddPath ID: RX 0, TX 6 Advertised to: r8(10.0.0.8) Last update: Fri Oct 30 18:26:39 2015 Local, (Received from a RR-client) 56.56.56.56 (metric 20) from r5(10.0.0.5) (10.0.0.5) Origin IGP, metric 0, localpref 100, valid, internal AddPath ID: RX 0, TX 5 Advertised to: r8(10.0.0.8) Last update: Fri Oct 30 18:26:39 2015 Local, (Received from a RR-client) 34.34.34.34 (metric 20) from r4(10.0.0.4) (10.0.0.4) Origin IGP, metric 0, localpref 100, valid, internal AddPath ID: RX 0, TX 4 Advertised to: r8(10.0.0.8) Last update: Fri Oct 30 18:26:39 2015 Local, (Received from a RR-client) 12.12.12.12 (metric 20) from r1(10.0.0.1) (10.0.0.1) Origin IGP, metric 0, localpref 100, valid, internal, best AddPath ID: RX 0, TX 3 Advertised to: r1(10.0.0.1) r2(10.0.0.2) r3(10.0.0.3) r4(10.0.0.4) r5(10.0.0.5) r6(10.0.0.6) r8(10.0.0.8) Last update: Fri Oct 30 18:26:34 2015 superm-redxp-05#
Diffstat (limited to 'lib')
-rw-r--r--lib/stream.c26
-rw-r--r--lib/stream.h3
2 files changed, 27 insertions, 2 deletions
diff --git a/lib/stream.c b/lib/stream.c
index fcdf56f64..11f35d884 100644
--- a/lib/stream.c
+++ b/lib/stream.c
@@ -752,20 +752,35 @@ stream_put_in6_addr_at (struct stream *s, size_t putp, struct in6_addr *addr)
/* Put prefix by nlri type format. */
int
-stream_put_prefix (struct stream *s, struct prefix *p)
+stream_put_prefix_addpath (struct stream *s, struct prefix *p,
+ int addpath_encode, u_int32_t addpath_tx_id)
{
size_t psize;
+ size_t psize_with_addpath;
STREAM_VERIFY_SANE(s);
psize = PSIZE (p->prefixlen);
+
+ if (addpath_encode)
+ psize_with_addpath = psize + 4;
+ else
+ psize_with_addpath = psize;
- if (STREAM_WRITEABLE (s) < (psize + sizeof (u_char)))
+ if (STREAM_WRITEABLE (s) < (psize_with_addpath + sizeof (u_char)))
{
STREAM_BOUND_WARN (s, "put");
return 0;
}
+ if (addpath_encode)
+ {
+ s->data[s->endp++] = (u_char)(addpath_tx_id >> 24);
+ s->data[s->endp++] = (u_char)(addpath_tx_id >> 16);
+ s->data[s->endp++] = (u_char)(addpath_tx_id >> 8);
+ s->data[s->endp++] = (u_char)addpath_tx_id;
+ }
+
s->data[s->endp++] = p->prefixlen;
memcpy (s->data + s->endp, &p->u.prefix, psize);
s->endp += psize;
@@ -773,6 +788,13 @@ stream_put_prefix (struct stream *s, struct prefix *p)
return psize;
}
+int
+stream_put_prefix (struct stream *s, struct prefix *p)
+{
+ return stream_put_prefix_addpath (s, p, 0, 0);
+}
+
+
/* Read size from fd. */
int
stream_read (struct stream *s, int fd, size_t size)
diff --git a/lib/stream.h b/lib/stream.h
index 3efabe358..32d266831 100644
--- a/lib/stream.h
+++ b/lib/stream.h
@@ -175,6 +175,9 @@ extern int stream_put_ipv4 (struct stream *, u_int32_t);
extern int stream_put_in_addr (struct stream *, struct in_addr *);
extern int stream_put_in_addr_at (struct stream *, size_t, struct in_addr *);
extern int stream_put_in6_addr_at (struct stream *, size_t, struct in6_addr *);
+extern int stream_put_prefix_addpath (struct stream *, struct prefix *,
+ int addpath_encode,
+ u_int32_t addpath_tx_id);
extern int stream_put_prefix (struct stream *, struct prefix *);
extern void stream_get (void *, struct stream *, size_t);