Donald Sharp [Thu, 11 Jan 2018 16:47:04 +0000 (11:47 -0500)]
zebra: Encode the ifindex over netlink
In order for routes to be leaked the ifindex must be sent
down into the kernel over the netlink protocol. So
send it( we always figure it out ) when we add the
route.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Donald Sharp [Tue, 9 Jan 2018 19:47:11 +0000 (14:47 -0500)]
zebra: Move NS/VRF initialization earlier
Move the NS/VRF initialization code for zebra to an earlier
point in startup. In the future we will have code that
will want to install_element into a VRF_NODE from zebra_vty.c
Signed-off-by: Donald Sharp <sahrpd@cumulusnetworks.com>
Donald Sharp [Fri, 12 Jan 2018 14:20:30 +0000 (09:20 -0500)]
zebra: Add nh_vrf_id to 'struct route_entry`
With VRF route-leaking we need to know what vrf
the nexthops are in compared to this vrf. This
code adds the nh_vrf_id to the route entry and
sets it up correctly for the non-route-leaking
case.
The assumption here is that future commits
will make the nh_vrf_id *different* than
the vrf_id.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Donald Sharp [Fri, 5 Jan 2018 14:21:55 +0000 (09:21 -0500)]
lib: Allow interface lookup by VRF_UNKNOWN
Modify if_lookup_by_index to accept a VRF_UNKNOWN
as a vrf_id. This will cause it to look in all
vrf's for the interface pointer.
Subsequently all if_XXXX functions that call this function
will also get this behavior.
VRF_UNKNOWN *should* not be used for interface creation
as that this will break some core assumptions.
This work is part of allowing vrf route leaking. Currently
it is possible to create a route in the linux kernel that has
a nexthop across vrf boundaries.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Donald Sharp [Mon, 8 Jan 2018 13:57:44 +0000 (08:57 -0500)]
lib: Add notice of when we can remove some deprecated code.
The zapi_ipv4_route, zapi_ipv6_route and zapi_ipv4_route_ipv6_nexthop
functions are deprecated. Add notice of when we can remove the
deprecated code from the system.
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>
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>