Rafael Zalamena [Wed, 7 Feb 2018 18:26:25 +0000 (16:26 -0200)]
isis: use descriptor polling instead of time
Allow other supported Operating Systems (OS) to use file descriptor
polling, instead of doing timed fd checks. This should improve
performance greatly on modern OSes (e.g. that support polling on
filtered sockets).
The known OS that doesn't support this is FreeBSD < 5.0, but even then
FRR doesn't compile in these versions. OSes using DLPI method (e.g
Solaris) does not support select()/poll()ing fds as well, so it will be
disabled for it.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Olivier Dugeon [Mon, 5 Feb 2018 19:24:17 +0000 (20:24 +0100)]
OSPFd: Fix Opaque LSA filtering in Segment Routing
Opaque LSA were incorrectly filtered. LSA Type 1 with a
router id set to 4.x.x.x or 7.x.x.x. or 8.x.x.x are not correctly
filtered and pass to Segment Routing as wrong Opaque LSA of type
Router Information, Extended Prefix respectively Extended Link.
- Add Opaque LSA check to the filter
The CLI command 'segment-routing prefix' didn't check if a same prefix
already exist in SRDB resulting to multiple entries in the SRDB for the
same prefix.
- Update prefix intead of adding a new one if already present in the SRDB
Donald Sharp [Mon, 5 Feb 2018 08:44:29 +0000 (03:44 -0500)]
bgpd, lib, pimd: Make nexthop_update decoding common
Create a zapi_nexthop_update_decode function that both
pim and bgp use to decode the message from zebra.
There probably could be further optimizations but I opted
to keep the code as similiar as is possible between the
originals because they both make some assumptions about
code flow that I do not fully understand yet.
The real goal here is that I want to create a new
user of the nexthop tracking code from a higher level
daemon and I see no need to re-implement this damn
code again for a 3rd time.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Olivier Dugeon [Sat, 3 Feb 2018 18:30:33 +0000 (19:30 +0100)]
OSPFd: Fix ospfd crash during CI
When preforming CI test, CLI command 'no router ospf' followed by a
'router ospf' is performed to clean up the previous configuration.
Ospfd crash when configuring 'netwoark area'.
This is due to opsf_opaque_term() introduce in previous commit that cause this
crash. It remove not only Opaque LSA but also the list through the call to
'list_delete_and_null()' function. Same take place in 'ospf_mpls_te_term()',
'ospf_router_info_term()' and 'ospf_ext_term()' function.
New set of 'ospf_XXX_finish()' has been introduced to solve this issue while
keeping the possiblity to terminate properly the Opaque LSA and remove MPLS
LFIB entries set by Segment Routing.
Donald Sharp [Sat, 3 Feb 2018 00:26:22 +0000 (19:26 -0500)]
bgpd: Add ability to see martian next-hop's for a vrf
We've run across an issue where the local connected
ip address is not being removed in some error condition.
During trackdown it was noticed that we cannot look
at this table for views/vrf's. While we don't have the
bug tracked down yet this will help us figure it out.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Renato Westphal [Fri, 2 Feb 2018 01:18:46 +0000 (23:18 -0200)]
lib: fix more warnings on *BSD
* zebra/kernel_socket.c: include "rt.h" to provide the prototypes of
kernel_init() and kernel_terminate();
* lib/prefix.h: remove the deprecation warning whenever ETHER_ADDR_LEN
is used. isisd uses the ETHER_HDR_LEN constant which is defined in
terms of ETHER_ADDR_LEN in the *BSD system headers. So, when building
FRR on *BSD, we were getting several warnings because we were using
ETHER_ADDR_LEN indirectly;
* lib/command_lex.l, lib/defun_lex.l: ignore other harmless warnings;
* lib/spf_backoff.c: cast 'tv->tv_usec' to 'long int' before printing.
Renato Westphal [Thu, 1 Feb 2018 23:04:03 +0000 (21:04 -0200)]
tests: fix warnings related to afi/safi constants
We were improperly mixing constants used to identify AFI/SAFI values
using the IANA and internal representations. Things happened to be
working because the IANA/internal values are the same in some cases
(e.g. AFI_IP and IANA_AFI_IPV4). This commit fixes a few warnings when
running "make check" on FreeBSD 11.1.
Renato Westphal [Thu, 1 Feb 2018 22:59:08 +0000 (20:59 -0200)]
tests: fix warnings by removing dead code
These variables being removed were made obsolete by commit 9cabb64b3. As
of now, the parse_test() function fetches the afi/safi values from
the parsed NLRIs. There's no need to have duplicate information in the
'test_segment' structure anymore.
This fixes several warnings of this kind when running "make check"
on FreeBSD: "implicit conversion from enumeration type 'iana_safi_t'
to different enumeration type 'safi_t'".
Olivier Dugeon [Thu, 1 Feb 2018 13:30:34 +0000 (14:30 +0100)]
OSPFd: Correct Extended Prefix LSA refresh
- When Extended Prefix LSA need to be refresh, paramaters may be
taken from the wrong interface i.e. Extended Link instead of Prefix
resulting in producing an empty LSA body. Then, ospfd crash due to the
assert on LSA length in ospf_lsa_different() function: code check that
the LSA size is larger than LSA header i.e. LSA is not empty.
smccroskey [Thu, 1 Feb 2018 01:15:36 +0000 (17:15 -0800)]
debianpkg rules files: WANT_CUMULUS_MODE, not WANT_CUMULUS_NODE
variable name seemed strange, and previously-commented-out name
suggests it was a typo, remove the newly-added definitions and
fix the ifeq block to reference the intended name.
smccroskey [Thu, 1 Feb 2018 01:10:44 +0000 (17:10 -0800)]
debianpkg rules files: bgp-vnc is enabled by default
9782a8db773b8c5d9094eb3743aae43cc04e12f0 went with the wrong source of
truth when comments and code disagreed over whether bgp-vnc should be
enabled by default. Fix the behavior back to what it was before.
smccroskey [Wed, 31 Jan 2018 01:00:48 +0000 (17:00 -0800)]
debianpkg: normalize rules files
downstream packagers prefer to change defaults in a trackable way by
changing the rules file directly, rather than setting environment
variables. Use '?=' (set if not already set in the environment or on
the make cmdline) to set defaults rather than alternating between
ifeq/ifneq clauses, which is harder to follow and edit. Change any
existing `ifneq(...,0)' cases to `ifeq(...,1)', and get rid of any
ifdef/ifndefs, as ?= guarantees he value will be defined in one way or
another. This allows the old behavior of overriding via the
environment while simplifying the workflow for anyone editing or
extending the current logic and defaults.
Portability note about '?=': it is GNU-make specific, but so is
ifeq/ifneq, which is/was used in this file, and this file is specific
to debian-based system as it is, so I don't consider it to be a
problem in this case.
Added any missing defaults (WANT_SNMP, WANT_CUMULUS_NODE) and
made it so that USE_XXX is always set for the sake of consistency.
Also brought a few changes from base debianpkg/rules into the
backports versions of the files where they were missing.
Olivier Dugeon [Tue, 30 Jan 2018 15:17:54 +0000 (16:17 +0100)]
OSPFd: Clean up Segment Routing patch
- ospfd/ospf_te.c: Remove unregister function and call to
ospf_delete_opaque_functab() following the introduction of
ospf_opaque_term() function in ospfd.c for ospfd termination.
- ospfd/ospf_sr.c: Set initial index value for node-msd CLI to
avaoid crash when using this command
- ospfd/ospf_ext.c: Disable call to ospf_sr_update_prefix() if
Segment Routing, thus Extended Link/Prefix, is not enable
- ospfd/ospf_opaque.c: Correct scheduling of Opaque LSA flooding
Don Slice [Thu, 25 Jan 2018 16:06:27 +0000 (16:06 +0000)]
bgpd: fix output of show bgp vrf all neighbor x.x.x.x
Problem reported with output of the command "show bgp vrf all
neighbor x.x.x.x" not limiting the output to that peer in any vrf.
This fix corrects the logic to display by neighbor
(ipv4/ipv6/interface) in any vrf.
Ticket: CM-17377 Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
Donald Sharp [Mon, 29 Jan 2018 22:52:15 +0000 (17:52 -0500)]
zebra: Fix crash when dereferencing dest->selected_fib
When a rib_unlink() event is directly called for a
route_entry we need to see if the dest->selected_fib
is the same and just unset the dest->selected_fib.
This was happening for redistributed table 10 routes
into BGP.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Donald Sharp [Mon, 29 Jan 2018 21:20:41 +0000 (16:20 -0500)]
zebra: On shutdown actually delete rn's assoc w/ other_tables
Zebra stores routes coming from the kernel for non-default
tables. This information on shutdown was being leaked
because we never cleaned it up. Allow for this to happen
now.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Olivier Dugeon [Mon, 29 Jan 2018 16:58:53 +0000 (17:58 +0100)]
OSPFd: Update Segment Routing PR following review
Following various review, following files have been modfied:
- All: Change u_intXX_t typedef to standard uintXX_t types
- doc/OSPF-SR.rst: Update doc in particular the Linux Kernel configuration
section
- doc/ospfd.texi: Update CLI
- ospfd/ospf_dump.[c,h]: Add new 'debug ospf sr' when performing 'sh run'
- ospfd/ospf_ext.[c, h]: Various bug corrections notably to handle flooding of
Extended Prefix at startup. iFix TLVs size for LAN Adjacency.
Update Licence as per Community.md
- ospfd/ospf_opaque.c: Add proper termination function call to remove MPLS entries
- ospfd/ospf_ri.[c,h]: Bug corrections
- ospfd/ospf_sr.[c,h]: Various bug corrections, notably to determine the nexthop
SR Node. Add support to 'no-php-flag'.
Update Licence as per Community.md
- ospfd/ospfd.c: Add call to 'ospf_opaque_term()'
Donald Sharp [Sat, 27 Jan 2018 23:56:30 +0000 (18:56 -0500)]
zebra: Fix failure to parse src
If src happens to point at all 0's due to not initializing
it and if the address passed in is not a v6 address then
we would not set src in the AF_INET6 call and would
fail the (src.ipv4.s_addr && inet_pton(AF_INET...)
call. Thus causing us to return a NULL and make
the routemap code think there was an issue.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Chirag Shah [Thu, 25 Jan 2018 03:02:19 +0000 (19:02 -0800)]
ospf6d: Fix redist w/ route-map during restart
Add hook for route-map update event.
Add a delay one shot timer to accomodate route-map
update and reset redist with zebra to process
all redistribute routes with route-map info.
Cleanup route-map, prefix cached date during ospf6 exit.
Ticket:CM-13800
Testing Done:
configure redistribute connected with route-map to define
type-2 routes. Restart frr.service and validated
route-map add,update event, thread is scheduled,
once timer is done redist reset with zebra.
Upon redist add notification, all route map info is cached
in ospf6 and processed as type-2 route and send ASE E2 LSA.
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
Mitesh Kanjariya [Sat, 27 Jan 2018 01:16:48 +0000 (17:16 -0800)]
bgpd: support for filtering EVPN routes based on route-types.
In many situations, it is desirable to only exchange EVPN routes of a particular type.
For e.g., a common deployment scenario for large DCs
is to sub-divide the DC into multiple PODs with full host mobility within a POD
(i.e., all subnets provisioned on all leaf switches within the POD)
but only do prefix-based routing across PODs.
This can be achieved by only exchanging EVPN type-5 routes across PODs.
Implement a policy to filter EVPN routes based on route type.
Don Slice [Thu, 25 Jan 2018 17:45:40 +0000 (17:45 +0000)]
bgpd: remove poorly located bestpath json output
The bestpath multipath-relax setting was added to the output of
"show ip bgp neighbor json" several months ago but this is not
the correct place to display that information and this fix removes
it from there. The multipath-relax setting was also added
to the output of "show ip bgp sum json" which is fine.
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
Donald Sharp [Thu, 25 Jan 2018 01:53:40 +0000 (20:53 -0500)]
zebra: Fix crash in ptm code
The code change to switch from stream_getX to STREAM_GETX added
a goto statement to be handled for a failure case. The failure
case was properly handled but the normal case was not tested
properly and there exists a situation where we would free
the out_ctxt 2 times. Prevent that from happening.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
mitesh [Wed, 24 Jan 2018 23:25:03 +0000 (15:25 -0800)]
zebra: optimize l3vni lookup in certain callflows
Currently, while processing kernel messages related to VNIs
we first check if VNI is L3 - this is a hash lookup
later, we do the lookup again to find the L3-VNI.
This is non-optimal.
Made changed to make sure we only do the lookup once.
Quentin Young [Wed, 24 Jan 2018 16:07:27 +0000 (11:07 -0500)]
bgpd: update pthreads to use lib changes
Use the new threading facilities provided in lib/ to streamline the
threads used in bgpd. In particular, all of the lifecycle code has been
removed from the I/O thread and replaced with the default loop. Did not
do the same to the keepalives thread as it is much smaller (doesn't need
the event system).
Also cleaned up some comments to match the style guide.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Quentin Young [Mon, 22 Jan 2018 19:23:55 +0000 (14:23 -0500)]
lib: streamline frr_pthreads, add default loop
Some work on FRR's pthread wrapper.
* Provide a built-in way to synchronize thread startup
* Make utility functions take frr_pthread * instead of its integer ID
* Pass frr_pthread * as pthread start function argument
* Correct some comment styling
* Rename some variables to match naming conventions in the file
* Change parameter ordering in stop function prototype to follow the
convention in the other functions
* Default new frr_pthreads to using a vanilla event loop
For the last point, the original goal when designing the implementation
of pthreads into FRR was to be able to use the thread.c event based
system inside pthreads. This code essentially encapuslates all the
thread.c functionality into an easy to use pthread out of the box.
Creating a new frr_pthread with a null attributes field will cause the
created frr_pthread to run a thread.c event loop. The upshot of this is
that it is now possible to safely run existing functions in a pthread in
roughly 3 lines of code. It also serves as an example / starting point
for others.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Donald Sharp [Wed, 24 Jan 2018 13:22:57 +0000 (08:22 -0500)]
zebra: Modify southbound interface to pass `struct route_node`
The route_node that we are working on is going to be interesting
to the kernel_route_rib_pass_fail. So I am setting up the
code to allow me to pass it. This will be done in a subsuquent
commit.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>