Commit Graph

290 Commits

Author SHA1 Message Date
Donald Sharp
e4bd522a31 zebra: No need to pass sock descriptor around.
Standardize the api to read zapi requests from protocols.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-23 18:09:22 -04:00
Renato Westphal
451fda4f9a *: use the FOR_ALL_INTERFACES abstraction from babeld
This improves code readability and also future-proofs our codebase
against new changes in the data structure used to store interfaces.

The FOR_ALL_INTERFACES_ADDRESSES macro was also moved to lib/ but
for now only babeld is using it.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-10 09:05:46 -03:00
Renato Westphal
f4e14fdba7 *: use rb-trees to store interfaces instead of sorted linked-lists
This is an important optimization for users running FRR on systems with
a large number of interfaces (e.g. thousands of tunnels). Red-black
trees scale much better than sorted linked-lists and also store the
elements in an ordered way (contrary to hash tables).

This is a big patch but the interesting bits are all in lib/if.[ch].

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-10 09:05:02 -03: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
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
Renato Westphal
b3c18264e4 Merge pull request #1079 from qlyoung/fix-style-a
*: fix style
2017-08-31 13:22:55 -03:00
Jafar Al-Gharaibeh
959768e8d0 Merge pull request #1044 from donaldsharp/combination
Coverity Cleanup of Stuff
2017-08-31 10:25:55 -05:00
Quentin Young
60466a63f2
*: fix style
Fixes style nits introduced by recent pull requests.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-08-30 11:27:11 -04:00
Donald Sharp
1e9f448fe1 zebra: Coverity Code Cleanup
1) Various socket close issues
2) Ensure afi passed is usable
3) Fix some reads beyond buffer and reads after free
4) Ensure some failure modes are handled properly
5) Memory Leak(s) fix
6) There is no 6.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-25 11:37:07 -04:00
Renato Westphal
0af35d90a1 *: fix assorted issues detected by Coverity Scan
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-24 21:49:39 -03:00
Mitesh Kanjariya
71349e0358 zebra: lookup link by ifindex
Frr has an assumption that when interface A links to B,
we already know about B. But that might be true always.
It is probably purely depends on the configuration
and how the interfaces are hashed in Kernel.
FRR seems to sometimes get "A is linked to B" before it knows about B,
in that case, the linkage between the data structure for A & B won't be proper.

Ticket: CM-17679
Review: ccr-6628
Testing: Manual

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-08-20 06:10:38 -07:00
Mitesh Kanjariya
f51d8a274b zebra: Delete AUTO macs when neigh list is empty
Ticket: CM-17660
Review: CCR-6624
Testing: Manual

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-08-20 05:53:15 -07:00
Mitesh Kanjariya
57f7feb64f Fix coding style.
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-08-18 17:33:56 -07:00
Mitesh Kanjariya
859b32c030 zebra: Revert the fix for zebra: Refresh remote neighbors when they go stale
NUD_STALE flag is causing a build breakage,
we might have to define it somewhere in frr.
Reverting the fix for now untill we decide how to handle it correctly.

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-08-17 17:40:17 -07:00
vivek
b682f6de5a zebra: Fix MAC change handling for a neighbor
When the MAC changes for a local neighbor, ensure that the neighbor data
structure as well as the link between the neighbor and MAC data structures
is updated correctly.

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

Ticket: CM-17565
Reviewed By: CCR-6605
Testing Done: Manual, evpn-smoke
2017-08-17 03:54:38 -07:00
vivek
c65f709ec6 zebra: Refresh remote neighbors when they go stale
If we get an ageout notification from the kernel for EVPN-installed
neighbors, ensure that they are readded. Otherwise, while entries in
STALE state are usable, based on other kernel parameters they can
get deleted and adding them back only at delete can have other
undesirable performance consequences.

Note: This is the current Linux kernel behavior (to ageout EVPN
installed neighbors).

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

Ticket: CM-15623, CM-17490
Reviewed By: CCR-6586
Testing Done: Manual, evpn-min
2017-08-17 02:53:29 -07:00
vivek
af026ae40e zebra: Fix VxLAN interface add-del to bridge
Ensure that removal and addition of VxLAN interface from/to bridge is
handled correctly.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2017-08-17 02:48:41 -07:00
vivek
b5ebdc9ba5 zebra: Handle MACIP requests when in transient conditions
When multiple events are happening, it is possible that remote
MACIP or other requests may be received when an interface is down
or removed from a bridge. Handle this correctly.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2017-08-17 02:31:45 -07:00
Mitesh Kanjariya
0a97666de7 zebra: Use neigh_list instead of neigh_refcnt for zebra_mac and zebra_neigh binding
Ticket: CM-17500
Review: CCR-6584
Testing: Manual

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-08-16 18:56:15 -07:00
Mitesh Kanjariya
23341a0584 Zebra: replace mac entry in kernel when it moves from local to remote
Until now, we had to delete the local mac entries when a mac moved from local to remote,
with the new kernel patch that is no longer necessary.

Ticket:CM-16094
Reviewed By:CCR-6470
Testing Done: Manual

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-08-16 17:30:46 -07:00
Mitesh Kanjariya
297a21b66b zebra: zebra should not try and advertise gateway macip if EVPN is disabled
Ticket: CM-17050
Review: CCR-6447
Unit-test: Manual

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-08-08 10:28:54 -04:00
Mitesh Kanjariya
ddd16ed5f2 bgpd/zebra: honor tunnel ip change in bgp regardless of vni readiness
Ticket: CM-17014
Review: CCR-6432
Unit-test: Manual

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-08-08 10:28:54 -04:00
Mitesh Kanjariya
b6938a74e5 zebra: Provide neigh-mac tie-in in zebra
Currently, FRR does not do any linking between local MACs and neighbors.
We found this necessary when dealing with centralized GW. A neigh is considered local only when the mac is learnt locally as well.

Ticket: CM-16544
Review: CCR-6388
Unit-test: Manual/Evpn-Smoke

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-08-08 10:28:51 -04:00
Chirag Shah
cd23307906 zebra: Enable JSON for EVPN show cmds
Ticket: CM-16959
Reviewed By: CCR-6401
Testing Done:
Execute 'show evpn .... json' form of outputs with local/remote vteps

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-08-08 10:28:50 -04:00
Donald Sharp
9b67b51474 zebra: Fix some memory leaks on shutdown
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-08 10:28:50 -04:00
Mitesh Kanjariya
1a98c08704 bgpd/zebra/lib: EVPN support for asymmetric VxLan routing
1. Advertise gateway mac-ip in EVPN
2. Advertise VRR mac-ip in EVPN
3. Ignore gateway mac-ip advertisements in case of distributed gateway
4. Config knob to enable/disable gateway mac-ip advertisements

Ticket: CM-16456, CM-16543, CM-16555, CM-16778
Review: CCR-6283
Unit-test: Manual

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-08-08 10:28:46 -04:00
Mitesh Kanjariya
8f4b98eedb zebra: fix mac mobility code path
Ticket: CM-16928
Review: CCR-6210
Unit-test: Manual

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-08-08 10:09:37 -04:00
Mitesh Kanjariya
b8ce75a5d3 zebra: update sticky mac attribute to BGP if necessary
Ticket: CM-16732
Review: CCR-6368
Unit-test: Manual (logs attached to ticket)

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-08-08 10:09:37 -04:00
Mitesh Kanjariya
421bb26a51 bgpd/zebra: fix bgpd crash happening in mac mobility code path
Ticket: CM-16216
Review: CCR-6210
Unit-test: Manual

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-08-08 10:09:37 -04:00
Donald Sharp
ff8b7eb870 zebra: Switch to using ETH_ALEN
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-04 09:06:14 -04:00
Donald Sharp
25331def55 zebra: Fix crash when OOM happens.
The hash key function choosen for mac vni's would tend
to clump the key value to the same number.  Use a better
hash key generator to spread the hash values out.

A bad hash key might lead to O(2^n) memory consumption
because the hash size is doubled, each time a backet
exceeds a predefined threshold.  This quickly leads
to OOM.  Fixing this issue by fixing the hash
key generation to actually spread the keys out.

Ticket: CM-17412
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-04 09:05:13 -04:00
David Lamparter
9d303b37d7 Revert "*: reindent pt. 2"
This reverts commit c14777c6bf.

clang 5 is not widely available enough for people to indent with.  This
is particularly problematic when rebasing/adjusting branches.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-22 14:52:33 +02:00
whitespace / reindent
c14777c6bf
*: reindent pt. 2
w/ clang 5

* reflow comments
* struct members go 1 per line
* binpack algo was adjusted
2017-07-17 15:26:02 -04:00
whitespace / reindent
d62a17aede *: reindent
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'`

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-17 14:04:07 +02:00
Donald Sharp
2850f0ea58 bgpd, zebra: Cleanup warnings from new code
1) Clean up VTY_NEWLINE -> \n
2) Remove usages of VTY_GET_INTEGER

Signed-off-by: Donald Sharp
2017-07-14 08:52:45 -04:00
vivek
c85c03c7f9 bgpd, zebra: Support for sticky MACs
Implement support for sticky (static) MACs. This includes the following:

- Recognize MAC is static (using NUD_NOARP flag) and inform BGP
- Construct MAC mobility extended community for sticky MACs as per
RFC 7432 section 15.2
- Inform to zebra that remote MAC is sticky, where appropriate
- Install sticky MACs into the kernel with the right flag
- Appropriate handling in route selection

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-12 14:37:14 -04:00
vivek
cec2e17d27 zebra: EVPN/VxLAN UI definitions and handling
Implement various UI (vty) commands for EVPN/VxLAN.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-12 12:29:27 -04:00
vivek
2232a77c2b zebra: MAC and Neighbor (ARP/ND) handling
Implement handling of MACs and Neighbors (ARP/ND entries) in zebra:
- MAC and Neighbor database handlers
- Read MACs and Neighbors from the kernel, when needed and create
entries in zebra's MAC and Neighbor databases.
- Handle add/update/delete notifications from the kernel for MACs and
Neighbors and update zebra's database appropriately
- Inform locally learnt MACs and Neighbors to client
- Handle MACIP add/delete from client and install appriporiate entries
into the kernel
- Since Neighbor entries will be installed on an SVI, implement the
needed mappings

NOTE: kernel interface is only implemented for Linux/netlink

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-12 12:29:25 -04:00
vivek
13d60d351c zebra: VNI and VTEP handling
Implement fundamental handling for VNIs and VTEPs:
- Handle EVPN enable/disable by client (advertise-all-vni)
- Create/update/delete VNIs based on VxLAN interface events and inform
client
- Handle VTEP add/delete from client and install into kernel
- New debug command for VxLAN/EVPN
- kernel interface (Linux/netlink only)

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-12 12:26:02 -04:00