summaryrefslogtreecommitdiff
path: root/bgpd/bgp_vpn.c
AgeCommit message (Collapse)Author
2024-04-15bgpd: Fix display when using `missing-as-worst`Donald Sharp
The usage of the `bgp bestpath med missing-as-worst` command was being accepted and applied during bestpath, but during output of the routes affected by this it would not give any indication that this was happening or what med value was being used. Fixes: #15718 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-07bgpd: show_adj_route_vpn always leaked json memoryDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-12-11bgpd: Remove deprecated code for bgpStatusCodes/bgpOriginCodesDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-02-09*: auto-convert to SPDX License IDsDavid Lamparter
Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-25bgpd: Convert vty_out to vty_json for JSONDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-18*: Remove unused variablesDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-18bgpd: Replace inet_ntop to %pI4/6 for JSON outputsDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-04-12bgpd: Filter BGP routes by prefix versionDonatas Abraitis
The idea is to find out prefixes including specific BGP table version and above. Let's say I have a converged network and suddently I noticed a couple of prefixes seems hijacked. I want to look what new prefixes arrived with a specific BGP table version. ``` exit1-debian-9# show ip bgp version 8 BGP table version is 9, local router ID is 192.168.100.1, vrf id 0 Default local pref 100, local AS 65534 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path * 192.168.2.0/24 192.168.0.2 0 0 65030 ? *> 192.168.0.2 0 0 65030 ? * 192.168.3.0/24 192.168.0.2 0 0 65030 ? *> 192.168.0.2 0 0 65030 ? Displayed 2 routes and 18 total paths exit1-debian-9# ``` ``` exit1-debian-9# show ip bgp version 8 json { "vrfId": 0, "vrfName": "default", "tableVersion": 9, "routerId": "192.168.100.1", "defaultLocPrf": 100, "localAS": 65534, "routes": { "192.168.2.0/24": [ { "valid":true, "pathFrom":"external", "prefix":"192.168.2.0", "prefixLen":24, "network":"192.168.2.0\/24", "version":8, "metric":0, "weight":0, "peerId":"2a02:bbd::2", "path":"65030", "origin":"incomplete", "nexthops":[ { "ip":"192.168.0.2", "hostname":"home-spine1.donatas.net", "afi":"ipv4", "used":true } ] }, { "valid":true, "bestpath":true, "selectionReason":"Neighbor IP", "pathFrom":"external", "prefix":"192.168.2.0", "prefixLen":24, "network":"192.168.2.0\/24", "version":8, "metric":0, "weight":0, "peerId":"192.168.0.2", "path":"65030", "origin":"incomplete", "nexthops":[ { "ip":"192.168.0.2", "hostname":"home-spine1.donatas.net", "afi":"ipv4", "used":true } ] } ],"192.168.3.0/24": [ { "valid":true, "pathFrom":"external", "prefix":"192.168.3.0", "prefixLen":24, "network":"192.168.3.0\/24", "version":9, "metric":0, "weight":0, "peerId":"2a02:bbd::2", "path":"65030", "origin":"incomplete", "nexthops":[ { "ip":"192.168.0.2", "hostname":"home-spine1.donatas.net", "afi":"ipv4", "used":true } ] }, { "valid":true, "bestpath":true, "selectionReason":"Neighbor IP", "pathFrom":"external", "prefix":"192.168.3.0", "prefixLen":24, "network":"192.168.3.0\/24", "version":9, "metric":0, "weight":0, "peerId":"192.168.0.2", "path":"65030", "origin":"incomplete", "nexthops":[ { "ip":"192.168.0.2", "hostname":"home-spine1.donatas.net", "afi":"ipv4", "used":true } ] } ] } } ``` Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-10-18bgpd: Convert inet_ntoa to %pI4/inet_ntopDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-07-23bgpd: wide optionMadhuri Kuruganti
Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
2020-06-23bgp: rename bgp_node to bgp_destDonald Sharp
This is the bulk part extracted from "bgpd: Convert from `struct bgp_node` to `struct bgp_dest`". It should not result in any functional change. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-04-20*: sprintf -> snprintfQuentin Young
Replace sprintf with snprintf where straightforward to do so. - sprintf's into local scope buffers of known size are replaced with the equivalent snprintf call - snprintf's into local scope buffers of known size that use the buffer size expression now use sizeof(buffer) - sprintf(buf + strlen(buf), ...) replaced with snprintf() into temp buffer followed by strlcat Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-04-01bgpd: #if ENABLE_BGP_VNC -> #ifdef ENABLE_BGP_VNCQuentin Young
This macro is undefined if vnc is disabled, and while it defaults to 0, this is still wrong and causes issues with -Werror Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-03-26bgpd: Convert users of `rn->p` to use accessor functionDonald Sharp
Add new function `bgp_node_get_prefix()` and modify the bgp code base to use it. This is prep work for the struct bgp_dest rework. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-21bgpd: Blank RD in "sh bgp l2vpn evpn all neighbors <ip> advertised-routes json"Lakshman Krishnamoorthy
Bug: While preparing the JSON output, 2 loops are traversed: the outer loop loops through RD, and the inner loop loops through the prefixes of that RD. We hit the bug (printing blank RD and stale or null prefix info) when the inner loop exits with nothing to print, (without allocating json_routes) and the outer loop still tries to attach it to the parent, json_adv. Thus, we have key=<BLANK RD>, value=<junk or prev json_routes> The fix: Avoid attaching json_routes to the parent json if there is nothing to print. Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-11-12bgpd: Bug fix in "show bgp l2vpn evpn ... advertised-routes'Lakshman Krishnamoorthy
The bug: As part of displaying advertised routes to a peer, in the outer loop, we iterate through all prefixes in the evpn table. In the inner loop, we iterate through adj_out of each prefix. If a prefix which is present in the evpn table is not advertised to a peer, its corresponding attr == NULL. Checking for this condition is the fix. Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-09-27bgpd: Fixing "show bgp l2vpn evpn neighbors x.x.x.x advertised-routes jsonLakshman Krishnamoorthy
Display output from adj_out instead of the rib table. Also fixes crash for the json output. RCA: prefix is written to json object using inet_ntop. But, this api returns null buffer for AF_EVPN address family (it works only for AF_INET and AF_INET6). This null buffer is then deref'd by json-object-to string api. Full output shown in PR: https://github.com/FRRouting/frr/pull/5078 Crash issue: https://github.com/FRRouting/frr/issues/5010 Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-08-08bgpd: Display received and advertised EVPN routes from neighborsDinesh Dutt
"show bgp l2vpn evpn neighbors <neighbor> [advertised-routes|routes]' did not work due to various bugs. First, the command only accepted IPv4 addresses as valid neighbor ID, thereby rejecting unnumbered BGP and IPv6 neighbor address. Second, the SAFI was hardcoded to MPLS_VPN even though we were passing the safi. Third, "all" made no sense in the command context and to make the command uniform across all address families, I removed the "all" keyword from the command. Signed-off-by: Dinesh G Dutt <ddps4u@gmail.com>
2018-11-16bgpd: Cleanup non-usage of prefix2str in bgp_vpn.cDonald Sharp
We were printing out a prefix by not using the prefix2str function. Let's use that. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-11-16bgpd: Cleanup show_adj_route_vpn to be easier to readDonald Sharp
The show_adj_route_vpn function was incredibly hard to read because of the incredibly deep indentation. fix this up some. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-11-16bgpd: Abstract bgp_table retrieving/setting from info pointerDonald Sharp
Convert the set/get of bgp_table's from the info pointer. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-11-16bgpd: Abstract bgp_info retrieving/setting from info pointerDonald Sharp
The bgp_info data is stored as a void pointer in `struct bgp_node`. Abstract retrieval of this data and setting of this data into functions so that in the future we can move around what is stored in bgp_node. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-30bgpd/ospfd: make bgp and ospf json response a bit more consistentDon Slice
Problem reported that some bgp and ospf json commands did not return any json output at all if the bgp/ospf instance did not exist. Additionally, some bgp and ospf json commands did not return any json output if the instance existed but no neighbors were defined. This fix makes these commands more consistent in returning empty braces for json output and issue a message if not using json output. Additionally, made the flag "use_json" a bool to make it consistent since previously, it had been defined as an int, char, u_char, and bool at various places. Ticket: CM-21040 Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-06-21Merge pull request #2501 from pacovn/infer_unused1Quentin Young
bgpd isisd ldpd lib ospfd pimd: redundancy (infer, grouped)
2018-06-20bgpd isisd ldpd lib ospfd pimd: redundancy (infer)paco
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-20bgpd: json output fix (Coverity 1470098)paco
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-18bgpd: null check (Coverity 1408766)paco
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-03-27*: use C99 standard fixed-width integer typesQuentin Young
The following types are nonstandard: - u_char - u_short - u_int - u_long - u_int8_t - u_int16_t - u_int32_t Replace them with the C99 standard types: - uint8_t - unsigned short - unsigned int - unsigned long - uint8_t - uint16_t - uint32_t Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-07-26bgpd/ospfd: fix json leaks and blank outputRenato Westphal
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-07-22Revert "*: reindent pt. 2"David Lamparter
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>
2017-07-17*: reindent pt. 2whitespace / reindent
w/ clang 5 * reflow comments * struct members go 1 per line * binpack algo was adjusted
2017-07-17*: reindentreindent-master-afterwhitespace / reindent
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14*: remove VTYNL, part 3 of 6David Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14*: remove VTYNL, part 1 of 6David Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14*: ditch vty_outln(), part 2 of 2David Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-13*: ditch vty_outln(), part 1 of 2David Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-06-29*: vty_outln (vty, "") --> vty_out (vty, VTYNL)Quentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29*: s/VTY_NEWLINE/VTYNL/gQuentin Young
Should be able to fit more vty_out onto one line now Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29*: use vty_outlnQuentin Young
Saves 400 lines Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-15*: make consistent & update GPLv2 file headersDavid Lamparter
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>
2017-04-04*: Clean up some wrong referencesDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-14bgpd: enhance EPVN vty show commandsPhilippe Guibert
This patch introduces show show bgp evpn commands to dump NLRI entries configured or received on BGP, related to EVPN New command introduced is the following: show [ip] bgp l2vpn evpn [all | rd <rd name> ] [overlay] Like for MPLS, similar set of commands is added for EVPN: show [ip] bgp l2vpn evpn [all|rd <RDNAME>] show [ip] bgp l2vpn evpn all neighbor <NEIGHBOR> routes show [ip] bgp l2vpn evpn all neighbor <NEIGHBOR> advertised-routes Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>