summaryrefslogtreecommitdiffstats
path: root/bgpd (follow)
Commit message (Collapse)AuthorAgeFilesLines
* bgpd: move packet read tracepoint out of mutexQuentin Young2020-10-231-1/+1
| | | | Signed-off-by: Quentin Young <qlyoung@nvidia.com>
* lib, bgpd: convert lttng tracepoints to frrtrace()Quentin Young2020-10-234-27/+18
| | | | | | | | | | | - tracepoint() -> frrtrace() - tracelog() -> frrtracelog() - tracepoint_enabled() -> frrtrace_enabled() Also removes copypasta'd #ifdefs for those LTTng macros, those are handled in lib/trace.h Signed-off-by: Quentin Young <qlyoung@nvidia.com>
* bgpd: route processing tracepointsQuentin Young2020-10-232-15/+105
| | | | | | Add tracepoints for route process, input filter and output filter. Signed-off-by: Quentin Young <qlyoung@nvidia.com>
* bgpd: add basic packet-related tracepointsQuentin Young2020-10-235-2/+105
| | | | | | | | Add tracepoints for: - packet pushed to internal rx queue - packet dequeued from rx queue and processed Signed-off-by: Quentin Young <qlyoung@nvidia.com>
* Merge pull request #7323 from ton31337/fix/inet_ntoa_to_pFX_masterDonald Sharp2020-10-2017-279/+360
|\ | | | | bgpd: Convert inet_ntoa to %pI4
| * bgpd: Convert inet_ntoa to %pI4/inet_ntopDonatas Abraitis2020-10-1817-279/+360
| | | | | | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* | Merge pull request #7311 from donaldsharp/table_lock_countDonatas Abraitis2020-10-206-19/+25
|\ \ | | | | | | Abstract rn->lock accessing and cleanup usage to %pFX and %pRN
| * | *: Create/Use accessor functions for lock countDonald Sharp2020-10-176-19/+25
| |/ | | | | | | | | | | | | | | Create appropriate accessor functions for the rn->lock data. We should be accessing this data through accessor functions since it is private data to the data structure. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* | Merge pull request #7300 from sworleys/EVPN-RType-NUMsPatrick Ruddy2020-10-204-111/+126
|\ \ | |/ |/| lib,bgpd: more evpn route-type numerical command versions
| * bgpd: numerical evpn type support to route-map cmdsStephen Worley2020-10-131-14/+46
| | | | | | | | | | | | | | Add numberical evpn route-type support to route-map evpn commands. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
| * bgpd: numerical evpn type support to debug commandsStephen Worley2020-10-133-17/+19
| | | | | | | | | | | | Add number evpn route type support for debug commands. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
| * bgpd: make debug evpn help use string constantsStephen Worley2020-10-131-8/+8
| | | | | | | | | | | | | | Make the debug evpn help commands use evpn string constants for evpn route type info. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
| * bgpd: numerical evpn type support to more show cmdsStephen Worley2020-10-131-77/+58
| | | | | | | | | | | | | | | | | | | | | | Add numberical evpn route type support to some more show commands. Also, simplify some of the code there to call common type parsing function. Some of the bounds checking there is also unncessary given how our cli node matching works. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* | Merge pull request #7306 from donaldsharp/bgp_dest_printDonatas Abraitis2020-10-1712-244/+245
|\ \ | | | | | | Bgp dest print
| * | bgpd: Use bgp_dest_get_prefix accessor functionDonald Sharp2020-10-172-5/+8
| | | | | | | | | | | | | | | | | | Use the appropriate bgp_dest_get_prefix accessor function Signed-off-by: Donald Sharp <sharpd@nvidia.com>
| * | bgpd: More bgp_node -> bgp_dest cleanupDonald Sharp2020-10-174-149/+161
| | | | | | | | | | | | | | | | | | | | | | | | Some more of the bgp_node usage snuck in from big commits in the past month or so from feature work. Do some work to put it back to bgp_dest for incoming future work. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
| * | bgpd: Convert to %pFX or %pBD where possibleDonald Sharp2020-10-172-71/+44
| | | | | | | | | | | | | | | | | | | | | Search and destroy places where we used prefix2str that could be replaced with %pFX or %pBD in bgpd. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
| * | bgpd: add `%pBD` for printing `struct bgp_dest *`David Lamparter2020-10-178-23/+36
| | | | | | | | | | | | | | | | | | `%pRN` is not appropriate anymore. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | | bgpd: replace bgp_evpn_route2str with prefix2strPat Ruddy2020-10-164-106/+25
|/ / | | | | | | | | | | Remove bgp_evpn_route2str and replace calls with prefix2str Signed-off-by: Pat Ruddy <pat@voltanet.io>
* | bgpd: print error when as-path filter doesn't existIgor Ryzhov2020-10-141-2/+4
| | | | | | | | Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* | Merge pull request #7283 from donaldsharp/thread_off_semanticsDonatas Abraitis2020-10-143-10/+5
|\ \ | |/ |/| *: Use proper semantics for turning off thread
| * *: Use proper semantics for turning off threadDonald Sharp2020-10-123-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | We have this pattern in the code base: if (thread) THREAD_OFF(thread); If we look at THREAD_OFF we check to see if thread is non-null too. So we have a double check. This is unnecessary. Convert to just using THREAD_OFF Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* | Merge pull request #7277 from chiragshah6/yang_nb6Donatas Abraitis2020-10-136-21/+69
|\ \ | | | | | | bgpd: fix crash in bgp instance creation
| * | bgpd: use common api in bgp_getChirag Shah2020-10-133-32/+26
| | | | | | | | | | | | | | | | | | | | | Use consolidate api in bgp_get and bgp northbound create callback. Signed-off-by: Chirag Shah <chirag@nvidia.com>
| * | bgpd: fix crash in bgp instance creationChirag Shah2020-10-132-10/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In bgp global commands northbound local-as modify callback check for backend db for checking existing bgp instance. In an instance where no router bgp with old ASN cleaned up followed by new bgp instance with new AS is created, the nb_running_get_entry in validation phase returns stale bgp reference, which leads to rejection of the router bgp command. Uncovered via: toptotest evpn_type5_test_topo1/test_evpn_type5_topo1.py test_bgp_attributes_for_evpn_address_family_p1 Signed-off-by: Chirag Shah <chirag@nvidia.com>
| * | bgpd: rename router bgp callbacksChirag Shah2020-10-133-6/+6
| | | | | | | | | | | | | | | | | | Avoid similar name function as bgp_crate() Signed-off-by: Chirag Shah <chirag@nvidia.com>
* | | bgpd: fix show bgp neighbor routes for labeled-unicastTrey Aspelund2020-10-121-4/+4
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bgp_show_neighbor_route() was rewriting safi from LU to uni before checking if the peer was enabled for LU. This resulted in the peer's address-family check looking for unicast, which would always fail for LU peers since unicast + LU are mutually-exclusive AFIs. This moves this safi reassignment after the peer AFI check, ensuring that the peer's address-family check looks for LU while the call to bgp_show() still uses uni. -- highlights from manual testing config: router bgp 2 neighbor 1.1.1.1 remote-as external neighbor 1.1.1.1 disable-connected-check neighbor 1.1.1.1 update-source 2.2.2.2 ! address-family ipv4 unicast no neighbor 1.1.1.1 activate exit-address-family ! address-family ipv4 labeled-unicast neighbor 1.1.1.1 activate exit-address-family before: spine01# show bgp ipv4 unicast neighbors 1.1.1.1 routes % No such neighbor or address family spine01# show bgp ipv4 labeled-unicast neighbors 1.1.1.1 routes % No such neighbor or address family after: spine01# show bgp ipv4 unicast neighbors 1.1.1.1 routes % No such neighbor or address family spine01# show bgp ipv4 label neighbors 1.1.1.1 routes BGP table version is 1, local router ID is 2.2.2.2 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 *> 11.11.11.11/32 1.1.1.1 0 0 1 i Displayed 1 routes and 1 total paths Signed-off-by: Trey Aspelund <taspelund@cumulusnetworks.com>
* / bgpd: Correctly calculate threshold being reachedDonald Sharp2020-10-121-1/+2
|/ | | | | | | | | if (pcout > (pcount * peer->max_threshold[afi][safi] / 100 )) is always true. So the very first route received will always trigger the warning. We actually want the warning to happen when we hit the threshold. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* Merge pull request #7268 from ton31337/fix/dead_name_bgpdDonald Sharp2020-10-101-1/+1
|\ | | | | bgpd: Use default VRF name if using `router bgp` command
| * bgpd: Use default VRF name if using `router bgp` commandDonatas Abraitis2020-10-091-1/+1
| | | | | | | | | | | | | | | | When we enter `router bgp` it enters non-VRF instance which is default. No need to check for VRF/VIEW name, kinda dead code. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* | Merge pull request #7252 from sworleys/EVPN-RType-HelpDonatas Abraitis2020-10-091-67/+67
|\ \ | |/ |/| lib,bgpd: EVPN help string cleanup
| * bgpd: re-use HELP_STR evpn macrosStephen Worley2020-10-081-67/+67
| | | | | | | | | | | | | | Re-use some of the HELP_STR macros rather than copypastaing strings everywhere. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* | bgpd: hide test commandsIgor Ryzhov2020-10-081-2/+2
|/ | | | Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* Merge pull request #7246 from mjstapp/fix_bgp_nb_saDonatas Abraitis2020-10-071-5/+0
|\ | | | | bgpd: fix SA warnings in bgp northbound
| * bgpd: fix SA warnings in bgp northboundMark Stapp2020-10-061-5/+0
| | | | | | | | | | | | Fix a couple of new SA warnings in the new bgp northbound. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* | Merge pull request #7239 from opensourcerouting/bgp-aggregate-medDonatas Abraitis2020-10-072-242/+340
|\ \ | | | | | | bgpd: aggregate-address on matching MED only
| * | bgpd: aggregate address matching-MED-onlyRafael Zalamena2020-10-062-11/+256
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add code to handle MED matching: - When MED matches act as normal. - When MED doesn't match do the following: * Uninstall the aggregate route * Unsuppress routes (if using summary-only) - When MED didn't match, but now matches: * Install the aggregate route * Suppress all routes (if using summary-only) Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
| * | bgpd: simplify aggregate address commandsRafael Zalamena2020-10-051-235/+88
| | | | | | | | | | | | | | | | | | Use `DEFPY` instead of `DEFUN` to remove duplicated code. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* | | Revert "bgpd: allow bestpath to handle mutliple locally-originated paths"Donald Sharp2020-10-061-8/+4
| | | | | | | | | | | | This reverts commit 82a843fa3df4adff6d2eaffbaba96eb136fcaebb.
* | | bgpd: allow bestpath to handle mutliple locally-originated pathsDonald Sharp2020-10-061-4/+8
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current code in bgp bestpath selection would accept the newest locally originated path as the best path. Making the selection non-deterministic. Modify the code to always come to the same bestpath conclusion when you have multiple locally originated paths in bestpath selection. Before: eva# conf eva(config)# router bgp 323 eva(config-router)# address-family ipv4 uni eva(config-router-af)# redistribute connected eva(config-router-af)# network 192.168.161.0/24 eva(config-router-af)# do show bgp ipv4 uni 192.168.161.0 BGP routing table entry for 192.168.161.0/24 Paths: (2 available, best #1, table default) Not advertised to any peer Local 0.0.0.0(eva) from 0.0.0.0 (192.168.161.245) Origin IGP, metric 0, weight 32768, valid, sourced, local, bestpath-from-AS Local, best (Origin) Last update: Wed Sep 16 15:03:03 2020 Local 0.0.0.0(eva) from 0.0.0.0 (192.168.161.245) Origin incomplete, metric 0, weight 32768, valid, sourced Last update: Wed Sep 16 15:02:52 2020 eva(config-router-af)# no redistribute connected eva(config-router-af)# do show bgp ipv4 uni 192.168.161.0 BGP routing table entry for 192.168.161.0/24 Paths: (1 available, best #1, table default) Not advertised to any peer Local 0.0.0.0(eva) from 0.0.0.0 (192.168.161.245) Origin IGP, metric 0, weight 32768, valid, sourced, local, bestpath-from-AS Local, best (First path received) Last update: Wed Sep 16 15:03:03 2020 eva(config-router-af)# redistribute connected eva(config-router-af)# do show bgp ipv4 uni 192.168.161.0 BGP routing table entry for 192.168.161.0/24 Paths: (2 available, best #2, table default) Not advertised to any peer Local 0.0.0.0(eva) from 0.0.0.0 (192.168.161.245) Origin incomplete, metric 0, weight 32768, valid, sourced Last update: Wed Sep 16 15:03:32 2020 Local 0.0.0.0(eva) from 0.0.0.0 (192.168.161.245) Origin IGP, metric 0, weight 32768, valid, sourced, local, bestpath-from-AS Local, best (Origin) Last update: Wed Sep 16 15:03:03 2020 eva(config-router-af)# Notice the route choosen depends on order received Fixed behavior: eva# conf eva(config)# router bgp 323 eva(config-router)# address-family ipv4 uni eva(config-router-af)# redistribute connected eva(config-router-af)# network 192.168.161.0/24 eva(config-router-af)# do show bgp ipv4 uni 192.168.161.0 BGP routing table entry for 192.168.161.0/24 Paths: (2 available, best #1, table default) Not advertised to any peer Local 0.0.0.0(eva) from 0.0.0.0 (192.168.161.245) Origin IGP, metric 0, weight 32768, valid, sourced, local, bestpath-from-AS Local, best (Origin) Last update: Wed Sep 16 15:03:03 2020 Local 0.0.0.0(eva) from 0.0.0.0 (192.168.161.245) Origin incomplete, metric 0, weight 32768, valid, sourced Last update: Wed Sep 16 15:02:52 2020 eva(config-router-af)# no redistribute connected eva(config-router-af)# do show bgp ipv4 uni 192.168.161.0 BGP routing table entry for 192.168.161.0/24 Paths: (1 available, best #1, table default) Not advertised to any peer Local 0.0.0.0(eva) from 0.0.0.0 (192.168.161.245) Origin IGP, metric 0, weight 32768, valid, sourced, local, bestpath-from-AS Local, best (First path received) Last update: Wed Sep 16 15:03:03 2020 eva(config-router-af)# redistribute connected eva(config-router-af)# do show bgp ipv4 uni 192.168.161.0 BGP routing table entry for 192.168.161.0/24 Paths: (2 available, best #2, table default) Not advertised to any peer Local 0.0.0.0(eva) from 0.0.0.0 (192.168.161.245) Origin incomplete, metric 0, weight 32768, valid, sourced Last update: Wed Sep 16 15:03:32 2020 Local 0.0.0.0(eva) from 0.0.0.0 (192.168.161.245) Origin IGP, metric 0, weight 32768, valid, sourced, local, bestpath-from-AS Local, best (Origin) Last update: Wed Sep 16 15:03:03 2020 eva(config-router-af)# Ticket: CM-31490 Found-by: Trey Aspelund <taspelund@nvidia.com> Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* | bgpd: no router bgp check candidate configChirag Shah2020-10-031-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For `no router bgp` without ASN check candidate config for default bgp instance presence to avoid failure from checking backend db where bgp instance may not be created. This situation can be seen in transactional cli mode with following config. bharat(config)# router bgp 101 bharat(config-router)# exit bharat(config)# no router bgp % No BGP process is configured bharat(config)# no router bgp % No BGP process is configured bharat(config)# Signed-off-by: Chirag Shah <chirag@nvidia.com>
* | bgpd: move router bgp nb callbackChirag Shah2020-10-034-19/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | move `router bgp` nb callback at `bgp` node level to have access to bgp context at neighbor and peer-group level and align create/destroy callbacks call during no router bgp. Earlier `no router bgp` is performed first global destroy callback is called which essentially removes `bgp context` then it calls to remove (parallel nodes) neighbor and peer-group which does not have access to bgp context. Moving router bgp at bgp solves this destroy callback ordering issue. Signed-off-by: Chirag Shah <chirag@nvidia.com>
* | bgpd: correct bgp global contextChirag Shah2020-10-033-131/+161
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move bgp (router bgp) context at "bgp" node level from (instead of) "global" level. This change allows access of bgp context at neighbor and peer-group node levels. +--rw bgp <--- (store `struct bgp` at bgp node xpath) +--rw global! | ... | +--rw afi-safis | ... +--rw neighbors | +--rw neighbor* [remote-address] | ... | | +--rw afi-safis | ... | +--rw unnumbered-neighbor* [interface] | ... +--rw peer-groups +--rw peer-group* [peer-group-name] ... Signed-off-by: Chirag Shah <chirag@nvidia.com>
* | bgpd: shorten northbound callback namesChirag Shah2020-10-033-5166/+5076
| | | | | | | | | | | | | | | | Omit routing protocol augment name from callbacks name. (Omitted: routing_control_plane_protocols_control_plane_protocol_) Signed-off-by: Chirag Shah <chirag@nvidia.com>
* | bgpd: register nb routing hookChirag Shah2020-10-033-0/+25
| | | | | | | | | | | | | | | | On bgpd bootstrap register routing hook which ensures only single bgp named instance created per vrf routing hierarchy. Signed-off-by: Chirag Shah <chirag@nvidia.com>
* | bgpd: convert global config to transactional cliChirag Shah2020-10-039-1044/+1886
| | | | | | | | | | | | | | Convert global congigurations clis to transactional clis using northbound plugin callbacks. Signed-off-by: Chirag Shah <chirag@nvidia.com>
* | bgpd: register northbound callbacks to bootstrapChirag Shah2020-10-031-0/+4
| | | | | | | | | | | | | | Register bgpd northbound callbacks to bgp daemon bootstrap. Signed-off-by: Chirag Shah <chirag@nvidia.com>
* | bgpd: bgp northbound callbacks prototypesChirag Shah2020-10-034-0/+40880
| | | | | | | | | | | | | | | | This commit contains splitting of auto-generated bgp northbound callbacks into separate files. Include the files into bgp makefile. Signed-off-by: Chirag Shah <chirag@nvidia.com>
* | *: add bgp yang files into makefilesChirag Shah2020-10-031-0/+13
|/ | | | Signed-off-by: Chirag Shah <chirag@nvidia.com>
* vtysh: dynamically generate the list of daemons for commandsIgor Ryzhov2020-10-021-0/+2
| | | | | | | Some daemons were actually missing from the static definitions: nhrpd, babeld, eigrpd and bfdd. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>