Commit Graph

411 Commits

Author SHA1 Message Date
Donald Sharp
12e7fe3aa0 zebra: Add a switch statement for rib_process_after
Future commits are going to introduce more rigor in
state setting in the case of received results from
the data plane.  So let us move the DPLANE_OP_ROUTE_DELETE
state check to the same spot as the rest of the code that
is handling a particular operation.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-11 11:48:14 -05:00
Donald Sharp
f52ed67796 zebra: Limit meta_queue insertion to one time.
Modify the meta_queue insertion such that we only enqueue
the route_node into one meta_queue instead of several.

Suppose we have multiple route_entries associated with
a particular node from rip, bgp, staticd.  If we receive a
route update from rip, we would enqueue the route_node into
the 1, 2, 3 meta-nodes.  Which means that we would run
the entire process of figuring out a route 3 times, while
nothing would change the second two times.

Modify the code to choose the lowest meta-queue and
install it into that one for processing.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-11 11:48:14 -05:00
Donald Sharp
9d5a82a5c2
Merge pull request #3526 from mjstapp/dplane_lists
zebra: pass lists of results from dataplane to zebra
2019-01-10 19:20:35 -05:00
Mark Stapp
4c206c8f74 zebra: pass lists of results from dataplane to zebra
Pass lists of results back to zebra from the dataplane subsystem
(and pthread). This helps reduce the lock/unlock cycles when
zebra is busy. Also remove a couple of typedefs that made their
way into the dataplane header file - those violate the FRR style
guidelines.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-01-10 13:24:13 -05:00
Donald Sharp
73547a754e zebra: Consolidate meta_queue_map into route_info
The route_info data structure already had a mapping of route type
to admin distance.  Consolidate the meta_queue_map information
into this route_info data structure.  This is to reduce the number
of places we need to remember to touch when adding a new routing
protocol.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-02 09:15:30 -05:00
Donald Sharp
85c3d6005e
Merge pull request #3464 from mjstapp/wq_event
libs,zebra: support timeout for workqueue retries, use for rib
2018-12-14 10:00:49 -05:00
Donald Sharp
dba52387b7 zebra: On route removal failure return proper message
When a route removal failure happens return to the installing
protocol that the route deletion failed.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-12-13 20:00:33 -05:00
Mark Stapp
6dd7b84894 zebra: use a small retry timeout for the rib workqueue
In the zebra rib processing workqueue, set a small timeout
so that we will wait a short time if the queue into the
async dataplane is full. This helps avoid a situation where
the zebra main pthread constantly retries rib work without
giving the dataplane pthread a chance to make progress.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-12-13 14:15:27 -05:00
Russ White
f4aaa03907
Merge pull request #3477 from donaldsharp/multipath_respect
zebra: Allow zebra to only mark up to multipath_num nexthops as ACTIVE
2018-12-13 10:41:26 -05:00
Russ White
eefe8ab766
Merge pull request #3467 from donaldsharp/kernel_socket_cleanup
Kernel socket cleanup
2018-12-13 10:32:09 -05:00
Donald Sharp
220f0f4245 zebra: Allow zebra to only mark up to multipath_num nexthops as ACTIVE
NEXTHOP_FLAG_ACTIVE currently means that the nexthop is considered
good enough to be installed. With current ecmp restrictions this
translation from multipath_num is enforced in the data plane.
The problem with this is of course that every data plane now
becomes concerned about the multipath num and must enforce it
independently.  Currently *bsd does not honor multipath_num at
all and linux marks all nexthops as being installed even when
it honors a multipath_num that is less than the total.

This code change moves the multipath_num enforcement from a dataplane
decision to a zebra nexthop decision.  Thus dataplanes now can
just install those nexthops marked as NEXTHOP_FLAG_ACTIVE
without having to worry about multipath_num.

*BSD will now respect multipath_num and Linux now properly notes
which routes are actually installed or not:

sharpd@donna ~/f/t/topotests> ps -ef | grep frr
frr       6261  1556  0 09:12 ?        00:00:00 /usr/lib/frr/zebra -e 2 --daemon -A 127.0.0.1
frr       6279  1556  0 09:12 ?        00:00:00 /usr/lib/frr/staticd --daemon -A 127.0.0.1

donna.cumulusnetworks.com(config)# do show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route

K>* 0.0.0.0/0 [0/106] via 10.0.2.2, enp0s3, 00:00:45
S>* 4.4.4.4/32 [1/0] via 10.0.2.1, enp0s3, 00:00:02
  *                  via 192.168.209.1, enp0s8, 00:00:02
                     via 192.168.210.1, enp0s9 inactive, 00:00:02
C>* 10.0.2.0/24 is directly connected, enp0s3, 00:00:45
C>* 192.168.209.0/24 is directly connected, enp0s8, 00:00:45
C>* 192.168.210.0/24 is directly connected, enp0s9, 00:00:45
donna.cumulusnetworks.com(config)#

sharpd@donna ~/f/t/topotests> ip route show
default via 10.0.2.2 dev enp0s3 proto dhcp metric 106
4.4.4.4 proto 196 metric 20
	nexthop via 10.0.2.1 dev enp0s3 weight 1
	nexthop via 192.168.209.1 dev enp0s8 weight 1
10.0.2.0/24 dev enp0s3 proto kernel scope link src 10.0.2.15 metric 106
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown
192.168.209.0/24 dev enp0s8 proto kernel scope link src 192.168.209.2 metric 105
192.168.210.0/24 dev enp0s9 proto kernel scope link src 192.168.210.2 metric 103
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-12-13 09:21:26 -05:00
Donald Sharp
c626d369fd zebra: Remove rib_lookup_ipv4_route
The rib_lookup_ipv4_route function is only used in a debug path.
Is only used for v4 and only checks to make sure that the rib
and fib are in sync( which is not needed/used/supported on other
platforms ).  So let's just remove it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-12-12 11:54:12 -05:00
Donald Sharp
0dddbf72ec zebra: Convert nexthop_active functions to use bool
The set value was only being used as a bool, formalize this
in the call chain.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-12-10 10:21:41 -05:00
Mark Stapp
68b375e059 zebra: revise dplane dequeue api
Change the dataplane context dequeue api used by zebra to make the
purpose a bit clearer.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-11-21 10:38:08 -05:00
Mark Stapp
c831033fff zebra: dataplane provider enhancements
Limit the number of updates processed from the incoming queue;
add more stats. Fill out apis for dataplane providers; convert
route update processing to provider model; move dataplane
status enum

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-11-21 10:37:54 -05:00
Donald Sharp
effcfaeb3d zebra: Carry onlink if set from resolving nexthop
When resolving a nexthop, carry the onlink flag if it
is set to the new nexthop.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-11-07 11:28:01 -05:00
Mark Stapp
258c07e4e2 zebra: only uninstall once, when closing rib table
When the rib code is informed that a table is closing/
going away, only try once to uninstall associated routes from
the fib/dataplane. The close path can be called multiple times
in some cases - zebra shutdown, e.g.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-30 09:41:55 -04:00
Donald Sharp
69c19e1def
Merge pull request #2946 from mjstapp/dplane_2
Zebra: async dataplane, phase 1
2018-10-28 16:10:45 -04:00
Mark Stapp
8b962e7759 zebra: rebase dataplane, align with master
Rebase and pick up dataplane changes on master, including
renamed structs and enums.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:57:04 -04:00
Mark Stapp
91f1681258 zebra: limit queued route updates
Impose a configurable limit on the number of route updates
that can be queued towards the dataplane subsystem.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:57:04 -04:00
Mark Stapp
2577906481 zebra: revise struct names to resolve review comments
Use standard type naming and remove use of typedef to resolve
some review comments.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:57:04 -04:00
Mark Stapp
14c8b173d2 zebra: remove old apis after new dplane work
Replaced or out-grew a few zebra internal apis during async
dataplane work; removing them.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:57:04 -04:00
Mark Stapp
f183e380fa zebra: add handy res2str utility
Add a 2str utility for dplane result codes; use it in
a debug or two.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:57:04 -04:00
Mark Stapp
1bcea841b1 zebra: netlink fuzzing path correction
Correct use of netlink_parse_info() in the netlink fuzzing path.
Also clarify a couple of comments about pthreads.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:34:30 -04:00
Mark Stapp
fe2c53d4ea zebra: Fix style issues
Clean up a couple of checkstyle reports in the dataplane
commit.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:34:30 -04:00
Mark Stapp
5af4b34689 zebra: ensure redist of system routes
We need a bit of special handling for system routes, which need
to be offered for redistribution even though they won't be
passing through the dplane system.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:34:30 -04:00
Mark Stapp
5709131cec zebra: resolve style issues in dplane commit
Resolve (most) style issues in the initial zebra dataplane
commit branch.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:34:30 -04:00
Mark Stapp
8cb41cd624 zebra: set SELECTED flag in rib_process
Set SELECTED re immediately in rib_process, without expecting
that fib install has completed. Remove premature redistribute
call also.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:34:30 -04:00
Mark Stapp
97f5b44182 zebra: use async dplane route updates
Enqueue updates to the dplane system; add a couple of stats.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:34:30 -04:00
Mark Stapp
e5ac2adf17 zebra: wip: early version of dplane result handler
Early try at a result handler for async dplane route updates

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:34:30 -04:00
Mark Stapp
7cdb1a8445 zebra: start dataplane layer work
Reduce or eliminate use of global zebra_ns structs in
a couple of netlink/kernel code paths, so that those paths
can potentially be made asynch eventually.

Slide netlink_talk_info into place to remove dependency on core
zebra structs; add accessors for dplane context block

Start init of route context from zebra core re and rn structs;
start queueing and event handling for incoming route updates.

Expose netlink apis that don't rely on zebra core structs;
add parallel route-update code path using the dplane ctx;
simplest possible event loop to process queued route'
updates.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:34:30 -04:00
Donald Sharp
89272910f7 zebra: Start breakup of zns into zrouter and zns
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>
2018-10-24 06:52:07 -04:00
David Lamparter
cd5f56bb4e Merge branch 'pull/3165'
...with an additional comment.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-23 12:42:42 +02:00
David Lamparter
ef57f35f41 zebra: add comment about Linux ifdown handling
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-23 12:42:06 +02:00
Donald Sharp
7939ff769f zebra: Add some missing breadcrumbs
During a debugging session last night I discovered that I was
still having some `fun` figuring out why zebra was not making
a route's nexthop active.  After some debugging I figured out
that I was missing some states that we could end up in that
didn't have debug information about what happened in nexthop_active.

Add the missing breadcrumbs for nexthop resolution.  In addition
add a bit of code to notice the ebgp state without recursion turned
on and to let the user know about it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-18 09:13:18 -04:00
Philippe Guibert
212df1de28 zebra: remove kernel routes that are suppressed
on some cases, kernel routes are not selected, because the kernel
suppressed it without informing the netlink layer that the route has
been suppressed ( for instance, when an interface goes down, the route
never goes back when interface goes up again). This commit intends to
suppress that entry from zebra.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-10-17 23:01:10 +02:00
vishaldhingra
6d53d7b1af zebra: vrf aware routmap is missing in Zebra #2802(Part 2 of 4)
Function parameter replacement of using zvrf instead of vrf_id

Signed-off-by: vishaldhingra vdhingra@vmware.com
2018-10-11 10:46:55 -07:00
vishaldhingra
ac6eebce50 zebra: vrf aware routmap is missing in Zebra #2802(Part 1 of 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
2018-10-11 10:44:55 -07:00
David Lamparter
6a154c8812 *: list_delete_and_null() -> list_delete()
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-02 11:40:52 +02:00
Renato Westphal
38ca1c9256
Merge pull request #3081 from donaldsharp/table_table_table
bgpd, lib, zebra: Wrapper get/set of table->info pointer
2018-09-24 23:32:50 -03:00
Donald Sharp
6ca30e9ec6 bgpd, lib, zebra: Wrapper get/set of table->info pointer
Wrapper the get/set of the table->info pointer so that
people are not directly accessing this data.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-23 20:04:39 -04:00
Mark Stapp
ea1c14f680 zebra: Create zebra_dplane.c and .h
Add first sketchy 'dplane' files.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-19 18:29:55 -04:00
Quentin Young
1c50c1c0d6 *: style for EC replacements
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-13 19:38:57 +00:00
Quentin Young
e914ccbe9c zebra: ZEBRA_[ERR|WARN] -> EC_ZEBRA
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-13 19:23:29 +00:00
David Lamparter
e991eff5b5 Merge remote-tracking branch 'frr/master' into warnings
Conflicts:
	zebra/if_ioctl_solaris.c
	zebra/rtread_getmsg.c

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-12 21:58:39 +02:00
Donald Sharp
714e135429
Merge pull request #2875 from opensourcerouting/fabricd
OpenFabric support
2018-09-08 13:48:48 -04:00
Donald Sharp
34815ea334 zebra: Modify nexthop checks to report inactive a bit more
Debugging inactive nexthops in zebra can be quite difficult
and non-obvious what has gone wrong.  Add detailed rib
debugs for the cases where we decide that a nexthop is
inactive so that we can more easily debug a reason
for the failure.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-06 20:24:00 -04:00
Quentin Young
9df414feeb zebra: flog_warn conversion
Convert Zebra to user error subsystem.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-06 20:56:38 +00:00
Donald Sharp
2d68a0f2da zebra: Fix _route_entry_dump to handle nexthop family as appropriate
The _route_entry_dump function was not handling the nexthop as passed
in from an upper level protocol appropriate and as such not displaying
the v4/v6 nexthop right in the case where we have both going.

Additionally dump the nexthop vrf as well.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-05 21:02:18 -04:00
Christian Franke
103e4a718f zebra: add a ZEBRA_FLAG_ONLINK so that routes bypass the is-unnumbered check
For OpenFabric operation, we need to be able to install routes via
interfaces without any IPv4 addresses configured. Introduce a flag
ZEBRA_FLAG_ONLINK which upper protocols can set on a route they send
towards zebra, to force the nexthops to be considered onlink.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2018-09-05 11:38:13 +02:00