Commit Graph

1526 Commits

Author SHA1 Message Date
Donald Sharp
5d920111b9 Merge pull request #1210 from opensourcerouting/misc-mpls-bgp-lu-fixes
Misc BGP-LU fixes
2017-10-10 12:19:37 -04:00
Renato Westphal
e56ab0e971 Merge pull request #1301 from donaldsharp/zebra_vxlan
Zebra vxlan
2017-10-10 09:00:44 -03:00
Renato Westphal
424270dd23 Merge pull request #1297 from dslicenc/cm18154-import-table
zebra: resolve issue with importing table entries correctly
2017-10-09 20:27:57 -03:00
Renato Westphal
d855d11fad zebra: use a switch statement in nexthop_set_resolved()
This makes the function much easier to read, and also faster.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-09 20:15:14 -03:00
Renato Westphal
ad4527eb61 zebra: fix uninitialized prefixes in the handling of FEC messages
This was causing some weird prefixes to pop up in my log files. One
alternate solution would be to call apply_mask() on the prefix, but
memcpy() is faster and just enough in this case.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-09 20:15:14 -03:00
Renato Westphal
9a62e84b5b zebra: fix logging of MPLS labels
* use %u instead of %d, we don't want to print negative labels;
* increase the size of label_buf to accommodate the worst case scenarios;
* use strlcat() instead of strcat() as a security best practice.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-09 20:15:14 -03:00
Renato Westphal
09d0f308ce Merge pull request #1237 from donaldsharp/distance_special
zebra: Modify metric read to be admin distance and metric
2017-10-09 20:11:39 -03:00
Vincent JARDIN
792fa92ec1 zebra: fix clang warning
Set to 0 to avoid "Branch condition evaluates to a garbage value".

Signed-off-by: Vincent Jardin <vincent.jardin@6wind.com>
2017-10-08 23:47:43 +02:00
vivek
790f8dc572 zebra: Fix MAC counts for EVPN
MAC entries are internally created for purposes such as when a local
neighbor is learnt but the MAC itself is not yet learnt. Such MACs are
not "real", so ensure they are not counted for UI output.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>

Ticket: CM-17991
Reviewed By: None
Testing Done: Manual, evpn-smoke
2017-10-06 10:00:19 -04:00
vivek
2853fed67a zebra: Handle L3 multi-tenancy correctly for EVPN
Fix following flaws that resulted in EVPN with L3 multi-tenancy (i.e.,
EVPN dealing with VxLAN routing in the presence of tenant VRFs) not
working properly:

1. EVPN enable ("advertise-all-vni") is a global command, ensure it is
accordingly processed. The config is maintained against the default VRF.
2. There was an incorrect attempt to derive the L3 VRF for L2 interfaces
- the VRF only applies for L3 interfaces, though the code may initialize
to the default value in other cases.
3. Functions to map (port, VLAN) to SVI or vice versa were incorrect -
particularly, zvni_map_svi() since it was looking in the L3 VRF for
"matching" L2 interface which it would never find. Fix.

In addition, since the 'zebra_vrf *' parameter is not relevant in most
places, it has been removed.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Mitesh Kanjariya <mitesh@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-17840
Reviewed By: CCR-6685
Testing Done: evpn-smoke, various manual tests
2017-10-06 09:59:43 -04:00
Renato Westphal
8526b84200 zebra: fix display of negative route metrics and tags
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-05 22:55:58 -03:00
Don Slice
5c4b6e577c zebra: resolve issue with importing table entries correctly
Problem reported when a table entry originated by rdnbrd was moved from one
interface to another on the same switch.  Both would be deleted, leaving
no imported entry in the table.  Modified zebra_add_import_table_entry to
used rib_add_multipath as well as correct the call to delete a duplicate
entry to include the nexthop associated with the route_entry.

Ticket: CM-18154
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed By: CCR-6731
Testing Done: Manual testing successful, deb given to submitter, bgp-smoke
had no new failures
2017-10-05 16:08:46 +00:00
Donald Sharp
acdf5e2510 *: Convert list_free usage to list_delete
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>
2017-10-05 10:53:17 -04:00
Donald Sharp
affe9e9983 *: Convert list_delete(struct list *) to ** to allow nulling
Convert the list_delete(struct list *) function to use
struct list **.  This is to allow the list pointer to be nulled.

I keep running into uses of this list_delete function where we
forget to set the returned pointer to NULL and attempt to use
it and then experience a crash, usually after the developer
has long since left the building.

Let's make the api explicit in it setting the list pointer
to null.

Cynical Prediction:  This code will expose a attempt
to use the NULL'ed list pointer in some obscure bit
of code.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-05 10:53:13 -04:00
Donald Sharp
6977eb91c6 *: Add some documentation about how to handle new daemons
Add some breadcrumbs for when we add a new routing daemon
so things `just work`.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-05 08:54:03 -04:00
Quentin Young
07fb10ad90 Merge pull request #1263 from vjardin6WIND/cleanup
Cleanup - scan-build
2017-10-03 11:39:59 -04:00
Renato Westphal
47cf17fd59 Merge pull request #1277 from donaldsharp/zebra_crash
Zebra crash and valgrind issues
2017-10-02 14:05:54 -03:00
Renato Westphal
36a58930ff Merge pull request #1254 from donaldsharp/irdp_no_crash
zebra: Fix irdp so it doesn't crash when looked at
2017-10-02 12:41:24 -03:00
Donald Sharp
f88bd20c39 zebra: Cleanup ptm memory *after* we tell the sockets to clean up
The zebra_ptm_finish() code was being called before the
client_list deletion.  The client_list deletion is
attempting to call the ptm daemon and shut down the connection.
We should not be doing this *after* we shut down memory associated
with it as that we were writing into memory in random spots
in this case.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-02 11:06:09 -04:00
Donald Sharp
b8aa376766 zebra: Properly initialize memory for rtadv
The adata pointer was not properly being set to
0 before being used.  In addition notice malloc
failure and hard exit.  If we have no memory on
startup something terrible has gone wrong and
we were going to crash shortly here anyways.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-02 11:06:06 -04:00
Donald Sharp
cbaca6a144 zebra: Fix valgrind report of unintialized data
When calling the kernel we are not properly initializing
iov and msg on function startup.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-02 10:42:53 -04:00
Vincent JARDIN
c31a793b48 scan-build: cleanup some warnings
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;
2017-10-02 09:14:03 +02:00
Renato Westphal
c00ad29fc4 Merge pull request #1236 from donaldsharp/interface_startup
zebra: Do not allow same rib_dest_t be queued multiple times to meta …
2017-09-28 22:04:02 -03:00
Renato Westphal
67c0a9206c Merge pull request #1180 from dwalton76/ipv6-static-route-null0
Ipv6 static route null0
2017-09-27 13:42:53 -03:00
Daniel Walton
1e058f38c2 zebra: split ip route DEFUNs for blackhole, reject, etc
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2017-09-27 15:35:28 +00:00
Daniel Walton
66b8ce1a17 Merge branch 'master' into bgpd-debug-updates-prefix 2017-09-27 09:21:26 -04:00
Renato Westphal
310f64be93 Merge pull request #1240 from donaldsharp/allow_self_delete
zebra: Do not allow delete of route from kernel in non-startup case
2017-09-27 09:11:11 -03:00
Renato Westphal
5f3d15f2c3 Merge pull request #1249 from donaldsharp/debugodebug
Debugodebug
2017-09-26 22:21:41 -03:00
Donald Sharp
e92044cd96 zebra: Fix irdp so it doesn't crash when looked at
irdp is crashing because it assumes that people have
configured it in a certain way.  Ensure that this
'way' is honored at least enough so that we don't
crash.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-09-26 19:57:27 -04:00
Vincent JARDIN
337960dded zebra: static ns
it only for local usage, only accessors are used.
2017-09-26 22:12:32 +02:00
Donald Sharp
95744ad864 zebra: Display if we are debugging zebra vxlan or not
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-09-26 15:43:23 -04:00
Renato Westphal
8a38c34b5a Merge pull request #1235 from chiragshah6/ospf_vrf_dev
zebra: Nexthop APIs to use correct vrf_id
2017-09-26 00:34:04 -03:00
Donald Sharp
5dfeba1904 zebra: Do not allow delete of route from kernel in non-startup case
This is a continuation of 915902cb82.  Basically the netlink
read of messages up from the kernel is now noticing the proper
owner of the route.  As such when rib_delete was being called
as part of the upcall from the kernel we were not noticing that
we were the originator and not diss-allowing the rib_delete
from happening.  This restores this behavior that we were getting
pre-915902cb82cfd

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-09-25 12:28:39 -04:00
Donald Sharp
fd289fc83e zebra: Make admin distance a uint8_t
While u_char is technically a uint8_t in size I would
like to treat and think about the admin distance
as an actual integer value from 0-255, instead
of a char.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-09-25 08:41:33 -04:00
Donald Sharp
25715c7e50 zebra: Modify metric read to be admin distance and metric
For ZEBRA_ROUTE_KERNEL types:

The metric/priority of the route received from the kernel
is a 32 bit number.  We are going to interpret the high
order byte as the Admin Distance and the low order 3 bytes
as the metric.

This will allow us to do two things:
1) Allow the creation of kernel routes that can be
   overridden by zebra.
2) Allow the old behavior for 'most' kernel route types
   if a user enters 'ip route ...' v4 routes get a metric
   of 0 and v6 routes get a metric of 1024.  Both of these
   values will end up with a admin distance of 0, which
   will cause them to win for the purposes of zebra.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-09-25 08:37:04 -04:00
Donald Sharp
1ca60f2c3e zebra: Do not allow same rib_dest_t be queued multiple times to meta queue
If we have already scheduled a node to be on the meta_queue, there is no
need to schedule it up again.

On startup we are calling rib_update() multiple times per connected route.
Due to the multiple ways we can get callbacks for adding a connected route
I decided it was best to just improve meta_queue performance as opposed
to trying to figure out all the different ways across all the platforms
that we can decide that a connected route has changed.  This appears
to solve the issue with a very large # of interfaces coming up
at the same time on startup.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-09-25 08:10:24 -04:00
Chirag Shah
eec2e59276 zebra: Nexthop APIs to use correct vrf_id
For unnumbered interface lookup vrf aware interface
info.
Pass vrf aware interface info for route entry's nexthop
ifindex in route add path.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-09-24 18:05:12 -07:00
Renato Westphal
66af68454b zebra: make rib_add() a simple wrapper for rib_add_multipath()
Both function were very similar, and as we know code duplication is not
good. As an example, in the past couple of weeks some fixes were made
on rib_add() but not on rib_add_multipath(), causing known bugs to still
exist in a different form.

Instead of merging the two functions into one, let's make rib_add()
call rib_add_multipath() with the appropriate parameters. This way we
remove the code duplication but still keep the easy-to-use rib_add()
function for single-path routes.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-09-21 13:27:50 -03:00
Renato Westphal
844b3a8748 zebra: fix detection of duplicate kernel routes (ECMP version)
Fixes the following bug:
% ip route add 50.0.0.0/8 nexthop via 10.0.1.2 nexthop via 10.0.2.2
% ip route replace 50.0.0.0/8 nexthop via 10.0.1.3 nexthop via 10.0.2.3
% ip route replace 50.0.0.0/8 nexthop via 10.0.1.4 nexthop via 10.0.2.4
%
% vtysh -c "show ip route"
[snip]
K * 50.0.0.0/8 [0/0] via 10.0.1.4, rt1-eth1, 00:00:00
  *                  via 10.0.2.4, rt1-eth2, 00:00:00
K * 50.0.0.0/8 [0/0] via 10.0.1.3, rt1-eth1, 00:00:10
  *                  via 10.0.2.3, rt1-eth2, 00:00:10
K>* 50.0.0.0/8 [0/0] via 10.0.1.2, rt1-eth1, 00:00:24
  *                  via 10.0.2.2, rt1-eth2, 00:00:24

Commit a3d18ce6 fixed a similar problem for single-path routes.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-09-21 13:27:50 -03:00
Renato Westphal
8b1450b94d zebra: fix multihop/multipath confusion
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-09-21 13:27:50 -03:00
Renato Westphal
805444ce72 zebra: install MPLS LSPs with appropriate protocol type
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-09-21 13:27:50 -03:00
Renato Westphal
eb327fa590 zebra: pay attention to metric from kernel (ECMP version)
Commit f19435a8 fixed rib_add() but didn't fix rib_add_multipath().

While here, remove the unnecessary 'same->table == re->table' check as
it always evaluate to true.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-09-21 13:27:50 -03:00
Renato Westphal
7865c65d23 zebra: plug memory leak in rib_add_multipath()
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-09-21 13:27:50 -03:00
Renato Westphal
7990990e54 zebra: use the afi parameter in rib_add_multipath()
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-09-21 13:27:50 -03:00
Jafar Al-Gharaibeh
b1cebe20cd Merge pull request #1157 from donaldsharp/recursive_blackhole
Recursive blackhole resolution
2017-09-21 11:16:35 -05:00
Donald Sharp
972019ae02 zebra: Free leaked zclient data structures on shutdown
On shutdown we were deleting the linked list that
kept the zclient connections, but we were not
freeing the data pointed at by the link list.

This modification allows the normal cleanup of the
linked list to cleanup the zclient data structure.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-09-21 09:40:58 -04:00
Donald Sharp
60c2286880 Merge pull request #1160 from opensourcerouting/admin_distance
Admin distance
2017-09-21 07:55:08 -04:00
Daniel Walton
d7d75634e9 zebra: cleanup reject vs blackhole vs null0 vs Null0
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2017-09-20 22:24:27 +04:00
Donald Sharp
d1ca0f1d5b zebra: Allow static routes to track how long they've been around
Static routes were not keeping track of uptime appopriately and
as such we were not properly displaying uptime.

Fixes: #1196
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-09-19 13:47:16 -04:00
Daniel Walton
8527ce3a31 zebra: return CMD_SUCCESS when enabling debugs 2017-09-19 14:01:28 +00:00