summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_aspath.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* bgpd: Fix AS_PATH size calculation for long pathsAndreas Jaggi2017-09-081-1/+1
| | | | | | | | | | | | | | | | If you have an AS_PATH with more entries than what can be written into a single AS_SEGMENT_MAX it needs to be broken up. The code that noticed that the AS_PATH needs to be broken up was not correctly calculating the size of the resulting message. This patch addresses this issue. This patch was built from an email that Andreas sent to the dev alias for FRRouting. Fixes: #1114 Signed-off-by: Andreas Jaggi <aj@open.ch> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* bgpd: Add various hash optimizationsDonald Sharp2017-09-051-1/+4
| | | | | | | | | | | | 1) Add hash names to all hash_create calls 2) Fix community_hash, ecommunity_hash and lcommunity_hash key creation 3) Fix output of community and lcommunity iterators( why would we want to see the memory location of the backet? ). Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Revert "*: reindent pt. 2"David Lamparter2017-07-221-12/+8
| | | | | | | | | This reverts commit c14777c6bfd0a446c85243d3a9835054a259c276. clang 5 is not widely available enough for people to indent with. This is particularly problematic when rebasing/adjusting branches. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: reindent pt. 2whitespace / reindent2017-07-171-8/+12
| | | | | | | | w/ clang 5 * reflow comments * struct members go 1 per line * binpack algo was adjusted
* *: reindentreindent-master-afterwhitespace / reindent2017-07-171-1728/+1608
| | | | | | indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: fix GCC 7 switch/case fallthrough warningsDavid Lamparter2017-07-141-0/+1
| | | | | | Need a comment on these. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: ditch vty_outln(), part 1 of 2David Lamparter2017-07-131-1/+1
| | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: update hash_create(), hash_create_size()Quentin Young2017-07-021-1/+1
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: use vty_outlnQuentin Young2017-06-291-1/+1
| | | | | | Saves 400 lines Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: make consistent & update GPLv2 file headersDavid Lamparter2017-05-151-19/+19
| | | | | | | | | | | The FSF's address changed, and we had a mixture of comment styles for the GPL file header. (The style with * at the beginning won out with 580 to 141 in existing files.) Note: I've intentionally left intact other "variations" of the copyright header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: remove unnecessary #include "vty.h"Quentin Young2017-03-021-1/+0
| | | | | | Per previous commit, these are no longer necessary. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* Merge remote-tracking branch 'osr_private_quagga/queue/osr/vtysh-generic' ↵Quentin Young2016-12-021-1/+0
|\ | | | | | | into vtysh-grammar
| * Merge branch 'vtysh-grammar'David Lamparter2016-11-281-0/+1
| |\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: isisd/isisd.c lib/Makefile.am lib/thread.c Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * | lib: replace strlcpy & strlcat with glibc versionsDavid Lamparter2016-11-151-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | It seems these two were at some point copied in from rsync; replace with more recent versions that will hopefully become available in glibc as well. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | | bgpd: Make `ip` optional for all `show bgp` and `show ip bgp` commandsQuentin Young2016-12-011-1/+1
| |/ |/| | | | | | | | | | | This should unify the `show bgp ...` and `show ip bgp...` command variants under one tree. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | Merge branch 'cmaster-next' into vtysh-grammarQuentin Young2016-10-211-2/+25
|\| | | | | | | | | | | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com> Conflicts: bgpd/bgp_vty.c
| * bgpd: add 'neighbor x.x.x.x allowas-in origin' knobDaniel Walton2016-10-211-2/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com> Ticket: CM-13207 normal table on spine-1....we do not see 6.0.0.10 (spine-2's loopback) spine-1 and spine-2 are in AS 65200 superm-redxp-05# show ip bgp BGP table version is 13, local router ID is 6.0.0.9 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 6.0.0.5/32 swp1 0 0 65101 ? *> 6.0.0.6/32 swp2 0 0 65101 ? *> 6.0.0.7/32 swp3 0 0 65104 ? *> 6.0.0.8/32 swp4 0 0 65104 ? *> 6.0.0.9/32 0.0.0.0 0 32768 ? *= 6.0.0.11/32 swp2 0 65101 65001 ? *> swp1 0 65101 65001 ? *= 6.0.0.12/32 swp2 0 65101 65002 ? *> swp1 0 65101 65002 ? *= 6.0.0.13/32 swp4 0 65104 65001 ? *> swp3 0 65104 65001 ? *= 6.0.0.14/32 swp4 0 65104 65002 ? *> swp3 0 65104 65002 ? Displayed 9 out of 13 total prefixes superm-redxp-05# spine-1 with "neighbor x.x.x.x allowas-in origin", we now see 6.0.0.10 superm-redxp-05# show ip bgp BGP table version is 14, local router ID is 6.0.0.9 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 6.0.0.5/32 swp1 0 0 65101 ? *> 6.0.0.6/32 swp2 0 0 65101 ? *> 6.0.0.7/32 swp3 0 0 65104 ? *> 6.0.0.8/32 swp4 0 0 65104 ? * 6.0.0.9/32 swp2 0 65101 65200 ? * swp1 0 65101 65200 ? * swp3 0 65104 65200 ? * swp4 0 65104 65200 ? *> 0.0.0.0 0 32768 ? *= 6.0.0.10/32 swp2 0 65101 65200 ? *> swp1 0 65101 65200 ? *= swp3 0 65104 65200 ? *= swp4 0 65104 65200 ? *= 6.0.0.11/32 swp2 0 65101 65001 ? *> swp1 0 65101 65001 ? *= 6.0.0.12/32 swp2 0 65101 65002 ? *> swp1 0 65101 65002 ? *= 6.0.0.13/32 swp4 0 65104 65001 ? *> swp3 0 65104 65001 ? *= 6.0.0.14/32 swp4 0 65104 65002 ? *> swp3 0 65104 65002 ? Displayed 10 out of 21 total prefixes superm-redxp-05# The only as-paths with 65200 that made it through were the ones that originated from 65200 superm-redxp-05# show ip bgp regexp _65200_ BGP table version is 14, local router ID is 6.0.0.9 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path * 6.0.0.9/32 swp2 0 65101 65200 ? * swp1 0 65101 65200 ? * swp3 0 65104 65200 ? * swp4 0 65104 65200 ? *= 6.0.0.10/32 swp2 0 65101 65200 ? *> swp1 0 65101 65200 ? *= swp3 0 65104 65200 ? *= swp4 0 65104 65200 ? Displayed 2 out of 21 total prefixes superm-redxp-05#
* | Merge branch 'cmaster-next' into vtysh-grammarQuentin Young2016-10-201-3/+11
|\| | | | | | | | | | | | | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com> Conflicts: isisd/isis_routemap.c zebra/rt_netlink.c
| * bgpd, lib: memory cleanups for valgrind, plus debug changesLou Berger2016-10-181-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Description: We use valgrind memcheck quite a bit to spot leaks in our work with bgpd. In order to eliminate false positives, we added code in the exit path to release the remaining allocated memory. Bgpd startup log message now includes pid. Some little tweaks by Paul Jakma <paul.jakma@hpe.com>: * bgp_mplsvpn.c: (str2prefix_rd) do the cleanup in common code at the end and goto it. [DL: dropped several chunks from original commit which are obsolete by now on this tree.]
* | bgpd: argv update for all but bgp_vty.cDaniel Walton2016-09-221-0/+1
|/ | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
* lib, bgpd, tests: Refactor FILTER_X in zebra.hDonald Sharp2016-08-161-0/+1
| | | | | | | | lib/zebra.h has FILTER_X #define's. These do not belong there. Put them in lib/filter.h where they belong. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> (cherry picked from commit 0490729cc033a3483fc6b0ed45085ee249cac779)
* *: use void * for printing pointersDavid Lamparter2016-05-301-1/+1
| | | | | | | | | On higher warning levels, compilers expect %p printf arguments to be void *. Since format string / argument warnings can be useful otherwise, let's get rid of this noise by sprinkling casts to void * over printf calls. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* Author: Timo Teräs <timo.teras@iki.fi>Daniel Walton2016-05-261-24/+41
| | | | | | | | | | | | Date: Tue Sep 30 11:31:53 2014 +0300 bgpd: implement route-map set as-path prepend last-as It picks up the AS to add from the aspath, or uses the peers AS number. Useful mostly in iBGP setups. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Reviewed-by: Paul Jakma <paul@opensourcerouting.org>
* bgpd: Clean up some static analysis warningsDonald Sharp2016-05-191-8/+3
| | | | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com> Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
* BGP: Implement "neighbor x.x.x.x addpath-tx-bestpath-per-AS"Daniel Walton2015-11-061-0/+9
| | | | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Ticket: CM-8114
* Bgpd: aspath json memory leak fixDonald Sharp2015-09-031-2/+5
| | | | | | | | | | | Ticket: CM-6790 Reviewed by: CCR-3453 Testing: See bug This code change fixes these things: (a) Fixes an assert followed by an if statement (B) Fixes the memory leak in aspath->json
* Key changes:Donald Sharp2015-06-121-1/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - The aspath and community structures now have a json_object where we store the json representation. This is updated at the same time the "str" for aspath/community are updated. We do this so that we do not have to compute the json rep - Added a small wrappper to libjson0, the wrapper lives in quagga's lib/json.[ch]. - Added more structure to the json output. Sample output: show ip bgp summary json ------------------------ BGP router identifier 10.0.0.1, local AS number 10 BGP table version 2400 RIB entries 4799, using 562 KiB of memory Peers 17, using 284 KiB of memory Peer groups 4, using 224 bytes of memory Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd 1.1.1.1 4 10 0 0 0 0 0 never Active 10.0.0.2 4 10 104 7 0 0 0 00:02:29 600 10.0.0.3 4 10 104 7 0 0 0 00:02:29 600 10.0.0.4 4 10 204 7 0 0 0 00:02:29 1200 20.1.1.6 4 20 406 210 0 0 0 00:02:44 600 20.1.1.7 4 20 406 210 0 0 0 00:02:44 600 40.1.1.2 4 40 406 210 0 0 0 00:02:44 600 40.1.1.6 4 40 406 210 0 0 0 00:02:44 600 40.1.1.10 4 40 406 210 0 0 0 00:02:44 600 Total number of neighbors 9 { "as": 10, "dynamic-peers": 0, "peer-count": 17, "peer-group-count": 4, "peer-group-memory": 224, "peer-memory": 291312, "peers": { "1.1.1.1": { "inq": 0, "msgrcvd": 0, "msgsent": 0, "outq": 0, "prefix-advertised-count": 0, "prefix-received-count": 0, "remote-as": 10, "state": "Active", "table-version": 0, "uptime": "never", "version": 4 }, "10.0.0.2": { "hostname": "r2", "inq": 0, "msgrcvd": 104, "msgsent": 7, "outq": 0, "prefix-advertised-count": 1200, "prefix-received-count": 600, "remote-as": 10, "state": "Established", "table-version": 0, "uptime": "00:02:21", "version": 4 }, "10.0.0.3": { "hostname": "r3", "inq": 0, "msgrcvd": 104, "msgsent": 7, "outq": 0, "prefix-advertised-count": 1200, "prefix-received-count": 600, "remote-as": 10, "state": "Established", "table-version": 0, "uptime": "00:02:21", "version": 4 }, "10.0.0.4": { "hostname": "r4", "inq": 0, "msgrcvd": 204, "msgsent": 7, "outq": 0, "prefix-advertised-count": 1200, "prefix-received-count": 1200, "remote-as": 10, "state": "Established", "table-version": 0, "uptime": "00:02:21", "version": 4 }, "20.1.1.6": { "hostname": "r6", "inq": 0, "msgrcvd": 406, "msgsent": 210, "outq": 0, "prefix-advertised-count": 2400, "prefix-received-count": 600, "remote-as": 20, "state": "Established", "table-version": 0, "uptime": "00:02:36", "version": 4 }, "20.1.1.7": { "hostname": "r7", "inq": 0, "msgrcvd": 406, "msgsent": 210, "outq": 0, "prefix-advertised-count": 2400, "prefix-received-count": 600, "remote-as": 20, "state": "Established", "table-version": 0, "uptime": "00:02:36", "version": 4 }, "40.1.1.10": { "hostname": "r10", "inq": 0, "msgrcvd": 406, "msgsent": 210, "outq": 0, "prefix-advertised-count": 2400, "prefix-received-count": 600, "remote-as": 40, "state": "Established", "table-version": 0, "uptime": "00:02:36", "version": 4 }, "40.1.1.2": { "hostname": "r8", "inq": 0, "msgrcvd": 406, "msgsent": 210, "outq": 0, "prefix-advertised-count": 2400, "prefix-received-count": 600, "remote-as": 40, "state": "Established", "table-version": 0, "uptime": "00:02:36", "version": 4 }, "40.1.1.6": { "hostname": "r9", "inq": 0, "msgrcvd": 406, "msgsent": 210, "outq": 0, "prefix-advertised-count": 2400, "prefix-received-count": 600, "remote-as": 40, "state": "Established", "table-version": 0, "uptime": "00:02:36", "version": 4 } }, "rib-count": 4799, "rib-memory": 575880, "router-id": "10.0.0.1", "table-version": 2400, "total-peers": 9 } show ip bgp json ---------------- *> 40.1.1.2 0 0 100 200 300 400 500 40 i * 40.3.88.0/24 40.1.1.6 0 0 100 200 300 400 500 40 i * 40.1.1.10 0 0 100 200 300 400 500 40 i *> 40.1.1.2 0 0 100 200 300 400 500 40 i * 40.3.89.0/24 40.1.1.6 0 0 100 200 300 400 500 40 i * 40.1.1.10 0 0 100 200 300 400 500 40 i *> 40.1.1.2 0 0 100 200 300 400 500 40 i "40.3.88.0/24": [ { "aspath": "100 200 300 400 500 40", "med": 0, "nexthops": [ { "afi": "ipv4", "ip": "40.1.1.6", "used": true } ], "origin": "IGP", "path-from": "external", "valid": true, "weight": 0 }, { "aspath": "100 200 300 400 500 40", "med": 0, "nexthops": [ { "afi": "ipv4", "ip": "40.1.1.10", "used": true } ], "origin": "IGP", "path-from": "external", "valid": true, "weight": 0 }, { "aspath": "100 200 300 400 500 40", "bestpath": true, "med": 0, "nexthops": [ { "afi": "ipv4", "ip": "40.1.1.2", "used": true } ], "origin": "IGP", "path-from": "external", "valid": true, "weight": 0 } ], "40.3.89.0/24": [ { "aspath": "100 200 300 400 500 40", "med": 0, "nexthops": [ { "afi": "ipv4", "ip": "40.1.1.6", "used": true } ], "origin": "IGP", "path-from": "external", "valid": true, "weight": 0 }, { "aspath": "100 200 300 400 500 40", "med": 0, "nexthops": [ { "afi": "ipv4", "ip": "40.1.1.10", "used": true } ], "origin": "IGP", "path-from": "external", "valid": true, "weight": 0 }, { "aspath": "100 200 300 400 500 40", "bestpath": true, "med": 0, "nexthops": [ { "afi": "ipv4", "ip": "40.1.1.2", "used": true } ], "origin": "IGP", "path-from": "external", "valid": true, "weight": 0 } ], show ip bgp x.x.x.x json ------------------------ BGP routing table entry for 40.3.86.0/24 Paths: (3 available, best #3, table Default-IP-Routing-Table) Advertised to non peer-group peers: 10.0.0.2 10.0.0.3 10.0.0.4 20.1.1.6 20.1.1.7 40.1.1.2 40.1.1.6 40.1.1.10 100 200 300 400 500 40 40.1.1.6 from 40.1.1.6 (40.0.0.9) Origin IGP, metric 0, localpref 100, valid, external Community: 1:1 2:2 3:3 4:4 10:10 20:20 Extended Community: RT:100:100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66 Last update: Fri May 8 21:23:41 2015 100 200 300 400 500 40 40.1.1.10 from 40.1.1.10 (40.0.0.10) Origin IGP, metric 0, localpref 100, valid, external Community: 1:1 2:2 3:3 4:4 10:10 20:20 Extended Community: RT:100:100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66 Last update: Fri May 8 21:23:41 2015 100 200 300 400 500 40 40.1.1.2 from 40.1.1.2 (40.0.0.8) Origin IGP, metric 0, localpref 100, valid, external, best Community: 1:1 2:2 3:3 4:4 10:10 20:20 Extended Community: RT:100:100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66 Last update: Fri May 8 21:23:41 2015 { "advertised-to": { "10.0.0.2": { "hostname": "r2" }, "10.0.0.3": { "hostname": "r3" }, "10.0.0.4": { "hostname": "r4" }, "20.1.1.6": { "hostname": "r6" }, "20.1.1.7": { "hostname": "r7" }, "40.1.1.10": { "hostname": "r10" }, "40.1.1.2": { "hostname": "r8" }, "40.1.1.6": { "hostname": "r9" } }, "paths": [ { "aspath": { "length": 6, "segments": [ { "list": [ 100, 200, 300, 400, 500, 40 ], "type": "as-sequence" } ], "string": "100 200 300 400 500 40" }, "community": { "list": [ "1:1", "2:2", "3:3", "4:4", "10:10", "20:20" ], "string": "1:1 2:2 3:3 4:4 10:10 20:20" }, "extended-community": { "string": "RT:100:100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66" }, "last-update": { "epoch": 1431120222, "string": "Fri May 8 21:23:42 2015\n" }, "localpref": 100, "med": 0, "nexthops": [ { "accessible": true, "afi": "ipv4", "ip": "40.1.1.6", "metric": 0, "used": true } ], "origin": "IGP", "peer": { "hostname": "r9", "peer-id": "40.1.1.6", "router-id": "40.0.0.9", "type": "external" }, "valid": true }, { "aspath": { "length": 6, "segments": [ { "list": [ 100, 200, 300, 400, 500, 40 ], "type": "as-sequence" } ], "string": "100 200 300 400 500 40" }, "community": { "list": [ "1:1", "2:2", "3:3", "4:4", "10:10", "20:20" ], "string": "1:1 2:2 3:3 4:4 10:10 20:20" }, "extended-community": { "string": "RT:100:100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66" }, "last-update": { "epoch": 1431120222, "string": "Fri May 8 21:23:42 2015\n" }, "localpref": 100, "med": 0, "nexthops": [ { "accessible": true, "afi": "ipv4", "ip": "40.1.1.10", "metric": 0, "used": true } ], "origin": "IGP", "peer": { "hostname": "r10", "peer-id": "40.1.1.10", "router-id": "40.0.0.10", "type": "external" }, "valid": true }, { "aspath": { "length": 6, "segments": [ { "list": [ 100, 200, 300, 400, 500, 40 ], "type": "as-sequence" } ], "string": "100 200 300 400 500 40" }, "bestpath": { "overall": true }, "community": { "list": [ "1:1", "2:2", "3:3", "4:4", "10:10", "20:20" ], "string": "1:1 2:2 3:3 4:4 10:10 20:20" }, "extended-community": { "string": "RT:100:100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66" }, "last-update": { "epoch": 1431120222, "string": "Fri May 8 21:23:42 2015\n" }, "localpref": 100, "med": 0, "nexthops": [ { "accessible": true, "afi": "ipv4", "ip": "40.1.1.2", "metric": 0, "used": true } ], "origin": "IGP", "peer": { "hostname": "r8", "peer-id": "40.1.1.2", "router-id": "40.0.0.8", "type": "external" }, "valid": true } ], "prefix": "40.3.86.0", "prefixlen": 24 }
* Here we have an unsual confederations config, "router bgp X" andDonald Sharp2015-06-121-19/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "bgp confederation id X" are the same value. router bgp 1 bgp router-id 10.1.1.1 bgp confederation identifier 1 bgp confederation peers 24 35 neighbor 10.1.1.2 remote-as 24 neighbor 10.1.1.2 update-source lo neighbor 10.1.1.3 remote-as 1 neighbor 10.1.1.3 update-source lo The customer does this because they want to peer to 10.1.1.2 as a confed-external peer but peer with 10.1.1.3 as a normal iBGP peer. The bug was that we thought 10.1.1.3 was an EBGP peer so we did not send him LOCALPREF which caused the Juniper to send us a NOTIFICATION. I confirmed that quagga also sends a NOTIFICATION in this scenario. The fix is to add a check to see if router bgp X and bgp confederation identifier X are equal because that is a factor in determining if a peer is EBGP or IBGP Additional issues fixed in the this patch: We were not properly removing all AS_CONFED_SEQUENCEs/SETs from the aspath when advertising a route to an ebgp peer. This was due to two issues: We only called aspath_delete_confed_seq() if confederations were configured. We can RX as aspath with CONFED segments even if confederations are not configured. aspath_delete_confed_seq() was implemented based on the original confed RFC 3065 which basically said "remove all of the leading AS_CONFED_SEQUENCEs/SETs" where the new confed RFC 5065 says "remove ALL of the AS_CONFED_SEQUENCEs/SETs" peer-groups did not work for confed-external peers. peer_calc_sort() always returned BGP_PEER_EBGP for a confederations where the remote-as was not specified. The reason was the peer->as_type was AS_UNSPECIFIED but we checked if (peer->as_type != AS_SPECIFIED) return (peer->as_type == AS_INTERNAL ? BGP_PEER_IBGP : BGP_PEER_EBGP); After fixing that I found that when we got to the else where we checked for peer1 we could only possibly return BGP_PEER_IBGP or BGP_PEER_EBGP, we need to also be able to return BGP_PEER_CONFED. I changed this to return peer1->sort. "show ip bgp x.x.x.x" would always display "Local" for the aspath. This is because we were calling aspath_counts_hop() to determine if the aspath was empty. This is wrong though because CONFED segments do not count towards aspath hopcount. The fix is to null check aspath->segments to determine if the aspath is actually empty. "show ip bgp x.x.x.x" and "show ip bgp neighbor" always displayed "internal" or "external" and never "confed-internal" or "confed-external". This made troubleshooting difficult because I couldn't tell exactly what kind of peer I was dealing with. I added the confed-internal and confed-external output...also added a "peer-type" field in the json output for 'show ip bgp x.x.x.x' "show ip bgp peer-group" did not list the peer-group name if we hadn't determined the "type" (internal, external, etc) for the peer-group
* AS_PATH comparison is broken if CONFED_AS_SEQ are presentDonald Sharp2015-05-201-4/+4
|
* bgpd: bgpd-warnings.patchDonald Sharp2015-05-201-1/+1
| | | | | | Remove compile warnings for the bgpd directory Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by:
* BGP: Add dynamic update group supportDonald Sharp2015-05-201-0/+1
| | | | | | | | | | | | | | | | | | | | This patch implements the 'update-groups' functionality in BGP. This is a function that can significantly improve BGP performance for Update generation and resultant network convergence. BGP Updates are formed for "groups" of peers and then replicated and sent out to each peer rather than being formed for each peer. Thus major BGP operations related to outbound policy application, adj-out maintenance and actual Update packet formation are optimized. BGP update-groups dynamically groups peers together based on configuration as well as run-time criteria. Thus, it is more flexible than update-formation based on peer-groups, which relies on operator configuration. [Note that peer-group based update formation has been introduced into BGP by Cumulus but is currently intended only for specific releases.] From 11098af65b2b8f9535484703e7f40330a71cbae4 Mon Sep 17 00:00:00 2001 Subject: [PATCH] updgrp commits
* Implement BGP as-override featureDonald Sharp2015-05-201-0/+52
|
* Add replace-as option to remove-private-asDonald Sharp2015-05-201-11/+105
|
* Fix aggregation issues found via ANVLDonald Sharp2015-05-201-0/+3
| | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
* iBGP multipath is broken if 'bgp deterministic-med' is enabledDonald Sharp2015-05-201-0/+4
|
* Make the private AS number check 4 byte compatible.Donald Sharp2015-05-201-1/+3
| | | | | | Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com> Reviewed-by: Dinesh Dutt <ddutt@cumulusnetworks.com> Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
* *: nuke ^L (page feed)David Lamparter2014-06-041-6/+6
| | | | | | | | | | | | | | Quagga sources have inherited a slew of Page Feed (^L, \xC) characters from ancient history. Among other things, these break patchwork's XML-RPC API because \xC is not a valid character in XML documents. Nuke them from high orbit. Patches can be adapted simply by: sed -e 's%^L%%' -i filename.patch (you can type page feeds in some environments with Ctrl-V Ctrl-L) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* hash: force size to be a power of 2Stephen Hemminger2013-02-241-1/+1
| | | | | | | | | By forcing the hash table size to be a power of 2, a potentially expensive divide can be replaced by a mask operation. Almost all usage of the hash table was using default size of 1024. Only places with different size was thread library (1011) and bgp aspath. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: optimize aspath string representation and assegments handlingJorge Boncompte [DTI2]2012-05-221-66/+75
| | | | | | | | | | | | | | | | | | | | | | * bgp_aspath.h: Add str_len to struct aspath. * bgp_aspath.c: Save the aspath string representation length and use it instead of strlen(). (aspath_make_str_count) assign the string buffer directly for consistency with the string length and change the return type to void. (aspath_dup) use str_len and copy the string instead of calling aspath_make_str_count(). (assegment_data_new) change from XCALLOC to XMALLOC. All users initialize the memory before use. (assegment_data_free) unused, removed. (aspath_intern) check that there's always a ->str pointer. (aspath_hash_alloc) reuse assegments and string representation instead of copying them. (aspath_parse) now aspath_hash_alloc does not dupes memory, free the temporary structures only if the aspath it is in the hash. (aspath_cmp_left) remove useless NULL initialization. Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* Merge branch 'quagga' into google-bgp-multipathAvneesh Sachdev2012-04-091-81/+79
|\ | | | | | | | | Conflicts: bgpd/bgp_route.c
| * general: remove inline qualifiers and move in-header functions to objectsPaul Jakma2012-01-061-4/+4
| | | | | | | | | | | | * (general) Move functions in headers into files, to be compiled into shared object files. Remove inline qualifier from functions. Let the compiler do the work.
| * bgpd: Implement revised error handling for partial optional/trans. attributesPaul Jakma2011-03-211-10/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * BGP error handling generally boils down to "reset session". This was fine when all BGP speakers pretty much understood all BGP messages. However the increasing deployment of new attribute types has shown this approach to cause problems, in particular where a new attribute type is "tunneled" over some speakers which do not understand it, and then arrives at a speaker which does but considers it malformed (e.g. corruption along the way, or because of early implementation bugs/interop issues). To mitigate this drafts before the IDR (likely to be adopted) propose to treat errors in partial (i.e. not understood by neighbour), optional transitive attributes, when received from eBGP peers, as withdrawing only the NLRIs in the affected UPDATE, rather than causing the entire session to be reset. See: http://tools.ietf.org/html/draft-scudder-idr-optional-transitive * bgp_aspath.c: (assegments_parse) Replace the "NULL means valid, 0-length OR an error" return value with an error code - instead taking pointer to result structure as arg. (aspath_parse) adjust to suit previous change, but here NULL really does mean error in the external interface. * bgp_attr.h (bgp_attr_parse) use an explictly typed and enumerated value to indicate return result. (bgp_attr_unintern_sub) cleans up just the members of an attr, but not the attr itself, for benefit of those who use a stack-local attr. * bgp_attr.c: (bgp_attr_unintern_sub) split out from bgp_attr_unintern (bgp_attr_unintern) as previous. (bgp_attr_malformed) helper function to centralise decisions on how to handle errors in attributes. (bgp_attr_{aspathlimit,origin,etc..}) Use bgp_attr_malformed. (bgp_attr_aspathlimit) Subcode for error specifc to this attr should be BGP_NOTIFY_UPDATE_OPT_ATTR_ERR. (bgp_attr_as4_path) be more rigorous about checks, ala bgp_attr_as_path. (bgp_attr_parse) Adjust to deal with the additional error level that bgp_attr_ parsers can raise, and also similarly return appropriate error back up to (bgp_update_receive). Try to avoid leaking as4_path. * bgp_packet.c: (bgp_update_receive) Adjust to deal with BGP_ATTR_PARSE_WITHDRAW error level from bgp_attr_parse, which should lead to a withdraw, by making the attribute parameter in call to (bgp_nlri_parse) conditional on the error, so the update case morphs also into a withdraw. Use bgp_attr_unintern_sub from above, instead of doing this itself. Fix error case returns which were not calling bgp_attr_unintern_sub and probably leaking memory. * tests/aspath_test.c: Fix to work for null return with bad segments
| * bgpd: Try fix extcommunity resource allocation probs, particularly with 'set ↵Paul Jakma2011-03-211-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | extcom..' * Extended communities has some kind of resource allocation problem which causes a double-free if the 'set extcommunity ...' command is used. Try fix by properly interning extcommunities. Also, more generally, make unintern functions take a double pointer so they can NULL out callers references - a usefully defensive programming pattern for functions which make refs invalid. Sadly, this patch doesn't fix the problem entirely - crashes still occur on session clear. * bgp_ecommunity.h: (ecommunity_{free,unintern}) take double pointer args. * bgp_community.h: (community_unintern) ditto * bgp_attr.h: (bgp_attr_intern) ditto * bgp_aspath.h: (bgp_aspath.h) ditto * (general) update all callers of above * bgp_routemap.c: (route_set_ecommunity_{rt,soo}) intern the new extcom added to the attr, and unintern any old one. (route_set_ecommunity_{rt,soo}_compile) intern the extcom to be used for the route-map set. (route_set_ecommunity_*_free) unintern to match, instead of free (route_set_ecommunity_soo) Do as _rt does and don't just leak any pre-existing community, add to it (is additive right though?)
| * bgpd: Rollback some of the changes made for invalid AS_PATH segment fixPaul Jakma2011-03-211-70/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some of the changes made in commit cddb8112b80fa9867156c637d63e6e79eeac67bb don't work particularly well for other changes that need to be made to address BGP attribute error handling problems. In particular, returning a pointer from complex attribute data parsing functions will not suffice to express the require range of return status conditions. * bgp_aspath.c: (assegments_parse) Rollback to a more minimal set of changes to fix the original problem. (aspath_parse) Slightly needless pushing around of code, and taking 2 parameters to say whether ot use 2 or 4 byte encoding seems unnecessary. * bgp_attr.c: (bgp_attr_as{,4}path) Rollback, in preparation for BGP attribute error handling update.
* | bgpd: Adds equal-paths check to path comparison. Paths that areJosh Bailey2011-07-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | equal to the best path are accumulated onto an ordered list (mp_list) if maximum-paths is configured. A future commit will add the multipath markup to the BGP rib table based on the mp_list. Add unit test for the added mp_list functions. Deterministic MED is not supported in this commit, it will be added later. * bgpd/bgp_aspath.c * Make aspath_cmp() an external symbol so it can be used in equivalent paths check * bgpd/bgp_aspath.h * Add extern declaration of aspath_cmp() * bgpd/bgp_mpath.c * bgp_info_nexthop_cmp(): Compares nexthops of two paths * bgp_info_mpath_cmp(): Compare function to order multipaths by nexthop and then by peer address * bgp_mp_list_init(): Initialize a list with the multipath order function * bgp_mp_list_clear(): Clear out the mp_list * bgp_mp_list_add(): Add a multipath to mp_list * bgpd/bgp_mpath.h * External declarations for above added functions in bgp_mpath.c * bgpd/bgp_route.c * bgp_info_cmp(): Add equivalent paths result (paths_eq). If eBGP paths are equal down to IGP metric check, flag as equal if peer AS matches. Similarly for iBGP paths but compare full AS_PATH. * bgp_best_selection(): If multipath is enabled, accumulate equivalent paths in mp_list. Add debug bgp event output to see result (will be filtered later to display only when change occurs) * bgp_process_rsclient(): Pass multipath config to bgp_best_selection() * bgp_process_main(): Pass multipath config to bgp_best_selection() * tests/bgp_mpath_test.c * Add unit test case for bgp_mp_list functions
* | bgpd: trivial format / warning fixesPaul Jakma2011-04-131-17/+18
|/ | | | | | | * bgp_aspath.c: (assegments_parse) just bail early if length doesn't match and fix the formatting. * bgp_network.c: add include needed for set_nonblocking * bgp_packet.c: formatting
* bgpd: fix handling of AS path dataChris Hall2010-08-091-43/+72
| | | | | | | | | | | | | | | | * bgpd/bgp_aspath.c * assegments_parse(): add handling of AS4_PATH input, update bounds checks, add check for AS segment type * aspath_parse(): add handling of AS4_PATH input, expect assegments_parse() to do length checking * aspath_empty(): update for the new function prototype * bgpd/bgp_aspath.h: ditto * tests/aspath_test.c: ditto * bgpd/bgp_attr.c * bgp_attr_aspath(): add handling of AS4_PATH input, update flags checks, change returned type * bgp_attr_as4_path(): discard, superseded by bgp_attr_aspath() * bgp_attr_parse(): update respectively
* bgpd: code cleanupStephen Hemminger2009-12-171-17/+1
| | | | | | | | | | | * bgpd/bgp_aspath.c * ashash: only used in one file, make static * aspath_count_numas(): dead code, sayonara * bgpd/bgpd.c * peer_nsf_stop(): only used in one file, make static * bgpd/bgp_packet.h * bgp_capability_receive(): add missing prototype for a global function
* bgpd: work around warning in assegments_parse()Denis Ovsienko2009-12-041-2/+5
|
* bgpd: Delete AS_CONFED_SEQUENCE when prepending an AS_SEQUENCE type segmentVasilis Tsiligiannis2009-07-281-0/+4
| | | | | | | AS_CONFED_SEQUENCE segment should always be deleted when prepending (e.g. with a route-map) an AS_SEQUENCE segment to an AS path. Otherwise, AS_CONFED_SEQUENCE will not be deleted later when updating EBGP peers (since it is not the leftmost segment) and will leak outside the confederation.