Commit graph

17715 commits

Author SHA1 Message Date
Stephen Worley ace3bbba4b zebra: Don't clear nexthop fib flag on rib_install
We cannot clear the NEXTHOP_FLAG_FIB nexthop flag
when sending routes to the dataplane anymore since
nexthops are now shared.

We were seeing a situation where if we delete a route
using a nexthop group that is still active with another
route, the fib flag was being unset by this code
path despite them still being valid fib nexthops with the
other route.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-11-12 01:24:39 -05:00
Stephen Worley 19474c9c8c zebra: mpls_ftn_uninstall handle nhg hash label change
We were crashing due to a missed label change code path
in mpls_ftn_uninstall() with the zebra_nhg hashing code.

Add a static handler function for label changing everywhere
in that code and use it in mpls_ftn_uninstall().

The crash was found in the ISIS-SR tests:

==23== Thread 1:
==23== Invalid read of size 4
==23==    at 0x15B20E: zebra_nhg_hash_equal (zebra_nhg.c:365)
==23==    by 0x489A2FD: hash_get (hash.c:143)
==23==    by 0x489A4BC: hash_lookup (hash.c:183)
==23==    by 0x15B5A3: zebra_nhg_find (zebra_nhg.c:494)
==23==    by 0x15C536: zebra_nhg_rib_find (zebra_nhg.c:1070)
==23==    by 0x1573E8: mpls_ftn_update (zebra_mpls.c:2661)
==23==    by 0x1A2554: zread_mpls_labels_replace (zapi_msg.c:1890)
==23==    by 0x1A41CD: zserv_handle_commands (zapi_msg.c:2613)
==23==    by 0x199B17: zserv_process_messages (zserv.c:517)
==23==    by 0x48EE6B7: thread_call (thread.c:1549)
==23==    by 0x48A8AD5: frr_run (libfrr.c:1064)
==23==    by 0x1391B7: main (main.c:468)
==23==  Address 0x5839330 is 0 bytes inside a block of size 80 free'd
==23==    at 0x48369AB: free (vg_replace_malloc.c:530)
==23==    by 0x48AEE6C: qfree (memory.c:129)
==23==    by 0x15C5F8: zebra_nhg_free (zebra_nhg.c:1095)
==23==    by 0x15BC8C: zebra_nhg_handle_uninstall (zebra_nhg.c:734)
==23==    by 0x15DCFA: zebra_nhg_uninstall_kernel (zebra_nhg.c:1826)
==23==    by 0x15C666: zebra_nhg_decrement_ref (zebra_nhg.c:1106)
==23==    by 0x15D9D7: zebra_nhg_re_update_ref (zebra_nhg.c:1711)
==23==    by 0x15D8B1: nexthop_active_update (zebra_nhg.c:1660)
==23==    by 0x167072: rib_process (zebra_rib.c:1154)
==23==    by 0x168D72: process_subq_route (zebra_rib.c:2039)
==23==    by 0x168E92: process_subq (zebra_rib.c:2078)
==23==    by 0x168F5B: meta_queue_process (zebra_rib.c:2112)
==23==  Block was alloc'd at
==23==    at 0x4837B65: calloc (vg_replace_malloc.c:752)
==23==    by 0x48AED56: qcalloc (memory.c:110)
==23==    by 0x15B07B: zebra_nhg_copy (zebra_nhg.c:307)
==23==    by 0x15B13E: zebra_nhg_hash_alloc (zebra_nhg.c:329)
==23==    by 0x489A339: hash_get (hash.c:148)
==23==    by 0x15B6CA: zebra_nhg_find (zebra_nhg.c:532)
==23==    by 0x15C536: zebra_nhg_rib_find (zebra_nhg.c:1070)
==23==    by 0x15D89A: nexthop_active_update (zebra_nhg.c:1658)
==23==    by 0x167072: rib_process (zebra_rib.c:1154)
==23==    by 0x168D72: process_subq_route (zebra_rib.c:2039)
==23==    by 0x168E92: process_subq (zebra_rib.c:2078)
==23==    by 0x168F5B: meta_queue_process (zebra_rib.c:2112)

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-11-12 01:24:39 -05:00
Sri Mohana Singamsetty 1deb86be7d
Merge pull request #5311 from chiragshah6/mdev
bgpd: fix rd output in show commands for evpn routs
2019-11-11 16:34:26 -08:00
Sri Mohana Singamsetty 5761cee5cc
Merge pull request #5310 from donaldsharp/ospf_use_after_free
ospfd: Function order caused use after free.
2019-11-11 13:29:28 -08:00
Quentin Young 61395893b4
Merge pull request #5259 from mjstapp/dplane_sample_plugin
zebra: Add a sample dataplane plugin module
2019-11-11 11:56:42 -05:00
Chirag Shah 90c31d7190 bgpd: fix json output for show cmd for evpn routes
Fix json output where show command displayed
"Route Distinguisher: " string in json output because
NULL json object passed to bgp_evpn_show_route_rd_header()

Testing Done:
Route Distinguisher: ip 27.0.0.11:3
Route Distinguisher: ip 27.0.0.11:4
Route Distinguisher: ip 27.0.0.16:3
Route Distinguisher: ip 27.0.0.16:5
Route Distinguisher: ip 27.0.0.16:9
{
  "27.0.0.11:3":{
    "rd":"27.0.0.11:3",
    "[2]:[0]:[48]:[00:02:00:00:00:02]":{
      "prefix":"[2]:[0]:[48]:[00:02:00:00:00:02]",
      "prefixLen":288,
 ...
}

Post fix:
{
  "27.0.0.11:3":{
    "rd":"27.0.0.11:3",
    "[2]:[0]:[48]:[00:02:00:00:00:02]":{
      "prefix":"[2]:[0]:[48]:[00:02:00:00:00:02]",
      "prefixLen":288,
  ...
}
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-11-11 07:57:57 -08:00
Chirag Shah 527fd6dee5 bgpd: fix rd printing in show commands for evpn rts
PR 5118 introduce additional (prepend) keywords
like 'ip' to Route Distinguisher output which
breaks existing evpn route show commands parsing.

Restore to original behavior.

Testing Done:

vtysh -c 'show bgp l2vpn evpn route'

Before fix:
Route Distinguisher: ip 27.0.0.15:44

Post fix:
Route Distinguisher: 27.0.0.15:44

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-11-11 07:57:37 -08:00
Donald Sharp ae82bb756b ospfd: Function order caused use after free.
The opaque lsa that we are storing is stored on various
lists depending on it's type.  This removal from the
list was being done *after* the pointer was freed.  This
is not a good idea.  Since the use after free was just
removal from a linked list and the freeing function does
not do anything other than free data, than just switching the function
order should be sufficient.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-11 10:17:31 -05:00
Donald Sharp a5f271c635
Merge pull request #5299 from ton31337/fix/remove_dead_code
bgpd: Remove not used bgp_find_nexthop() function
2019-11-11 07:57:09 -05:00
Donald Sharp 97b8644912
Merge pull request #5306 from ton31337/fix/replace_subcode_static_value_to_const_name
bgpd: Use BGP_NOTIFY_SUBCODE_UNSPECIFIC value for bgp_notify_send() where 0
2019-11-11 07:56:42 -05:00
Donatas Abraitis 0e35025eb4 bgpd: Use BGP_NOTIFY_SUBCODE_UNSPECIFIC value for bgp_notify_send() where 0
Just a code cleanup to keep the code consistent.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-11-10 17:54:37 +02:00
Russ White 26109a7873
Merge pull request #5298 from donaldsharp/bgp_prefix_rpki
bgpd: Fix missed prefix_free conversion in rpki code
2019-11-08 15:29:05 -05:00
Donatas Abraitis a78d1c77fe bgpd: Remove not used bgp_find_nexthop() function
Seems like a dead code.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-11-08 15:04:29 +02:00
Donald Sharp 45206fe2d0 bgpd: Fix missed prefix_free conversion in rpki code
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-08 07:51:57 -05:00
Donald Sharp 306c4dab55
Merge pull request #5278 from slankdev/slankdev-bgpd-fix-prefix-sid-fetch-error
bgpd: skip unsupported PREFIX_SID sub-type
2019-11-07 10:36:47 -05:00
Donatas Abraitis 0ed33f4a43
Merge pull request #5283 from donaldsharp/bgp_vrf_stuff
bgpd: Have Nexthop Tracking specify vrf we are in for debugs
2019-11-07 17:21:48 +02:00
Donald Sharp 8c1a4c1041 bgpd: use bgp->name_pretty in debugs and add vrf to some output
Recently had a case where I was attempting to debug a nexthop tracking
issue across multiple bgp vrf's and since the setup vrf's in it with
overlapping address ranges, it became real fun real fast to track
vrf data associated.  Add a bit of code to allow us to figure out
what vrf we are in when we print out debug messages.

Look through the rest of the code and find debugs where we are
not using bgp->name_pretty and switch it over.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-07 07:20:41 -05:00
Russ White 46ddfc4096
Merge pull request #5269 from sworleys/Zebra-VRF-Lookup-Not-Get
zebra: separate zebra_vrf_lookup_table_with_id()
2019-11-06 14:10:59 -05:00
Russ White a049e601ec
Merge pull request #5281 from bisdhdh/bgpv4-over-v6-1
BGPD: Prevent IPv6-LL being fwd to IBGP peers not on same link.
2019-11-06 14:03:52 -05:00
Martin Winter 566c5d2127
Merge pull request #5196 from kuldeepkash/testcases
tests: Enhance bgp-path-attributes-topo1 test suite
2019-11-06 07:18:04 -05:00
Donatas Abraitis b3bce3a4fc
Merge pull request #5280 from qlyoung/doc-clean-topotest-json
doc: clean up && index topotest json docs
2019-11-05 20:15:37 +02:00
Donald Sharp 3bc6be29c3
Merge pull request #5253 from opensourcerouting/update-vpls-topotest
Fix the LDP VPLS topotest
2019-11-05 11:36:33 -05:00
Lou Berger 3160b7ffb0
Merge pull request #5261 from donaldsharp/pointer_fun
Convert some XXX_free lib functions to a double pointer
2019-11-05 11:32:20 -05:00
bisdhdh 63696f1d89 BGPD: Prevent IPv6-LL being fwd to IBGP peers not on same link.
Prevent IPv6 Link-local address being forward to IBGP peer,
which are not directly connected.

R1----IPV6-unnumbered-EBGP-------R2-----IPV6-IBGP-----R3

Configure route-map to set preferred global address on and apply
route-map-IN on R2 for R1-R2 session. Now check on R3's BGP and
RIB table has route nexthop as R1 link-local address, which is
not correct.

As of now we clear link-local address info from mp_nexthop_global,
only if mp_nexthop_global is populated with link-local address.

We should do it even if route-map is configured boz forwarding
link-local address from one link scope to another is violation of
the standards.

Signed-off-by: Biswajit Sadhu sadhub@vmware.com
2019-11-05 11:17:47 +05:30
Hiroki Shirokura c6ca155d73 bgpd: skip unsupported PREFIX_SID sub-type
This commit make bgpd to skip and ignore unsupported
sub-type of PREFIX_SID. (especially new defined sub-type)
Current bgpd can't parase unsupported sub-type of PREFIX_SID.
PREFIX_SID is drafted on draft-ietf-idr-bgp-prefix-sid-27.
There are already new sub-type drafted on
draft-dawra-idr-srv6-vpn-05. (Type5,6 is new defined.)
This commit fix the problem reported as #5277 on GitBub.

Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2019-11-05 03:41:53 +00:00
Quentin Young 8a6b34c260 doc: clean up && index topotest json docs
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-11-04 18:51:31 +00:00
Jafar Al-Gharaibeh ba3afa4c2c
Merge pull request #5275 from opensourcerouting/emacs-conf
tools: fix emacs configuration file
2019-11-04 11:01:25 -06:00
Renato Westphal c6d345e4a4 topotest: update the LDP VPLS test
The final test case of this topotest wasn't really testing
anything. Do the following changes to fix this:
* Remove "no link-detect" from the zebra configs so that link down
  failures are detected immediately;
* After shutting down the interface between r1 and r2, wait five
  seconds before testing if the pseudowires reconverged through
  the r3 router.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-11-04 13:05:47 -03:00
Renato Westphal a89241b42d topotest: enable MPLS processing on all interfaces by default
This is necessary to make some tests work correctly. Only topologies
created using the topogen framework benefit from this change.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-11-04 13:05:47 -03:00
Donatas Abraitis e536181ef0
Merge pull request #5265 from Jafaral/deb-changes
tools: generate .changes file required for deb pkg upload
2019-11-04 17:06:40 +02:00
Rafael Zalamena 3a0f661844 tools: fix emacs configuration file
It was missing a set of parentheses and a dot before
`indent-tabs-mode'.

More information here:
https://www.gnu.org/software/emacs/manual/html_node/emacs/Directory-Variables.html#Directory-Variables

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-11-04 11:45:52 -03:00
Donald Sharp 2bbb98d60f
Merge pull request #5272 from vincentbernat/fix/debian-copyright
debian: update debian/copyright
2019-11-03 15:05:22 -05:00
Vincent Bernat 6d8adf6b23 debian: update debian/copyright
Some authors are added in the "GPL-2+" section, notably Alexandre
Cassen for the code in `vrrpd/`, and Cumulus Networks and Open Source
Routing which were uncredited despite many occurrence in the headers.

Signed-off-by: Vincent Bernat <vincent@bernat.ch>
2019-11-03 18:36:18 +01:00
Donald Sharp f609709a58 lib, ospfd, zebra: Convert interface_delete to take double pointer
When free'ing the interface pointer, set it to NULL.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-02 16:13:44 -04:00
Donald Sharp 721c08573a *: Convert connected_free to a double pointer
Set the connected pointer to set the pointer to NULL.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-02 16:13:44 -04:00
Donald Sharp 63265b5c1f *: Convert prefix_free to double pointer
Have the prefix_free code take a double pointer to free the data.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-02 16:13:44 -04:00
Stephen Worley c7c0b007a4 zebra: separate zebra_vrf_lookup_table_with_id()
We were creating `other` tables in rib_del(), vty commands, and
dataplane return callback via the zebra_vrf_table_with_table_id()
API.

Seperate the API into only a lookup, never create
and added another with `get` in the name (following the standard
we use in other table APIs).

Then changed the rib_del(), rib_find_rn_from_ctx(), and show route
summary vty command to use the lookup API instead.

This was found via a crash where two different vrfs though they owned
the table. On delete, one free'd all the nodes, and then the other tried
to use them. It required specific timing of a VRF existing, going away,
and coming back again to cause the crash.

=23464== Invalid read of size 8
==23464==    at 0x179EA4: rib_dest_from_rnode (rib.h:433)
==23464==    by 0x17ACB1: zebra_vrf_delete (zebra_vrf.c:253)
==23464==    by 0x48F3D45: vrf_delete (vrf.c:243)
==23464==    by 0x48F4468: vrf_terminate (vrf.c:532)
==23464==    by 0x13D8C5: sigint (main.c:172)
==23464==    by 0x48DD25C: quagga_sigevent_process (sigevent.c:105)
==23464==    by 0x48F0502: thread_fetch (thread.c:1417)
==23464==    by 0x48AC82B: frr_run (libfrr.c:1023)
==23464==    by 0x13DD02: main (main.c:483)
==23464==  Address 0x5152788 is 104 bytes inside a block of size 112 free'd
==23464==    at 0x48369AB: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==23464==    by 0x48B25B8: qfree (memory.c:129)
==23464==    by 0x48EA335: route_node_destroy (table.c:500)
==23464==    by 0x48E967F: route_node_free (table.c:90)
==23464==    by 0x48E9742: route_table_free (table.c:124)
==23464==    by 0x48E9599: route_table_finish (table.c:60)
==23464==    by 0x170CEA: zebra_router_free_table (zebra_router.c:165)
==23464==    by 0x170DB4: zebra_router_release_table (zebra_router.c:188)
==23464==    by 0x17AAD2: zebra_vrf_disable (zebra_vrf.c:222)
==23464==    by 0x48F3F0C: vrf_disable (vrf.c:313)
==23464==    by 0x48F3CCF: vrf_delete (vrf.c:223)
==23464==    by 0x48F4468: vrf_terminate (vrf.c:532)
==23464==  Block was alloc'd at
==23464==    at 0x4837B65: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==23464==    by 0x48B24A2: qcalloc (memory.c:110)
==23464==    by 0x48EA2FE: route_node_create (table.c:488)
==23464==    by 0x48E95C7: route_node_new (table.c:66)
==23464==    by 0x48E95E5: route_node_set (table.c:75)
==23464==    by 0x48E9EA9: route_node_get (table.c:326)
==23464==    by 0x48E1EDB: srcdest_rnode_get (srcdest_table.c:244)
==23464==    by 0x16EA4B: rib_add_multipath (zebra_rib.c:2730)
==23464==    by 0x1A5310: zread_route_add (zapi_msg.c:1592)
==23464==    by 0x1A7B8E: zserv_handle_commands (zapi_msg.c:2579)
==23464==    by 0x19D689: zserv_process_messages (zserv.c:523)
==23464==    by 0x48F09F8: thread_call (thread.c:1599)

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-11-01 16:06:19 -04:00
Jafar Al-Gharaibeh e8e4d6ec03 tools: generate .changes file required for deb pkg upload
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2019-11-01 11:30:26 -05:00
Mark Stapp 7a6fc8774d
Merge pull request #5263 from donaldsharp/pim_excessive_warnings
pimd: Do not spew a million warnings
2019-11-01 12:13:00 -04:00
Rafael Zalamena 845e689ea0
Merge pull request #5258 from dslicenc/ospf-bfd
ospf: BFD down not tearing down OSPF adjacency for point-to-point net…
2019-11-01 11:22:56 -03:00
Donald Sharp 889a75be0d pimd: Do not spew a million warnings
We have a zlog_warn that is unguarded ( and really is a debug message )
as that there is nothing the end user can do and nothing to note
here other than a debug message to track refcounts.  Change
to an appropriate debug and zlog_debug it instead.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-01 10:11:13 -04:00
Martin Winter 0106c0236e
Merge pull request #5168 from donaldsharp/dev_workflow
doc: Update documentation to talk about development branches
2019-11-01 10:09:00 -04:00
Donald Sharp 16318c5cdc doc: Update documentation to talk about development branches
As per weekly meeting this is an attempt to document about
how we as a community will work together on development
branches.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-31 20:55:08 -04:00
Mark Stapp 743dd5f618 zebra: Add a sample dataplane plugin module
Add a dataplane plugin module as a sample or reference for
folks who might like to integrate with the zebra dataplane
subsystem. This isn't part of the FRR build or product; there
are some simple build and load-at-runtime instructions in
comments in the file.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-10-31 16:24:16 -04:00
Radhika Mahankali 6e641a8f2e ospf: BFD down not tearing down OSPF adjacency for point-to-point network
Root Cause:
Lookup for the point-to-point neighbor was failing because the neighbor
lookup was based on neighbor interface IP address. But, for point-to-point
neighbor the key is router-id for lookup. Lookup failure was causing the
BFD updates from PTM to get dropped.

Fix:
Added walk of the neighbor list if the network type is point-to-point to
find the appropriate neighbor. The match is based on source IP address of
the neighbor since that’s the address registered with BFD for monitoring.

Ticket: CM-20411
Signed-off-by: Radhika Mahankali <radhika@cumulusnetworks.com>
2019-10-31 11:11:44 +00:00
Donatas Abraitis f149ebd9a7
Merge pull request #5248 from opensourcerouting/bgp-sender-as-path-loop-detection
bgpd: sender side AS path loop detection
2019-10-31 08:36:33 +02:00
Renato Westphal e13d98376d
Merge pull request #5237 from ton31337/fix/doc_bgp_redistribute_vpn
doc: Add redistribute vnc-direct command and fix typo in redistribute vnc
2019-10-30 20:47:04 -03:00
Mark Stapp f9688ae659
Merge pull request #5251 from qlyoung/vrrp-startup-logs-more
vrrpd: some more error logging fixes
2019-10-30 14:00:33 -04:00
Quentin Young e64f235bc4
Merge pull request #5186 from opensourcerouting/nb-cbs-reorg
northbound callbacks reorganization
2019-10-30 13:59:13 -04:00
Renato Westphal f5f0a0e302 tools: update the northbound callbacks generator
Add a new '-s' option which controls whether the generated northbound
callbacks are declared with the 'static' specifier or not. If not
(the default), a prototype is generated for each callback before
their declarations.

It's suggested that daemons shouldn't use the '-s' option so that
their northbound callbacks can be implemented in different files
according to their class (config, state, rpc or notification).

libfrr commands, on the other hand, can use the '-s' option when
their associated YANG module is too small and putting all callbacks
in the same file is desirable.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-10-30 10:32:51 -03:00