Commit Graph

8680 Commits

Author SHA1 Message Date
Donald Sharp
0ffa840756 eigrpd: Remove 'struct prefix_ipv4' from eigrp_interface.c
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-24 08:09:04 -04:00
Donald Sharp
cd6c066eb3 eigrpd: Refactor eigrp_network_[un]set to use prefix
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-24 08:09:03 -04:00
Donald Sharp
476a146963 eigrpd: Refactor eigrp_topoloy_table_lookup_ipv4
Allow eigrp_topology_table_lookup_ipv4 to use
'struct prefix'

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-24 08:09:03 -04:00
Donald Sharp
836aad7ee8 eigrpd: Refactor to use 'struct prefix' for eigrp_zebra.h
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-24 08:09:02 -04:00
Donald Sharp
02b4599881 eigrpd: Convert pe->destination_ipv4 to pe->destination
Convert the destination_ipv4 to a struct prefix and just
call it destination.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-24 08:04:20 -04:00
Donald Sharp
348addb4e7 eigrpd: Use FSM for interface pe already known.
There exists a case where a switch already has
a eigrp_prefix_entry for a interface that is
coming up.

In this situation, we need to use the FSM
to let the connected route take precedence
instead of blindly just updating the world
about it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-24 08:04:20 -04:00
Donald Sharp
5ca6df7822 eigrpd: No need to create TLV type
There is no need to create a TLV type to pass in for the
FSM message.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-24 08:04:20 -04:00
Donald Sharp
db6ec9ff6e eigrpd: Remove union from FSM msg
Remove the union of passing the TLV and just pass the metric in.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-24 08:04:20 -04:00
Donald Sharp
3aea4e507b eigrpd: Improve external route distance comparison
If the new nexthop is external while the previous
best was Internal or Connected, it should always loose.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-24 08:04:20 -04:00
Donald Sharp
7cfa432255 eigrpd: make fsm msg data_type an enum
We need to eventually be able to handle multiple
data types to figure out if the distance is better
worse.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-24 08:04:20 -04:00
Donald Sharp
6118272f14 eigrpd: Refactor FSM calling
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-24 08:04:20 -04:00
Donald Sharp
92035b1db4 eigrpd: Fix memory leak in FSM
The FSM was never freeing the msg.  Since we
do not have a special queue for it, just don't
allocate the memory.  In the future we can put
this back.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-24 08:04:20 -04:00
Donald Sharp
695ff37bab eigrpd: Cleanup list accessors
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-24 08:04:20 -04:00
Donald Sharp
c1c32a7803 eigrpd: Remove unnecessary check
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-24 08:04:20 -04:00
Donald Sharp
cd04424793 eigrpd: Start split-horizon
EIGRP was not handling split-horizon.  This code starts
down the path of properly considering it.  There still
exists situations where we are not properly handling it
though.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-24 08:04:20 -04:00
Donald Sharp
cbe6eca6a6 Merge pull request #1022 from opensourcerouting/zapi_consolidation
Zapi consolidation
2017-08-24 06:03:55 -04:00
Renato Westphal
f474e08be0 lib: mark the old zebra API for route advertisement as deprecated
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 20:28:34 -03:00
Renato Westphal
b30f3b91d4 ospf6d: fix regression detected by topotest
With the old API, ospf6d always needed to send a nexthop address and a
nexthop interface when advertising a route to zebra. In the case where
the nexthop address didn't exist (e.g. connected route), zebra would
take care of ignore it in the zread_ipv6_add() function.

Now, if we have a nexthop interface but not a nexthop address, we not
only can but we should send a nexthop of type NEXTHOP_TYPE_IFINDEX. zebra
won't fix bad nexthops anymore because the clients have a proper API to
send correct messages.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 20:25:45 -03:00
Renato Westphal
744899219f *: use zapi_route to send/receive redistributed routes as well
Some differences compared to the old API:
* Now the redistributed routes are sent using address-family
  independent messages (ZEBRA_REDISTRIBUTE_ROUTE_ADD and
  ZEBRA_REDISTRIBUTE_ROUTE_DEL). This allows us to unify the ipv4/ipv6
  zclient callbacks in the client daemons and thus remove a lot of
  duplicate code;

* Now zebra sends all nexthops of the redistributed routes to the client
  daemons, not only the first one. This shouldn't have any noticeable
  performance implications and will allow us to remove an ugly exception
  we had for ldpd (which needs to know all nexthops of the redistributed
  routes). The other client daemons can simply ignore the nexthops if
  they want or consult just the first one (e.g. ospfd/ospf6d/ripd/ripngd).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 20:25:45 -03:00
Renato Westphal
2ad4f0933c bgpd: unify ipv4/ipv6 zebra-tx functions
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 20:25:45 -03:00
Renato Westphal
9350687dc4 nhrpd: unify ipv4/ipv6 zebra-tx functions
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 20:25:45 -03:00
Renato Westphal
f80dd32b13 isisd: unify ipv4/ipv6 zebra-tx functions
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 20:25:45 -03:00
Renato Westphal
9913029c5c bgpd: use the new API to send routes to zebra
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 20:25:40 -03:00
David Lamparter
bd59f16782 Merge pull request #1026 from qlyoung/no-ospf6
ospf6d: add `no` forms for interface commands
2017-08-24 00:24:57 +02:00
Renato Westphal
5afa1c6be2 ospf6d: use the new API to send routes to zebra
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 18:58:35 -03:00
Renato Westphal
5fef910e71 ospfd: use the new API to send routes to zebra
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 18:58:35 -03:00
Renato Westphal
6f27a9f6a5 nhrpd: use the new API to send routes to zebra
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 18:58:35 -03:00
Renato Westphal
c0721de4d4 isisd: use the new API to send routes to zebra
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 18:58:35 -03:00
Renato Westphal
8fb753e360 eigrpd: use the new API to send routes to zebra
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 18:58:35 -03:00
Renato Westphal
c9fb3e233e ripd/ripngd: use the new API to send routes to zebra
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 18:58:35 -03:00
Renato Westphal
52dd3aa483 zapi: add support for routes with multiple labels
This will be necessary for the Segment Routing feature.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 18:58:35 -03:00
Renato Westphal
c8f9e916df babeld: unify kernel_route_v4() and kernel_route_v6()
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 18:58:35 -03:00
Renato Westphal
0e51b4a368 lib/zserv: introduce address-family independent ZAPI message types
As noticed in 657cde1, the zapi_ipv[4|6]_route functions are broken in
many ways and that's the reason that many client daemons (e.g. ospfd,
isisd) need to send handcrafted messages to zebra.

The zapi_route() function introduced by Donald solves the problem
by providing a consistent way to send ipv4/ipv6 routes to zebra with
nexthops of any type, in all possible combinations including IPv4 routes
with IPv6 nexthops (for BGP unnumbered routes).

This patch goes a bit further and creates two new address-family
independent ZAPI message types that the client daemons can
use to advertise route information to zebra: ZEBRA_ROUTE_ADD and
ZEBRA_ROUTE_DELETE. The big advantage of having address-family independent
messages is that it allows us to remove a lot of duplicate code in zebra
and in the client daemons.

This patch also introduces the zapi_route_decode() function. It will be
used by zebra to decode route messages sent by the client daemons using
zclient_route_send(), which calls zapi_route_encode().

Later on we'll use this same pair of encode/decode functions to
send/receive redistributed routes from zebra to the client daemons,
taking the idea of removing code duplication to the next level.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 17:45:17 -03:00
Renato Westphal
bb1b9c47ca lib: updates to zapi_route
This patch introduces the following changes to the zapi_route structure
and associated code:
* Use a fixed-size array to store the nexthops instead of a pointer. This
  makes the zapi_route() function much easier to use when we have multiple
  nexthops to send. It's also much more efficient to put everything on
  the stack rather than allocating an array in the heap every time we
  need to send a route to zebra;

* Use the new 'zapi_nexthop' structure. This will allow the client daemons
  to send labeled routes without having to allocate memory for the labels
  (the 'nexthop' structure was designed to be memory efficient and doesn't
  have room for MPLS labels, only a pointer). Also, 'zapi_nexthop' is more
  compact and more clean from an API perspective;

* Embed the route prefix inside the zapi_route structure. Since the
  route's prefix is sent along with its nexthops and attributes, it makes
  sense to pack everything inside the same structure.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 17:45:17 -03:00
Renato Westphal
81c11e3fea zserv: identify label type based on the client protocol
This fixes a problem where the type of the BGP-LU labels was not
being set.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 17:45:17 -03:00
Renato Westphal
d51b9e4509 zserv: simplify handling of route delete requests
Route attributes like tag, distance and metric are irrelevant when we
want to delete a route from a client daemon. The same can be said about
the nexthops of the route. Only the IP prefix and client protocol are
enough to identify the route we want to remove, considering that zebra
maintains at most one route from each client daemon for each prefix. Once
rib_delete() is called, it deletes the selected route with all of its
nexthops.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 17:45:17 -03:00
Renato Westphal
e959008b1e babeld/eigrpd/ldpd/nhrpd: add prefix length sanity checks
Pulled from d917882.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 17:45:17 -03:00
Renato Westphal
f38efb809d zebra: add support for NEXTHOP_TYPE_IPV6_IFINDEX in zserv
This is the v6 counterpart of commit c963c20.

Fixes a bug where ipv6 routes received from babeld were being ignored.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 17:45:17 -03:00
Renato Westphal
c125d1d41e babeld/nhrpd: ignore ipv6 srcdest routes
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 17:45:17 -03:00
Renato Westphal
34b054ba6d *: remove leftovers from "router zebra"
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 17:45:17 -03:00
Renato Westphal
89a8b5cada vnc/eigrpd/isisd: check for the correct message types
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 17:45:17 -03:00
Renato Westphal
153856bbe9 lib: remove redundant zebra messages
This also fixes a bug of ipv6 routes advertised by the VNC code being
ignored by zebra.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 17:45:17 -03:00
Renato Westphal
d00061ea32 *: reduce excessive indentation in a few places
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 17:45:17 -03:00
Quentin Young
e1b9b080b8 Merge pull request #1030 from opensourcerouting/bgpd-fd-leak
bgpd: fix file descriptor leak
2017-08-23 15:45:53 -04:00
Renato Westphal
5ecf554009 bgpd: fix file descriptor leak
Bug introduced by commit 37d361e7. Removing the call to bgp_close()
from bgp_delete() was a mistake.

Reported-by: Don Slice <dslice@cumulusnetworks.com>
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-22 20:09:26 -03:00
Donald Sharp
c25445c820 Merge pull request #1028 from opensourcerouting/mpls_label_stack
zebra: increase maximum label stack depth
2017-08-22 18:25:23 -04:00
Renato Westphal
5e8c8947e3 zebra: increase maximum label stack depth
* Bump MPLS_MAX_LABELS from 2 to 16;
* Adjust the static_nh_label structure and the mpls_label2str() function;
* On OpenBSD, print an error message when trying to push more than one
  label at once (kernel limitation). While here, add support for MPLSv6
  FTNs in OpenBSD.

This is not the full package. We still can't pop multiple labels at once,
or do things like swap a label and push other ones. We'll address that
in the future.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-22 17:37:58 -03:00
Quentin Young
d23d6de866
ospf6d: add no forms for interface commands
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-08-22 16:07:30 -04:00
David Lamparter
1d84515ca9 Merge pull request #1025 from qlyoung/no-ospf
ospfd, ospf6d: cleanup some `no` commands
2017-08-22 17:55:01 +02:00
Donald Sharp
569ab7a544 Merge pull request #1023 from opensourcerouting/route-node-const
lib: fix const-check in route_node
2017-08-22 11:44:45 -04:00