summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_rnh.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* zebra: Use ROUTE_ENTRY_INSTALLED as decision for route is installedDonald Sharp2019-01-261-10/+8
| | | | | | | | | | | | | | zebra is using NEXTHOP_FLAG_FIB as the basis of whether or not a route_entry is installed. This is problematic in that we plan to separate out nexthop handling from route installation. So modify the code to keep track of whether or not a route_entry is installed/failed. This basically means that every place we set/unset NEXTHOP_FLAG_FIB, we actually also set/unset ROUTE_ENTRY_INSTALLED on the route_entry. Additionally where we check for route installed via NEXTHOP_FLAG_FIB switch over to checking if the route think's it is installed. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: remove dead macroRenato Westphal2019-01-211-10/+0
| | | | | | This macro is not used since commit 078430f609e. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* zebra: consolidate how we indentify address-families in the NHT codeRenato Westphal2019-01-211-61/+52
| | | | | | | | | | | | | | | | Favor usage of the afi_t enumeration to identify address-families over using the classic AF_INET[6] constants for that. The choice to use either of the two seems to be mostly arbitrary throughout our code base, which leads to confusion and bugs like the one fixed by commit 6f95d11a1. To address this problem, favor usage of the afi_t enumeration whenever possible, since 1) it's an enumeration (helps the compilers to catch some bugs), 2) has a safi_t sibling and 3) can be used to index static arrays. AF_INET[6] should then be used only when interfacing with the kernel or external libraries like libc. The family2afi() and afi2family() functions can be used to convert between the two different representations back and forth. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* zebra: Remove zebra_delete_rnh from being a public functionDonald Sharp2019-01-041-1/+1
| | | | | | | The zebra_delete_rnh function is not needed to be exposed to the entire world. Limit it's scope. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: Abstract zebra_delete_rnhDonald Sharp2019-01-041-7/+7
| | | | | | | The deletion of a rnh is always proceeded by the same checks to see if it is done. Just let zebra_delete_rnh do this test. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: For rnh handling use actual resolved nexthopDonald Sharp2018-12-121-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | For nexthop handling use the actual resolved nexthop. Nexthops are stored as a `special` list: Suppose we have 3 way ecmp A, B, C: nhop A -> resolves to nhop D | nhop B | nhop C -> resolves to nhop E A and C are typically NEXTHOP_TYPE_IPV4( or 6 ) if they recursively resolve We do not necessarily store the ifindex that this resolves to. Current nexthop code only loops over A,B and C and uses those for the zebra_rnh.c handling. So interested parties might receive non-fully resolved nexthops( and they assume they are! ). Let's convert the looping to go over all nexthops and only deal with the resolved ones, so we will look at and use D,B and E. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: Always resend nexthop information when registeredDonald Sharp2018-11-281-3/+7
| | | | | | | Always resend the nexthop information when we get a registration event. Multiple daemons expect this information. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com.
* lib, zebra: Encode nexthop vrf in nht updatesDonald Sharp2018-11-011-0/+1
| | | | | | | The nexthop vrf was not being encoded in nht updates. Add it in. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Merge pull request #2946 from mjstapp/dplane_2Donald Sharp2018-10-281-4/+26
|\ | | | | Zebra: async dataplane, phase 1
| * zebra: support zebra shutdown and cleanupMark Stapp2018-10-251-9/+16
| | | | | | | | | | | | | | | | | | Dplane support for zebra's route cleanup during shutdown (clean shutdown via SIGINT, anyway.) The dplane has the opportunity to process incoming updates, and then triggers final cleanup in zebra's main thread. Signed-off-by: Mark Stapp <mjs@voltanet.io>
| * zebra: add handy res2str utilityMark Stapp2018-10-251-1/+16
| | | | | | | | | | | | | | Add a 2str utility for dplane result codes; use it in a debug or two. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* | zebra: Start breakup of zns into zrouter and znsDonald Sharp2018-10-241-7/+6
|/ | | | | | | | | | | | | | | | | | | | | | The `struct zebra_ns` data structure is being used for both router information as well as support for the vrf backend( as appropriate ). This is a confusing state. Start the movement of `struct zebra_ns` into 2 things `struct zebra_router` and `struct zebra_ns`. In this new regime `struct zebra_router` is purely for handling data about the router. It has no knowledge of the underlying representation of the Data Plane. `struct zebra_ns` becomes a linux specific bit of code that allows us to handle the vrf backend and is allowed to have knowledge about underlying data plane constructs. When someone implements a *bsd backend the zebra_vrf data structure will need to be abstracted to take advantage of this instead of relying on zebra_ns. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: vrf aware routmap is missing in Zebra #2802(Part 2 of 4)vishaldhingra2018-10-111-46/+48
| | | | | | Function parameter replacement of using zvrf instead of vrf_id Signed-off-by: vishaldhingra vdhingra@vmware.com
* zebra: vrf aware routmap is missing in Zebra #2802(Part 1 of 4)vishaldhingra2018-10-111-2/+4
| | | | | | | Work to handle the route-maps, namely the header changes in zebra_vrf.h and the mapping of using that everywhere Signed-off-by: vishaldhingra vdhingra@vmware.com
* *: list_delete_and_null() -> list_delete()David Lamparter2018-10-021-2/+2
| | | | Signed-off-by: David Lamparter <equinox@diac24.net>
* *: style for EC replacementsQuentin Young2018-09-131-2/+2
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* zebra: ZEBRA_[ERR|WARN] -> EC_ZEBRAQuentin Young2018-09-131-2/+2
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* zebra: flog_warn conversionQuentin Young2018-09-061-2/+3
| | | | | | Convert Zebra to user error subsystem. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* zebra: When registering a nexthop, we do not always need to re-evalDonald Sharp2018-08-251-5/+17
| | | | | | | | | | | | | | | | | | | | The code prior to this change, was allowing clients to register for nexthop tracking. Then zebra would look up the rnh and send to that particular client any known data. Additionally zebra was blindly re-evaluating the rnh for every registration. This leads to interesting behavior in that all people registered for that nexthop will get callbacks even if nothing changes. Modify the code to know if we have evaluated the rnh or not and if so limit the re-evaluation to when absolutely necessary This is of particular importance to do because of nht callbacks for protocols cause those protocols to do not insignificant work and as more protocols are registering for nht callbacks we will cause more work than is necessary. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: rename zlog_fer -> flog_errQuentin Young2018-08-141-1/+1
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* zebra, lib: error references for zebraQuentin Young2018-08-141-2/+4
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* staticd: Start the addition of a staticdDonald Sharp2018-07-291-192/+0
| | | | | | | | | This is the start of separating out the static handling code from zebra -> staticd. This will help simplify the zebra code and isolate static route handling to it's own code base. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: refactor zserv names, consolidate eventsQuentin Young2018-05-291-2/+2
| | | | | | | | | | | | | | * Add centralized thread scheduling dispatchers for client threads and the main thread * Rename everything in zserv.c to stop using a combination of: - zebra_server_* - zebra_* - zserv_* Everything in zserv.c now begins with zserv_*. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* zebra: style last 3 changesQuentin Young2018-04-231-1/+2
| | | | | | Fixup latent style issues in copied code. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* zebra: cleanup for zapi_msg.c splitQuentin Young2018-04-231-1/+1
| | | | | | | | | | * Rename client_connect and client_close hooks to zapi_client_connect and zapi_client_close * Remove some more unnecessary headers * Fix a copy-paste error in zapi_msg.[ch] header comments * Fix an inclusion comment in zserv.c Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* zebra: use hooks for client lifecycle callbacksQuentin Young2018-04-231-1/+9
| | | | | | | | | zserv.c was using hardcoded callbacks to clean up various components when a client disconnected. Ergo zserv.c had to know about all these unrelated components that it should not care about. We have hooks now, let's use the proper thing instead. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* zebra: clean up zapi organizationQuentin Young2018-04-231-28/+55
| | | | | | | | | | | | | zserv.c has become something of a dumping ground for everything vaguely related to ZAPI and really needs some love. This change splits out the code fo building and consuming ZAPI messages into a separate source file, leaving the actual session and client lifecycle code in zserv.c. Unfortunately since the #include situation in Zebra has not been paid much attention I was forced to fix the headers in a lot of other source files. This is a net improvement overall though. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* zebra: Tell rib_process to actually rethink pbr routes.Donald Sharp2018-04-181-1/+3
| | | | | | | | | When I implemented this code change I was only testing against static routes and with one nexthop. I missed the fact that we needed to tell rib_process to actually rethink the nexthops. Ticket: CM-20274 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: Add code to notice nexthop changes for pbr tablesDonald Sharp2018-04-061-0/+56
| | | | | | | | | | | | | | | | | | | | When we have a PBR installed as a table, we need to notice when a nexthop changes and rethink the routes for the pbr tables. Add code to nexthop tracking to notice the pbr watched nexthop has changed in some manner. If it is a pbr route that depends on the nexthop then just enqueue it for rethinking. This is a bit of a hammer, we know that only pbr routes are going to be installing routes in weird non-standard tables as such we need to only handle nexthop changes for nexthops that are actually changing that we care about and to only requeue for route nodes we have route entries for from PBR Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: use C99 standard fixed-width integer typesQuentin Young2018-03-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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>
* lib, zebra: Signal the existence of labels on a nexthop for nhtDonald Sharp2018-03-161-15/+23
| | | | | | | | | When we are signaling to a client from zebra that a nexthop has changed, include the labels on the nexthop as well. Upper level protocols need to know if the labels exist in order to make intelligent decisions about what to do. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: reorganize zserv, batch i/oQuentin Young2018-03-121-3/+2
| | | | | | | | Group send and receive functions together, change handlers to take a message instead of looking at ->ibuf and ->obuf, allow zebra to read multiple packets off the wire at a time. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: Isolate nexthop_group functions to nexthop_group.cDonald Sharp2018-03-091-9/+10
| | | | | | | Also modify `struct route_entry` to use nexthop_groups. Move ALL_NEXTHOPS loop to nexthop_group.h Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: conform with COMMUNITY.md formatting rules, via 'make indent'Lou Berger2018-03-061-27/+23
| | | | Signed-off-by: Lou Berger <lberger@labn.net>
* lib, zebra: Add type and instance to nexthop update messageDonald Sharp2018-03-011-0/+4
| | | | | | | | | | | Add the originating routes type and instance to the nexthop update message. This is necessary because there exist scenarios where BGP needs to make a decision about the originating route type and instance to know if it is going to be doing a route replace to a route that would resolve to itself. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib, zebra: Move nh_resolve_via_default to appropriate headerDonald Sharp2018-02-091-1/+1
| | | | | | | | The nh_resolve_via_default function is an accessor function for NHT in zebra. Let's move this function to it's proper place. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: Track vrfs per nexthop not per route entryDonald Sharp2018-02-091-1/+0
| | | | | | | Track the vfrs on a per nexthop basis instead of on a per route entry basis. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: Cleanup nexthop update encodingDonald Sharp2018-02-051-8/+1
| | | | | | | The encoding of the nexthop update made some distinctions between nexthop types that it does not need to. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Merge pull request #1618 from donaldsharp/zebra_startup_orderingPhilippe Guibert2018-01-231-0/+2
|\ | | | | zebra route-leaking for static routes
| * zebra: Add nh_vrf_id to 'struct route_entry`Donald Sharp2018-01-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | With VRF route-leaking we need to know what vrf the nexthops are in compared to this vrf. This code adds the nh_vrf_id to the route entry and sets it up correctly for the non-route-leaking case. The assumption here is that future commits will make the nh_vrf_id *different* than the vrf_id. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | zebra: use zclient_create_headerDonald Sharp2018-01-221-1/+1
|/ | | | | | | | The function zserv_create_header was exactly the same as zclient_create_header. Let's just have one in the system. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: slight mods to commit for nexthop resolution with /32 nexthopDon Slice2017-11-221-9/+4
| | | | | | Contains minor changes in response to code review comments. Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
* zebra: fix resolving nexthop through itselfDon Slice2017-11-091-41/+111
| | | | | | | | | | | | | | | Problems reported with zebra nht oscillating when a nexthop is resolved using the same address to reach the nexthop (for example, 10.0.0.8 is resolved via 10.0.0.8/32.) This fix removes this attempt to resolve thru itself unless the route being resolved is also a host route. This fix also walks up the tree looking for a less specific route to reach the nexthop if needed. Smoke testing completed successfully. Ticket: CM-8192 Signed-off-by: Don Slice <dslice@cumulusnetworks.com> Reviewed-by: CCR-6583 Testing done: Manual testing successful, bgp-min completed successfully l3-smoke completed with two test changes required.
* *: Convert list_free usage to list_deleteDonald Sharp2017-10-051-3/+3
| | | | | | | | | | list_free is occassionally being used to delete the list and accidently not deleting all the nodes. We keep running across this usage pattern. Let's remove the temptation and only allow list_delete to handle list deletion. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* scan-build: cleanup some warningsVincent JARDIN2017-10-021-0/+1
| | | | | | | Current cleanup is for unset values or variables that are not used anymore. Regarding ospfd/ospf_vty.c: argv_find() we'll never get it NULL, so get coststr = argv[idx]->arg;
* *: use clang's 'ForEachMacros' format style optionRenato Westphal2017-09-151-4/+2
| | | | | | | | | | | | | This fixes the broken indentation of several foreach loops throughout the code. From clang's documentation[1]: ForEachMacros: A vector of macros that should be interpreted as foreach loops instead of as function calls. [1] http://clang.llvm.org/docs/ClangFormatStyleOptions.html Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* zebra: add new flag to detect nexthop label updatesRenato Westphal2017-08-091-2/+5
| | | | | | | | | | | | With the introduction of the pseudowire manager, the NHT tracking code needs to detect label updates as well. Create a specific nexthop flag for that. We can't reuse the RIB_ENTRY_NEXTHOPS_CHANGED flag for this porpose because this flag is always cleared and reevaluated in rib_process(), setting it outside that function is a nop. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* zebra: add nexthop tracking for pseudowiresRenato Westphal2017-08-091-2/+72
| | | | | | | | If the remote end of a pseudowire becomes unreachable (no route or an unlabeled route), then it must be uninstalled. In the same way, when the remote end becomes reachable, the pseudowire must be installed. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* zebra: track and compare distance of recursive nexthopsJorge Boncompte2017-08-041-0/+4
| | | | | | | Fixes routing loops when backup routes with recursive nexthops of other protocols come and go. Signed-off-by: Jorge Boncompte <jbonor@gmail.com>
* *: reindentreindent-master-afterwhitespace / reindent2017-07-171-818/+792
| | | | | | indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>