]> git.proxmox.com Git - mirror_frr.git/log
mirror_frr.git
4 years agozebra: Fix label manager memory leak (#5680)
David Lamparter [Thu, 16 Jan 2020 09:20:57 +0000 (10:20 +0100)]
zebra: Fix label manager memory leak (#5680)

zebra: Fix label manager memory leak

4 years agoMerge pull request #5674 from qlyoung/fix-zebra-redist-disconnect-memleak
David Lamparter [Thu, 16 Jan 2020 09:18:35 +0000 (10:18 +0100)]
Merge pull request #5674 from qlyoung/fix-zebra-redist-disconnect-memleak

zebra: fix redist memleak on client disconnect

4 years agoMerge pull request #5672 from qlyoung/fix-zebra-pbr-iptable-heap-uaf
David Lamparter [Thu, 16 Jan 2020 09:14:45 +0000 (10:14 +0100)]
Merge pull request #5672 from qlyoung/fix-zebra-pbr-iptable-heap-uaf

zebra: fix iptable install heap UAF

4 years agozebra: fix assert crash on corrupt vxlan msg (#5670)
David Lamparter [Thu, 16 Jan 2020 09:13:59 +0000 (10:13 +0100)]
zebra: fix assert crash on corrupt vxlan msg (#5670)

zebra: fix assert crash on corrupt vxlan msg

4 years agozebra: Do not accept illegal safi's for route installation (#5679)
David Lamparter [Thu, 16 Jan 2020 09:12:44 +0000 (10:12 +0100)]
zebra: Do not accept illegal safi's for route installation (#5679)

zebra: Do not accept illegal safi's for route installation

4 years agoMerge pull request #5664 from mitch-skiba/addpath-adj-out
Donatas Abraitis [Thu, 16 Jan 2020 04:52:21 +0000 (06:52 +0200)]
Merge pull request #5664 from mitch-skiba/addpath-adj-out

bgpd: add addpath ID to adj_out tree sort

4 years agoMerge pull request #5600 from sworleys/NHG-Depend-Crash
Mark Stapp [Wed, 15 Jan 2020 21:31:55 +0000 (16:31 -0500)]
Merge pull request #5600 from sworleys/NHG-Depend-Crash

zebra: can't improve efficiency for recursive depends

4 years agoMerge pull request #5616 from sworleys/NHG-Fix-Recurse-to-Group
Mark Stapp [Wed, 15 Jan 2020 21:26:06 +0000 (16:26 -0500)]
Merge pull request #5616 from sworleys/NHG-Fix-Recurse-to-Group

zebra: just set nexthop member in handle_recursive_depend()

4 years agozebra: fix assert crash on corrupt vxlan msg
Quentin Young [Mon, 13 Jan 2020 21:22:27 +0000 (16:22 -0500)]
zebra: fix assert crash on corrupt vxlan msg

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
4 years agozebra: fix iptable install heap UAF
Quentin Young [Tue, 14 Jan 2020 06:18:44 +0000 (01:18 -0500)]
zebra: fix iptable install heap UAF

My previous patch to fix a memory leak, caused by not properly freeing
the iptable iface list on stream parse failure, created/exposed a heap
use after free because we were not doing a deep copy

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
4 years agozebra: fix redist memleak on client disconnect
Quentin Young [Tue, 14 Jan 2020 06:15:04 +0000 (01:15 -0500)]
zebra: fix redist memleak on client disconnect

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
4 years agoMerge pull request #5666 from donaldsharp/more_nhg_fixes
Donatas Abraitis [Wed, 15 Jan 2020 18:38:54 +0000 (20:38 +0200)]
Merge pull request #5666 from donaldsharp/more_nhg_fixes

bgpd, ospfd, zebra: Do not use 0 as VRF_DEFAULT

4 years agolib: assert if someone adds to nexthop list to nhg
Stephen Worley [Mon, 13 Jan 2020 19:28:29 +0000 (14:28 -0500)]
lib: assert if someone adds to nexthop list to nhg

If someone tries to add a nexthop with a list of nexthops
already attached to it, let's just assert. This standardizes
the API to say we assume this is an individual nexthop
you are appending to a group.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
4 years agozebra: just set nexthop member in handle_recursive_depend()
Stephen Worley [Fri, 3 Jan 2020 17:35:15 +0000 (12:35 -0500)]
zebra: just set nexthop member in handle_recursive_depend()

With recent changes to the lib nexthop_group
APIs (e1f3a8eb193267da195088cc515b598ae5a92a12), we are making
new assumptions that this should be adding a single nexthop
to a group, not a list of nexthops.

This broke the case of a recursive nexthop resolving to a group:

```
D>  2.2.2.1/32 [150/0] via 1.1.1.1 (recursive), 00:00:09
  *                      via 1.1.1.1, dummy1 onlink, 00:00:09
                       via 1.1.1.2 (recursive), 00:00:09
  *                      via 1.1.1.2, dummy2 onlink, 00:00:09
D>  3.3.3.1/32 [150/0] via 2.2.2.1 (recursive), 00:00:04
  *                      via 1.1.1.1, dummy1 onlink, 00:00:04
K * 10.0.0.0/8 [0/1] via 172.27.227.148, tun0, 00:00:21
```

This group can instead just directly point to the nh that was passed.
Its only being used for a lookup (the memory gets copied and used
elsewhere if the nexthop is not found).

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
4 years agolib,zebra: tighten up the nexthop_copy/nexthop_dup APIs
Stephen Worley [Mon, 13 Jan 2020 18:29:58 +0000 (13:29 -0500)]
lib,zebra: tighten up the nexthop_copy/nexthop_dup APIs

Make the nexthop_copy/nexthop_dup APIs more consistent by
adding a secondary, non-recursive, version of them. Before,
it was inconsistent whether the APIs were expected to copy
recursive info or not. Make it clear now that the default is
recursive info is copied unless the _no_recurse() version is
called. These APIs are not heavily used so it is fine to
change them for now.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
4 years agozebra: can't improve efficiency for recursive depends
Stephen Worley [Tue, 31 Dec 2019 17:10:58 +0000 (12:10 -0500)]
zebra: can't improve efficiency for recursive depends

cb86eba3ab3d82f540bdb9ed5f65d361ca301ea8 was causing zebra to crash
when handling a nexthop group that had a nexthop which was recursively resolved.

Steps to recreate:

!
nexthop-group red
 nexthop 1.1.1.1
 nexthop 1.1.1.2
!

sharp install routes 8.8.8.1 nexthop-group red 1

=========================================
==11898== Invalid write of size 8
==11898==    at 0x48E53B4: _nexthop_add_sorted (nexthop_group.c:254)
==11898==    by 0x48E5336: nexthop_group_add_sorted (nexthop_group.c:296)
==11898==    by 0x453593: handle_recursive_depend (zebra_nhg.c:481)
==11898==    by 0x451CA8: zebra_nhg_find (zebra_nhg.c:572)
==11898==    by 0x4530FB: zebra_nhg_find_nexthop (zebra_nhg.c:597)
==11898==    by 0x4536B4: depends_find (zebra_nhg.c:1065)
==11898==    by 0x453526: depends_find_add (zebra_nhg.c:1087)
==11898==    by 0x451C4D: zebra_nhg_find (zebra_nhg.c:567)
==11898==    by 0x4519DE: zebra_nhg_rib_find (zebra_nhg.c:1126)
==11898==    by 0x452268: nexthop_active_update (zebra_nhg.c:1729)
==11898==    by 0x461517: rib_process (zebra_rib.c:1049)
==11898==    by 0x4610C8: process_subq_route (zebra_rib.c:1967)
==11898==  Address 0x0 is not stack'd, malloc'd or (recently) free'd

Zebra crashes because we weren't handling the case of the depend nexthop
being recursive.

For this case, we cannot make the function more efficient. A nexthop
could resolve to a group of any size, thus we need allocs/frees.

To solve this and retain the goal of the original patch, we separate out the
two cases so it will still be more efficient if the nexthop is not recursive.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
4 years agobgpd: add addpath ID to adj_out tree sort
Mitchell Skiba [Thu, 9 Jan 2020 19:46:13 +0000 (11:46 -0800)]
bgpd: add addpath ID to adj_out tree sort

When withdrawing addpaths, adj_lookup was called to find the path that
needed to be withdrawn. It would lookup in the RB tree based on subgroup
pointer alone, often find the path with the wrong addpath ID, and return
null.  Only the path highest in the tree sent to the subgroup could be
found, thus withdrawn.

Adding the addpath ID to the sort criteria for the RB tree allows us to
simplify the logic for adj_lookup, and address this problem. We are able
to remove the logic around non-addpath subgroups because the addpath ID
is consistently 0 for non-addpath adj_outs, so special logic to skip
matching the addpath ID isn't required.  (As a side note, addpath will
also never use ID 0, so there won't be any ambiguity when looking at the
structure content.)

Signed-off-by: Mitchell Skiba <mskiba@amazon.com>
4 years agoMerge pull request #5681 from opensourcerouting/manpage-rename
Donald Sharp [Wed, 15 Jan 2020 16:24:26 +0000 (11:24 -0500)]
Merge pull request #5681 from opensourcerouting/manpage-rename

doc: manpage rename

4 years agobgpd, ospfd, zebra: Do not use 0 as VRF_DEFAULT
Donald Sharp [Thu, 9 Jan 2020 21:57:35 +0000 (16:57 -0500)]
bgpd, ospfd, zebra: Do not use 0 as VRF_DEFAULT

Explicitly spell out what we are trying to do.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years agozebra: Do not accept illegal safi's for route installation
Donald Sharp [Wed, 15 Jan 2020 02:03:11 +0000 (21:03 -0500)]
zebra: Do not accept illegal safi's for route installation

The only two safi's that are usable for zebra for installation
of routes into the rib are SAFI_UNICAST and SAFI_MULTICAST.
The acceptance of other safi's is causing a memory leak:

Direct leak of 56 byte(s) in 1 object(s) allocated from:
    #0 0x5332f2 in calloc (/usr/lib/frr/zebra+0x5332f2)
    #1 0x7f594adc29db in qcalloc /opt/build/frr/lib/memory.c:110:27
    #2 0x686849 in zebra_vrf_get_table_with_table_id /opt/build/frr/zebra/zebra_vrf.c:390:11
    #3 0x65a245 in rib_add_multipath /opt/build/frr/zebra/zebra_rib.c:2591:10
    #4 0x7211bc in zread_route_add /opt/build/frr/zebra/zapi_msg.c:1616:8
    #5 0x73063c in zserv_handle_commands /opt/build/frr/zebra/zapi_msg.c:2682:2
Collapse

Sequence of events:

Upon vrf creation there is a zvrf->table[afi][safi] data structure
that tables are auto created for.  These tables only create SAFI_UNICAST
and SAFI_MULTICAST tables.  Since these are the only safi types that
are zebra can actually work on.  zvrf data structures also have a
zvrf->otable data structure that tracks in a RB tree other tables
that are created ( say you have routes stuck in any random table
in the 32bit route table space in linux ).  This data structure is
only used if the lookup in zvrf->table[afi][safi] fails.

After creation if we pass a route down from an upper level protocol
that has non unicast or multicast safi *but* has the actual
tableid of the vrf we are in, the initial lookup will always
return NULL leaving us to look in the otable.  This will create
a data structure to track this data.

If after this event you pass in a second route with the same
afi/safi/table_id, the otable will be created and attempted
to be stored, but the RB_TREE_UNIQ data structure when it sees
this will return the original otable returned and the lookup function
zebra_vrf_get_table_with_table_id will just drop the second otable.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years agozebra: Fix label manager memory leak
Donald Sharp [Wed, 15 Jan 2020 03:38:49 +0000 (22:38 -0500)]
zebra: Fix label manager memory leak

==25402==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0x533302 in calloc (/usr/lib/frr/zebra+0x533302)
    #1 0x7fee84cdc80b in qcalloc /home/qlyoung/frr/lib/memory.c:110:27
    #2 0x5a3032 in create_label_chunk /home/qlyoung/frr/zebra/label_manager.c:188:3
    #3 0x5a3c2b in assign_label_chunk /home/qlyoung/frr/zebra/label_manager.c:354:8
    #4 0x5a2a38 in label_manager_get_chunk /home/qlyoung/frr/zebra/label_manager.c:424:9
    #5 0x5a1412 in hook_call_lm_get_chunk /home/qlyoung/frr/zebra/label_manager.c:60:1
    #6 0x5a1412 in lm_get_chunk_call /home/qlyoung/frr/zebra/label_manager.c:81:2
    #7 0x72a234 in zread_get_label_chunk /home/qlyoung/frr/zebra/zapi_msg.c:2026:2
    #8 0x72a234 in zread_label_manager_request /home/qlyoung/frr/zebra/zapi_msg.c:2073:4
    #9 0x73150c in zserv_handle_commands /home/qlyoung/frr/zebra/zapi_msg.c:2688:2

When creating label chunk that has a specified base, we eventually are
calling assign_specific_label_chunk. This function finds the appropriate
list node and deletes it from the lbl_mgr.lc_list but since
the function uses list_delete_node() the deletion function that is
specified for lbl_mgr.lc_list is not called thus dropping the memory.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years agoospfclient: don't install man page
David Lamparter [Wed, 15 Jan 2020 11:22:26 +0000 (12:22 +0100)]
ospfclient: don't install man page

... we're not installing ospfclient (it's a demo/example program), so
installing the man page is quite useless.

Signed-off-by: David Lamparter <equinox@diac24.net>
4 years agodoc: rename man pages to frr-*
David Lamparter [Tue, 14 Jan 2020 23:00:32 +0000 (00:00 +0100)]
doc: rename man pages to frr-*

The vrrpd one conflicts with the standalone vrrpd package; also we're
installing daemons to /usr/lib/frr on some systems so they're not on
PATH.

Signed-off-by: David Lamparter <equinox@diac24.net>
4 years agoMerge pull request #5677 from qlyoung/fix-my-bfd-screwups
David Lamparter [Wed, 15 Jan 2020 13:04:44 +0000 (14:04 +0100)]
Merge pull request #5677 from qlyoung/fix-my-bfd-screwups

zebra: bfd message handling cleanup foo

4 years agoMerge pull request #5590 from qlyoung/fix-nhrp-underflow
Jafar Al-Gharaibeh [Wed, 15 Jan 2020 04:57:15 +0000 (22:57 -0600)]
Merge pull request #5590 from qlyoung/fix-nhrp-underflow

nhrpd: offset value not checked for min size

4 years agonhrpd: offset value not checked for min size
Quentin Young [Thu, 26 Dec 2019 11:58:02 +0000 (06:58 -0500)]
nhrpd: offset value not checked for min size

If the extension offset points to a location within the packet header,
we end up with an integer underflow leading to heap buffer read
overflow.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
4 years agoMerge pull request #5657 from mjstapp/staticd_add_debugs
Quentin Young [Tue, 14 Jan 2020 22:43:48 +0000 (17:43 -0500)]
Merge pull request #5657 from mjstapp/staticd_add_debugs

staticd: add debug support

4 years agozebra: bfd message handling cleanup foo
Quentin Young [Tue, 14 Jan 2020 18:55:55 +0000 (13:55 -0500)]
zebra: bfd message handling cleanup foo

Previous patches introduced various issues:
- Removal of stream_free() to fix double free caused memleak
- Patch for memleak was incomplete

This should fix it hopefully.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
4 years agoMerge pull request #5627 from chiragshah6/mdev
Renato Westphal [Tue, 14 Jan 2020 16:32:35 +0000 (13:32 -0300)]
Merge pull request #5627 from chiragshah6/mdev

*:  modify two evpn debugs

4 years ago*: Modify version number of build
Donald Sharp [Tue, 14 Jan 2020 13:21:57 +0000 (08:21 -0500)]
*: Modify version number of build

With the pull of the 7.3 stabilization branch, update the
version number we will auto generate.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years agoMerge pull request #5663 from donaldsharp/nhg_topotests_fixes
Mark Stapp [Fri, 10 Jan 2020 23:19:23 +0000 (18:19 -0500)]
Merge pull request #5663 from donaldsharp/nhg_topotests_fixes

Nhg topotests fixes

4 years agoMerge pull request #5662 from qlyoung/fix-ptm-bfd-deregister-memleak
Mark Stapp [Fri, 10 Jan 2020 21:59:20 +0000 (16:59 -0500)]
Merge pull request #5662 from qlyoung/fix-ptm-bfd-deregister-memleak

zebra: fix bfd deregister message memleak

4 years agozebra: Actually add the NLA_F_NESTED flag to our code
Donald Sharp [Fri, 10 Jan 2020 20:13:36 +0000 (15:13 -0500)]
zebra: Actually add the NLA_F_NESTED flag to our code

The existing usage of the rta_nest and addattr_nest
functions were not adding the NLA_F_NESTED flag
to the type.  As such the new nexthop functionality was
actually looking for this flag, while apparently older
code did not.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years agobgpd: debug convert to snprintf
Chirag Shah [Tue, 7 Jan 2020 04:45:53 +0000 (20:45 -0800)]
bgpd: debug convert to snprintf

Change sprintf to snprintf

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
4 years agozebra: fix debug in macvlan down event
Chirag Shah [Fri, 3 Jan 2020 23:34:44 +0000 (15:34 -0800)]
zebra: fix debug in macvlan down event

fix a debug where display parent interface name
only if it exists.

Ticket:CM-27733

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
4 years agobgpd: add rmac field in route_add debug
Chirag Shah [Sat, 19 Oct 2019 18:28:15 +0000 (11:28 -0700)]
bgpd: add rmac field in route_add debug

For evpn routes, nexthop and RMAC fileds are synced
in route add to zebra.

In case of EVPN routes display RMAC field in route add
debug log.

Reviewed By:CCR-9381
Testing Done:

BGP:   nhop [1]: 27.0.0.11 if 30 VRF 26   RMAC 00:02:00:00:00:2e

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
4 years agoMerge pull request #5661 from ton31337/fix/doc_for_redhat
Quentin Young [Fri, 10 Jan 2020 18:44:21 +0000 (13:44 -0500)]
Merge pull request #5661 from ton31337/fix/doc_for_redhat

doc: Replace wrong paths for centos/fedora source build instructions

4 years agotests: ospf6-topo1 did not work properly with nhg's and 5.3 kernels
Donald Sharp [Fri, 10 Jan 2020 13:57:18 +0000 (08:57 -0500)]
tests: ospf6-topo1 did not work properly with nhg's and 5.3 kernels

Fix the ospf6-topo1 test to understand nhg's and what happens
when they are installed into a kernel that can support them.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years agoMerge pull request #5609 from kooky/fix_log
Quentin Young [Fri, 10 Jan 2020 01:55:05 +0000 (20:55 -0500)]
Merge pull request #5609 from kooky/fix_log

Fix logrotate in debian for bfdd, pbrd and vrrpd.

4 years agodebian: Fix logrotate in debian for bfdd, pbrd and vrrpd.
Tim Bray [Thu, 2 Jan 2020 20:00:07 +0000 (20:00 +0000)]
debian: Fix logrotate in debian for bfdd, pbrd and vrrpd.

Signed-off-by: Tim Bray <tim@kooky.org>
4 years agozebra: fix bfd deregister message memleak
Quentin Young [Thu, 9 Jan 2020 23:50:18 +0000 (18:50 -0500)]
zebra: fix bfd deregister message memleak

Removing double frees accidentally introduced a memleak

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
4 years agodoc: Replace wrong paths for centos/fedora source build instructions
Donatas Abraitis [Thu, 9 Jan 2020 22:11:09 +0000 (00:11 +0200)]
doc: Replace wrong paths for centos/fedora source build instructions

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
4 years agoMerge pull request #5410 from ton31337/feature/bgp_default-route_with_route-map_set
Donald Sharp [Thu, 9 Jan 2020 13:39:32 +0000 (08:39 -0500)]
Merge pull request #5410 from ton31337/feature/bgp_default-route_with_route-map_set

bgpd: An ability to set attributes for default-originate via route-map

4 years agostaticd: add debug support
Mark Stapp [Wed, 8 Jan 2020 19:13:42 +0000 (14:13 -0500)]
staticd: add debug support

Add initial debug support to staticd, using the lib/debug
form of debug support.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
4 years agoMerge pull request #5560 from sworleys/Pim-Vrf-Hang-3
Mark Stapp [Wed, 8 Jan 2020 20:14:40 +0000 (15:14 -0500)]
Merge pull request #5560 from sworleys/Pim-Vrf-Hang-3

lib,zebra: add zapi msg top level error handling

4 years agoMerge pull request #5418 from qlyoung/fix-bgp-prefix-sid-missing-boundscheck
Donatas Abraitis [Wed, 8 Jan 2020 19:59:07 +0000 (21:59 +0200)]
Merge pull request #5418 from qlyoung/fix-bgp-prefix-sid-missing-boundscheck

bgpd: fix missing bounds checks for psid attr

4 years agopimd: lookup nh using vrf_id we checked before
Stephen Worley [Mon, 16 Dec 2019 22:40:41 +0000 (17:40 -0500)]
pimd: lookup nh using vrf_id we checked before

Update zclient_lookup_nexthop_once() to create the zapi
header using the vrf_id on the pim->vrf struct.

This is the one we do a check on a couple lines before, so
we should be using it when we actually create the header as
well.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
4 years agopimd: allow pimd to handle nexthop_lookup zapi error
Stephen Worley [Fri, 13 Dec 2019 01:14:51 +0000 (20:14 -0500)]
pimd: allow pimd to handle nexthop_lookup zapi error

Allow pimd to stop the lookup if zebra tells pimd that the
lookup failed due to a zapi error. Otherwise, it will keep
waiting for a nexthop message that will never come.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
4 years agolib,zebra: add zapi msg top level error handling
Stephen Worley [Tue, 17 Dec 2019 22:00:52 +0000 (17:00 -0500)]
lib,zebra: add zapi msg top level error handling

Add error handling for top level failures (not able to
execute command, unable to find vrf for command, etc.)

With this error handling we add a new zapi message type
of ZEBRA_ERROR used when we are unable to properly handle
a zapi command and pass it down into the lower level code.

In the event of this, we reply with a message of type
enum zebra_error_types containing the error type.

The sent packet will look like so:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             Length            |     Marker    |    Version    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                             VRF ID                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            Command            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            ERROR TYPE         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Also add appropriate hooks for clients to subscribe to for
handling these types of errors.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
4 years agoMerge pull request #5551 from mjstapp/fix_zebra_show_nhg
Donald Sharp [Wed, 8 Jan 2020 16:54:01 +0000 (11:54 -0500)]
Merge pull request #5551 from mjstapp/fix_zebra_show_nhg

zebra: make current show nexthop-group cli zebra-specific

4 years agozebra: make current show nexthop-group cli zebra-specific
Mark Stapp [Tue, 17 Dec 2019 16:31:17 +0000 (11:31 -0500)]
zebra: make current show nexthop-group cli zebra-specific

There's confusion between the nexthop-group configuration and a
zebra-specific show command. For now, make the zebra show
command string RIB-specific until we're able to unify these
paths.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
4 years agoMerge pull request #5260 from donaldsharp/evpn_mac_daddy
Donatas Abraitis [Wed, 8 Jan 2020 06:59:51 +0000 (08:59 +0200)]
Merge pull request #5260 from donaldsharp/evpn_mac_daddy

bgpd: Prevent usage after free in bgp_mac.c

4 years agoMerge pull request #5314 from qlyoung/yang-vrrp
Renato Westphal [Wed, 8 Jan 2020 00:36:46 +0000 (21:36 -0300)]
Merge pull request #5314 from qlyoung/yang-vrrp

VRRP northbound conversion

4 years agoMerge pull request #5650 from qlyoung/fix-cast-malloc
Mark Stapp [Tue, 7 Jan 2020 21:46:29 +0000 (16:46 -0500)]
Merge pull request #5650 from qlyoung/fix-cast-malloc

zebra: remove cast from l3vni XMALLOC

4 years agoMerge pull request #5624 from qlyoung/fix-zebra-ptm-buffer-overrun
Rafael Zalamena [Tue, 7 Jan 2020 20:02:07 +0000 (17:02 -0300)]
Merge pull request #5624 from qlyoung/fix-zebra-ptm-buffer-overrun

Fix PTM ZAPI stream parsing

4 years agoMerge pull request #5646 from Spantik/bgp_unalign
Donald Sharp [Tue, 7 Jan 2020 19:35:59 +0000 (14:35 -0500)]
Merge pull request #5646 from Spantik/bgp_unalign

bgpd: fix unaligned access to addpath id

4 years agozebra: remove cast from l3vni XMALLOC
Quentin Young [Tue, 7 Jan 2020 18:54:04 +0000 (13:54 -0500)]
zebra: remove cast from l3vni XMALLOC

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
4 years agoMerge pull request #5617 from donaldsharp/zebra_bites
Mark Stapp [Tue, 7 Jan 2020 18:41:03 +0000 (13:41 -0500)]
Merge pull request #5617 from donaldsharp/zebra_bites

zebra: misc zebra cleanups

4 years agoMerge pull request #5639 from qlyoung/fix-zebra-ptm-double-free
Mark Stapp [Tue, 7 Jan 2020 16:20:22 +0000 (11:20 -0500)]
Merge pull request #5639 from qlyoung/fix-zebra-ptm-double-free

zebra: fix ptm heap double free

4 years agoMerge pull request #5628 from donaldsharp/rtm_getneigh
Russ White [Tue, 7 Jan 2020 15:47:50 +0000 (10:47 -0500)]
Merge pull request #5628 from donaldsharp/rtm_getneigh

zebra: Ignore RTM_GETNEIGH messages from the linux kernel

4 years agobgpd: fix unaligned access to addpath id
Santosh P K [Tue, 7 Jan 2020 15:47:13 +0000 (07:47 -0800)]
bgpd: fix unaligned access to addpath id

uint8_t * cannot be cast to uint32_t * unless the
pointed-to address is aligned according to uint32_t's
alignment rules. And it usually is not.

Signed-off-by: Santosh P K <sapk@vmware.com>
4 years agoMerge pull request #5634 from chiragshah6/evpn_dev2
Russ White [Tue, 7 Jan 2020 15:45:30 +0000 (10:45 -0500)]
Merge pull request #5634 from chiragshah6/evpn_dev2

bgpd: fix advertise pip running config

4 years agoMerge pull request #5644 from donaldsharp/more_pim_doc
Russ White [Tue, 7 Jan 2020 15:34:01 +0000 (10:34 -0500)]
Merge pull request #5644 from donaldsharp/more_pim_doc

doc: Clarify what is supported directly in PIM documentation

4 years agodoc: Clarify what is supported directly in PIM documentation
Donald Sharp [Tue, 7 Jan 2020 14:03:08 +0000 (09:03 -0500)]
doc: Clarify what is supported directly in PIM documentation

The FRR community keeps getting asked about what is supported or not.
Try to clarify in an additional spot what is and what is not supported.
Where people interested in using PIM might have a chance at actually
seeing the notification.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years agoMerge pull request #5638 from qlyoung/fix-bgp-cluster-list-null-memcmp
Donatas Abraitis [Tue, 7 Jan 2020 08:54:31 +0000 (10:54 +0200)]
Merge pull request #5638 from qlyoung/fix-bgp-cluster-list-null-memcmp

bgpd: avoid memcmp(NULL, NULL)

4 years agoMerge pull request #5635 from donaldsharp/debian_build
Donatas Abraitis [Tue, 7 Jan 2020 08:47:41 +0000 (10:47 +0200)]
Merge pull request #5635 from donaldsharp/debian_build

debian: Fix spelling error

4 years agoMerge pull request #5636 from qlyoung/fix-bgp-unaligned-addpath-id-pointer
Donatas Abraitis [Tue, 7 Jan 2020 08:47:16 +0000 (10:47 +0200)]
Merge pull request #5636 from qlyoung/fix-bgp-unaligned-addpath-id-pointer

bgpd: fix unaligned access to addpath id

4 years agobgpd: An ability to set attributes for default-originate via route-map
Donatas Abraitis [Wed, 27 Nov 2019 20:50:33 +0000 (22:50 +0200)]
bgpd: An ability to set attributes for default-originate via route-map

With this change, we are able to set attributes via route-map to the default
route. It's useful in cases where we have two or more spines and we want to
prefer one router over others for leaves. This simplifies configuration instead
of using 'network 0.0.0.0/0' or 'ip route 0.0.0.0/0 ...' and 'redistribute
static' combination.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
4 years agotests: Add a test for 'neighbor <neighbor> default-originate route-map <rm>'
Donatas Abraitis [Wed, 27 Nov 2019 20:50:21 +0000 (22:50 +0200)]
tests: Add a test for 'neighbor <neighbor> default-originate route-map <rm>'

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
4 years agobgpd: avoid memcmp(NULL, NULL)
Quentin Young [Tue, 7 Jan 2020 05:51:35 +0000 (00:51 -0500)]
bgpd: avoid memcmp(NULL, NULL)

Undefined behavior

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
4 years agoMerge pull request #5623 from qlyoung/fix-zebra-rtadv-interval-overflow
Renato Westphal [Tue, 7 Jan 2020 02:51:44 +0000 (23:51 -0300)]
Merge pull request #5623 from qlyoung/fix-zebra-rtadv-interval-overflow

zebra: disallow negative rtadv intvl, fix overflow

4 years agoMerge pull request #5625 from qlyoung/fix-zapi-ipset-name-nullterm
Renato Westphal [Tue, 7 Jan 2020 02:47:41 +0000 (23:47 -0300)]
Merge pull request #5625 from qlyoung/fix-zapi-ipset-name-nullterm

zebra: ensure ipset name is null terminated

4 years agoMerge pull request #5614 from qlyoung/fix-zebra-zapi-crashes
Renato Westphal [Tue, 7 Jan 2020 02:45:49 +0000 (23:45 -0300)]
Merge pull request #5614 from qlyoung/fix-zebra-zapi-crashes

Fix zebra zapi crashes

4 years agoMerge pull request #5580 from mjstapp/zebra_nhg_debug_category
Renato Westphal [Tue, 7 Jan 2020 02:44:23 +0000 (23:44 -0300)]
Merge pull request #5580 from mjstapp/zebra_nhg_debug_category

zebra: add a debug category for nexthops

4 years agoMerge pull request #5550 from manuhalo/fix_isis_def_level
Renato Westphal [Tue, 7 Jan 2020 02:43:07 +0000 (23:43 -0300)]
Merge pull request #5550 from manuhalo/fix_isis_def_level

isisd, yang: set default is-type to level-1-2

4 years agodebian: Fix spelling error
Donald Sharp [Tue, 7 Jan 2020 01:36:13 +0000 (20:36 -0500)]
debian: Fix spelling error

Spelling error pointed out by debian build.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years agoMerge pull request #5546 from mjstapp/fix_notify_nht
Donald Sharp [Tue, 7 Jan 2020 01:34:24 +0000 (20:34 -0500)]
Merge pull request #5546 from mjstapp/fix_notify_nht

zebra: route changes via notify path should trigger nht

4 years agoMerge pull request #5553 from slankdev/slankdev-fix-kernel-route-deletion-on-vrf
Donald Sharp [Tue, 7 Jan 2020 01:32:16 +0000 (20:32 -0500)]
Merge pull request #5553 from slankdev/slankdev-fix-kernel-route-deletion-on-vrf

zebra: fix kernel-route's deletion on vrf

4 years agozebra: Handle crash when backpointer does not exist
Donald Sharp [Fri, 3 Jan 2020 19:35:10 +0000 (14:35 -0500)]
zebra: Handle crash when backpointer does not exist

=================================================================
==3058==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000010 (pc 0x7f5bf3ef7477 bp 0x7ffdfaa20d40 sp 0x7ffdfaa204c8 T0)
==3058==The signal is caused by a READ memory access.
==3058==Hint: address points to the zero page.
    #0 0x7f5bf3ef7476 in memcpy /build/glibc-OTsEL5/glibc-2.27/string/../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:134
    #1 0x4d158a in __asan_memcpy (/usr/lib/frr/zebra+0x4d158a)
    #2 0x7f5bf58da8ad in stream_put /home/qlyoung/frr/lib/stream.c:605:3
    #3 0x67d428 in zsend_ipset_entry_notify_owner /home/qlyoung/frr/zebra/zapi_msg.c:851:2
    #4 0x5c70b3 in zebra_pbr_add_ipset_entry /home/qlyoung/frr/zebra/zebra_pbr.c
    #5 0x68e1bb in zread_ipset_entry /home/qlyoung/frr/zebra/zapi_msg.c:2465:4
    #6 0x68f958 in zserv_handle_commands /home/qlyoung/frr/zebra/zapi_msg.c:2611:3
    #7 0x55666d in main /home/qlyoung/frr/zebra/main.c:309:2
    #8 0x7f5bf3e5db96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
    #9 0x4311d9 in _start (/usr/lib/frr/zebra+0x4311d9)

the ipset->backpointer was NULL as that the hash lookup failed to find
anything.  Prevent this crash from happening.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years agozebra: Refactor _add and _del to use a common function
Donald Sharp [Fri, 3 Jan 2020 18:30:37 +0000 (13:30 -0500)]
zebra: Refactor _add and _del to use a common function

The decoding of _add and _del functions is practically identical
do a bit of work and make them so.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years agozebra: Prevent zebra vxlan remote macip del buffer overflow
Donald Sharp [Fri, 3 Jan 2020 17:55:09 +0000 (12:55 -0500)]
zebra: Prevent zebra vxlan remote macip del buffer overflow

=================================================================
==13611==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffe9e5c8694 at pc 0x0000004d18ac bp 0x7ffe9e5c8330 sp 0x7ffe9e5c7ae0
WRITE of size 17 at 0x7ffe9e5c8694 thread T0
    #0 0x4d18ab in __asan_memcpy (/usr/lib/frr/zebra+0x4d18ab)
    #1 0x7f16f04bd97f in stream_get2 /home/qlyoung/frr/lib/stream.c:277:2
    #2 0x6410ec in zebra_vxlan_remote_macip_del /home/qlyoung/frr/zebra/zebra_vxlan.c:7718:4
    #3 0x68fa98 in zserv_handle_commands /home/qlyoung/frr/zebra/zapi_msg.c:2611:3
    #4 0x556add in main /home/qlyoung/frr/zebra/main.c:309:2
    #5 0x7f16eea3bb96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
    #6 0x431249 in _start (/usr/lib/frr/zebra+0x431249)

This decode is the result of a buffer overflow because we are
not checking ipa_len.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years agobgpd: fix unaligned access to addpath id
Quentin Young [Tue, 7 Jan 2020 01:09:23 +0000 (20:09 -0500)]
bgpd: fix unaligned access to addpath id

uint8_t * cannot be cast to uint32_t * unless the pointed-to address is
aligned according to uint32_t's alignment rules. And it usually is not.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
4 years agobgpd: fix advertise pip running config
Chirag Shah [Mon, 6 Jan 2020 22:48:57 +0000 (14:48 -0800)]
bgpd: fix advertise pip running config

advertise pip running configuration should
display ip followed by mac parameters value as defined
in cli signature.

advertise-pip is enabled by default, when displaying the
running configuration, there is '\n' added after
ip and mac parameters which was not guarded around
the non-default parameters.

Currently, for every bgp vrf instance it ends up
displaying l2vpn address-family section due to
unguarded newline.

running config:
router bgp 6004 vrf vrf1
 !
 address-family l2vpn evpn
 exit-address-family
!

Ticket:CM-26964
Testing Done:

With fix when only 'router bgp 6004 vrf vrf1' configured,
running config looks like:

!
router bgp 6004 vrf vrf1
!

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
4 years agozebra: fix ptm heap double free
Quentin Young [Tue, 7 Jan 2020 00:48:08 +0000 (19:48 -0500)]
zebra: fix ptm heap double free

Don't need to free these, they're freed by the caller.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
4 years agoMerge pull request #5621 from qlyoung/fix-zclient-excess-nexthop-decode
Mark Stapp [Mon, 6 Jan 2020 21:00:35 +0000 (16:00 -0500)]
Merge pull request #5621 from qlyoung/fix-zclient-excess-nexthop-decode

lib: dont decode more nexthops than we can handle

4 years agoMerge pull request #5626 from qlyoung/fix-zapi-pbr-foo
Mark Stapp [Mon, 6 Jan 2020 19:59:07 +0000 (14:59 -0500)]
Merge pull request #5626 from qlyoung/fix-zapi-pbr-foo

zebra: Fix zapi pbr foo, pseudowire ifname termination

4 years agoMerge pull request #5622 from qlyoung/fix-iface-ifindex-compare
Mark Stapp [Mon, 6 Jan 2020 19:04:33 +0000 (14:04 -0500)]
Merge pull request #5622 from qlyoung/fix-iface-ifindex-compare

lib: fix ifindex comparison overflow

4 years agolib: dont decode more nexthops than we can handle
Quentin Young [Sat, 4 Jan 2020 00:07:25 +0000 (19:07 -0500)]
lib: dont decode more nexthops than we can handle

If someone provides us more nexthops than our configured multipath
setting, drop the rest of them

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
4 years agoMerge pull request #5607 from ton31337/fix/deprecate_bgpTimerUp
Quentin Young [Mon, 6 Jan 2020 17:28:52 +0000 (12:28 -0500)]
Merge pull request #5607 from ton31337/fix/deprecate_bgpTimerUp

bgpd: Time to deprecate bgpTimerUp

4 years agoMerge pull request #5606 from ton31337/fix/docker_centos8_image_name
Jafar Al-Gharaibeh [Mon, 6 Jan 2020 17:24:15 +0000 (11:24 -0600)]
Merge pull request #5606 from ton31337/fix/docker_centos8_image_name

docker: Use proper container name when creating CentOS 8 container

4 years agoMerge pull request #5632 from ton31337/fix/dont_use_pipes
Jafar Al-Gharaibeh [Mon, 6 Jan 2020 17:19:42 +0000 (11:19 -0600)]
Merge pull request #5632 from ton31337/fix/dont_use_pipes

packaging: Redirect stderr to /dev/null in %post action (frr.spec.in)

4 years agozebra: free ptm message on error
Quentin Young [Mon, 6 Jan 2020 17:09:23 +0000 (12:09 -0500)]
zebra: free ptm message on error

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
4 years agoMerge pull request #5545 from ton31337/feature/show_bgp_json_regexp
Jafar Al-Gharaibeh [Mon, 6 Jan 2020 17:03:55 +0000 (11:03 -0600)]
Merge pull request #5545 from ton31337/feature/show_bgp_json_regexp

bgpd: Print json output for show_ip_bgp_regexp_cmd

4 years agozebra: route changes via notify path trigger nht and mpls
Mark Stapp [Tue, 17 Dec 2019 14:21:21 +0000 (09:21 -0500)]
zebra: route changes via notify path trigger nht and mpls

Changes to a route via the dataplane notify path should
trigger nht and mpls lsp processing.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
4 years agoMerge pull request #5618 from qlyoung/fix-san-flags-additive
Rafael Zalamena [Mon, 6 Jan 2020 14:51:02 +0000 (11:51 -0300)]
Merge pull request #5618 from qlyoung/fix-san-flags-additive

configure.ac: make msan & ubsan flags additive

4 years agoMerge pull request #5619 from qlyoung/fix-zebra-netlink-undefined-bitshift
Mark Stapp [Mon, 6 Jan 2020 13:59:49 +0000 (08:59 -0500)]
Merge pull request #5619 from qlyoung/fix-zebra-netlink-undefined-bitshift

zebra: fix undefined bitshifts in netlink stuff

4 years agoMerge pull request #5630 from slankdev/slankdev-bgpd-fix-large-rd
Donatas Abraitis [Mon, 6 Jan 2020 11:15:07 +0000 (13:15 +0200)]
Merge pull request #5630 from slankdev/slankdev-bgpd-fix-large-rd

bgpd: fix large route-distinguisher's format

4 years agobgpd: fix large route-distinguisher's format
Hiroki Shirokura [Sun, 5 Jan 2020 13:56:14 +0000 (22:56 +0900)]
bgpd: fix large route-distinguisher's format

This commit is about #5629 's issue.
Before this commit, bgpd creates format string of
bgp-route-distinguisher as int32, but correctly format
is uint32. current bgpd's sh-run-cli generate int32 rd,
so if user sets the rd as 1:4294967295(0x1:0xffffffff),
sh-run cli generates 1: -1 as running-config. This
commit fix that issue.

Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
4 years agoMerge pull request #5467 from pogojotz/alpine-linux-build
Donatas Abraitis [Sun, 5 Jan 2020 20:10:34 +0000 (22:10 +0200)]
Merge pull request #5467 from pogojotz/alpine-linux-build

alpine: fix build on current 'edge' version of Alpine

4 years agoMerge pull request #5601 from donaldsharp/pim_rb
Donatas Abraitis [Sun, 5 Jan 2020 20:07:00 +0000 (22:07 +0200)]
Merge pull request #5601 from donaldsharp/pim_rb

Pim rb