Commit Graph

122 Commits

Author SHA1 Message Date
Renato Westphal
50732983b9 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>
2017-10-10 09:37:31 -03:00
Renato Westphal
11bf8e13f2 ldpd: sprinkle in some asserts to make scan-build happy
While here, fix the other SA warnings.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-06 17:50:19 -03:00
Renato Westphal
08e4b24451 ldpd: guard the label allocation debug messages
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-09-12 11:10:15 -03:00
Renato Westphal
2a178cdd7c ldpd: fix broken label allocation
Once ldpd allocated label 48 for a given FEC, all subsequent requests
for a new label would return the same value (48). The problem is that
we were left shifting an uint32_t value up to 64 times, losing important
information.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-09-12 09:52:54 -03:00
David Lamparter
4e1fd26a5e Merge remote-tracking branch 'frr/master' into tcp-zebra 2017-08-09 20:42:27 +02:00
Donald Sharp
f790234f2f Merge pull request #892 from opensourcerouting/watchfrr-simplify
simplify watchfrr, add --terminal, improve startup logging
2017-08-09 14:32:44 -04:00
Renato Westphal
b4fcca6bf2 ldpd: fix missing label mappings
In some scenarios, it's possible to send a Label Withdraw to a neighbor
and not receive a corresponding Label Release right away. This can happen
during reconvergence after a network failure or configuration change.

When this happens, the list of upstream mappings of a given FEC might
not be empty even after sending a Label Withdraw to all neighbors. This
situation holds until all neighbors either send a Label Release or are
torn down (e.g. keepalive timeout).

With that said, we shouldn't check for 'RB_EMPTY(&fn->upstream)'
in lde_kernel_update() because it can prevent ldpd from sending label
mappings in such circumstances. This check was introduced to avoid sending
the same label mapping more than once to the same neighbor, but we need
to remove this optimization for now until we find a better solution (which
probably involves refactoring the whole zebra<->ldpd communication).

While here, add a new debug message in lde_send_labelmapping() which
can aid in troubleshooting label problems in the future.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-09 12:35:16 +02:00
Renato Westphal
87b5f1b77b ldpd: integrate with the pseudowire manager in zebra
If we receive a notification from zebra indicating that the installation
of a pseudowire has failed (e.g. no reachability), send a PW Status
notification to the remote peer (or a Label Withdraw if the remote peer
doesn't support the PW Status TLV).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-09 12:35:16 +02:00
David Lamparter
689f5a8c84 *: remove --enable-tcp-zebra, rework ZAPI path
This adds "@tcp" as new choice on the -z option present in zebra and the
protocol daemons.  The --enable-tcp-zebra option on configure is no
longer needed, both UNIX and TCP socket support is always available.

Note that @tcp should not be used by default (e.g. in an init script),
and --enable-tcp-zebra should never have been in any distro package
builds, because

**** TCP-ZEBRA IS A SECURITY PROBLEM ****

It allows arbitrary local users to mess with the routing table and
inject bogus data -- and also ZAPI is not designed to be robust against
attacks.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-08 11:14:05 +02:00
David Lamparter
37a1f2fbb6 lib: privs: make uid/gid accessible before setuid
This splits off privs_preinit(), which does the lookups for user and
group IDs.  This is so the init code can create state directories while
still running as root.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-02 23:36:39 +02:00
Renato Westphal
1e4c867357 ldpd: silence coverity scan warning
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-07-31 08:56:44 -03:00
Quentin Young
972a411ccc lib: more show thread cpu
Add support for naming pthreads. Also, note that we don't have any
records yet if that's the case.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29 23:40:56 +00:00
Rafael Zalamena
45926e5874 lib: improve the RB implementation
Switch the RB tree implementation completely to the new dlg@'s version
that uses pre-declared functions instead of macros for tree functions.

Original e-mail/diff:
https://marc.info/?l=openbsd-tech&m=147087487111068&w=2

Pros:

* Reduces the amount of code that the usage of those macros generate
* Allows the compiler to do a better compile-time check job
* Might have better i-cache utilization since the tree code is shared

Con:

* dlg@ benchmarks shows it has 'very slightly slower' insertions
* imported RB_* code must adapt the following calls:
  RB_INIT(), RB_GENERATE(), RB_ROOT(), RB_EMPTY(), make compare
  functions use 'const' (if not already) and maybe others.
2017-06-16 10:44:31 -03:00
David Lamparter
645bb0b10e Merge branch 'stable/3.0'
Dropped:
	redhat/README.rpm_build.md
	redhat/daemons
	redhat/frr.init
	redhat/frr.logrotate
	redhat/frr.spec.in

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-06-13 17:37:58 +02:00
Renato Westphal
316d0ae57b ldpd: remove pledge calls
In OpenBSD pledge is a mitigation mechanism used to restrict the syscalls
a program can use, enforcing its correct behavior.

In this port of OpenBSD's ldpd(8), it's hard to run under the same
tight pledge promises because of libfrr and additional components we
introduced, like a zclient in lde. Since ldpd is already privsep'ed,
removing the pledge calls shouldn't be a big compromise security-wise.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-06-07 10:32:38 -03:00
Renato Westphal
6bbf78cf52 ldpd: fix issues detected by Coverity Scan
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-06-05 12:24:32 -03:00
Renato Westphal
abb1600611 ldpd: schedule the sending of label messages when necessary
Once we send a Label Withdraw, we can't send a Label Mapping for the
same FEC until we receive a Label Release from the peer. This is due to
some limitations in the LDP algorithms described in Appendix A. ("LDP
Label Distribution Procedures") of RFC 5036.

To workaround this issue, make it possible to schedule the sending of
a Label Mapping as soon as a Label Release is received for the same FEC.

The easiest way to test this patch is by typing the "label local advertise
explicit-null" command. ldpd will withdraw all null labels using a
Wildcard FEC and then send new Label Mappings as soon the corresponding
Label Releases are received.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-06-05 12:24:11 -03:00
Renato Westphal
d8292558bd ldpd: use synchronous channels for sending log messages
This is necessary to guarantee that all log messages sent from the child
processes are received in the parent process right away.

Without this patch, when a child process calls fatal() or fatalx(),
the log messages don't make it to the parent because the child doesn't
have a chance to flush its buffers before exiting.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-06-05 12:23:33 -03:00
Renato Westphal
30f35e8566 ldpd: remove unnecessary checks if a signal was caught
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-06-05 12:23:25 -03:00
Renato Westphal
b3121cd7d1 ldpd: fix segfault after failed initialization
When ldpd fails to start for some reason, like failing to create a pid
file, the child processes call their shutdown functions without being
completely initialized. This patch adds some protections to prevent a
segmentation fault on such circumstances.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-06-05 12:23:18 -03:00
Renato Westphal
e75f810c2f ldpd: simplify initialization of the child processes
In order to have separate ASLR/cookies per process, ldpd calls exec()
in the child processes after fork() (this is also known as the fork+exec
model).

This is an important security feature but it makes the initialization
of the child processes a bit more complicated as they're not a copy of
the parent anymore, so all parameters given via command line are lost.

To solve this problem, we were creating an argv array by hand with all
necessary parameters and providing it to the exec() syscall. This works
but it's a very ugly solution. This patch introduces a different approach
to solve the problem: send an IMSG_INIT message to the child processes
with all parameters they need in order to initialize properly. This
makes adding additional initialization parameters much more convenient
and less error prone.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>

Conflicts:
	ldpd/ldpd.c
	ldpd/ldpd.h
2017-06-05 12:23:02 -03:00
Renato Westphal
0b4d8f1e38 ldpd: split log.c into two files
This is basically to keep in sync with OpenBSD's ldpd(8) where the same
change was done.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-06-05 12:05:22 -03:00
David Lamparter
fa84d1932b Merge branch 'stable/3.0'
Conflicts:
	ldpd/lde.c
	zebra/label_manager.c

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-18 14:14:00 +02:00
ßingen
5c7ef8dc4f lm: Make relay label manager async
To avoid blocking zebra when it's acting as a proxy for an external
label manager.

Besides:

Fix get chunk reconnection. Socket was still being destroyed on failure,
so next attempt would never work.

Filter out unwanted messages in lm sync sock.
Until LDE client sends ZEBRA_LABEL_MANAGER_CONNECT message, zserv
doesn't know which kind of client it is, so it might enqueue unwanted
messages like interface add, interface up, etc. Changes in this commit
discard those messages in the client side in case they arrive before the
expected response.

Change function name for zclient_connect in label manager to avoid
confusion with zclient one.

Signed-off-by: ßingen <bingen@voltanet.io>
2017-05-11 19:20:08 +02:00
Quentin Young
66e78ae64b *: update thread_add_* calls
Pass pointer to pointer instead of assigning by return value. See
previous commit message.

To ensure that the behavior stays functionally correct, any assignments
with the result of a thread_add* function have been transformed to set
the pointer to null before passing it. These can be removed wherever the
pointer is known to already be null.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-09 20:44:22 +00:00
Quentin Young
ffa2c8986d *: remove THREAD_ON macros, add nullity check
The way thread.c is written, a caller who wishes to be able to cancel a
thread or avoid scheduling it twice must keep a reference to the thread.
Typically this is done with a long lived pointer whose value is checked
for null in order to know if the thread is currently scheduled.  The
check-and-schedule idiom is so common that several wrapper macros in
thread.h existed solely to provide it.

This patch removes those macros and adds a new parameter to all
thread_add_* functions which is a pointer to the struct thread * to
store the result of a scheduling call. If the value passed is non-null,
the thread will only be scheduled if the value is null. This helps with
consistency.

A Coccinelle spatch has been used to transform code of the form:

  if (t == NULL)
    t = thread_add_* (...)

to the form

  thread_add_* (..., &t)

The THREAD_ON macros have also been transformed to the underlying
thread.c calls.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-09 20:44:19 +00:00
Renato Westphal
af7e63a357 ldpd: fix issues detected by Coverity Scan
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-04-27 08:56:15 -03:00
Renato Westphal
7c2abbd734 ldpd: schedule the sending of label messages when necessary
Once we send a Label Withdraw, we can't send a Label Mapping for the
same FEC until we receive a Label Release from the peer. This is due to
some limitations in the LDP algorithms described in Appendix A. ("LDP
Label Distribution Procedures") of RFC 5036.

To workaround this issue, make it possible to schedule the sending of
a Label Mapping as soon as a Label Release is received for the same FEC.

The easiest way to test this patch is by typing the "label local advertise
explicit-null" command. ldpd will withdraw all null labels using a
Wildcard FEC and then send new Label Mappings as soon the corresponding
Label Releases are received.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-04-26 10:36:33 -03:00
Renato Westphal
5afba51d83 ldpd: fix small style issues
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-04-26 10:36:33 -03:00
Renato Westphal
f2232fdf8a ldpd: use synchronous channels for sending log messages
This is necessary to guarantee that all log messages sent from the child
processes are received in the parent process right away.

Without this patch, when a child process calls fatal() or fatalx(),
the log messages don't make it to the parent because the child doesn't
have a chance to flush its buffers before exiting.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-04-26 10:36:33 -03:00
Renato Westphal
d1fcf957d1 ldpd: remove unnecessary checks if a signal was caught
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-04-26 10:36:33 -03:00
Renato Westphal
835a7376b7 ldpd: fix segfault after failed initialization
When ldpd fails to start for some reason, like failing to create a pid
file, the child processes call their shutdown functions without being
completely initialized. This patch adds some protections to prevent a
segmentation fault on such circumstances.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-04-26 10:36:33 -03:00
Renato Westphal
274f5abf24 ldpd: simplify initialization of the child processes
In order to have separate ASLR/cookies per process, ldpd calls exec()
in the child processes after fork() (this is also known as the fork+exec
model).

This is an important security feature but it makes the initialization
of the child processes a bit more complicated as they're not a copy of
the parent anymore, so all parameters given via command line are lost.

To solve this problem, we were creating an argv array by hand with all
necessary parameters and providing it to the exec() syscall. This works
but it's a very ugly solution. This patch introduces a different approach
to solve the problem: send an IMSG_INIT message to the child processes
with all parameters they need in order to initialize properly. This
makes adding additional initialization parameters much more convenient
and less error prone.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-04-26 10:36:30 -03:00
Renato Westphal
fa68f9da9e ldpd: split log.c into two files
This is basically to keep in sync with OpenBSD's ldpd(8) where the same
change was done.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-04-24 20:30:58 -03:00
Renato Westphal
1d75a89d85 ldpd: do not consume vty_conf when updating the configuration
David Lamparter gave the idea of keeping vty_conf as a permanent copy of
ldpd_conf in order to simplify the CLI code and facilitate the integration
with his cap'n proto framework in the future. Doing this demanded quite
some effort but it was worth it as the code looks much better now.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-03-31 13:51:53 -03:00
Renato Westphal
52b530fc64 ldpd: fix configuration of non-existing VPLS interfaces and pseudowires
If we don't know the ifindex, flags, etc of an interface at the time it's
configured, we should make sure that once this information is available
the appropriate structures are updated.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-03-31 12:57:37 -03:00
Renato Westphal
726329191d ldpd: no need to synchronize pseudowires with LSPs anymore
Since commit 595b4be, the l2vpn_pw_ok() function doesn't check if there's
a working LSP to the remote end of the pseudowire (we assume that zebra
will do that for us). With that said, the l2vpn_sync_pws() function is
not necessary anymore.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-03-31 11:12:39 -03:00
Donald Sharp
821260f642 Merge pull request #297 from opensourcerouting/ldpd-openbsd
Add support for MPLSv6 in OpenBSD + minor fixes
2017-03-30 06:23:59 -05:00
Renato Westphal
05f23ace3f ldpd: update pledge promise in lde
With the introduction of the label manager, now lde needs to pledge
"unix" as well in order to connect to zebra.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-03-27 21:50:05 -03:00
Renato Westphal
1e7e440f5a ldpd: ignore the SIGHUP signal in the child processes
Only the parent process should handle the SIGHUP signal, but we need
to make sure that this signal is ignored in the child processes so a
command like "killall -SIGHUP ldpd" won't kill ldpd.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-03-27 14:54:57 -03:00
ßingen
7c6b529102 ldpd: Remove lde_release_label_chunk to avoid warnings 2017-03-23 17:35:48 +01:00
ßingen
66749b59e1 lm: Fix some errors detected by Coverity Scan 2017-03-22 11:34:10 +01:00
ßingen
00696e04ec ldpd: Fix compilation errors n Ubuntu CI
Signed-off-by: ßingen <bingen@voltanet.io>
2017-03-21 12:44:10 +01:00
ßingen
73be9aeb13 ldpd: Catch signal on reconnect
To be able to interrupt LDE when it's trying to reconnect to label
manager.

Signed-off-by: ßingen <bingen@voltanet.io>
2017-03-21 12:19:53 +01:00
ßingen
0d12df4a34 ldpd: Fix bug in get label func
Signed-off-by: ßingen <bingen@voltanet.io>
2017-03-21 09:11:15 +01:00
ßingen
fea12efb86 Implement generic label manager
Label Manager allows to share MPLS label space among different
daemons. Each daemon can request a chunk of consecutive labels and
release it if it doesn't need them anymore. Label Manager stores the
daemon protocol and instance to identify the owner client. It uses them
to perform garbage collection, releasing all label chunks from a client
when it gets disconnected or reconnected.

Additionally, every client can request that the chunk is never garbage
collected. In that case client has the responsibility to release
non-used labels.

Zebra can host the label manager itself (if no -l param is provided) or
connect to an external one using zserv/zclient (providing its address
with -l param).

Client code is in lib/zclient.c, but currently only LDP is using it.

TODO: Allow for custom ranges requests, i.e., specify the start label
besides the chunk.
TODO: Release labels from LDP.

Signed-off-by: Bingen Eguzkitza <bingen@voltanet.io>
2017-03-20 17:10:41 +01:00
Renato Westphal
236c69359e ldpd: remove unnecessary memcpy's
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-03-03 17:50:22 -03:00
Renato Westphal
257799cdb6 ldpd: implement RFC 5919 (LDP End-of-LIB)
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-03-03 17:50:22 -03:00
Renato Westphal
aba50a83ea ldpd: implement RFC 6667 (Typed Wildcard FEC for PWid)
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-03-03 17:50:22 -03:00
Renato Westphal
d4afb81972 ldpd: implement RFC 5918 (Typed Wildcard FEC)
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-03-03 17:50:22 -03:00
Renato Westphal
0bcc2916a0 ldpd: implement support for PWid group wildcards
This was missing from our original RFC 4447 VPLS implementation. Now
ldpd understands group wildcards as mandated by the RFC, but we still
don't send them ourselves. I can't see any case in which sending a group
wildcard would be useful, but nonetheless this patch provides a function
called lde_send_labelwithdraw_pwid_wcard() which is ready to be used in
the future anytime we feel like it might be useful.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-03-03 17:50:22 -03:00
Renato Westphal
05aac414e6 ldpd: minor tweaks
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-03-03 17:50:22 -03:00
Renato Westphal
8cb1fc4537 ldpd: update local labels when necessary
ldpd allocates null labels for directly connected routes. If a connected
route is removed (interface goes down) and an IGP learned route takes its
place in the RIB, ldpd must update the local label of the associated FEC
entry with a non-null label. The same applies for the other way around
(an interface goes up and a connected route is selected in favour of an
IGP route). Labels should be dynamic and change when necessary.

Additionally, this patch fixes the processing of route delete messages
from zebra. Route delete messages don't contain any nexthop, meaning that
whenever we receive such messages we must delete all nexthop previously
received.

Based on a patch from Bingen Eguzkitza <bingen@voltanet.io>.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-02-06 13:05:41 -02:00
Renato Westphal
f460ecf9a7 ldpd: fix silly bug introduced by a recent commit
This call to fatalx() was making ldpd crash when a pseudowire was
configured.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-02-06 12:13:44 -02:00
Renato Westphal
45a8eba972 ldpd: introduce advanced filtering capabilities
This patch introduces several new configuration commands to ldpd. These
commands should allow the operator to define advanced filtering policies
for things like label advertisement, label allocation, etc.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-02-01 22:03:36 -02:00
Renato Westphal
28e8294caa ldpd: add synchronous IPC channels
By default all ldpd interprocess communication is asynchronous
(non-blocking socketpairs). Under some circumstances, however, we'll
need synchronous IPC as well. Examples:
* the lde child process requesting labels to zebra (through the parent
  process);
* apply an access-list on a given IP prefix (ACLs are only available in
  the parent process).

This patch only adds the necessary infrastructure to allow the child
processes to make synchronous requests to the parent process. Later
patches will make use of this new infrastructure.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-02-01 21:55:47 -02:00
Renato Westphal
be54d7449a ldpd: fix a bug in the explicit-null command
Be more clever and update the label of the connected routes just once upon
a configuration change. This is not only more efficient but also fixes
a bug where no labels were updated when we didn't have any neighbors.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-02-01 21:48:54 -02:00
Donald Sharp
aac93a83e3 Merge pull request #40 from opensourcerouting/ldpd-ordered-output
ldpd ordered output - fixes issue#18
2017-01-06 14:01:23 -05:00
Donald Sharp
3b14d86eed Merge remote-tracking branch 'origin/stable/2.0' 2017-01-06 09:58:21 -05:00
Renato Westphal
057d48bd58 ldpd: use red-black trees to store 'adj' elements
Using red-black trees instead of linked lists brings the following
benefits:
1 - Elements are naturally ordered (no need to reorder anything before
    outputting data to the user);
2 - Faster lookups/deletes: O(log n) time complexity against O(n).

The insert operation with red-black trees is more expensive though,
but that's not a big issue since lookups are much more frequent.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-01-03 22:07:13 -02:00
Renato Westphal
20bacaeba2 ldpd: use red-black trees to store 'l2vpn_pw' elements
Using red-black trees instead of linked lists brings the following
benefits:
1 - Elements are naturally ordered (no need to reorder anything before
    outputting data to the user);
2 - Faster lookups/deletes: O(log n) time complexity against O(n).

The insert operation with red-black trees is more expensive though,
but that's not a big issue since lookups are much more frequent.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-01-03 22:07:13 -02:00
Renato Westphal
029c195854 ldpd: use red-black trees to store 'l2vpn_if' elements
Using red-black trees instead of linked lists brings the following
benefits:
1 - Elements are naturally ordered (no need to reorder anything before
    outputting data to the user);
2 - Faster lookups/deletes: O(log n) time complexity against O(n).

The insert operation with red-black trees is more expensive though,
but that's not a big issue since lookups are much more frequent.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-01-03 22:07:13 -02:00
Renato Westphal
90d7e7bd8b ldpd: use red-black trees to store 'l2vpn' elements
Using red-black trees instead of linked lists brings the following
benefits:
1 - Elements are naturally ordered (no need to reorder anything before
    outputting data to the user);
2 - Faster lookups/deletes: O(log n) time complexity against O(n).

The insert operation with red-black trees is more expensive though,
but that's not a big issue since lookups are much more frequent.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-01-03 22:07:13 -02:00
Renato Westphal
76c4abd19f ldpd: use red-black trees to store 'nbr_params' elements
Using red-black trees instead of linked lists brings the following
benefits:
1 - Elements are naturally ordered (no need to reorder anything before
    outputting data to the user);
2 - Faster lookups/deletes: O(log n) time complexity against O(n).

The insert operation with red-black trees is more expensive though,
but that's not a big issue since lookups are much more frequent.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-01-03 22:07:13 -02:00
Renato Westphal
7989cdba45 ldpd: use red-black trees to store 'tnbr' elements
Using red-black trees instead of linked lists brings the following
benefits:
1 - Elements are naturally ordered (no need to reorder anything before
    outputting data to the user);
2 - Faster lookups/deletes: O(log n) time complexity against O(n).

The insert operation with red-black trees is more expensive though,
but that's not a big issue since lookups are much more frequent.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-01-03 22:07:13 -02:00
Renato Westphal
7d3d7491a0 ldpd: use red-black trees to store 'iface' elements
Using red-black trees instead of linked lists brings the following
benefits:
1 - Elements are naturally ordered (no need to reorder anything before
    outputting data to the user);
2 - Faster lookups/deletes: O(log n) time complexity against O(n).

The insert operation with red-black trees is more expensive though,
but that's not a big issue since lookups are much more frequent.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-01-03 22:07:13 -02:00
Renato Westphal
d3e1887ad6 ldpd: use red-black trees to store 'lde_map' elements
Using red-black trees instead of linked lists brings the following
benefits:
1 - Elements are naturally ordered (no need to reorder anything before
    outputting data to the user);
2 - Faster lookups/deletes: O(log n) time complexity against O(n).

The insert operation with red-black trees is more expensive though,
but that's not a big issue since lookups are much more frequent.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-01-03 22:07:13 -02:00
David Lamparter
b2f361571b build: rename (1 of ?): configure.ac + preproc
This replaces Quagga -> FRR in most configure.ac settings as well as
a handful of preprocessor macros in the source code.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-20 17:57:47 +01:00
Renato Westphal
88d88a9c7a zebra/ldpd: allow MPLS ECMP on unnumbered interfaces
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
(cherry picked from commit 7144dc12b55e05c9ae3d784dfb75817c9f881eb6)
2016-12-14 13:21:08 -05:00
Renato Westphal
134970a2a1 ldpd: fix processing of redistributed routes
Commit 5048fe changed the way zebra behave when a route is updated. Now,
whenever a route is changed, zebra advertises its new version without
withdrawing the old one. This patch adapts ldpd to understand this new
behavior. After processing a ZEBRA_REDISTRIBUTE_IPV[46]_ADD message,
we need to check for nexthops that were removed and, for each of them
(if any), withdraw the associated labels from zebra.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-09-28 16:05:39 -04:00
Renato Westphal
eac6e3f027 ldpd: adapt the code for Quagga
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-09-23 09:31:09 -04:00
Renato Westphal
8429abe0c2 ldpd: copy original sources from OpenBSD (14/09/2016)
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-09-23 09:31:05 -04:00