]> git.proxmox.com Git - mirror_frr.git/log
mirror_frr.git
6 years agobuild: include our own copies of some linux kernel headers
Renato Westphal [Thu, 21 Sep 2017 01:12:56 +0000 (22:12 -0300)]
build: include our own copies of some linux kernel headers

This is the definitive solution to avoid build issues on old Linux
systems, where the system kernel headers might not contain some constants
or macros used by FRR (e.g. MPLS_IPTUNNEL_DST, introduced on 2015).

This is the same strategy adopted by other projects, like iproute2,
libnl, lldpd, strongswan, etc. These header files don't need to be in
sync with upstream, they only need to be updated when necessary (e.g. if
we want to use a new feature introduced by a recent kernel).

Fixes #962 using the solution suggested by David Lamparter.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agoMerge pull request #1341 from chiragshah6/ospf_vrf_dev
Renato Westphal [Mon, 23 Oct 2017 13:27:02 +0000 (11:27 -0200)]
Merge pull request #1341 from chiragshah6/ospf_vrf_dev

ospf6d: Divide LSupdate to keep size small

6 years agoMerge pull request #1353 from opensourcerouting/rpm-fix-master
Donald Sharp [Mon, 23 Oct 2017 12:33:30 +0000 (08:33 -0400)]
Merge pull request #1353 from opensourcerouting/rpm-fix-master

Rpm fix master

6 years agoMerge pull request #1349 from opensourcerouting/bgpd_listen_queue
Donald Sharp [Sat, 21 Oct 2017 12:19:09 +0000 (08:19 -0400)]
Merge pull request #1349 from opensourcerouting/bgpd_listen_queue

bgpd: bump listen() backlog

6 years agoredhat: Fix doc by removing outdated package information and point to main doc/ direc...
Martin Winter [Sat, 21 Oct 2017 01:22:24 +0000 (18:22 -0700)]
redhat: Fix doc by removing outdated package information and point to main doc/ directory for it

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
6 years agoredhat: Fix rpm scripts to correctly restart daemons on upgrade
Martin Winter [Fri, 20 Oct 2017 23:33:39 +0000 (16:33 -0700)]
redhat: Fix rpm scripts to correctly restart daemons on upgrade

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
6 years agoredhat: Add fix to correct watchfrr config during upgrade
Martin Winter [Fri, 20 Oct 2017 21:06:05 +0000 (14:06 -0700)]
redhat: Add fix to correct watchfrr config during upgrade

- /etc/frr/daemon is a config file and won't be replaced, do quick sed fix
- Updated changelog

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
Conflicts:
redhat/frr.spec.in

6 years agoredhat: systemd file should not be executable
Martin Winter [Fri, 20 Oct 2017 02:36:59 +0000 (19:36 -0700)]
redhat: systemd file should not be executable

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
6 years agoredhat: Always reference main frr start/stop script in /usr/lib/frr
Martin Winter [Fri, 20 Oct 2017 01:02:45 +0000 (18:02 -0700)]
redhat: Always reference main frr start/stop script in /usr/lib/frr

* Fixes issue where daemon default config tried to use /etc/init.d/frr script which doesn't exist on systemd systems

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
Conflicts:
redhat/daemons

6 years agoospf6d: Divide LSupdate to keep size small
Chirag Shah [Wed, 18 Oct 2017 04:54:29 +0000 (21:54 -0700)]
ospf6d: Divide LSupdate to keep size small

Within OSPFv3 area, Disect Router LSA and
Intra-prefix LSA in order to keep LSA size Small.
Each LSA has unique Link State ID assigned.

Intra-Area-Prefix LSA:
Spread prefixes across multiple intra-area-prefix-LSAs.

Ticket:CM-18069
Testing Done:
Tested 92 ospf6 enabled (point-to-point) interfaces
between two routers.
92 adajancy comes up with Full Neighborship.
Validated 'show ipv6 ospf6 database router detail' &
'show ipv6 ospf6 database intra-prefix detail', each adv-router
has two distinct LSA of such catgory.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
6 years agobgpd: bump listen() backlog
Rafael Zalamena [Fri, 20 Oct 2017 21:29:07 +0000 (19:29 -0200)]
bgpd: bump listen() backlog

Handle better stress situations when multiple peers are trying to
connect at the same time by bumping the TCP connection backlog limit.

This reduces the convergence time of BGPerf stress test.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
6 years agoMerge pull request #1347 from medallia/all-routes-to-fpm
Donald Sharp [Fri, 20 Oct 2017 17:43:20 +0000 (13:43 -0400)]
Merge pull request #1347 from medallia/all-routes-to-fpm

Send all routes to FPM, including VRF and multicast

6 years agoSend all routes to FPM, including VRF and multicast
Thorvald Natvig [Fri, 20 Oct 2017 06:34:42 +0000 (23:34 -0700)]
Send all routes to FPM, including VRF and multicast

Signed-off-by: Thorvald Natvig <thorvald@medallia.com>
6 years agoMerge pull request #1331 from donaldsharp/hash_speedup
Renato Westphal [Thu, 19 Oct 2017 01:52:41 +0000 (23:52 -0200)]
Merge pull request #1331 from donaldsharp/hash_speedup

lib: Allow hash_get to sidestep expensive hash key generation in someā€¦

6 years agoMerge pull request #1332 from chiragshah6/ospf_vrf_dev
Renato Westphal [Thu, 19 Oct 2017 01:46:48 +0000 (23:46 -0200)]
Merge pull request #1332 from chiragshah6/ospf_vrf_dev

ospf6d: Handle lsupdate upto max ospf6 payload

6 years agoMerge pull request #1272 from donaldsharp/peer_group_ordering
Renato Westphal [Thu, 19 Oct 2017 01:12:31 +0000 (23:12 -0200)]
Merge pull request #1272 from donaldsharp/peer_group_ordering

bgpd: Fix peer group copying of data for late activation

6 years agoMerge pull request #1339 from donaldsharp/bgp_compile_issues
Martin Winter [Thu, 19 Oct 2017 00:05:46 +0000 (17:05 -0700)]
Merge pull request #1339 from donaldsharp/bgp_compile_issues

Bgp compile issues

6 years agobgpd: Fix 'not initialized' possibly on older compilers
Donald Sharp [Wed, 18 Oct 2017 22:39:04 +0000 (18:39 -0400)]
bgpd: Fix 'not initialized' possibly on older compilers

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agobgpd: Fix off by one error introduced by 8c9cc7bbf657e3440d9bc758fe45aef5f43c989f
Donald Sharp [Wed, 18 Oct 2017 22:37:38 +0000 (18:37 -0400)]
bgpd: Fix off by one error introduced by 8c9cc7bbf657e3440d9bc758fe45aef5f43c989f

Commit 8c9cc7bbf657e3440d9bc758fe45aef5f43c989f changed the size
of the `struct bgp_attr_encap_subtlv` type to be a zero length
array at the end instead of having a 1 byte.  All memory allocations
for this subsuquently were off by 1 byte since those were not
adjusted either.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoMerge pull request #1333 from donaldsharp/command_py_leak
Jafar Al-Gharaibeh [Wed, 18 Oct 2017 04:03:43 +0000 (23:03 -0500)]
Merge pull request #1333 from donaldsharp/command_py_leak

lib: Fix small memory leak when using command_py.c

6 years agoMerge pull request #1334 from donaldsharp/large_number
Lou Berger [Wed, 18 Oct 2017 01:56:23 +0000 (21:56 -0400)]
Merge pull request #1334 from donaldsharp/large_number

Large number

6 years agobgpd: Display unsigned ints
Donald Sharp [Wed, 18 Oct 2017 00:57:40 +0000 (20:57 -0400)]
bgpd: Display unsigned ints

We are storing data as an unsigned int and we should not
display it as a signed number.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agolib: Display unsigned instead of signed
Donald Sharp [Wed, 18 Oct 2017 00:49:15 +0000 (20:49 -0400)]
lib: Display unsigned instead of signed

When displaying thread cpu data, display unsigned instead
of signed data when we get really really really large
numbers of invocations.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agolib: Fix small memory leak when using command_py.c
Donald Sharp [Tue, 17 Oct 2017 13:22:41 +0000 (09:22 -0400)]
lib: Fix small memory leak when using command_py.c

When free'ing memory associated with the wgraph, also
free memory malloced during the initialization.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoMerge pull request #1308 from chiragshah6/mdev1
Olivier Dugeon [Tue, 17 Oct 2017 08:28:37 +0000 (10:28 +0200)]
Merge pull request #1308 from chiragshah6/mdev1

ospfd: fix ospf nssa command

6 years agoospf6d: Handle lsupdate upto max ospf6 payload
Chirag Shah [Thu, 12 Oct 2017 22:10:50 +0000 (15:10 -0700)]
ospf6d: Handle lsupdate upto max ospf6 payload

While traversing LSUpdate list, if LSUpdate message
fills up (w/ LSAs) to the interface MTU size,
Send the existing filled LSUpdate message if max
payload exceeds max ospf6 payload,
reset sendbuf (buffer) to fill rest of
the remaining LSAs.

Add relevant fields to debugs.

Ticket:CM-18069

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
6 years agoMerge pull request #1290 from qlyoung/doc-commit-msgs
Jafar Al-Gharaibeh [Tue, 17 Oct 2017 04:36:19 +0000 (23:36 -0500)]
Merge pull request #1290 from qlyoung/doc-commit-msgs

doc: add docs for commit message format

6 years agoMerge pull request #1300 from chiragshah6/mdev
Jafar Al-Gharaibeh [Tue, 17 Oct 2017 04:35:16 +0000 (23:35 -0500)]
Merge pull request #1300 from chiragshah6/mdev

ospf6d: fix ospf6d crash during sigterm/shutdown

6 years agoMerge pull request #1324 from donaldsharp/bgp_aspath
Lou Berger [Mon, 16 Oct 2017 18:51:02 +0000 (14:51 -0400)]
Merge pull request #1324 from donaldsharp/bgp_aspath

bgpd: Add ability to display information about bestpath in json

6 years agolib: No need to call apply_mask 2 times
Donald Sharp [Mon, 16 Oct 2017 18:47:08 +0000 (14:47 -0400)]
lib: No need to call apply_mask 2 times

route_node_set is only called by route_node_get
which calls apply_mask.  There is no need to do
this again.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agolib: Allow hash_get to sidestep expensive hash key generation in some cases
Donald Sharp [Mon, 16 Oct 2017 17:56:01 +0000 (13:56 -0400)]
lib: Allow hash_get to sidestep expensive hash key generation in some cases

There is no need to generate a hash key *if* the hash_alloc_function
is NULL and the hash is empty.

This changed showed a measurable increase in performance for
table hash lookup for tables that were meant to be empty in
bgp( the distance commands ).

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoospfd: fix ospf nssa command
Chirag Shah [Sat, 7 Oct 2017 20:26:13 +0000 (13:26 -0700)]
ospfd: fix ospf nssa command

-Fix ordering of nssa command with translate options
and no-summary option.
Just like ospf stub no-summary keep the order order
of nssa no-summary.
- Fix NSSA options.
- Avoid displaying translate-candiate (default) option
in running-config.

cumulus(config-router)# area 2.2.2.2 nssa
  <cr>
  no-summary           Do not inject inter-area routes into nssa
  translate-always     Configure NSSA-ABR to always translate
  translate-candidate  Configure NSSA-ABR for translate election (default)
  translate-never      Configure NSSA-ABR to never translate

Running-config output:
router ospf
 area 2.2.2.2 nssa translate-always
 area 2.2.2.2 nssa no-summary

Ticket:CM-8312

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
6 years agoMerge pull request #1313 from LabNConsulting/working/master/patch-set/block-non-core...
Donald Sharp [Mon, 16 Oct 2017 16:00:59 +0000 (12:00 -0400)]
Merge pull request #1313 from LabNConsulting/working/master/patch-set/block-non-core-fix-assert

bgpd: only allow unicast|multicast config commands in non-core BGP instances

6 years agoMerge pull request #1298 from opensourcerouting/iface-rb-tree
Donald Sharp [Mon, 16 Oct 2017 16:00:38 +0000 (12:00 -0400)]
Merge pull request #1298 from opensourcerouting/iface-rb-tree

Use rb-trees to store interfaces instead of linked-lists

6 years agoMerge pull request #1305 from donaldsharp/workqueue
Renato Westphal [Wed, 11 Oct 2017 14:59:15 +0000 (11:59 -0300)]
Merge pull request #1305 from donaldsharp/workqueue

lib: Free workqueue memory leak on free

6 years agoMerge pull request #1317 from donaldsharp/babel_mem
Renato Westphal [Wed, 11 Oct 2017 14:16:17 +0000 (11:16 -0300)]
Merge pull request #1317 from donaldsharp/babel_mem

babeld: Do not copy beyond end of data

6 years agolib: Free workqueue memory leak on free
Donald Sharp [Sat, 7 Oct 2017 01:40:08 +0000 (21:40 -0400)]
lib: Free workqueue memory leak on free

When free'ing the workqueue if you have items
on the workqueue you should free the memory associated
with it.

Additionally move the work_queue_item_remove function
to allow for static to be awesome

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoMerge pull request #1322 from donaldsharp/ospf6_proto
Renato Westphal [Wed, 11 Oct 2017 13:48:20 +0000 (10:48 -0300)]
Merge pull request #1322 from donaldsharp/ospf6_proto

ospf6d: Make ospf6_prefix have an empty v6 addr at end

6 years agoospf6d: Make ospf6_prefix have an empty v6 addr at end
Donald Sharp [Tue, 10 Oct 2017 17:07:16 +0000 (13:07 -0400)]
ospf6d: Make ospf6_prefix have an empty v6 addr at end

The `struct ospf6_prefix` type expects to have space allocated
at the end of the structure for a v6 prefix.  So let's tell
the compiler that there might be more there.  This is to fix
a coverity scan warning.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agobgpd: Add ability to display information about bestpath in json
Donald Sharp [Tue, 10 Oct 2017 20:30:36 +0000 (16:30 -0400)]
bgpd: Add ability to display information about bestpath in json

When retrieving information about neighbors or summary in json
add some information about what bestPath particulars we have for
this bgp session.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoMerge pull request #1120 from donaldsharp/branch_million
Martin Winter [Wed, 11 Oct 2017 07:36:07 +0000 (00:36 -0700)]
Merge pull request #1120 from donaldsharp/branch_million

configure: Have --enable-dev turn on better debugging.

6 years agoMerge pull request #1323 from donaldsharp/ospf_list_delete
Renato Westphal [Tue, 10 Oct 2017 23:59:45 +0000 (20:59 -0300)]
Merge pull request #1323 from donaldsharp/ospf_list_delete

ospfd: Fix ships in the night PR's and list_delete

6 years agoospfd: Do not delete write_q 2 times either
Donald Sharp [Tue, 10 Oct 2017 21:35:19 +0000 (17:35 -0400)]
ospfd: Do not delete write_q 2 times either

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoospfd: We should not be deleting ospf->oiflist 2 times
Donald Sharp [Tue, 10 Oct 2017 21:08:32 +0000 (17:08 -0400)]
ospfd: We should not be deleting ospf->oiflist 2 times

The ospf->oiflist deletion is happening 2 times now.
Let's delete it once only.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoospfd: Fix ships in the night PR's and list_delete
Donald Sharp [Tue, 10 Oct 2017 17:33:14 +0000 (13:33 -0400)]
ospfd: Fix ships in the night PR's and list_delete

list_delete_and_null should be used.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoMerge pull request #1304 from chiragshah6/ospf_vrf_dev
Renato Westphal [Tue, 10 Oct 2017 18:14:21 +0000 (15:14 -0300)]
Merge pull request #1304 from chiragshah6/ospf_vrf_dev

ospfd: OSPFv2 VRF, add vrf_name in show command output

6 years agoMerge pull request #1316 from donaldsharp/high_stuff
Renato Westphal [Tue, 10 Oct 2017 17:51:02 +0000 (14:51 -0300)]
Merge pull request #1316 from donaldsharp/high_stuff

High stuff

6 years agoMerge pull request #1319 from opensourcerouting/ldpd-use-after-free
Donald Sharp [Tue, 10 Oct 2017 16:57:22 +0000 (12:57 -0400)]
Merge pull request #1319 from opensourcerouting/ldpd-use-after-free

ldpd: fix heap-use-after-free at exit

6 years agoospfd: OSPFv2 VRF abstact api
Chirag Shah [Fri, 6 Oct 2017 22:32:25 +0000 (15:32 -0700)]
ospfd: OSPFv2 VRF abstact api

Create an api to display vrf name in vty or json format.
Use VRF Name for vtysh and vrfName for json output.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
6 years agoMerge pull request #1314 from donaldsharp/pim_rpf_address
Jafar Al-Gharaibeh [Tue, 10 Oct 2017 16:42:26 +0000 (11:42 -0500)]
Merge pull request #1314 from donaldsharp/pim_rpf_address

Pim rpf address

6 years agoospfd: OSPFv2 VRF, vrf in show command output
Chirag Shah [Sun, 17 Sep 2017 22:44:39 +0000 (15:44 -0700)]
ospfd: OSPFv2 VRF, vrf in show command output

Add VRF name in both vtysh and json format of
show commands.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
6 years agoospfd: Free memory associated with ospf instance startup
Donald Sharp [Wed, 4 Oct 2017 12:04:00 +0000 (08:04 -0400)]
ospfd: Free memory associated with ospf instance startup

We have memory that is initialized upon ospf instance
and area startup.  Free it up on shutdown.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoripngd: Fix possible memory leak of route_node
Donald Sharp [Wed, 4 Oct 2017 11:55:58 +0000 (07:55 -0400)]
ripngd: Fix possible memory leak of route_node

There exists a path where we do not save the route_node
after creation.  Allow cleanup.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agolib: Add some documentation about argv_find
Donald Sharp [Tue, 10 Oct 2017 16:29:54 +0000 (12:29 -0400)]
lib: Add some documentation about argv_find

We expect that the index value passed in for argv_find
should be initially set to 0.  This way if the cli
ever changes there is no need to modify the initial
value.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agolib: Fix missing va_end
Donald Sharp [Mon, 9 Oct 2017 20:23:30 +0000 (16:23 -0400)]
lib: Fix missing va_end

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoospfd: Fix leak of route_node
Donald Sharp [Mon, 9 Oct 2017 20:09:48 +0000 (16:09 -0400)]
ospfd: Fix leak of route_node

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoospfd: Fix leak of stream
Donald Sharp [Mon, 9 Oct 2017 20:09:23 +0000 (16:09 -0400)]
ospfd: Fix leak of stream

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoospfd: Fix memory leak
Donald Sharp [Mon, 9 Oct 2017 20:08:45 +0000 (16:08 -0400)]
ospfd: Fix memory leak

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoospfd: Fix leak of FD
Donald Sharp [Mon, 9 Oct 2017 20:08:08 +0000 (16:08 -0400)]
ospfd: Fix leak of FD

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agopimd: Fix uninited idx for argv_find
Donald Sharp [Mon, 9 Oct 2017 20:06:06 +0000 (16:06 -0400)]
pimd: Fix uninited idx for argv_find

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoisisd: Fix leaked memory in error case
Donald Sharp [Sat, 7 Oct 2017 12:53:35 +0000 (08:53 -0400)]
isisd: Fix leaked memory in error case

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoMerge pull request #1210 from opensourcerouting/misc-mpls-bgp-lu-fixes
Donald Sharp [Tue, 10 Oct 2017 16:19:37 +0000 (12:19 -0400)]
Merge pull request #1210 from opensourcerouting/misc-mpls-bgp-lu-fixes

Misc BGP-LU fixes

6 years agoMerge pull request #1315 from dslicenc/bgp-interface
Renato Westphal [Tue, 10 Oct 2017 15:25:23 +0000 (12:25 -0300)]
Merge pull request #1315 from dslicenc/bgp-interface

bgpd: check for bgp instance before processing interfaces

6 years agoldpd: send correct notification code upon receipt of malformed packet
Renato Westphal [Tue, 10 Oct 2017 12:41:26 +0000 (09:41 -0300)]
ldpd: send correct notification code upon receipt of malformed packet

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agoldpd: fix heap-use-after-free at exit
Renato Westphal [Tue, 10 Oct 2017 12:22:41 +0000 (09:22 -0300)]
ldpd: fix heap-use-after-free at exit

This problems happens because, in this port, whenever the child
processes want to log something they send a message to the parent. But
in the shutdown functions the first thing we do is to close the pipes
to the parent process. With that said, add some protections to prevent
the child processes from trying to use a closed pipe and just ignore
their log messages during shutdown. In the future we need to share
the logging configuration with the child processes so they can send
log messages on their own.

While here, remove some unnecessary calls to msgbuf_write() in
ldpe_shutdown().

Fixes #1253.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years ago*: use the FOR_ALL_INTERFACES abstraction from babeld
Renato Westphal [Fri, 6 Oct 2017 18:25:58 +0000 (15:25 -0300)]
*: use the FOR_ALL_INTERFACES abstraction from babeld

This improves code readability and also future-proofs our codebase
against new changes in the data structure used to store interfaces.

The FOR_ALL_INTERFACES_ADDRESSES macro was also moved to lib/ but
for now only babeld is using it.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agoospf6d: Add missing vrf lookup
Donald Sharp [Fri, 6 Oct 2017 12:41:36 +0000 (08:41 -0400)]
ospf6d: Add missing vrf lookup

The vrf lookup was missed in this conversion?

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agolib: fix bug in if_cmp_name_func()
Renato Westphal [Wed, 4 Oct 2017 23:13:56 +0000 (20:13 -0300)]
lib: fix bug in if_cmp_name_func()

If the p1 and p2 arguments pointed to identical strings ending with
a non-numeric character (e.g. "lo"), this function would return -1
instead of 0 as one would expect. This inconsistency didn't matter
for sorted linked-lists but for red-black trees it's a major source
of problems.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years ago*: introduce new rb-tree to optimize interface lookup by ifindex
Renato Westphal [Tue, 3 Oct 2017 01:06:04 +0000 (22:06 -0300)]
*: introduce new rb-tree to optimize interface lookup by ifindex

Performance tests showed that, when running on a system with a large
number of interfaces, some daemons would spend a considerable amount
of time in the if_lookup_by_index() function. Introduce a new rb-tree
to solve this problem.

With this change, we need to use the if_set_index() function whenever
we want to change the ifindex of an interface. This is necessary to
ensure that the 'ifaces_by_index' rb-tree is updated accordingly. The
return value of all insert/remove operations in the interface rb-trees
is checked to ensure that an error is logged if a corruption is
detected.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years ago*: eliminate IFINDEX_DELETED in favor of IFINDEX_INTERNAL
Renato Westphal [Tue, 3 Oct 2017 01:06:03 +0000 (22:06 -0300)]
*: eliminate IFINDEX_DELETED in favor of IFINDEX_INTERNAL

IFINDEX_DELETED is not necessary anymore as we moved from a global
list of interfaces to a list of interfaces per VRF.

This reverts commit 84361d615.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years ago*: use rb-trees to store interfaces instead of sorted linked-lists
Renato Westphal [Tue, 3 Oct 2017 01:06:01 +0000 (22:06 -0300)]
*: use rb-trees to store interfaces instead of sorted linked-lists

This is an important optimization for users running FRR on systems with
a large number of interfaces (e.g. thousands of tunnels). Red-black
trees scale much better than sorted linked-lists and also store the
elements in an ordered way (contrary to hash tables).

This is a big patch but the interesting bits are all in lib/if.[ch].

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agolib: register 'if_var_handlers' only once
Renato Westphal [Tue, 3 Oct 2017 01:06:00 +0000 (22:06 -0300)]
lib: register 'if_var_handlers' only once

There's no need to register 'if_var_handlers' for every VRF, we need
to do it only once.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agolib: nuke the if_*_by_name_len() functions
Renato Westphal [Tue, 3 Oct 2017 01:05:57 +0000 (22:05 -0300)]
lib: nuke the if_*_by_name_len() functions

Make use of strnlen() and strlcpy() so we can get rid of these
convoluted if_*_by_name_len() functions.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agoMerge pull request #1301 from donaldsharp/zebra_vxlan
Renato Westphal [Tue, 10 Oct 2017 12:00:44 +0000 (09:00 -0300)]
Merge pull request #1301 from donaldsharp/zebra_vxlan

Zebra vxlan

6 years agorfapi: whitespace change and add debug check
Lou Berger [Tue, 10 Oct 2017 11:29:40 +0000 (07:29 -0400)]
rfapi: whitespace change and add debug check

Signed-off-by: Lou Berger <lberger@labn.net>
6 years agobabeld: Do not copy beyond end of data
Donald Sharp [Mon, 9 Oct 2017 20:36:52 +0000 (16:36 -0400)]
babeld: Do not copy beyond end of data

The function really_send_update takes a 'const unsigned char *id'.
and is called with myid(a 8 byte array) and route->src->id(an 8
byte array), but we copy these pointers into
babel_ifp->buffered_id which is a 16 byte array.

Adjust the size of buffered_id to be 8 bytes and fix the copy
to only copy the 8 bytes.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoMerge pull request #1297 from dslicenc/cm18154-import-table
Renato Westphal [Mon, 9 Oct 2017 23:27:57 +0000 (20:27 -0300)]
Merge pull request #1297 from dslicenc/cm18154-import-table

zebra: resolve issue with importing table entries correctly

6 years agozebra: use a switch statement in nexthop_set_resolved()
Renato Westphal [Wed, 20 Sep 2017 03:04:58 +0000 (00:04 -0300)]
zebra: use a switch statement in nexthop_set_resolved()

This makes the function much easier to read, and also faster.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agobgpd: remove 'network' commands from the BGP_IPV6L node
Renato Westphal [Wed, 20 Sep 2017 03:04:04 +0000 (00:04 -0300)]
bgpd: remove 'network' commands from the BGP_IPV6L node

These commands don't belong in the BGP_IPV6L_NODE node anymore. A similar
change was done for BGP_IPV4L_NODE in commit 9bedbb1e5.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agozebra: fix uninitialized prefixes in the handling of FEC messages
Renato Westphal [Wed, 20 Sep 2017 03:02:50 +0000 (00:02 -0300)]
zebra: fix uninitialized prefixes in the handling of FEC messages

This was causing some weird prefixes to pop up in my log files. One
alternate solution would be to call apply_mask() on the prefix, but
memcpy() is faster and just enough in this case.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agozebra: fix logging of MPLS labels
Renato Westphal [Wed, 20 Sep 2017 03:02:01 +0000 (00:02 -0300)]
zebra: fix logging of MPLS labels

* use %u instead of %d, we don't want to print negative labels;
* increase the size of label_buf to accommodate the worst case scenarios;
* use strlcat() instead of strcat() as a security best practice.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agoMerge pull request #1237 from donaldsharp/distance_special
Renato Westphal [Mon, 9 Oct 2017 23:11:39 +0000 (20:11 -0300)]
Merge pull request #1237 from donaldsharp/distance_special

zebra: Modify metric read to be admin distance and metric

6 years agobgpd: check for bgp instance before processing interfaces
Don Slice [Mon, 9 Oct 2017 15:22:52 +0000 (15:22 +0000)]
bgpd: check for bgp instance before processing interfaces

Problem reported with the log displaying error messages if bgpd was
enabled in /etc/frr/daemons but bgp wasn't actually configured.  The
problem was due to operating on interfaces before if_create had been
called (which happens at "router bgp" not at frr starting.  Moved the
checks for the bgp instance before operating on interfaces.  Manual
testing successful and bgp-smoke completed with no new issues.

Ticket: CM-13504
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: CCR-6738
6 years agobgpd: only allow unicast|multicast SAFIs in VRF/View (i.e., non-core) BGP instances
Lou Berger [Mon, 9 Oct 2017 13:45:17 +0000 (09:45 -0400)]
bgpd: only allow unicast|multicast SAFIs in VRF/View (i.e., non-core) BGP instances

Signed-off-by: Lou Berger <lberger@labn.net>
6 years agorfapi: block vnc commands on vrfs/views
Lou Berger [Mon, 9 Oct 2017 13:18:10 +0000 (09:18 -0400)]
rfapi: block vnc commands on vrfs/views

Signed-off-by: Lou Berger <lberger@labn.net>
6 years agorfapi: explicitly test against success of is_configured.
Lou Berger [Mon, 9 Oct 2017 13:16:32 +0000 (09:16 -0400)]
rfapi: explicitly test against success of is_configured.

Signed-off-by: Lou Berger <lberger@labn.net>
6 years agorfapi: remove vestigial assert
Lou Berger [Mon, 9 Oct 2017 13:14:24 +0000 (09:14 -0400)]
rfapi: remove vestigial assert

Signed-off-by: Lou Berger <lberger@labn.net>
6 years agopimd: Cleanup deep nesting in pim_cmd.c
Donald Sharp [Mon, 9 Oct 2017 14:54:20 +0000 (10:54 -0400)]
pimd: Cleanup deep nesting in pim_cmd.c

Cleanup some deep nesting in pim_cmd.c so that functions
look easier on the eyes.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agopimd: Display RPF address as part of json output
Donald Sharp [Mon, 9 Oct 2017 14:31:24 +0000 (10:31 -0400)]
pimd: Display RPF address as part of json output

When displaying the 'show ip pim upstream' command.
Display proper information about the RPF address
choosen.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoMerge pull request #1312 from donaldsharp/snmp_compile
Lou Berger [Mon, 9 Oct 2017 13:53:51 +0000 (09:53 -0400)]
Merge pull request #1312 from donaldsharp/snmp_compile

ospf6d: Fix snmp compile breakage

6 years agoospf6d: Fix snmp compile breakage
Donald Sharp [Mon, 9 Oct 2017 12:54:30 +0000 (08:54 -0400)]
ospf6d: Fix snmp compile breakage

The recent clang fixes for Static Analysis were run without
compiling `--enable-snmp` these changes broke the snmp build.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoMerge pull request #1310 from vjardin6WIND/null_references
Donald Sharp [Mon, 9 Oct 2017 12:16:04 +0000 (08:16 -0400)]
Merge pull request #1310 from vjardin6WIND/null_references

lib: linklist avoid access NULL->data

6 years agoMerge pull request #1309 from vjardin6WIND/clean
Donald Sharp [Mon, 9 Oct 2017 12:14:16 +0000 (08:14 -0400)]
Merge pull request #1309 from vjardin6WIND/clean

Fix clang warnings

6 years agoMerge pull request #1311 from vjardin6WIND/csv_unittest
Donald Sharp [Mon, 9 Oct 2017 12:05:47 +0000 (08:05 -0400)]
Merge pull request #1311 from vjardin6WIND/csv_unittest

lib: csv unit tests

6 years agolib: fix wrong warning from clang
Vincent JARDIN [Mon, 9 Oct 2017 11:07:50 +0000 (13:07 +0200)]
lib: fix wrong warning from clang

The compiler cannot guess that rise() will not return here.
One should help.

Warning:
  Access to field 'file' results in a dereference of a null pointer
  (loaded from variable 'error')
aka error->file while error is NULL.

Signed-off-by: Vincent Jardin <vincent.jardin@6wind.com>
6 years agolib: csv unit tests
Vincent JARDIN [Mon, 9 Oct 2017 10:58:14 +0000 (12:58 +0200)]
lib: csv unit tests

Fix csv unit tests.

To be run using,
  gcc -o csv csv.c -DTEST_CSV
  ./csv

Signed-off-by: Vincent Jardin <vincent.jardin@6wind.com>
6 years agolib: fix NULL->field_len access
Vincent JARDIN [Mon, 9 Oct 2017 10:42:11 +0000 (12:42 +0200)]
lib: fix NULL->field_len access

Currenlty, this function is used only by:
  - unit test of csv.c (see its main() section)
  - ptm_lib.c

In case of ptm, it is safe to return NULL because:
  csv_encode_record() -> return NULL
     _ptm_lib_encode_header() -> return NULL
        the only consumer of the return value is: ptm_lib_init_msg()
        that checks the NULL return.

Warning:
  Access to field 'field_len' results in a dereference of a null
  pointer (loaded from variable 'fld')

Signed-off-by: Vincent Jardin <vincent.jardin@6wind.com>
6 years agolib: fix a64448ba, invalid NULL->num_labels
Vincent JARDIN [Mon, 9 Oct 2017 10:32:05 +0000 (12:32 +0200)]
lib: fix a64448ba, invalid NULL->num_labels

We should assume match OK only when neither nhl1
and neither nhl2 are NULL.
If both are NULL, it means match NOK.

Clang Warning:
  Access to field 'num_labels' results in a dereference of a null
  pointer (loaded from variable 'nhl1')

Signed-off-by: Vincent Jardin <vincent.jardin@6wind.com>
6 years agolib: linklist avoid access NULL->data
Vincent JARDIN [Mon, 9 Oct 2017 08:51:03 +0000 (10:51 +0200)]
lib: linklist avoid access NULL->data

Let's assert(NULL) if the datastructure is not set.
The code assumes that the pointer is always non NULL. So, let's enforce
this semantic.

Signed-off-by: Vincent Jardin <vincent.jardin@6wind.com>
6 years agobgpd: fix aspath parsing
Vincent JARDIN [Mon, 9 Oct 2017 07:43:26 +0000 (09:43 +0200)]
bgpd: fix aspath parsing

clang provides a notice about it that this p++ is useless,
because ++ would be done after the return.

From code review, I understand that p shall be incremented
for each token that is parsed from the buf. So let's keep
this intent.

Note that this commit is changing the behaviour of the source
code since from now p++ will be returned instead of p.
However, it does not hurt since the only consumer
just free() the aspath if it is parsed as as_token_unknown.
Let's be safe with a proper execution flow from now.

PS:
C reminders:

int f7(void) {
  int j = 7;

  return ++j; // return 8
}

int f8(void) {
  int j = 7;

  return j++; // return 7
}

Signed-off-by: Vincent Jardin <vincent.jardin@6wind.com>