]> git.puffer.fish Git - mirror/frr.git/log
mirror/frr.git
6 years agoMerge pull request #3898 from dslicenc/peer-group-remote-as
David Lamparter [Mon, 11 Mar 2019 18:40:24 +0000 (19:40 +0100)]
Merge pull request #3898 from dslicenc/peer-group-remote-as

bpgd: resolve more neighbor peer-group issues

6 years agoMerge pull request #3889 from donaldsharp/rnh_vrf_down_stuff
Mark Stapp [Fri, 8 Mar 2019 19:48:19 +0000 (14:48 -0500)]
Merge pull request #3889 from donaldsharp/rnh_vrf_down_stuff

zebra Rnh vrf down stuff

6 years agoMerge pull request #3926 from donaldsharp/improved_debugs_vxlan
Mark Stapp [Fri, 8 Mar 2019 17:02:52 +0000 (12:02 -0500)]
Merge pull request #3926 from donaldsharp/improved_debugs_vxlan

Improved debugs vxlan in zebra

6 years agozebra: Add some debugs to neighbor entry processing 3926/head
Donald Sharp [Fri, 8 Mar 2019 15:46:55 +0000 (10:46 -0500)]
zebra: Add some debugs to neighbor entry processing

When we get a neighbor entry in zebra we start processing it.
Let's add some additional debugs to the processing so that when
it bails out and we don't use the data, we know the reason.
This should help in debugging the problems from why bgp does
not appear to have data associated with a neighbor entry
in the kernel.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agozebra: Remove duplicate NUD_PERMANENT check
Donald Sharp [Fri, 8 Mar 2019 15:30:27 +0000 (10:30 -0500)]
zebra: Remove duplicate NUD_PERMANENT check

The check for an entry being NUD_PERMANENT has already been done
there is no need to do it twice.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoMerge pull request #3919 from sworleys/Remove-SNL-Var
Mark Stapp [Thu, 7 Mar 2019 13:06:14 +0000 (08:06 -0500)]
Merge pull request #3919 from sworleys/Remove-SNL-Var

zebra: Remove unused sockaddr variable

6 years agozebra: Remove unused sockaddr variable 3919/head
Stephen Worley [Wed, 6 Mar 2019 15:53:49 +0000 (10:53 -0500)]
zebra: Remove unused sockaddr variable

This variable does nothing, removing it.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
6 years agoMerge pull request #3855 from donaldsharp/bgp_clist_sa
David Lamparter [Wed, 6 Mar 2019 15:02:01 +0000 (16:02 +0100)]
Merge pull request #3855 from donaldsharp/bgp_clist_sa

bgpd: Cleanup cli for [l]community_delete functions

6 years agoMerge pull request #3853 from donaldsharp/partial_revert
David Lamparter [Wed, 6 Mar 2019 15:00:40 +0000 (16:00 +0100)]
Merge pull request #3853 from donaldsharp/partial_revert

zebra: Prevent crash in dad auto recovery

6 years agoMerge pull request #3911 from mjstapp/fix_privs_deadlock
David Lamparter [Wed, 6 Mar 2019 14:58:20 +0000 (15:58 +0100)]
Merge pull request #3911 from mjstapp/fix_privs_deadlock

libs: make privilege elevation thread-safe

6 years agoMerge pull request #3869 from qlyoung/cocci-fixes
David Lamparter [Wed, 6 Mar 2019 14:54:44 +0000 (15:54 +0100)]
Merge pull request #3869 from qlyoung/cocci-fixes

Assorted Coccinelle fixes

6 years agoRevert "nhrpd: strncpy -> strlcpy"
Quentin Young [Tue, 5 Mar 2019 19:29:49 +0000 (19:29 +0000)]
Revert "nhrpd: strncpy -> strlcpy"

This reverts commit eb266ecb847b70bcf9901da5ed59a39d3e07fd8f.

6 years agolibs: make privilege escalation thread-safe 3911/head
Mark Stapp [Tue, 5 Mar 2019 20:28:26 +0000 (15:28 -0500)]
libs: make privilege escalation thread-safe

Privs escalation is process-wide, and a multi-threaded process
can deadlock. This adds a mutex and a counter to the privs
object, preventing multiple threads from making the privs
escalation system call.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
6 years agoMerge pull request #3848 from chiragshah6/evpn_dev2
Sri Mohana Singamsetty [Tue, 5 Mar 2019 04:45:44 +0000 (20:45 -0800)]
Merge pull request #3848 from chiragshah6/evpn_dev2

bgpd: evpn reject bgp update to overwrite self mac as part of router-mac ext. community

6 years agoMerge pull request #3879 from chiragshah6/evpn_dev1
Sri Mohana Singamsetty [Mon, 4 Mar 2019 21:18:31 +0000 (13:18 -0800)]
Merge pull request #3879 from chiragshah6/evpn_dev1

bgpd: fix evpn type-5 implicit withdraw processing

6 years agobgpd: router mac same as self supress bgp update 3848/head
Chirag Shah [Thu, 28 Feb 2019 00:36:47 +0000 (16:36 -0800)]
bgpd: router mac same as self supress bgp update

bgp update can contain router mac address same as one of SVIs
mac address, during processing of evpn route in bpg_update()
check for the flag is set and filter the route from installing.
This check is done prior to attribute lookup or storing in database.

Parse check and set is done once during attribute parse
because all the NLRIs containing evpn prefix
(type-2/type-5) will have same exntended community applicable.

Ticket:CM-23674
Reviewed By:CCR-8336
Testing Done:

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
6 years agobgpd: parse and comapre rmac attr against self mac
Chirag Shah [Wed, 20 Feb 2019 00:02:00 +0000 (16:02 -0800)]
bgpd: parse and comapre rmac attr against self mac

Any evpn bgp update message comes with router mac extended
community, which can potentially contain the madd adddress
same as any of the local SVIs (L3VNI) MAC address.
Set route mac exist and during route processing in
bgp_update() filter the route.

Ticket:CM-23674
Reviewed By:CCR-8336
Testing Done:
Configure L3vni mac on TORS1 which is similar to TORC11
L3vni MAC. When TORC11 received the EVPN update with
Router mac extended community, this check rejected the
BGP update message.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
6 years agobpgd: resolve more neighbor peer-group issues 3898/head
Don Slice [Sat, 2 Mar 2019 19:40:17 +0000 (19:40 +0000)]
bpgd: resolve more neighbor peer-group issues

Found in testing that in a certain sequence, a neighbor's peer-group
membership would be lost.  This fix resolves that issue. Additionally
found that "no neighbor swp1 remote-as 2" would sometimes leave the
config with "neighbor swp1 remote-as 0" rather than removing from the
config. That one is also resolved.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
6 years agozebra: Upon vrf deletion, actually release this data. 3889/head
Donald Sharp [Thu, 28 Feb 2019 14:11:41 +0000 (09:11 -0500)]
zebra: Upon vrf deletion, actually release this data.

When a vrf is deleted we need to tell the zebra_router that we have
finished using the tables we are keeping track of.  This will allow
us to properly cleanup the data structures associated with them.

This fixes this valgrind error found:

==8579== Invalid read of size 8
==8579==    at 0x430034: zvrf_id (zebra_vrf.h:167)
==8579==    by 0x432366: rib_process (zebra_rib.c:1580)
==8579==    by 0x432366: process_subq (zebra_rib.c:2092)
==8579==    by 0x432366: meta_queue_process (zebra_rib.c:2188)
==8579==    by 0x48C99FE: work_queue_run (workqueue.c:291)
==8579==    by 0x48C3788: thread_call (thread.c:1607)
==8579==    by 0x48A2E9E: frr_run (libfrr.c:1011)
==8579==    by 0x41316A: main (main.c:473)
==8579==  Address 0x5aeb750 is 0 bytes inside a block of size 4,424 free'd
==8579==    at 0x4839A0C: free (vg_replace_malloc.c:540)
==8579==    by 0x438914: zebra_vrf_delete (zebra_vrf.c:279)
==8579==    by 0x48C4225: vrf_delete (vrf.c:243)
==8579==    by 0x48C4225: vrf_delete (vrf.c:217)
==8579==    by 0x4151CE: netlink_vrf_change (if_netlink.c:364)
==8579==    by 0x416810: netlink_link_change (if_netlink.c:1189)
==8579==    by 0x41C1FC: netlink_parse_info (kernel_netlink.c:904)
==8579==    by 0x41C2D3: kernel_read (kernel_netlink.c:389)
==8579==    by 0x48C3788: thread_call (thread.c:1607)
==8579==    by 0x48A2E9E: frr_run (libfrr.c:1011)
==8579==    by 0x41316A: main (main.c:473)
==8579==  Block was alloc'd at
==8579==    at 0x483AB1A: calloc (vg_replace_malloc.c:762)
==8579==    by 0x48A6030: qcalloc (memory.c:110)
==8579==    by 0x4389EF: zebra_vrf_alloc (zebra_vrf.c:382)
==8579==    by 0x438A42: zebra_vrf_new (zebra_vrf.c:93)
==8579==    by 0x48C40AD: vrf_get (vrf.c:209)
==8579==    by 0x415144: netlink_vrf_change (if_netlink.c:319)
==8579==    by 0x415E90: netlink_interface (if_netlink.c:653)
==8579==    by 0x41C1FC: netlink_parse_info (kernel_netlink.c:904)
==8579==    by 0x4163E8: interface_lookup_netlink (if_netlink.c:760)
==8579==    by 0x42BB37: zebra_ns_enable (zebra_ns.c:130)
==8579==    by 0x42BC5E: zebra_ns_init (zebra_ns.c:208)
==8579==    by 0x4130F4: main (main.c:401)

This can be found by: `ip link del <VRF DEVICE NAME>` then `ip link add <NAME> type vrf table X` again and
then attempting to use the vrf.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agosharpd: Add code to allow nexthops to be watched from non-default vrf
Donald Sharp [Thu, 28 Feb 2019 13:24:20 +0000 (08:24 -0500)]
sharpd: Add code to allow nexthops to be watched from non-default vrf

Add a bit of code to the sharp cli to allow it to specify a non-default
vrf.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoMerge pull request #3894 from donaldsharp/install_replace
Mark Stapp [Fri, 1 Mar 2019 21:19:31 +0000 (16:19 -0500)]
Merge pull request #3894 from donaldsharp/install_replace

zebra: When installing a new route always use REPLACE

6 years agosharpd: Add ability to pass vrf we want to watch
Donald Sharp [Thu, 28 Feb 2019 13:12:32 +0000 (08:12 -0500)]
sharpd: Add ability to pass vrf we want to watch

Add the ability for the sharp zebra code to pass down the
vrf that we want to watch.  At this point in time, we
cannot use it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agosharpd: Add cli to allow vrf route installation
Donald Sharp [Thu, 28 Feb 2019 13:09:53 +0000 (08:09 -0500)]
sharpd: Add cli to allow vrf route installation

Add a bit of code to allow the end user to specify a [vrf NAME]
for route installation/deletion.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agosharpd: Setup route installation to be able to select vrf to use
Donald Sharp [Thu, 28 Feb 2019 12:51:41 +0000 (07:51 -0500)]
sharpd: Setup route installation to be able to select vrf to use

Modify the sharp code to allow for vrf route installation.  At
this point in time the code is nascent.  Future commits will turn
on this behavior.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoMerge pull request #3877 from qlyoung/remove-strncpy
Renato Westphal [Fri, 1 Mar 2019 20:06:29 +0000 (17:06 -0300)]
Merge pull request #3877 from qlyoung/remove-strncpy

Remove strncpy

6 years agozebra: When installing a new route always use REPLACE 3894/head
Donald Sharp [Fri, 1 Mar 2019 18:56:12 +0000 (13:56 -0500)]
zebra: When installing a new route always use REPLACE

When we install a new route into the kernel always use
REPLACE.  Else if the route is already there it can
be translated into an append with the flags we are
using.

This is especially true for the way we handle pbr
routes as that we are re-installing the same route
entry from pbr at the moment.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoMerge pull request #3882 from vivek-cumulus/refine_evpn_route_add
Sri Mohana Singamsetty [Fri, 1 Mar 2019 17:15:26 +0000 (09:15 -0800)]
Merge pull request #3882 from vivek-cumulus/refine_evpn_route_add

Refine install of EVPN-based routes to remove some special handling

6 years agoMerge pull request #3743 from NaveenThanikachalam/2990_New
Donald Sharp [Fri, 1 Mar 2019 14:54:10 +0000 (09:54 -0500)]
Merge pull request #3743 from NaveenThanikachalam/2990_New

bgpd: Address performance issues in BGP route aggregation.

6 years agoMerge pull request #3606 from pguibert6WIND/if_rmap_container
Donald Sharp [Fri, 1 Mar 2019 14:46:22 +0000 (09:46 -0500)]
Merge pull request #3606 from pguibert6WIND/if_rmap_container

lib, rip, ripng, eigrp: rework if_rmap context

6 years agobgpd: Code to remove the bottleneck in aggregation. 3743/head
Naveen Thanikachalam [Wed, 6 Feb 2019 14:39:03 +0000 (06:39 -0800)]
bgpd: Code to remove the bottleneck in aggregation.

The code that causes the bottleneck has been written generically to
handle the below two cases:
a) When a new aggregate-address is configured.
b) When new routes, that can be aggregated under an existing
aggregate-address, are received.
This change optimizes the code that handles case-(b).

Signed-off-by: NaveenThanikachalam <nthanikachal@vmware.com>
6 years agobgpd: Code to handle BGP aggregate's l-communities.
Naveen Thanikachalam [Wed, 6 Feb 2019 14:35:04 +0000 (06:35 -0800)]
bgpd: Code to handle BGP aggregate's l-communities.

With this commit:
1) The code to manage the large-communities attribute of the routes that are
   aggregatable under a configured aggregate-address is introduced.
2) The code to compute the aggregate-route's large-communities attribute is
   introduced.

Signed-off-by: NaveenThanikachalam <nthanikachal@vmware.com>
6 years agobgpd: Code to handle BGP aggregate's e-communities.
Naveen Thanikachalam [Wed, 6 Feb 2019 14:31:37 +0000 (06:31 -0800)]
bgpd: Code to handle BGP aggregate's e-communities.

With this commit:
1) The code to manage the extended-communities attribute of the routes that are
   aggregatable under a configured aggregate-address is introduced.
2) The code to compute the aggregate-route's extended-communities attribute is
   introduced.

Signed-off-by: NaveenThanikachalam <nthanikachal@vmware.com>
6 years agobgpd: Code to handle BGP aggregate's communities.
Naveen Thanikachalam [Wed, 6 Feb 2019 14:28:18 +0000 (06:28 -0800)]
bgpd: Code to handle BGP aggregate's communities.

With this commit:
1) The code to manage the communities attribute of the routes that are
   aggregatable under a configured aggregate-address is introduced.
2) The code to compute the aggregate-route's communities attribute is
   introduced.

Signed-off-by: NaveenThanikachalam <nthanikachal@vmware.com>
6 years agobgpd: Code to handle BGP aggregate's as-path.
Naveen Thanikachalam [Wed, 6 Feb 2019 13:44:20 +0000 (05:44 -0800)]
bgpd: Code to handle BGP aggregate's as-path.

With this commit:
1) 'struct bgp_aggregate' is moved to bgp_route.h from bgp_route.c
2) Hashes to accommodate the as-path, communities, extended-communities and
   large-communities attributes of all the routes aggregated by an
   aggregate route is introduced in 'struct bgp_aggregate'.
3) Place-holders for the aggregate route's as-path, communities,
   extended-communities and large-communities attributes are introduced in
   'struct bgp_aggregate'.
4) The code to manage the as-path of the routes that are aggregatable under
   a configured aggregate-address is introduced.
5) The code to compute the aggregate-route's as-path is introduced.

Signed-off-by: NaveenThanikachalam <nthanikachal@vmware.com>
6 years agoMerge pull request #3876 from qlyoung/fmt-fixes
Mark Stapp [Thu, 28 Feb 2019 20:16:16 +0000 (15:16 -0500)]
Merge pull request #3876 from qlyoung/fmt-fixes

style fixes...

6 years agoMerge pull request #3878 from opensourcerouting/fix-6vpe
Donald Sharp [Thu, 28 Feb 2019 16:51:02 +0000 (11:51 -0500)]
Merge pull request #3878 from opensourcerouting/fix-6vpe

6VPE fixes

6 years agoMerge pull request #3890 from opensourcerouting/bgp-hide-ifdef-commands
Donald Sharp [Thu, 28 Feb 2019 16:48:40 +0000 (11:48 -0500)]
Merge pull request #3890 from opensourcerouting/bgp-hide-ifdef-commands

vtysh: hide old BGP vpnv(4|6) commands

6 years agovtysh: hide old BGP vpnv(4|6) commands 3890/head
Rafael Zalamena [Thu, 28 Feb 2019 14:15:15 +0000 (11:15 -0300)]
vtysh: hide old BGP vpnv(4|6) commands

Only show them when explicit compiled with KEEP_OLD_VPN_COMMANDS.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
6 years agoMerge pull request #3800 from chiragshah6/evpn_dev
Sri Mohana Singamsetty [Wed, 27 Feb 2019 21:38:03 +0000 (13:38 -0800)]
Merge pull request #3800 from chiragshah6/evpn_dev

zebra: advertise evpn route upon l3vni svi mac chg

6 years agoMerge pull request #3885 from qlyoung/capabilty
Sri Mohana Singamsetty [Wed, 27 Feb 2019 21:37:31 +0000 (13:37 -0800)]
Merge pull request #3885 from qlyoung/capabilty

bgpd: capabilty

6 years agobgpd: capabilty 3885/head
Quentin Young [Wed, 27 Feb 2019 18:09:08 +0000 (18:09 +0000)]
bgpd: capabilty

capabilty

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years agoMerge pull request #3880 from vivek-cumulus/evpn_advertise_rmap_fix
Sri Mohana Singamsetty [Wed, 27 Feb 2019 17:59:51 +0000 (09:59 -0800)]
Merge pull request #3880 from vivek-cumulus/evpn_advertise_rmap_fix

bgpd: Fix EVPN advertise route-map application

6 years agoMerge pull request #3872 from dslicenc/frr-reload-vrf-context
Russ White [Wed, 27 Feb 2019 16:16:38 +0000 (11:16 -0500)]
Merge pull request #3872 from dslicenc/frr-reload-vrf-context

tools: keep exit-vrf to change context correctly between vrfs

6 years ago*: Explicitly mark nexthop of EVPN-sourced routes as onlink 3882/head
vivek [Wed, 27 Feb 2019 12:54:24 +0000 (12:54 +0000)]
*: Explicitly mark nexthop of EVPN-sourced routes as onlink

In the case of EVPN symmetric routing, the tenant VRF is associated with
a VNI that is used for routing and commonly referred to as the L3 VNI or
VRF VNI. Corresponding to this VNI is a VLAN and its associated L3 (IP)
interface (SVI). Overlay next hops (i.e., next hops for routes in the
tenant VRF) are reachable over this interface. Howver, in the model that
is supported in the implementation and commonly deployed, there is no
explicit Overlay IP address associated with the next hop in the tenant
VRF; the underlay IP is used if (since) the forwarding plane requires
a next hop IP. Therefore, the next hop has to be explicit flagged as
onlink to cause any next hop reachability checks in the forwarding plane
to be skipped.

https://tools.ietf.org/html/draft-ietf-bess-evpn-prefix-advertisement
section 4.4 provides additional description of the above constructs.

Use existing mechanism to specify the nexthops as onlink when installing
these routes from bgpd to zebra and get rid of a special flag that was
introduced for EVPN-sourced routes. Also, use the onlink flag during next
hop validation in zebra and eliminate other special checks.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agozebra, bgpd: Use L3 interface for VRF's VNI in route install
vivek [Wed, 27 Feb 2019 12:25:53 +0000 (12:25 +0000)]
zebra, bgpd: Use L3 interface for VRF's VNI in route install

In the case of EVPN symmetric routing, the tenant VRF is associated with
a VNI that is used for routing and commonly referred to as the L3 VNI or
VRF VNI. Corresponding to this VNI is a VLAN and its associated L3 (IP)
interface (SVI). Overlay next hops (i.e., next hops for routes in the
tenant VRF) are reachable over this interface.

https://tools.ietf.org/html/draft-ietf-bess-evpn-prefix-advertisement
section 4.4 provides additional description of the above constructs.

Use the L3 interface exchanged between zebra and bgp in route install.
This patch in conjunction with the earlier one helps to eliminate some
special code in zebra to derive the next hop's interface.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agozebra, bgpd: Exchange L3 interface for VRF's VNI
vivek [Wed, 27 Feb 2019 11:52:34 +0000 (11:52 +0000)]
zebra, bgpd: Exchange L3 interface for VRF's VNI

In the case of EVPN symmetric routing, the tenant VRF is associated with
a VNI that is used for routing and commonly referred to as the L3 VNI or
VRF VNI. Corresponding to this VNI is a VLAN and its associated L3 (IP)
interface (SVI). Overlay next hops (i.e., next hops for routes in the
tenant VRF) are reachable over this interface.

https://tools.ietf.org/html/draft-ietf-bess-evpn-prefix-advertisement
section 4.4 provides additional description of the above constructs.

The implementation currently derives this L3 interface for EVPN tenant
routes using special code that looks at route flags. This patch
exchanges the L3 interface between zebra and bgpd as part of the L3-VNI
exchange in order to eliminate some this special code.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agobgpd: Fix EVPN advertise route-map application 3880/head
vivek [Wed, 27 Feb 2019 08:19:06 +0000 (08:19 +0000)]
bgpd: Fix EVPN advertise route-map application

When a IPv4 or IPv6 route that was formerly allowed by the route-map
to be injected into EVPN gets an updated set of attributes that now
causes it to be filtered, the route needs to be pulled out of EVPN.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agobgpd: fix evpn type-5 implicit withdraw processing 3879/head
Chirag Shah [Mon, 25 Feb 2019 18:07:05 +0000 (10:07 -0800)]
bgpd: fix evpn type-5 implicit withdraw processing

Withdraw flag is not sufficient to call bgp_update vs. bgp_withdraw()
processing for a given BGP evpn update message.

When a bgp update needs to be treated as an implicit withdraw
(e.g., due to malformed attribute), the code wasn't handling
things properly.

Rearranging attribute pass field to type-5 route processing and aligning
similar to done for other routes (type2/type-3).

Ticket:CM-24003
Reviewed By:CCR-8330
Testing Done:

Singed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
6 years agobgpd: add missing checks for vpnv6 nexthop lengths 3878/head
Renato Westphal [Tue, 26 Feb 2019 21:22:27 +0000 (18:22 -0300)]
bgpd: add missing checks for vpnv6 nexthop lengths

A few code paths weren't handling the vpnv6 nexthop lenghts as
expected, which was leading to problems like imported vpnv6 routes
not being marked as valid when they should. Fix this.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agoRevert "bgpd: in case nexthop is ipv6, set nh attribute flag in mpls vpn case"
Renato Westphal [Tue, 26 Feb 2019 21:22:10 +0000 (18:22 -0300)]
Revert "bgpd: in case nexthop is ipv6, set nh attribute flag in mpls vpn case"

BGP IPv6 routes should never contain the NEXT_HOP attribute
(MP_REACH_NLRI should be used instead).

This reverts commit 75cd35c6977137a14ac37347a465d4e8a91eb4c4.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agopimd: strncpy -> strlcpy 3877/head
Quentin Young [Tue, 26 Feb 2019 20:35:29 +0000 (20:35 +0000)]
pimd: strncpy -> strlcpy

strncpy is a byte copy function not a string copy function

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years agoospfd: strncpy -> strlcpy
Quentin Young [Tue, 26 Feb 2019 20:34:39 +0000 (20:34 +0000)]
ospfd: strncpy -> strlcpy

strncpy is a byte copy function not a string copy function

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years agonhrpd: strncpy -> strlcpy
Quentin Young [Tue, 26 Feb 2019 20:26:54 +0000 (20:26 +0000)]
nhrpd: strncpy -> strlcpy

strncpy is a byte copy function not a string copy function

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years agolib: strncpy -> strlcpy | memcpy
Quentin Young [Tue, 26 Feb 2019 20:25:24 +0000 (20:25 +0000)]
lib: strncpy -> strlcpy | memcpy

strncpy is a byte copy function not a string copy function

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years agoripd: strncpy -> strlcpy
Quentin Young [Tue, 26 Feb 2019 19:55:28 +0000 (19:55 +0000)]
ripd: strncpy -> strlcpy

strncpy is a byte copy function not a string copy function

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years agobgpd: strncpy -> strlcpy
Quentin Young [Tue, 26 Feb 2019 19:50:06 +0000 (19:50 +0000)]
bgpd: strncpy -> strlcpy

strncpy is a byte copy function not a string copy function

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years agoisisd: strncpy -> strlcpy
Quentin Young [Tue, 26 Feb 2019 19:48:12 +0000 (19:48 +0000)]
isisd: strncpy -> strlcpy

strncpy is a byte copy function not a string copy function

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years agozebra: fix style for 7d9ee1 3876/head
Quentin Young [Tue, 26 Feb 2019 19:04:15 +0000 (19:04 +0000)]
zebra: fix style for 7d9ee1

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years agobgpd: fix style for 0f19a8
Quentin Young [Tue, 26 Feb 2019 18:41:06 +0000 (18:41 +0000)]
bgpd: fix style for 0f19a8

:|

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years agoMerge pull request #3844 from opensourcerouting/rpm-new-libyang
Donald Sharp [Tue, 26 Feb 2019 18:40:57 +0000 (13:40 -0500)]
Merge pull request #3844 from opensourcerouting/rpm-new-libyang

redhat: Require newer libyang (> 0.16.74) for embedded extensions

6 years agotools: add coccinelle spatches 3869/head
Quentin Young [Tue, 26 Feb 2019 17:36:31 +0000 (17:36 +0000)]
tools: add coccinelle spatches

Add some Coccinelle semantic patches we can use to automatically
refactor code in the future.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years agoMerge pull request #3865 from qlyoung/fix-zebra-vxlan-smelly-strings
Russ White [Tue, 26 Feb 2019 16:08:18 +0000 (11:08 -0500)]
Merge pull request #3865 from qlyoung/fix-zebra-vxlan-smelly-strings

zebra: replace strncpy with strlcpy

6 years agoMerge pull request #3866 from donaldsharp/ospf_allow_vrf_starup
Russ White [Tue, 26 Feb 2019 16:03:50 +0000 (11:03 -0500)]
Merge pull request #3866 from donaldsharp/ospf_allow_vrf_starup

ospfd: Allow pre-existing vrf's to work

6 years agoMerge pull request #3868 from ton31337/fix/v6_only_flag
Russ White [Tue, 26 Feb 2019 16:03:14 +0000 (11:03 -0500)]
Merge pull request #3868 from ton31337/fix/v6_only_flag

bgpd: Add peer action for PEER_FLAG_IFPEER_V6ONLY flag

6 years agoMerge pull request #3871 from dslicenc/frr-reload-blackhole
Russ White [Tue, 26 Feb 2019 15:59:31 +0000 (10:59 -0500)]
Merge pull request #3871 from dslicenc/frr-reload-blackhole

tools: fix blackhole static changes in frr-reload.py

6 years agotools: keep exit-vrf to change context correctly between vrfs 3872/head
Don Slice [Mon, 11 Feb 2019 19:17:40 +0000 (14:17 -0500)]
tools: keep exit-vrf to change context correctly between vrfs

Discovered in testing that if a static route in the default table
was entered immediately after a vrf static block, the static route
intended for the default table was put in the vrf instead.  This
fix retains the "exit-vrf" statement which causes the following
static routes to appear in the default table correctly.

Ticket: CM-23985
Signed-off-by: Don Slice <dslice@cumulusnetwork.com>
6 years agotools: fix blackhole static changes in frr-reload.py 3871/head
Don Slice [Fri, 25 Jan 2019 18:37:03 +0000 (13:37 -0500)]
tools: fix blackhole static changes in frr-reload.py

Problem caused when nclu is used to create "ip route 1.1.1.0/24
blackhole" because frr-reload.py changed the line to Null0 instead
of blackhole.  If nclu tries to delete it using the same line as
entered, the commit fails since it doesn't match.

Ticket: CM-23986
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
6 years agoMerge pull request #3864 from qlyoung/fix-ospf-mtu-warning-style
Olivier Dugeon [Tue, 26 Feb 2019 08:48:31 +0000 (09:48 +0100)]
Merge pull request #3864 from qlyoung/fix-ospf-mtu-warning-style

ospfd: fix link MTU warning style

6 years agoMerge pull request #3832 from kooky/rename_backet
Martin Winter [Tue, 26 Feb 2019 01:19:49 +0000 (08:19 +0700)]
Merge pull request #3832 from kooky/rename_backet

Rename backet to bucket

6 years ago*: replace XMALLOC + memset with XCALLOC
Quentin Young [Mon, 25 Feb 2019 20:41:01 +0000 (20:41 +0000)]
*: replace XMALLOC + memset with XCALLOC

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years ago*: remove casts of XMALLOC / XCALLOC
Quentin Young [Mon, 25 Feb 2019 20:30:31 +0000 (20:30 +0000)]
*: remove casts of XMALLOC / XCALLOC

No cast necessary for void *

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years ago*: remove null check before XFREE
Quentin Young [Mon, 25 Feb 2019 20:18:13 +0000 (20:18 +0000)]
*: remove null check before XFREE

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years agolib: STAILQ_FOREACH_SAFE never gives a null elem
Quentin Young [Mon, 25 Feb 2019 20:05:08 +0000 (20:05 +0000)]
lib: STAILQ_FOREACH_SAFE never gives a null elem

So don't check it

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years ago*: compare pointer types to NULL, not 0
Quentin Young [Mon, 25 Feb 2019 19:49:00 +0000 (19:49 +0000)]
*: compare pointer types to NULL, not 0

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years ago*: do not check XMALLOC / XCALLOC for null ret
Quentin Young [Mon, 25 Feb 2019 19:43:09 +0000 (19:43 +0000)]
*: do not check XMALLOC / XCALLOC for null ret

They never return NULL

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years ago*: use array_size instead of raw division
Quentin Young [Mon, 25 Feb 2019 19:23:41 +0000 (19:23 +0000)]
*: use array_size instead of raw division

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years ago*: remove unnecessary semicolon from switches
Quentin Young [Mon, 25 Feb 2019 19:05:11 +0000 (19:05 +0000)]
*: remove unnecessary semicolon from switches

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years ago*: remove useless return variables
Quentin Young [Mon, 25 Feb 2019 18:59:55 +0000 (18:59 +0000)]
*: remove useless return variables

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years ago*: return bool from boolean functions
Quentin Young [Mon, 25 Feb 2019 18:55:37 +0000 (18:55 +0000)]
*: return bool from boolean functions

Not 1 or 0.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years ago*: use proper bool initializers & fix comparisons
Quentin Young [Mon, 25 Feb 2019 18:51:33 +0000 (18:51 +0000)]
*: use proper bool initializers & fix comparisons

- bools should be initialized with true/false
- bools do not need to be compared

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years agobgpd: Add peer action for PEER_FLAG_IFPEER_V6ONLY flag 3868/head
Donatas Abraitis [Mon, 25 Feb 2019 19:16:02 +0000 (21:16 +0200)]
bgpd: Add peer action for PEER_FLAG_IFPEER_V6ONLY flag

peer_flag_modify() will always return BGP_ERR_INVALID_FLAG because
the action was not defined for PEER_FLAG_IFPEER_V6ONLY flag.

```
global PEER_FLAG_IFPEER_V6ONLY = 16384;
global BGP_ERR_INVALID_FLAG = -2;

probe process("/usr/lib/frr/bgpd").statement("peer_flag_modify@/root/frr/bgpd/bgpd.c:3975")
{
if ($flag == PEER_FLAG_IFPEER_V6ONLY && $action->type == 0)
printf("action not found for the flag PEER_FLAG_IFPEER_V6ONLY\n");
}

probe process("/usr/lib/frr/bgpd").function("peer_flag_modify").return
{
if ($return == BGP_ERR_INVALID_FLAG)
printf("return BGP_ERR_INVALID_FLAG\n");
}
```
produces:
action not found for the flag PEER_FLAG_IFPEER_V6ONLY
return BGP_ERR_INVALID_FLAG

$ vtysh -c 'conf t' -c 'router bgp 20' -c 'neighbor eth1 interface v6only remote-as external'

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
6 years agoospfd: Allow pre-existing vrf's to work 3866/head
Donald Sharp [Mon, 25 Feb 2019 19:10:10 +0000 (14:10 -0500)]
ospfd: Allow pre-existing vrf's to work

When creating a ospf vrf based instance allow it to work
if the vrf has been created *before* we create the ospf
instance.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agozebra: remove all instances of strncpy 3865/head
Quentin Young [Mon, 25 Feb 2019 17:37:34 +0000 (17:37 +0000)]
zebra: remove all instances of strncpy

We have strlcpy.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years agolib: add compatibility #define for hash_backet 3832/head
Quentin Young [Mon, 25 Feb 2019 16:26:56 +0000 (16:26 +0000)]
lib: add compatibility #define for hash_backet

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years agoospfd: fix link MTU warning style 3864/head
Quentin Young [Mon, 25 Feb 2019 16:57:13 +0000 (16:57 +0000)]
ospfd: fix link MTU warning style

Kernel style dictates that we do not break log messages across lines

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years ago*: Rename backet to bucket
Tim Bray [Tue, 19 Feb 2019 15:46:52 +0000 (15:46 +0000)]
*: Rename backet to bucket

Presume typo from original author

Signed-off-by: Tim Bray <tim@kooky.org>
6 years agoMerge pull request #3856 from donaldsharp/dplane_use_after_free
Russ White [Sun, 24 Feb 2019 01:09:31 +0000 (20:09 -0500)]
Merge pull request #3856 from donaldsharp/dplane_use_after_free

zebra: Fix use after free in rib_process_result

6 years agozebra: Fix use after free in rib_process_result 3856/head
Donald Sharp [Sun, 24 Feb 2019 00:58:20 +0000 (19:58 -0500)]
zebra: Fix use after free in rib_process_result

Running zebra after commit 888756b208edc7935705d95b83f9513acc21e78a
in valgrind produces this item:

==17102== Invalid read of size 8
==17102==    at 0x44D84C: rib_dest_from_rnode (rib.h:375)
==17102==    by 0x4546ED: rib_process_result (zebra_rib.c:1904)
==17102==    by 0x45436D: rib_process_dplane_results (zebra_rib.c:3295)
==17102==    by 0x4D0902B: thread_call (thread.c:1607)
==17102==    by 0x4CC3983: frr_run (libfrr.c:1011)
==17102==    by 0x4266F6: main (main.c:473)
==17102==  Address 0x83bd468 is 88 bytes inside a block of size 96 free'd
==17102==    at 0x4A35F54: free (vg_replace_malloc.c:530)
==17102==    by 0x4CCAC00: qfree (memory.c:129)
==17102==    by 0x4D03DC6: route_node_destroy (table.c:501)
==17102==    by 0x4D039EE: route_node_free (table.c:90)
==17102==    by 0x4D03971: route_node_delete (table.c:382)
==17102==    by 0x44D82A: route_unlock_node (table.h:256)
==17102==    by 0x454617: rib_process_result (zebra_rib.c:1882)
==17102==    by 0x45436D: rib_process_dplane_results (zebra_rib.c:3295)
==17102==    by 0x4D0902B: thread_call (thread.c:1607)
==17102==    by 0x4CC3983: frr_run (libfrr.c:1011)
==17102==    by 0x4266F6: main (main.c:473)
==17102==  Block was alloc'd at
==17102==    at 0x4A36FF6: calloc (vg_replace_malloc.c:752)
==17102==    by 0x4CCAA2D: qcalloc (memory.c:110)
==17102==    by 0x4D03D88: route_node_create (table.c:489)
==17102==    by 0x4D0360F: route_node_new (table.c:65)
==17102==    by 0x4D034F8: route_node_set (table.c:74)
==17102==    by 0x4D03486: route_node_get (table.c:327)
==17102==    by 0x4CFB700: srcdest_rnode_get (srcdest_table.c:243)
==17102==    by 0x4545C1: rib_process_result (zebra_rib.c:1872)
==17102==    by 0x45436D: rib_process_dplane_results (zebra_rib.c:3295)
==17102==    by 0x4D0902B: thread_call (thread.c:1607)
==17102==    by 0x4CC3983: frr_run (libfrr.c:1011)
==17102==    by 0x4266F6: main (main.c:473)
==17102==

This is happening because of this order of events:

1) Route is deleted in the main thread and scheduled for rib processing.
2) Rib garbage collection is run and we remove the route node since it
is no longer needed.
3) Data plane returns from the deletion in the kernel and we call
the srcdest_rnode_get function to get the prefix that was deleted.
This recreates a new route node.  This creates a route_node with
a lock count of 1, which we freed via the route_unlock_node call.
Then we continued to use the rn pointer.  Which leaves us with use
after frees.

The solution is, of course, to just move the unlock the node at the
end of the function if we have a route_node.

Fixes: #3854
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agobgpd: Cleanup cli for [l]community_delete functions 3855/head
Donald Sharp [Sun, 24 Feb 2019 00:27:09 +0000 (19:27 -0500)]
bgpd: Cleanup cli for [l]community_delete functions

The community_delete and lcommunity_delete functionality was
creating a special string that needed to be specially parsed.
Remove all this string creation and just pass the pertinent
data into the appropriate functions.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoMerge pull request #3836 from opensourcerouting/debian/master-kill-backports
Donald Sharp [Sat, 23 Feb 2019 23:23:21 +0000 (18:23 -0500)]
Merge pull request #3836 from opensourcerouting/debian/master-kill-backports

[master] debian packaging

6 years agozebra: Prevent crash in dad auto recovery 3853/head
Donald Sharp [Sat, 23 Feb 2019 00:19:18 +0000 (19:19 -0500)]
zebra: Prevent crash in dad auto recovery

Commit: 6005fe55bce1c9cd54f4f7773fc2b0e15a99008f
Introduced a crash with zebra looking up either the
nbr structure or the mac structure.  This is because
the zvni used is NULL and we eventually call a hash_lookup
call that would cause a NULL dereference.  Partially
revert this commit to original behavior.

Problems found via clang Static Analyzer.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoMerge pull request #3843 from opensourcerouting/cli-fuzzer-fixes
Donald Sharp [Fri, 22 Feb 2019 19:46:54 +0000 (14:46 -0500)]
Merge pull request #3843 from opensourcerouting/cli-fuzzer-fixes

More cli fuzzer fizes

6 years agoMerge pull request #3847 from mjstapp/fix_rnode_unlock
Donald Sharp [Fri, 22 Feb 2019 18:11:32 +0000 (13:11 -0500)]
Merge pull request #3847 from mjstapp/fix_rnode_unlock

zebra: unlock route-node in dplane results handler

6 years agoMerge pull request #3851 from donaldsharp/bgp_routemap_fix
Mark Stapp [Fri, 22 Feb 2019 17:22:16 +0000 (12:22 -0500)]
Merge pull request #3851 from donaldsharp/bgp_routemap_fix

bgpd: Fix compile warning -> error

6 years agobgpd: Fix compile warning -> error 3851/head
Donald Sharp [Fri, 22 Feb 2019 15:50:14 +0000 (10:50 -0500)]
bgpd: Fix compile warning -> error

The struct prefix *prefix is really a const struct prefix *
This was causing compile warns->errors on some compilers

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoMerge pull request #3827 from chiragshah6/evpn_dev1
Sri Mohana Singamsetty [Thu, 21 Feb 2019 23:39:43 +0000 (15:39 -0800)]
Merge pull request #3827 from chiragshah6/evpn_dev1

bgpd: vrl source-vrf route map filter

6 years agozebra: advertise evpn route upon l3vni svi mac chg 3800/head
Chirag Shah [Thu, 14 Feb 2019 02:22:14 +0000 (18:22 -0800)]
zebra: advertise evpn route upon l3vni svi mac chg

L3VNI keeps reference to svi interface (ifp).

When a netlink change received there is no flag
that mac has changed. Currently simply overwrite
interface's (ifp) hw_addr (MAC) field.

For originating EVPN type-2 and type-5 routes due to VNI
MAC change, comparison is required to check existing MAC
vs. netlink change MAC field.

Ticket:CM-23850
Reviewed By:CCR-8283
Testing Done:

Validate EVPN type-5 routes originated upon changing MAC address
of L3VNI's SVI inteface via ip link set cmd.

checked show bgp l2vpn evpn route and Rmac field contains new
MAC address.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
6 years agozebra: unlock route-node in dplane results handler 3847/head
Mark Stapp [Thu, 21 Feb 2019 21:15:14 +0000 (16:15 -0500)]
zebra: unlock route-node in dplane results handler

Unlock the route-node struct we look up while processing
async dataplane results.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
6 years agoMerge pull request #3841 from donaldsharp/pim_test
Jafar Al-Gharaibeh [Thu, 21 Feb 2019 16:41:53 +0000 (10:41 -0600)]
Merge pull request #3841 from donaldsharp/pim_test

Add `test pim keepalive-reset A.B.C.D A.B.C.D` command to pim

6 years agoMerge pull request #3830 from opensourcerouting/cherrypicks
Donald Sharp [Thu, 21 Feb 2019 12:58:34 +0000 (07:58 -0500)]
Merge pull request #3830 from opensourcerouting/cherrypicks

[master] cherrypick backlog