Commit Graph

1641 Commits

Author SHA1 Message Date
Quentin Young
368d025eca lib: fix access to stack value
Passing stack value to thread_add_* causes thread->ref to become an
invalid pointer when the value goes out of scope

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-15 06:29:54 +00:00
Donald Sharp
56afaa8bcb Merge remote-tracking branch 'origin/stable/3.0' 2017-05-14 21:19:33 -04:00
Donald Sharp
dfdbe7e4b0 lib: Cleanup command parsing a tiny bit
The CLI changes now make it impossible for numbers
outside the range specified in the cli to make it to
this code.  No need to check for it again.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-13 13:08:00 -04:00
Quentin Young
ab87c0f350 lib: use %p specifier for pointers
Fixes builds on ARM

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-12 21:57:30 +00:00
Renato Westphal
17c7bb7b1c lib: remove gap between AFI_IP6 and AFI_L2VPN
We have several pieces of code like this in FRR:

  for (afi = AFI_IP; afi < AFI_MAX; afi++)
    for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
      bgp_distance_table[afi][safi] = bgp_table_init (afi, safi);

We were creating a lot of useless garbage in the code because of this
gap. Fix this.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-05-12 11:48:02 -03:00
Renato Westphal
5143a87b92 lib: add labeled-unicast in safi2str()
While here, move SAFI_ENCAP above SAFI_MPLS_VPN to keep the ordering
consistent.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-05-12 11:46:26 -03: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
Hung-Weic Chiu
9bc221113c - Solve the Coverity Scan PW.ASSIGN_WHERE_COMPARE_MEANT
- Minor refactoring

Signed-off-by: Hung-Weic Chiu <sppsorrg@gmail.com>
2017-05-10 16:02:48 -04:00
Hung-Weic Chiu
bb1e60c3a1 - Solve the Coverity Scan PW.ASSIGN_WHERE_COMPARE_MEANT
- Minor refactoring

Signed-off-by: Hung-Weic Chiu <sppsorrg@gmail.com>
2017-05-10 15:46:24 -04:00
Russ White
00a1578051 Merge pull request #408 from qlyoung/remove-thread-macros
*: remove THREAD_ON macros, add nullity check
2017-05-10 13:51:47 -04:00
Russ White
4037a433c0 Merge pull request #480 from donaldsharp/agentx
Agentx
2017-05-09 19:49:27 -04: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
32d86f8b7a lib: safely check & set thread pointers
When scheduling a thread, the scheduling function returns a pointer to
the struct thread that was placed on one of the scheduling queues in the
associated thread master. This pointer is used to check whether or not
the thread is scheduled, and is passed to thread_cancel() should the
daemon need to cancel that particular task.

The thread_fetch() function is called to retrieve the next thread to
execute. However, when it returns, the aforementioned pointer is not
updated. As a result, in order for the above use cases to work, every
thread handler function must set the associated pointer to NULL. This is
bug prone, and moreover, not thread safe.

This patch changes the thread scheduling functions to return void. If
the caller needs a reference to the scheduled thread, it must pass in a
pointer to store the pointer to the thread struct in. Subsequent calls
to thread_cancel(), thread_cancel_event() or thread_fetch() will result
in that pointer being nulled before return. These operations occur
within the thread_master critical sections.

Overall this should avoid bugs introduced by thread handler funcs
forgetting to null the associated pointer, double-scheduling caused by
overwriting pointers to currently scheduled threads without performing a
nullity check, and the introduction of true kernel threads causing race
conditions within the userspace threading world.

Also removes the return value for thread_execute since it always returns
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
David Lamparter
feaa866a4c Merge pull request #469 from qlyoung/fix-list-perm-3.0
lib: fix 'list permutations' (3.0)
2017-05-09 17:54:46 +02:00
David Lamparter
92fd8a7d59 Merge pull request #468 from qlyoung/fix-list-perm
lib: fix 'list permutations'
2017-05-09 17:54:22 +02:00
Donald Sharp
62ff928b37 *: Allow agentx to be displayed as part of vtysh
Modify code so that that vtysh can now accept the
agentx command for snmp support

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-09 10:16:06 -04:00
Donald Sharp
6281320446 Merge remote-tracking branch 'origin/stable/3.0' 2017-05-08 16:51:21 -04:00
Russ White
af95eb8755 Merge pull request #476 from qlyoung/abort-select-fd
lib: abort if fd >= FD_SETSIZE and using select
2017-05-07 19:49:26 -04:00
Quentin Young
6a5fb771a9 lib: abort if fd >= FD_SETSIZE and using select
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-07 04:42:07 +00:00
Quentin Young
e4e63cb6eb lib: fix 'list permutations'
Cyclic graphs ftw

Also remove graph pretty printer from permutations.c 'cause it's not
really needed anymore

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-05 00:19:00 +00:00
Quentin Young
dfe536f475 lib: fix 'list permutations'
Cyclic graphs ftw

Also remove graph pretty printer from permutations.c 'cause it's not
really needed anymore

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-05 00:18:14 +00:00
Donald Sharp
704ef00bb5 lib: Rename HAVE_POLL to prevent conflicting #defines
Rename HAVE_POLL to HAVE_POLL_CALL, when compiling with
snmp and poll enabled this was causing issues.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-04 10:32:41 -04:00
Donald Sharp
b46be72b4a Merge branch 'master' into EIGRP 2017-05-02 11:38:06 -04:00
Quentin Young
705f21797e lib: allow nonblocking thread_fetch()
This change adds three fields to thread_master and associated code to
use them. The fields are:

 * long selectpoll_timeout

This is a millisecond value that, if nonzero, will override the
internally calculated timeout for select()/poll(). -1 indicates
nonblocking while a positive value indicates the desired timeout in
milliseconds.

 * bool spin

This indicates whether a call to thread_fetch() should result in a loop
until work is available. By default this is set to true, in order to
keep the default behavior. In this case a return value of NULL indicates
that a fatal signal was received in select() or poll(). If it is set to
false, thread_fetch() will return immediately. NULL is then an
acceptable return value if there is no work to be done.

 * bool handle_signals

This indicates whether or not the pthread that owns the thread master
is responsible for handling signals (since this is an MT-unsafe
operation, it is best to have just the root thread do it). It is set to
true by default. Non-root pthreads should set this to false.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-04-30 23:06:14 +00:00
Quentin Young
98f14af8bf lib: add pthread manager
Adds infrastructure for keeping track of pthreads.

The general idea is to maintain a daemon-wide table of all pthreads,
running or not. A pthread is associated with its own thread master that
can be used with existing thread.c code, which provides user-space
timers, an event loop, non-blocking I/O callbacks and other facilities.

Each frr_pthread has a unique identifier that can be used to fetch it
from the table. This is to allow naming threads using a macro, for
example:

 #define WRITE_THREAD 0
 #define READ_THREAD  1
 #define WORK_THREAD  2

The idea here is to be relatively flexible with regard to how daemons
manage their collection of pthreads; the implementation could get away
with just some #define'd constants, or keep a dynamically allocated data
structure that provides organization, searching, prioritizing, etc.

Overall this interface should provide a way to maintain the familiar
thread.c userspace threading model while progressively introducing
pthreads.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-04-28 22:43:42 +00:00
Quentin Young
2c70efaed1 lib: additional thread.c MT-safety work
Fixes a few insufficient critical sections. Adds back locking for
thread_cancel(), since while thread_cancel() is only safe to call from
the pthread which owns the thread master due to races involving
thread_fetch() modifying thread master's ready queue, we still need
mutual exclusion here for all of the other public thread.c functions to
maintain their MT-safety.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-04-28 22:43:37 +00:00
Quentin Young
1189d95fca lib: make thread.c pthread-safe
This change introduces synchronization mechanisms to thread.c in order
to allow safe concurrent use.

Thread.c should now be threadstafe with respect to:
* struct thread
* struct thread_master

Calls into thread.c for operations upon data of this type should not
require external synchronization.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-04-28 22:43:36 +00:00
Donald Sharp
a8a5dbc01d lib: Actually include the header file
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-04-26 21:50:27 -04:00
Donald Sharp
ba0cb3fe96 lib: Fix compilation of some be32* code
The be32dec and be32enc functions are available on some
platforms and not others.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-04-26 21:46:10 -04:00
Donald Sharp
4f13df624b lib: Fix some *bsd build issues introduced by EIGRP code
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-04-26 15:16:29 -04:00
Donald Sharp
352a10a999 Merge remote-tracking branch 'origin/master' into mpls2 2017-04-26 14:18:22 -04:00
Donald Sharp
6aa210418e Merge remote-tracking branch 'origin/master' into EIGRP 2017-04-26 08:03:54 -04:00
Donald Sharp
c05f73e0f4 Merge remote-tracking branch 'origin/master' into mpls2 2017-04-26 07:50:02 -04:00
Donald Sharp
1876a731a4 Merge remote-tracking branch 'origin/stable/3.0' 2017-04-25 10:42:14 -04:00
Martin Winter
80b4df3b08 lib: Add CLI option --moduledir to override default module location (needed for snap support)
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2017-04-21 02:37:11 -07:00
Russ White
ae73184340 Merge pull request #374 from qlyoung/pqueue-linear-remove
lib: add removal by item to pqueue
2017-04-19 07:04:04 -04:00
Donald Sharp
de72643d15 Merge pull request #315 from LabNConsulting/working/master/patch/bgp-startup
Restore functionality broken/overridden by 857b544649
2017-04-18 12:14:58 -04:00
Donald Sharp
0f5ec54a69 Merge remote-tracking branch 'origin/stable/3.0' 2017-04-17 19:12:44 -04:00
Quentin Young
6cbc63316b lib: add removal by item to pqueue
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-04-17 00:06:02 +00:00
Donald Sharp
b3b3879c3e lib, bgpd: Remove UNDEFINED_NODE
Remove the UNDEFINED_NODE as that it's implementation breaks
our ability in BGP to figure out where we are by allowing
default: in the switch statement.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-04-15 13:26:56 -04:00
Donald Sharp
08c08a35c6 lib: Fix debugs to be guarded.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-04-08 08:55:40 -04:00
Renato Westphal
73a9e6d2a5 Merge pull request #347 from qlyoung/ignore-flex-sign-error
lib: add #pragma to ignore flex sign cmp error
2017-04-07 18:48:14 -03:00
Quentin Young
073845da5e lib: add #pragma's to ignore flex sign cmp error
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-04-07 19:18:57 +00:00
Donald Sharp
dad9e527fc Merge remote-tracking branch 'origin/stable/3.0' 2017-04-07 13:37:01 -04:00
Vivek Venkatraman
28d58fd7b1 bgpd, lib, zebra: Implement handling of BGP-Prefix-SID label Index
Implement BGP Prefix-SID IETF draft to be able to signal a labeled-unicast
prefix with a label index (segment ID). This makes it easier to deploy
global MPLS labels with BGP, even without other aspects of Segment Routing
implemented.

This patch implements the handling of the BGP-Prefix-SID Label Index
attribute. When received from a peer and the index is acceptable, the local
label is picked up from the SRGB and is programmed as the incoming label as
well as advertised to peers. If the index is not acceptable, no local label
is assigned. The outgoing label will always be the one advertised by the
downstream neighbor.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2017-04-06 10:32:07 -04:00
Don Slice
cd1964ff38 bgpd: labeled unicast processing
Implement support for negotiating IPv4 or IPv6 labeled-unicast address
family, exchanging prefixes and installing them in the routing table, as
well as interactions with Zebra for FEC registration. This is the
implementation of RFC 3107.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2017-04-06 10:32:07 -04:00
Don Slice
f51bae9cf9 bgpd: labeled unicast config
Implement support for activating the labeled-unicast address family in
BGP and relevant configuration for this address family.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2017-04-06 10:30:03 -04:00
Don Slice
e05fd627fb quagga: labeled unicast definitions
Internal and IANA definitions for labeled-unicast SAFI. Note that this SAFI
is specific to BGP and maps to the corresponding unicast SAFI in Zebra.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2017-04-06 10:29:19 -04:00
Don Slice
a64448baa6 zebra: labeled unicast handling
Support install of labeled-unicast routes by a client. This would be
BGP, in order to install routes corresponding to AFI/SAFI 1/4 (IPv4)
or 2/4 (IPv6). Convert labeled-unicast routes into label forwarding
entries (i.e., transit LSPs) when there is a static label binding.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2017-04-06 10:29:19 -04:00
Don Slice
5aba114af4 zebra: fec register
Implement interface that allows a client to register a FEC for obtaining
a label binding (in-label). Update client whenever the label binding is
updated and cleanup when client goes away.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2017-04-06 10:29:19 -04:00
Donald Sharp
856377cc39 lib: Fix missing help strings
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-04-05 23:20:26 -04:00
Donald Sharp
ca975a87e0 eigrpd: Cleanup the merge
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-04-05 21:01:31 -04:00
Donald Sharp
97133f7915 Merge remote-tracking branch 'origin/master' into EIGRP 2017-04-05 20:52:32 -04:00
Donald Sharp
6492ed5369 Merge pull request #310 from opensourcerouting/thread-prep
MT preparations
2017-04-05 12:39:25 -04:00
David Lamparter
422f8d0ca9 Merge branch 'master' 2017-04-04 20:04:07 +02:00
David Lamparter
3e7c8d040c Merge branch 'stable/2.0'
Fixed minor conflicts from "defaults" change on stable.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-04-04 19:01:47 +02:00
Donald Sharp
b3cfe637a6 Merge pull request #294 from opensourcerouting/modules
Loadable module support
2017-04-04 11:55:00 -04:00
David Lamparter
2a8e27afb8 vtysh: handle "show modules" like "show memory"
Preface with line identifying which daemon it applies to.
[Also fixes a missed "plugin" -> "module" replace.]

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-04-04 16:12:59 +02:00
David Lamparter
2e310ba9c3 Merge pull request #321 from donaldsharp/speed
Speedy McSpeederson
2017-04-04 15:58:11 +02:00
Donald Sharp
eb649b7ff3 lib, zebra: Fix CR comments
lib -> Add a bit of documentation about what units we are in.
zebra -> Fix failure case to be a bit better.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-04-03 18:28:26 -04:00
Donald Sharp
2d7f0d76c6 lib, zebra: Add ability to pass interface speed up from zebra
This is a prepatory commit for future improvements.

Add a change to the zapi to pass the interface speed up.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-04-03 14:49:35 -04:00
Quentin Young
f257ff2cdb lib: fix proto_redistnum() oversight from #257
proto_redistnum() now accepts full protocol strings and not partial
names per #10

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-04-02 23:21:09 +00:00
Lou Berger
c888ea1647 lib/frr: fix reference to zsuid before it is set
Signed-off-by: Lou Berger <lberger@labn.net>
2017-04-02 16:18:53 -04:00
Mike Tancsa
7e5b539722 lib: fix usage of getgrouplist() in *BSD
On BSD systems, the getgrouplist() function returns 0 if successful and
-1 on error.

Linux in the other hand returns *ngroups (the number of groups of which
user is a member) on success and -1 on error.

Given this difference, the most portable way to use getgrouplist()
is use its return value only for checking if it succeeded or not.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-04-01 00:50:40 -04:00
David Lamparter
fa7fe831aa lib: Linux indentation on memory.[ch]
The fact that I originally wrote this in Linux Kernel style and then
reindented it to GNU makes me want to gouge my eyes out every time I
look at it.  Restore original indentation.

[This patch is whitespace-only.]

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-31 17:59:48 +02:00
David Lamparter
a31446a88f lib: memtypes: restore atomicity
the original version of this code already used _Atomic and atomic_*().
Restore this functionality for future multithreading.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-31 17:59:48 +02:00
David Lamparter
899a4fd2a1 build: try to find some kind of atomic ops
Either one of:
- ISO C11
- gcc __atomic_*
- gcc/clang __sync_*

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-31 17:59:45 +02:00
David Lamparter
3f11a103a6 lib: make sure SEGV handler cannot lock up
Just adding -pthread to gcc options changes libc's behaviour, e.g.
making malloc() use proper locking.  This means a SEGV inside malloc()
(e.g. because malloc bookkeeping structures have been damaged by writing
to a broken pointer) can lead to a lockup by the following chain:

- random_function()
- malloc()
--- SEGV
- core_handler()
- zlog_backtrace_sigsafe()
- backtrace()
- malloc()

This will hang forever waiting for the malloc() lock to be released.

Another failure mode is dynamic linking with lazy binding (-z lazy,
default).  Since backtrace() is seldomly used, this means the call to
backtrace() in the core handler can in fact result in the dynamic linker
trying to resolve the "backtrace" symbol, which can also deadlock.

Add several safeguards to prevent any of this from happening.

(Unfortunately, these are not theoretical issues - I found them by
running into them headfirst.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-31 16:22:33 +02:00
Lou Berger
447a8fe92e Rename: FreeRangeRouting FRRouting
Signed-off-by: Lou Berger <lberger@labn.net>
2017-03-30 14:22:35 -04:00
Donald Sharp
7c7148e6c3 Merge pull request #296 from opensourcerouting/ldpd-sighup
ldpd: do a full configuration reload upon receiving a SIGHUP
2017-03-30 06:18:25 -05:00
David Lamparter
90e40ab024 lib: sandbox: print vtysh daemon targets
This is very useful to check whether a command disappeared from a
specific daemon (by comparing against an earlier output of
"grammar find-ambiguous printall nodescan")

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-28 15:48:07 -04:00
David Lamparter
2f834b3561 vtysh: parsing fixes on distribute-list
The vtysh preprocessing stuff doesn't like the first argument to
install_element() being something other than a _NODE constant, and the
comment hack wasn't cutting it... just expand this.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-28 15:48:07 -04:00
David Lamparter
505e50567f *: apply DEFUN_NOSH for node-switch CLI commands
These have copies in vtysh that do the node-switch locally and are
listed in extract.pl's ignore list.  The ignore list however is
redundant since DEFUN_NOSH does the same thing...

ldpd is a bit hacky, but Renato is reworking this anyway.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-28 15:48:07 -04:00
David Lamparter
8efe88eacf *: track version & "defaults" in configs
[CF]: Move default name to autoconf and update tests

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2017-03-28 19:18:42 +02: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
David Lamparter
5986b66b82 *: snmp: convert into modules
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-25 08:52:36 +01:00
David Lamparter
46081234b4 build: split off libfrrsnmp
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-25 08:52:36 +01:00
David Lamparter
a5b38c5bd2 lib: add hook infrastructure
Please refer to lib/hook.h for a description/documentation.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-25 08:52:28 +01:00
David Lamparter
b249c083d5 lib: add "show modules" CLI command
(for simplicity, this is stuffed in with memory_vty.c)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-24 13:02:33 +01:00
David Lamparter
30771d65b2 lib: dynamic module loading
This adds a "-M" option to each daemon, to load dynamic modules at
startup.  Modules are by default located in /usr/lib/frr/modules (lib64
if appropriate).  Unloading or loading at runtime is not supported at
this point to keep things simple.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-24 13:02:05 +01:00
David Lamparter
4c0a782d47 lib: remove unused add_snmp_pollfds()
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-24 12:46:26 +01:00
Donald Sharp
80f16600af Merge pull request #285 from bingen/label_manager_3
Implement generic label manager
2017-03-21 11:40:20 -04: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
Donald Sharp
d9be204162 Merge remote-tracking branch 'origin/master' into EIGRP 2017-03-17 17:36:44 -04:00
Donald Sharp
f15dd9a4ee bgpd, lib, zebra: Rename if_update_vrf -> if_update
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15 10:55:42 -04:00
Donald Sharp
128c2be2a1 bgpd, lib, zebra: Refactor ifname2ifindex to be VRF aware
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15 10:43:31 -04:00
Donald Sharp
baaea325e6 *: Refactor ifindex2ifname to be VRF aware
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15 10:43:21 -04:00
Donald Sharp
07a112a1dc lib: Refactor if_get_by_name_len to be VRF aware
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15 10:41:07 -04:00
Donald Sharp
92a57eb206 *: Refactor if_get_by_name to be VRF aware
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15 10:36:38 -04:00
Donald Sharp
1306c09a1b *: Refactor if_lookup_by_name to be VRF aware
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15 10:36:23 -04:00
Donald Sharp
a90607a4ba lib, ospf6d: Refactor if_lookup_prefix
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15 10:33:16 -04:00
Donald Sharp
fa787f911c lib, ospfd: Refactor if_lookup_by_name_len
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15 10:32:09 -04:00
Donald Sharp
95af5f130a lib, ospfd, ripd: Convert if_lookup_address to be vrf aware
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15 10:31:10 -04:00
Donald Sharp
c5e2cb11ad lib, pimd, zebra: Convert if_lookup_exact_address to VRF only
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15 10:30:58 -04:00
Donald Sharp
4e5266b8a3 lib, ospfd, pimd: Convert to using VRF based interface creation
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15 10:29:09 -04:00
Donald Sharp
7e2b760345 *: Remove non-vrf based ifindex lookup
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15 10:26:53 -04:00
Donald Sharp
cf7466acdd lib: Fix missed code
When converting to new format we missed some code.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-10 08:24:55 -05:00
David Lamparter
098c0eb8f4 Merge branch 'stable/2.0'
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-10 14:20:40 +01:00
David Lamparter
b32cba291b merge: pre-revert inapplicable changes
The following changes do not apply on master because the code has
changed:

- "vtysh: fix completion"
  reverts commit 09e61a383f.
- "Revert "lib: Fix tab completions memleak, memory stats corruption""
  reverts commit 4dcee34bd6.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-10 14:18:20 +01:00