Quentin Young [Fri, 12 Jan 2018 19:57:57 +0000 (14:57 -0500)]
bgpd: disallow invalid config at cli layer
Remove the ability to attempt to configure a couple of options on
directly connected neighbors that don't make sense for them, as well as
the soft error handling code.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Donald Sharp [Thu, 11 Jan 2018 00:01:57 +0000 (19:01 -0500)]
zebra: Add one-shot thread to recheck speed
There are certain interfaces that when brought up and we receive
the netlink notification about it, the speed of the interface is
not set correctly. This creates a one-shot thread that will
wait 15 seconds and then requery the speed and if it is different
it will renotify the running daemons.
The kernel should notify us on speed changes, unfortunately this
is not done currently via a netlink message as you would think.
As I understand it there is some in-fighting about the proper
way to approach this issue and due to the way the kernel release
cycle works we are a ways off from getting this fixed. This
is a `hack` to make us work correctly while we wait for the
true answer.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Don Slice [Wed, 10 Jan 2018 19:40:45 +0000 (19:40 +0000)]
bgpd: fix updating redist bitmask when vrf_id changes
Problem reported that when "systemctl restart networking" was
performed, prefixes previously redistributed into bgp from connected
were deleted from the bgp table. Determined that we were not correctly
changing the redistribution bitmask when the vrf_id of the vrf was
changed. This patch corrects that behavior.
Manual tests look good. bgp-min and vrf-min completed with no new failures.
Ticket: CM-19369 Signed-off-by: Don Slice <dslice@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Daniel Walton [Thu, 31 Aug 2017 16:58:38 +0000 (16:58 +0000)]
bgpd: 'summary' to show NoNeg if peer did not negotiate afi/safi
If we have configured neighbor 1.1.1.1 for an afi/safi but they have not
activated that afi/safi with us then display "NoNeg" in the state column
of the summary output. This is to make troubleshooting afi/safi
easier.
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Quentin Young [Wed, 10 Jan 2018 16:20:09 +0000 (11:20 -0500)]
bgpd: move startup sync lock around
Condition needs to be set inside critical section, otherwise i/o thread
can deadlock. Also unlock mutex once finished with it, no need to hold
the lock for the life of the program.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Quentin Young [Mon, 8 Jan 2018 21:40:49 +0000 (16:40 -0500)]
vtysh: optimize printout routine
When printing responses from a client, vtysh searches through every
response it receives twice. Once is to look for the terminating
sequence and the other is to translate \n to \0, which is used with the
line processing callback capability. However:
* There's no need to search all of the output for the terminator, we can
just check the last 4 bytes.
* In most scenarios we won't have a callback. Therefore we don't need to
process the output and can just dump it.
Together these optimizations have a significant impact on the total
runtime of talkative CLI commands, such as `sh ip bgp json` which runs
roughly 1000% faster when dumping 1,000,000 routes.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Daniel Walton [Mon, 8 Jan 2018 21:16:18 +0000 (21:16 +0000)]
ospfd: do not complain if same area is reconfigured
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Before
------
cel-redxp-10(config)# router ospf vrf RED
cel-redxp-10(config-router)# network 1.1.1.1/32 area 0.0.0.0
cel-redxp-10(config-router)# network 1.1.1.1/32 area 0.0.0.0
There is already same network statement.
cel-redxp-10(config-router)#
When we see the "There is already same network statement." message
vtysh exits non-zero. This scenario breaks frr-reload because
the command took and it in the config, it should exit zero here.
After
-----
cel-redxp-10(config)# router ospf vrf RED
cel-redxp-10(config-router)# network 1.1.1.1/32 area 0.0.0.0
cel-redxp-10(config-router)# network 1.1.1.1/32 area 0.0.0.0
cel-redxp-10(config-router)# network 1.1.1.1/32 area 0.0.0.0
cel-redxp-10(config-router)# network 1.1.1.1/32 area 0
cel-redxp-10(config-router)#
cel-redxp-10(config-router)# network 1.1.1.1/32 area 0.0.0.1
There is already same network statement.
cel-redxp-10(config-router)#
Donald Sharp [Sat, 6 Jan 2018 19:04:35 +0000 (14:04 -0500)]
bgpd: Ensure that io thread is running after start
The BGP IO thread must be running before other threads
can start using it. So at startup check to see
that it running once, instead of before every
function call into.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Quentin Young [Wed, 3 Jan 2018 18:58:53 +0000 (13:58 -0500)]
lib: fix a few bugs in ring buffers
* Fix rare failure caused when end pointer is at end of buffer memory
and a call to ringbuf_get() is made that reads all of the data in the
buffer; start pointer was advanced past end pointer, causing some
special handling to be skipped
* Fix ringbuf_peek() moving start pointer
* Fix use after free
* Remove extraneous assignment
* Update relevant tests
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Donald Sharp [Tue, 2 Jan 2018 14:47:38 +0000 (09:47 -0500)]
bgpd: Fix peer uptime display in milliseconds
For some reason bgp is calculating the peer uptime
in miliseconds incorrectly. Additionally we have
the peer_uptime function call that should be doing this!
But since we've choosen different names for the json output
we cannot fix it at this point.
uptime contains the number of seconds of uptime here. Just
multiply by 1k and display that( as peer_uptime does )
Fixes: #1585 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Donald Sharp [Wed, 3 Jan 2018 14:06:44 +0000 (09:06 -0500)]
pimd: Add finer grain return codes for configuration
When PIM handles some MSDP commands, a repeated command
was causing a CMD_WARNING_CONFIG_FAILED. This should
be a CMD_WARNING. Fix the code to allow vtysh to handle
this appropriately.
Ticket: CM-19053 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Donald Sharp [Tue, 2 Jan 2018 14:09:09 +0000 (09:09 -0500)]
zebra: Fix dest dereference
The rn can not have an rn->info pointer and as
such the dest may be NULL. Don't assign
the old_fib pointer if so. This is ok
because we know RNODE_FOREACH... will not
iterate if dest is NULL.
Fixes: #1575 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Chirag Shah [Thu, 28 Dec 2017 19:12:35 +0000 (11:12 -0800)]
ospf6d: Fix ospf6 redist with route-map
When ospf6 configure with redistribute connected/protocol
with route-map. Upon restart of frr.service, ospf6 receives
redistribute update then route-map update.
During redistribute route update, since route-map info is not
filled, route is suppressed from injected as external route.
Fix: reset redistribute when route-map update received
matches with redistribution (type) and route-map name.
Ticket:CM-13800
Testing Done:
Configure ospf6 redistribute with route-map to inject
Type-2 external routes into database. Trigger frr restart
redistribute with route-map happens.
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
Quentin Young [Tue, 26 Dec 2017 23:47:19 +0000 (18:47 -0500)]
lib: add ringbuf_peek()
Peek functionality for ring buffers and associated tests.
Also:
* Slight optimization to avoid 0-byte memcpy() by changing > to >=
* Add rv checks for some ringbuf_[put|get] calls that were missing them
in the test
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Don Slice [Mon, 18 Dec 2017 15:40:56 +0000 (10:40 -0500)]
bgpd: convert network statements from DEFUN to DEFPY
Problems reported with inconsistent use of parameters for bgp network
statements. Converted 12 DEFUNs to 2 DEFPY statements, making the
parameter use consistent with the exception of keeping the "backdoor"
keywork ipv4 only. Also verified that if a route-map or label-index
is specified in the "no" case it matches what had been previously
defined. Manual testing looks good and bgp-smoke will be performed
before pushing.
Ticket: CM-16860 Signed-off-by: Don Slice <dslice@cumulusnetworks.com> Reviewed-by: CCR-7056
ETH_ALEN is not equivalent to ETHER_HDR_LEN. ETHER_HDR_LEN is the
definition for the length of the full ethernet header, meanwhile
ETH_ALEN is just the length of the ethernet address.
Here is the OpenBSD/FreeBSD definition for ETHER_HDR_LEN:
#define ETHER_ADDR_LEN 6 /* Ethernet address length */
#define ETHER_TYPE_LEN 2 /* Ethernet type field length */
#define ETHER_HDR_LEN ((ETHER_ADDR_LEN * 2) + ETHER_TYPE_LEN)
(OpenBSD's definition is at net/if_ether.h, FreeBSD's is at
net/ethernet.h)
Linux definitions can be found at: net/ethernet.h
#define ETHER_ADDR_LEN ETH_ALEN /* size of ethernet addr */
#define ETHER_TYPE_LEN 2 /* bytes in type field */
#define ETHER_HDR_LEN ETH_HLEN /* total octets in header */
net/if_ether.h:
#define ETH_HLEN 14 /* Total octets in header. */
#define ETH_ALEN 6 /* Octets in one ethernet addr */
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>