Quentin Young [Mon, 19 Jun 2017 14:22:26 +0000 (14:22 +0000)]
lib, vtysh: hashtable statistics
Adds the ability to name hash tables, and a new cli command that will
show various summary statistics for named hash tables.
Statistics computed are
- load factor
- full load factor (see comments)
- stddev of full load factor
Standard deviation is computed by storing the sum of squares of bucket
lengths. This is somewhat susceptible to overflow. On platforms where a
double is 32 bits, placing 65535 or more elements into a hash table
opens up the potential for overflow, depending on how they are arranged
in buckets (which depends on the hash function). For example, placing
65535 elements into one hash bucket would cause ssq overflow, but
distributing 40000000 elements evenly among 400000 buckets (100 elements
per bucket) would not.
These cases are extremely degenerate, so the vague possibility of
overflow in an informational command is deemed an acceptable tradeoff
for constant time calculation of variance without locks or compromising
efficiency of actual table operations.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Quentin Young [Thu, 15 Jun 2017 19:10:57 +0000 (19:10 +0000)]
lib: make `show thread...` commands mt-aware
This patch fixes up show thread commands so that they know about
and operate on all extant thread_masters, since we can now have multiple
running in any given application.
This change also eliminates a heap use after free that appears when
using a single cpu_record shared among multiple threads. Since struct
thread's have pointers to bits of memory that are freed when the global
statistics hash table is freed, later accesses are invalid. By moving
the stats hash to be unique to each thread_master this problem is
sidestepped.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Quentin Young [Thu, 29 Jun 2017 23:05:36 +0000 (23:05 +0000)]
lib: always use 64-bit integers for json
json-c does not (yet) offer support for unsigned integer types, and
furthermore, the docs state that all integers are stored internally as
64-bit. So there's never a case in which we would want to limit,
implicitly or otherwise, the range of an integer when adding it to a
json object.
Among other things this fixes the display of ASN values greater than
(1/2) * (2^32 - 1)
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Donald Sharp [Thu, 29 Jun 2017 13:09:23 +0000 (09:09 -0400)]
bgpd, lib, zebra: Fix if_update function to represent what it does
The if_update function was taking the interface name as
input and reapplying it, using strncpy to reapply the name.
This has several issues. strncpy should not be used
to copy memory in place. The second issue is that
the interface name is not actually changing when we
update interface to be in the new vrf.
Since every usage of if_update was just reapplying the same
name the interface actually had, just remove that part of
the function and rename it to if_update_to_new_vrf
to represent what it is actually doing.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
ospfd: Bring in some OSPF useful changes that were lost during Quagga fork
Several changes were made from the original patch to resolve conflicts
and also to fix various issues that were discovered during testing. Below
is the original commit message minus a few parts that correspond to code
that was dropped during bug fixing.
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
ospfd: Extend 'ip ospf area' to take address argument + rationalise ospf enable
* ospfd.c: (general) Clean up the whole running of OSPF on interfaces.
(add_ospf_interface) taking (struct interface *) arg is pointless here.
(ospf_is_ready) new helper.
(ospf_network_run_subnet) Put all the code for choosing whether to enable
OSPF on a subnet, and if so which area configuration to use, here. If a
subnet should not be enabled, ensure an existing oi is freed.
(ospf_network_run_interface) Just call run_subnet for all subnets on an
interface.
(ospf_network_run) Just call run_interface for all interfaces.
(ospf_if_update) Just call run_interface for the given interface.
(ospf_network_unset) Just call run_subnet for existing ois.
(ospf_update_interface_area) helper: update area on an oi, or create it.
(ospf_interface_set) renamed to ospf_interface_area_set for clarity.
Ensures OSPF is created, then into if_update.
(ospf_interface_unset) renamed to ospf_interface_area_unset and collapses
down to simple loop to call run_subnet for all ois.
* ospf_interface.h: add a more general OSPF_IF_PARAM_IS_SET, which does the
right thing and takes default config into account.
* doc/ospfd.texi: add 'ip ospf area' command.
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
This patch has been part of Quagga since October 2015
Orignial Author: Paul Jakma <paul@quagga.net>
Date: Thu Aug 27 16:51:42 2009 +0100
Don Slice [Wed, 28 Jun 2017 18:53:27 +0000 (14:53 -0400)]
lib/ospf/eigrp: enable ospf and eigrp to use more specific network statements
Issue reported that a configuration commonly used on other routing implementations
fails in frr. If under ospf, "network 172.16.1.1/32 area 0" or under eigrp, "network
172.16.1.1/32" is entered, the appropriate interfaces are not included in the routing
protocol. This was because the code was calling prefix_match, which did not match if
the network statement had a longer mask than the interface being matched. This fix
takes away that restriction by creating a "lib/prefix_match_network_statement" function
which doesn't care about the mask of the interface. Manual testing shows both ospf and
eigrp now can be defined with more specific network statements.
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
Martin Winter [Wed, 28 Jun 2017 02:49:38 +0000 (19:49 -0700)]
redhat: On CentOS/RedHat 6, use python27-devel from iuscommunity.org
FRR requires now Python 2.7 development libraries, but CentOS 6
does not provide this (not in main and not in EPEL library)
This is only a build limitation.
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
Don Slice [Thu, 22 Jun 2017 16:17:24 +0000 (09:17 -0700)]
ospf6d: fix ifmtu settings when kernel changes values
Problem reported by customer that if an mtu value was set in the kernel,
quagga/frr would get very confused about what had been configured and
what had been learned. This caused peers to not be successfully established.
Resolved by keeping a configuration value separate than the operational value
and set the operational accordingly. If configured, it wins unless the config
defines a value that is higher than the kernel supports.
Ticket: CM-16876 Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed By: CCR-6399
Testing Done: Manual testing successful, submitter tested, ospf-smoke completed
with no new failures.
Donald Sharp [Thu, 22 Jun 2017 18:28:23 +0000 (14:28 -0400)]
bgpd: Refactor looping for talking to zebra
The data for each nexthop is stored off of the info
pointer, instead of handling the first one and then looping
over the remaining, just loop over them all and handle the
first one as a special case.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Donald Sharp [Thu, 22 Jun 2017 17:39:47 +0000 (13:39 -0400)]
bgpd: Make buffer sizes automatically the correct size
In the bgp code to send routes to zebra we were spending
a non trivial amount of time managing buffer sizes.
We know a priori the multipath supported by our system
so let's just use that value to appropriately size
the buffers.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>