Commit Graph

1641 Commits

Author SHA1 Message Date
Donald Sharp
1152f48669 lib: Add some breadcrumbs for new route types
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-06-07 15:47:35 -04:00
David Lamparter
fa135ba008 Merge pull request #648 from qlyoung/fix-pollfd-stack-overflow
lib: use heap for pollfds
2017-06-06 17:25:06 +02:00
Quentin Young
82fc5591f4 lib: allow infinite sleep in poll()
If fd_poll() is called with no file descriptors, an incorrect check in
the function prelude causes it to return instantly; for a thread that
wishes to poll but has no file descriptors, this results in busy
waiting. Desired behavior is to block.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-06 14:23:42 +00:00
Renato Westphal
082ac4fc2f Merge pull request #656 from qlyoung/fix-varhandler-reachable
lib: free varhandlers on exit
2017-06-03 19:00:52 -03:00
Donald Sharp
1da2945621 lib, zebra: Pass up kernel table_id for vrf's
pim controls the vrf table creation for due to the way that
pim must interact with the kernel.  In order to match the
table_id for unicast <-> multicast( not necessary but a
real nice to have ) we need to pass up from zebra the
table_id associated with the vrf.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-06-02 13:43:15 -04:00
Quentin Young
2b4dc78f7f lib: free varhandler on exit
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-02 17:24:01 +00:00
Quentin Young
95db01eb22 lib: use heap for pollfds
a bunch of pollfds can cause a stack overflow when using a stack
allocated buffer...silly me...

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-31 23:21:40 +00:00
Quentin Young
8c88ac94fa lib: make writing end of pipe nonblocking
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-31 17:30:53 +00:00
Quentin Young
a772d6eae6 lib: missed AWAKEN in r/w thread scheduler
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-30 10:27:10 -04:00
Quentin Young
3bf2673b30 lib: allow pthreads to poke poll()
When scheduling a task onto a thread master owned by another pthread, we
need to lock the thread master's mutex. However, if the pthread which
owns that thread master is in poll(), we could be stuck waiting for a
very long time. To solve this, we copy all data poll() needs and unlock
during poll(). To break the target pthread out of poll(), thread_master
has gained a pipe whose reading end is passed into poll(). After an event
that requires immediate action by the target pthread, a byte is written
into the pipe in order to wake it up.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
[DL: split off from select() removal]
2017-05-30 10:27:10 -04:00
Quentin Young
75bcb3558d lib: remove select()
poll() is present on every supported platform and does not have an upper
limit on file descriptors.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
[DL: split off from AWAKEN() change]
2017-05-30 10:27:10 -04:00
David Lamparter
b7218a7903 Merge pull request #563 from qlyoung/enforce-no-pthread-cancellation
lib: enforce thread_cancel() MT-unsafe invariant
2017-05-30 15:10:52 +02:00
Donald Sharp
9e962de4b6 Merge remote-tracking branch 'origin/stable/3.0' 2017-05-24 11:22:35 -04:00
Lou Berger
b1ff4223c7 lib: remove BGP_ENCAP(V6)_NODE
Signed-off-by: Lou Berger <lberger@labn.net>
2017-05-23 15:40:12 -04:00
Lou Berger
93b9c66617 lib: remove BGP_ENCAP(V6)_NODE
Signed-off-by: Lou Berger <lberger@labn.net>
2017-05-23 15:00:53 -04:00
Quentin Young
fb12f2c75f lib: fix array sizes for capability map
incorrect array sizes causing out of bounds read and potentially
incorrect capability settings

introduced in 1b322039

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-22 02:32:12 +00:00
Quentin Young
48cdf1a9d6 lib: enforce thread_cancel() MT-unsafe invariant
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-19 19:10:21 +00:00
David Lamparter
5662e2c91c lib: fix __attribute__ typo
__attribute breaks pycparser

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-18 14:07:28 -04:00
David Lamparter
297c8f6a31 lib: qobj: MT-guard with rwlock
Make qobj_* calls MT-Safe/LF-Blocking.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-18 14:07:28 -04:00
David Lamparter
b85120bcb3 lib: detangle protocol name/instance from logging
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-18 14:07:28 -04: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
Donald Sharp
f6a64b5fa0 Merge pull request #512 from bingen/tmp_lm_relay_async
lm: Make relay label manager async
2017-05-18 07:09:07 -04:00
David Lamparter
c3fb7c1064 Merge branch 'frr/pull/550'
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-18 12:32:28 +02:00
David Lamparter
bac7b7b935 Merge pull request #537 from donaldsharp/vrf_stuff
Vrf stuff
2017-05-17 22:06:39 +02:00
Quentin Young
dbb3cdb601 lib: correctly handle EOF when using poll()
Descriptor owner should handle EOF, not thread.c

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-17 15:05:42 +00:00
Lou Berger
745ad980fe Merge pull request #538 from qlyoung/fix-stack-access-2
lib: return thread * from thread_add*
2017-05-17 07:34:30 -04:00
David Lamparter
34f99549ab Merge pull request #549 from qlyoung/fix-poll-eof
lib: correctly handle EOF when using poll()
2017-05-17 11:25:30 +02:00
Donald Sharp
fe2bfdd608 Merge pull request #532 from opensourcerouting/gpl-headers
*: make consistent & update GPLv2 file headers
2017-05-16 18:04:31 -04:00
Daniel Walton
7780aaaa72 lib: Remove the "This command currently does nothing" message
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

This breaks the "vtysh -m" output which causes problems for
frr-reload.py
2017-05-16 18:57:20 +00:00
Quentin Young
6ccdc60d96 lib: correctly handle EOF when using poll()
Descriptor owner should handle EOF, not thread.c

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-16 18:29:51 +00:00
Quentin Young
d818259863 lib: let vty.c manage its own pointers
vty.c doesn't require back refs for a couple threads

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-16 15:59:51 +00:00
Quentin Young
56a94b3668 lib: return thread pointer from thread_add*
Allow some more flexibility in case callers wish to manage their own
thread pointers and don't require or don't want the thread to keep a
back reference to its holding pointer.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-16 15:59:51 +00:00
Donald Sharp
910a5c0e21 Merge branch 'master' into vrf_stuff 2017-05-16 07:58:55 -04:00
Donald Sharp
21a15acdde lib: Fix missing vrf_int.h from make distribute
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-16 07:49:46 -04:00
Donald Sharp
291ca371e2 lib: Improve error message for the developer
I keep getting people asking me about what to do
when this error is generated when they are programming
new cli.  Maybe this is a bit better bread-crumb?

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-15 20:55:33 -04:00
Donald Sharp
97b1a80cbb lib: Add some more documentation to vrf.h
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-15 19:37:16 -04:00
Donald Sharp
6df8536487 *: Consolidate vrf_hooks into vrf_init
We only needed to add/change the vrf callbacks when we initialize
the vrf subsystem.  As such it is not necessary to handle the callbacks
in any other way than through the init function.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-15 19:31:27 -04:00
Donald Sharp
759927a1b9 *: Remove some unneeded functions
vrf_iflist_create -> By the time this is called in enable, the vrf's iflist
is already created.  Additionally this code should be a properly of the vrf
to init/destroy not someone else.

vrf_iflist_terminate -> This function should be a property of vrf deletion
and does not need to be exposed.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-15 19:11:20 -04:00
Donald Sharp
7922fc65ae lib, zebra: Cleanup vrf api some
Segregate the vrf enable/disable functionality from other vrf
code.  This is to ensure that people are not actually using
the functions when they should not be.  Also document the
why of it properly in the new vrf_int.h header.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-15 19:02:34 -04:00
David Lamparter
7a38655aa0 lib: parser: remove forgotten line
MTYPE_CMD_TOKEN_DATA isn't used anymore, I forgot to ditch the line.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15 11:08:25 -04:00
David Lamparter
896014f4bc *: make consistent & update GPLv2 file headers
The FSF's address changed, and we had a mixture of comment styles for
the GPL file header.  (The style with * at the beginning won out with
580 to 141 in existing files.)

Note: I've intentionally left intact other "variations" of the copyright
header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15 16:37:41 +02:00
Lou Berger
4b34151b88 Merge pull request #531 from qlyoung/fix-stack-ref
lib: fix access to stack value
2017-05-15 10:34:38 -04:00
David Lamparter
9a7fc1bd7a lib: cli: fix IPv6 address partial matching
A partially-entered IPv6 address would never return a "partly_match",
meaning some possible completions weren't listed by the matcher.

This specifically breaks autocompleting BGP IPv6 neighbor addresses.
Before:
aegaeon# show ip bg ne 2001:<?>
  WORD      Neighbor on BGP configured interface

After:
aegaeon# show ip bg ne 2001:<?>
  WORD      Neighbor on BGP configured interface
  X:X::X:X  Neighbor to display information about
      2001:db8::2

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15 10:27:43 -04:00
David Lamparter
7f059ea614 vtysh: autocomplete variables
This asks the connected daemons for their variable completions through a
hidden CLI command.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15 10:27:43 -04:00
David Lamparter
70d44c5cd4 lib: cli: autocomplete variables
Shows known values in the appropriate naming domain when the user hits
<?> or <Tab>.  This patch only works in the telnet CLI, the next patch
adds vtysh support.

Included completions:
- interface names
- route-map names
- prefix-list names

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15 10:27:43 -04:00
David Lamparter
c09c46ae3c lib: parser: add pre-merge varname propagation step
Fills token->varname based on context.  WORD tokens use the WORD - if it
isn't actually "WORD".  Other than that, a preceding constant token is
used as name.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15 10:27:43 -04:00
David Lamparter
5894e76da7 lib: parser: split off & rename graph handling
Put core CLI graph stuff in lib/command_graph.[ch] and consistently
prefix all function names with "cmd_".

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15 10:27:43 -04:00
David Lamparter
16705ecc65 lib: parser: add named variables in CLI
struct cmd_token now has a "varname" field which is derived from the
DEFUN's string definition.  It can be manually specified with "$name"
after some token, e.g. "foo WORD$var".  A later commit adds code to
automatically fill the value if nothing is specified.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15 10:27:43 -04:00
Donald Sharp
6a72763d73 Merge pull request #520 from opensourcerouting/bgpd-fixes-master
bgpd: assorted fixes (master)
2017-05-15 10:01:39 -04:00
David Lamparter
36a963950c Merge pull request #526 from donaldsharp/renato_eigrp
Renato eigrp
2017-05-15 14:32:13 +02:00