Commit Graph

1641 Commits

Author SHA1 Message Date
David Lamparter
e2675fbd56 Merge pull request #266 from donaldsharp/nht
bug fixes
2017-03-10 14:10:10 +01:00
Lou Berger
6253a46a75 lib: handle case specifc types, protect against double free (issue #144)
Signed-off-by: Lou Berger <lberger@labn.net>
[DL: dropped changes except the two NULL assignments]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-09 19:24:49 +01:00
David Lamparter
4dcee34bd6 Revert "lib: Fix tab completions memleak, memory stats corruption"
This reverts commit 039dc61292.

The patch actually made the situation worse since the return value from
cmd_complete_command_real() was now inconsistently allocated from
different memory stat pools.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-09 19:23:00 +01:00
Martín Beauchamp
685e701ef3 Lowercase frr.conf 2017-03-09 09:45:00 -05:00
Donald Sharp
7f57883ee6 eigrp: Initial Commit
Please Note, I will be redoing this commit message with
more information.

Additionally I will rework the lib/* changes into their
own commits.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-08 23:07:46 -05:00
David Lamparter
4487fc74e8 *: fix some user-visible Quagga remnants
(Note: the allow_delete thing is called "zebra" on the commandline
because that's the clearest context there, while it is called "FRR" in
the CLI because that's considerably less confusing in a vtysh env.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-08 16:15:10 +01:00
David Lamparter
82a011a0a7 lib: time: remove leftover declarations
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-08 00:15:40 +01:00
David Lamparter
deaa50db47 lib: hide away logging internals
... no need to have struct zlog generally-exposed.

A few files get to include log_int.h because they use zlog/vzlog.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-08 00:15:40 +01:00
David Lamparter
dd8376febd lib: remove remaining struct zlog * args
These don't serve any purpose either.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-08 00:15:40 +01:00
David Lamparter
bf1013e6c4 lib: simplify protocol/log naming
The protocols enum serves no purpose other than adding potential for
bugs and making it complicated to add a new protocol... nuke.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-08 00:15:40 +01:00
David Lamparter
bb85d700d5 lib: ditch struct zlog * argument on zlog/vzlog()
It's completely useless...

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-08 00:15:39 +01:00
David Lamparter
4525281af1 *: get rid of zlog(*, LOG_LEVEL, ...)
Result of running the following Coccinelle patch + fixups:
<<EOF
/* long-forms: zlog(NULL, <level>, ...)
 *    =>       zlog_level(...)
 */

@@
expression list args;
@@
- zlog(NULL, LOG_DEBUG, args)
+ zlog_debug(args)

@@
expression list args;
@@
- zlog(NULL, LOG_NOTICE, args)
+ zlog_notice(args)

@@
expression list args;
@@
- zlog(NULL, LOG_INFO, args)
+ zlog_info(args)

@@
expression list args;
@@
- zlog(NULL, LOG_WARNING, args)
+ zlog_warn(args)

@@
expression list args;
@@
- zlog(NULL, LOG_ERR, args)
+ zlog_err(args)

/* long-forms: zlog(base->log, <level>, ...)
 *    =>       zlog_level(...)
 */

@@
expression base;
expression list args;
@@
- zlog(base->log, LOG_DEBUG, args)
+ zlog_debug(args)

@@
expression base;
expression list args;
@@
- zlog(base->log, LOG_NOTICE, args)
+ zlog_notice(args)

@@
expression base;
expression list args;
@@
- zlog(base->log, LOG_INFO, args)
+ zlog_info(args)

@@
expression base;
expression list args;
@@
- zlog(base->log, LOG_WARNING, args)
+ zlog_warn(args)

@@
expression base;
expression list args;
@@
- zlog(base->log, LOG_ERR, args)
+ zlog_err(args)

EOF

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-08 00:15:39 +01:00
David Lamparter
16077f2fc5 *: add frr_run()
Contains the fetch-and-run-thread logic, and vty startup (which is the
last thing happening before entering the main loop).

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-08 00:15:39 +01:00
David Lamparter
eb05883f3e *: add frr_config_fork()
Centralise read_config/daemonize/dryrun/pidfile/vty_serv into libfrr.

This also makes multi-instance pid/config handling available as part of
the library.  It's only wired up in ospfd, but the code is in lib/.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-08 00:15:36 +01:00
David Lamparter
857b544649 *: centralize more into frr_init()
Move CLI/VTY/Memory accounting init into frr_*

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-07 23:07:33 +01:00
David Lamparter
4f04a76b71 *: add frr_init() infrastructure
Start centralising startup & option parsing into the library.

FRR_DAEMON_INFO is a bit weird, but it will become useful later (e.g.
for killing the ZLOG_* enum, and having the daemon name available)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-07 23:07:20 +01:00
Donald Sharp
ae6ba9ba04 Merge pull request #257 from opensourcerouting/nhrpd
nhrpd
2017-03-07 15:15:23 -05:00
Donald Sharp
1a664f5e36 Merge pull request #254 from donaldsharp/shutdown3
Shutdown take 3
2017-03-07 11:29:44 -05:00
Timo Teräs
2fb975da77 nhrpd: implement next hop resolution protocol
This provides DMVPN support and integrates to strongSwan. Please read
README.nhrpd and README.kernel for more details.

[DL: cherry-picked from dafa05e65fe4b3b3ed5525443f554215ba14f42c]
[DL: merge partially resolved, this commit will not build.]
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-07 16:20:29 +01:00
David Lamparter
f6e250f850 Merge branch 'frr/pull/240' ("lib, bgpd: clean up headers")
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-07 16:03:36 +01:00
David Lamparter
1f806fc2c8 lib: add zlog_sanitize function
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2017-03-06 19:40:26 -05:00
Donald Sharp
5a1945e4e8 lib: Cleanup missing help strings for 'show commandtree..'
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-03 10:54:10 -05:00
Quentin Young
fd995a99e4 lib: add stream.h, vty.h, zebra.h to plist.h
Since `afi_t` and `struct vty` are used in plist.h, the appropriate
headers for them should be included.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-03-02 02:09:00 +00:00
Russ White
5f413b1473 Merge pull request #230 from qlyoung/remove-quagga_clkid
lib: remove unused quagga_clkid
2017-03-01 09:52:50 -05:00
Russ White
294f060523 Merge pull request #231 from qlyoung/monotime-retab
lib: monotime.h tabs -> spaces
2017-03-01 09:48:51 -05:00
Quentin Young
6da725ecf0 lib: remove unused quagga_clkid
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-02-27 19:40:33 +00:00
Quentin Young
0ee70925de lib: monotime.h tabs -> spaces
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-02-27 18:50:51 +00:00
Martín Beauchamp
e20dc2ba06 Lowercase frr.conf 2017-02-27 13:26:20 -05:00
Quentin Young
855ddb28b5 *: remove QUAGGA_NO_DEPRECATED_INTERFACES
This define is used only to guard macros in lib/linklist.h which
themselves are not used anywhere in the codebase and have been marked
deprecated since anno domini 2005

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-02-27 01:14:40 +00:00
Donald Sharp
821cf0d9f6 Merge pull request #219 from opensourcerouting/feature/isis-draft-ietf-rtgwg-backoff-algo
Add support for draft-ietf-rtgwg-backoff-algo to IS-IS
2017-02-24 10:09:19 -05:00
Donald Sharp
3f3169a2e6 Merge remote-tracking branch 'origin/stable/2.0' 2017-02-24 09:32:47 -05:00
Christian Franke
c1d0d21f98 lib: add SPF back-off implementation
Add an implementation of draft-ietf-rtgwg-backoff-algo-04 to
libfrr.
2017-02-22 16:18:40 +01:00
ßingen
4029782441 Add missing DESC_ENTRY to lib/log.c 2017-02-21 12:27:44 +01:00
Quentin Young
70abec3d71 *: remove QUAGGA_NO_DEPRECATED_INTERFACES
This define is used only to guard macros in lib/linklist.h which
themselves are not used anywhere in the codebase and have been marked
deprecated since anno domini 2005

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-02-17 18:19:27 +00:00
Philippe Guibert
66ef4ee487 lib: restore pre-evpn output behavior
If an EVPN entry is detected, and type is not route type 5, displays the
Ethernet MAC configured, as it was before evpn is introduced.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-16 15:12:22 +01:00
Philippe Guibert
43b4350ca7 lib: prefix2str initialises incoming buffer in case erroneous EVPN pfx
In the case, evpn prefix is requested to be transformed into string, and
if the evpn prefix is not an evpn route type 5 entry, then the prefix is
returning an initialised string that mentions the vpn prefix is unknown.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14 13:59:00 +01:00
Philippe Guibert
db42a173d6 lib: simplify str2mac and use struct ethaddr structure
This commit simplified the string to mac conversion, since it uses
sscanf, instead of depicting each incoming character one by one, and
doing self analysis. Also,this commit changes the internal usage of the
mac address representation in mac handling function.

Signed-off-by: Lou Berger <lberger@labn.net>
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14 13:59:00 +01:00
Philippe Guibert
d5c8a0cecf lib: append prefix_ for mac handling functions
This commit is changing the function naming for mac handling functions.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14 13:59:00 +01:00
Philippe Guibert
42f621a6ea lib: replace AFI_ETHER reference with AFI_L2VPN
The introduction of AFI_L2VPN prefix makes usage of AFI_ETHER deprecated
and is of no usage currently. The latter define is linked to AFI_L2VPN.
For that, the prefix enumerate has the AFI_ETHER value removed.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14 13:59:00 +01:00
Philippe Guibert
0362b0a7ec lib: handle str2mac case where buffer is allocated by the function
The case where no buffer is passed to the str2mac function is handled.
In that case, a buffer is allocated. Then the check against the buffer
length is not done.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14 13:58:59 +01:00
Philippe Guibert
c215ecaf83 lib: add string to macaddress and reverse function
As mac-address structure is to be used as a prefix field, two new
functions permit handling mac address in order to convert it. either
from string to internal value, or the reverse operation.
Internal representation of a mac address is a 6 byte char value standing
for the 6 byte value the mac address has.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14 13:58:59 +01:00
Philippe Guibert
0737aa5edb lib: remove HAVE_EVPN references
This commit removes references to HAVE_EVPN references in lib folder.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14 13:58:59 +01:00
Philippe Guibert
25098f9b97 lib: add define of compilation for EVPN in prefix.c
Because the prefix structure may include or not evpn sub structure, then
HAVE_EVPN compilation define is also used in prefix.c, because it
references the sub field evpn of prefix structure.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14 13:58:58 +01:00
vivek
78b81eaa44 lib: Enhance prefix dump for EVPN prefixes
This commit is also taking into account changes related to srcdes
feature introduction in zebra folder.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>

Ticket: CM-12262
Reviewed By: CCR-5065
Testing Done: Manual

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14 13:58:58 +01:00
vivek
fd6c6cb49b lib: Functions related to AF_ETHERNET
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2017-02-14 13:58:58 +01:00
Philippe Guibert
9e6df0b7ac lib: define BGP_EVPN_NODE
This define introduces bgp sub node address-family evpn.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14 13:58:57 +01:00
Philippe Guibert
79c0c95986 lib: afi_ether structure packing fix
'packed' keyword had no effect on packing the afi_ethernet structure.
The attribute keyword has been eppended in order to take into account
the packed feature.

Signed-off-by: Julien Courtat <julien.courtat@6wind.com>
2017-02-14 13:58:57 +01:00
Philippe Guibert
4470c22cad lib: add prefix support for evpn route type 5
The requirement from draft-ietf-bess-evpn-prefix-advertisement-03
mentions that the Eth-Tag ID, IP Prefix Length and IP Prefix will be
part of the route key used by BGP. The ip prefix length is then appended
to the evpn_addr. In addition to this, the ethernet tag ID is reused.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14 13:58:57 +01:00
vivek
a440846ea6 lib: EVPN prefix definition
Extend the prefix data structure to allow for basic support for EVPN type-3
and type-2 routes.

Note: This may be revised in future.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-11937
Reviewed By: CCR-5001
Testing Done: None

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14 13:58:57 +01:00
Philippe Guibert
924bf71cd1 lib: add AFI_L2VPN and SAFI_EVPN
To support EVPN, a new AFI and SAFI value are defined here.
For internal processing, two other values are used. Those values will
be used to reach RIB entries by using internal afi and safi values
as indexes. This commit is using naming convention for using EVPN.
External value exchanged in BGP packets  is called of with
IANA_ presence in macro, while internal value will not have _IANA_
presence.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14 13:58:57 +01:00
Donald Sharp
757abe78d8 Merge pull request #195 from opensourcerouting/cli_merge
CLI: independent merge step
2017-02-11 07:00:00 -05:00
David Lamparter
37f9f36ec9 grammar_sandbox: count ambiguous commands
... and make the return value useful (for vtysh)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-10 17:14:50 +01:00
David Lamparter
0a22b97922 grammar_sandbox: add ambiguous-command finder
Best run in vtysh.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-10 16:44:28 +01:00
David Lamparter
db85c8b384 lib: track name of command in cmd_element
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-10 16:44:28 +01:00
David Lamparter
de8f7a3983 lib: parser: rewrite token deduplication
Merge the parsed graph into the existing one as a separate step.  This
makes it possible to merge identical subgraphs, which is used e.g. in
bgpd for <A.B.C.D|X:X::X:X|WORD> neighbor names.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-10 15:39:04 +01:00
David Lamparter
6de469061b lib: rework vty_use_backup_config()
Like config_write(), this should use rename(), even though atomicity is
not a real issue here.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-10 15:04:40 +01:00
David Lamparter
148781210f lib: fix remaining coverity issues
Reported-by: Coverity
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-10 15:04:06 +01:00
David Lamparter
6432969db9 lib: parser: remove previous deduplication code
Rewritten in next commit.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-10 13:38:04 +01:00
Martin Winter
b3411578b0 lib: CID 1399296: Assign instead of compare (PW.ASSIGN_WHERE_COMPARE_MEANT)
Needs to be a comparison, not assignment

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2017-02-10 16:52:54 +07:00
Donald Sharp
305e9740ff Merge remote-tracking branch 'origin/stable/2.0' 2017-02-09 09:53:46 -05:00
Donald Sharp
b9aa3abbbe Merge pull request #189 from opensourcerouting/config-write-sync
lib: use fsync() for config writes, plug fd leak
2017-02-09 09:52:58 -05:00
David Lamparter
1520d0aca9 lib: use fsync() for config writes, plug fd leak
sync() has a HUGE impact on systems that perform actual I/O, i.e. real
servers...

Also, we were leaking a fd on each config write ever since
c5e69a0 "lib/vty: add separate output fd support to VTYs"
(by myself :( ...)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-09 14:25:55 +01:00
David Lamparter
056cfe496e lib: use fsync() for config writes, plug fd leak
sync() has a HUGE impact on systems that perform actual I/O, i.e. real
servers...

Also, we were leaking a fd on each config write ever since
c5e69a0 "lib/vty: add separate output fd support to VTYs"
(by myself :( ...)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-09 12:54:25 +01:00
David Lamparter
8ac885457f lib: csv: plug memleaks
Reported-by: Coverity Scan
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-08 16:35:02 +01:00
David Lamparter
a31ff449a0 lib: fix some coverity NULL check warnings
Reported-by: Coverity Scan
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-08 16:34:59 +01:00
David Lamparter
dbb5a5552a lib: remove unused str2in6_addr()
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-08 16:33:47 +01:00
David Lamparter
caeb0a4f65 lib: remove unused cmd_concat_strvec()
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-08 16:33:25 +01:00
Donald Sharp
fa6d4efea0 lib: Fix warning -> error build issue
When compiling ./buildtest.sh the gcc compiler
on fedora 25 complains about indentation

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-07 13:55:55 -05:00
Donald Sharp
0dca233ec0 *: Found some instances of Quagga.conf
Cleanup Quagga.conf -> Frr.conf

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-07 13:44:09 -05:00
Donald Sharp
7df2e1c379 Merge remote-tracking branch 'origin/stable/2.0' 2017-02-07 13:20:12 -05:00
Donald Sharp
2cfe3d285f Merge pull request #176 from opensourcerouting/mtype-underflow-backtrace
lib: print backtrace on MTYPE count underflow
2017-02-07 13:04:27 -05:00
David Lamparter
9da3dd3bc5 Merge pull request #161 from donaldsharp/stableMcLibrary
Stable mc library
2017-02-07 17:17:12 +01:00
David Lamparter
f65e2d40cc lib: print backtrace on MTYPE count underflow
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-07 16:23:38 +01:00
David Lamparter
fa02c492fa Merge branch 'frr/pull/152' ("Lib fixes")
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-07 15:48:46 +01:00
Donald Sharp
f0d975f752 lib: Fixup CR comment
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-07 04:54:40 -05:00
Donald Sharp
f96872f001 lib: Don't use malloc!
thread.c was using malloc.  This was found by the
assert added to memory.c.

Fixes issues #170

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-06 12:52:28 -05:00
Donald Sharp
55c7280315 *: Convert libzebra -> libfrr
The library libzebra that is installed with FRR will
conflict with Quagga.  So let's rename it to libfrr.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-03 08:29:13 -05:00
Donald Sharp
1a35e2e565 Merge remote-tracking branch 'origin/stable/2.0' 2017-02-02 10:42:51 -05:00
Donald Sharp
0527bd80c9 lib: Treat v6 address as a v6 address
The code was making the correct assumption
that the v4 and v6 addresses start in the
same spot in memory and since we were looking
at a v6 prefix it would just work.  This
causes distress in SA systems, so let's just
make it happy.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-01 19:52:54 -05:00
Donald Sharp
9010012aa1 lib: Fix possible array overrun
It is possible if the hostname is > 32
characters that we would just overrun the
client_name data structure.  Truncate
the hostname string to 31 characters (to allow for NULL)

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-01 19:51:31 -05:00
Donald Sharp
3d217741c3 lib: Properly Initialize code
was_stdio was never set up with a 'correct'
initial value, leading to cases where
we would choose what to do based upon
what was in the stack.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-01 19:49:48 -05:00
Donald Sharp
907ca8e4d5 lib: Inadvertent assignment in ? operator
In the case where we are using select as
the operator *and* we call
funcname_thread_add_read_write *and* the
fd is already set, we would overwrite
the read/write direction to always be READ.

Clearly this was a bad idea.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-01 19:47:39 -05:00
Donald Sharp
a1198921f2 lib: Fix SA warnings and reduce cli
The cli could be reduced for v4 and v6 code
paths into 1 function.  Additionally the v6
code path had a SA issue found where it
"theoratically" could have caused a null
de-reference.  This issue has been removed
as well.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-01 19:45:57 -05:00
Donald Sharp
c28e5b2a83 lib: Fix SA issue with stream s read
We were checking for non-null of 'struct stream *s'
after we did a stream_getl, which would have crashed
the program.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-01 19:43:43 -05: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
cfb67a784e lib: remove unnecessary variable
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-02-01 12:47:58 -02:00
David Lamparter
98645ada19 lib: plug leak in prefix_list_delete()
prefix_list_delete wasn't releasing chained trie entries, only the main
one.  Just call the proper trie_del.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-01 13:24:37 +01:00
David Lamparter
ff1c42fb9f *: fix warning fallout from set_socket_path
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-01 13:12:16 +01:00
Donald Sharp
e46538e628 Merge pull request #139 from opensourcerouting/cli_merge_prep_final
CLI split merge-step preparations
2017-01-31 13:27:42 -05:00
Christian Franke
e322dbc73a Merge branch 'master' into feature/zebra-srcdest 2017-01-31 16:22:54 +01:00
David Lamparter
dd03f8cae1 lib: move at_close call in vty_stdio to end
Since the at_close call for the stdio vty might exit() the process, move
it to the end of the function, after freeing all memory.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-31 15:28:39 +01:00
David Lamparter
bff9c3e9d3 lib/tests: add cmd_hostname_set()
To make it possible for testcli to get a clean memory management bill.
(Note: XFREE() is NULL-safe, just like free().)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-31 15:28:39 +01:00
David Lamparter
0d9e204694 lib: add vector_unset_value()
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-31 15:28:19 +01:00
David Lamparter
66d29a54a1 lib: clean up tab-completion memory counting
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-31 15:28:19 +01:00
David Lamparter
55b7f20fda lib: parser: fix allocation counting
command_lex.l was allocating as MTYPE_TMP, while command_parse.y would
just call free().  Make both use MTYPE_LEX.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-31 15:28:19 +01:00
David Lamparter
26df3a33ae Merge branch 'frr/pull/133' ("Pim cleanup")
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-31 15:26:07 +01:00
Quentin Young
0d70298614 lib, bgpd: fix miscellaneous route-map commands
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-01-31 02:25:08 +00:00
Donald Sharp
bf21dc0a41 Merge pull request #127 from LabNConsulting/working/master/patch/assert-dup-free
lib: assert on duplicate free (count)
2017-01-30 13:07:44 -05:00
Donald Sharp
8613585e1f lib: Moved zapi message types to zclient.h
Move the data structure used to have knowledge about
the zapi message types to zclient.h where it belongs.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-30 11:48:38 -05:00
Donald Sharp
94ed344a8f zebra: Refactor Error codes to proper place
These error codes have ended up only being used
for socket type interfaces to the kernel(*bsd),
yet we were exposing the #defines to the entirety
of the project.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-30 11:48:38 -05:00
Christian Franke
a27428eb71 lib: add cleanup hook to route table 2017-01-30 13:54:46 +01:00
David Lamparter
0964ad9cec lib: add second-level route_table for srcdest
IPv6 srcdest routes need to be keyed by both destination and source
prefix.  Since the lookup order is destination first, the simplest thing
to do here is to add a second route_table to destination entries, which
then contain source entries.  Sadly, the result is somewhat confusing
since a route_node might now be either a source node or a destination
node.

There are helper functions to get source and destination prefix from a
given route node (which can be either a destination or a source route).

The following bits have been added by Christian Franke
<chris@opensourcerouting.org>:
- make srcdest routing table reusable by moving it into lib
- make the srcdest routing table structure more opaque
- implement a srcdest routing table iterator
- fix a refcounting issue in src_node_lookup
- match route_node_lookup behavior with srcdest_rnode_lookup
- add accessor for the route_node table and table_info
- add string formatter srcdest_rnode2str

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
[v3: adapted for cmaster-next as of 2016-12-05]
2017-01-30 13:51:50 +01:00
David Lamparter
61cdc88971 lib: add route_node_lookup_maynull
The sourcedest code needs to get the route_node even if its info pointer
is NULL (which occurs when there are srcdest routes, but no general
destination route.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-30 13:47:04 +01:00
David Lamparter
d75f3b00e7 lib: send ZAPI IPv6 source prefix
This introduces ZAPI_MESSAGE_SRCPFX, and if set adds a source prefix
field to ZAPI IPv6 route messages sent from daemons to zebra.  The
function calls all have a new prefix_ipv6 * argument specifying the
source, or NULL.  All daemons currently supply NULL.

Zebra support for processing the field was added in the previous patch,
however, zebra does not do anything useful with the value yet.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-30 13:47:04 +01:00
David Lamparter
3c7c91d0bd zebra: receive ZAPI IPv6 source prefix
Check and read the IPv6 source prefix on ZAPI messages, and pass it down
to the RIB functions (which do nothing with it yet.)  Since the RIB
functions now all have a new extra argument, this also updates the
kernel route read functions to supply NULL.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-30 13:47:04 +01:00
Donald Sharp
c3d89003a4 lib: Fix Auto generation of redistribution strings
When we changed the parser we forgot to update this
script to modify the '(...)' to '<...>'

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-27 15:37:14 -05:00
Lou Berger
aceb2285da Merge pull request #107 from donaldsharp/bgpafisafi
Bgp afi safi fixes
2017-01-27 10:57:46 -05:00
Lou Berger
fd7aa3f557 lib: assert on duplicate free (count)
Signed-off-by: Lou Berger <lberger@labn.net>
2017-01-27 07:46:25 -05:00
Donald Sharp
7f12cb2b65 Merge remote-tracking branch 'origin/master' into bgpafisafi 2017-01-26 10:38:07 -05:00
David Lamparter
c30420200b lib: graph: fix vector_remove()
vector_remove would corrupt the data in the following sequence:
1. assume vector v = [a, b], active = 2
2. vector_unset(v, 0) => v = [NULL, b], active = 2
3. vector_remove(v, 1)

vector_remove calls vector_unset(v, 1), vector_unset notices index #0 is
also NULL and thus sets active to 0.

The equality test in vector_remove() now fails, leading it to decrement
v->active *again*, leading to an underflow that will likely crash the
daemon (and might even be exploitable).

This call sequence does not happen in existing code since vector_unset()
is not used on graph from/to lists.  Nonetheless this is a buried land
mine in the code at best.

Rewrite the function - while we're at it, there's no reason to move the
entire array around, just fill the hole with the last element.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Cc: Quentin Young <qlyoung@cumulusnetworks.com>
2017-01-26 07:05:56 +01:00
David Lamparter
5bf313994d lib: graph: speed up node deletion
We don't need to copy the from/to arrays, we can just iterate backwards.

NB: this makes graph_remove_edge delete only one edge (which is more
consistent with graph_add_edge allowing parallel edges).

Iterating graph->nodes backwards also makes graph_delete_graph faster
since that also iterates backwards.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-26 07:05:56 +01:00
David Lamparter
72d98ee943 lib: graph: fix deletions
Iterating over an array while deleting items needs to consider
interactions between the iteration position and deletion.  The previous
code completely ignored that problem, leading to memleaks (graph_delete
skipping half of the nodes) and dangling pointers (if parallel edges
exist in graph_remove_edge).

Iterating backwards is safe and reduces "move to fill hole" overhead in
deletion.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Cc: Quentin Young <qlyoung@cumulusnetworks.com>
2017-01-26 07:05:21 +01:00
Donald Sharp
6dfe1c38d7 Merge pull request #101 from LabNConsulting/working/master/patch-set/3-vrf
Master version of basic vrf commands & some other missed fixes
2017-01-25 18:26:15 -05:00
David Lamparter
dcb817fd27 Merge branch 'frr/pull/92' (BGP Large Community support)
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-25 23:04:29 +01:00
Martin Winter
38657f2ebd lib: Don't change uid/gid if we are already the correct uid/gid
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2017-01-26 00:45:05 +07:00
Martin Winter
950765ba10 lib: Add set_socket_path() to sockopt.c to override the path element of a (vty) socket (but keep filename)
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2017-01-26 00:40:55 +07:00
ßingen
5cd459e86e lib: Fix missing break in zlcient switch 2017-01-25 14:33:01 +01:00
Donald Sharp
d2ce19c9b5 Merge pull request #105 from opensourcerouting/cli_merge_step_prep
Prepare for split-off cli parser "merge" step
2017-01-25 07:49:21 -05:00
David Lamparter
83364d20d5 lib: parser: fix memory management
command.c had:
DEFINE_MTYPE_STATIC(LIB, CMD_TOKENS, "Command desc")
while command_match.c had:
DEFINE_MTYPE_STATIC(LIB, CMD_TOKENS, "Command Tokens")

... which means that there are 2 distinct MTYPE_CMD_TOKENS.
(The description text being different does not matter, even with the
same text it'd be 2 distinct types.)

command_match.c allocates token->arg in command_match_r() while
command.c frees it in del_cmd_token().  Therefore with each command
being executed, the allocation count goes up on one, down on the other.

=> clean up parser allocation counting.  Also, use separate MTYPEs for
the different fields in struct cmd_token.

Fixes: #108 / ee9216cf ("lib, ripngd: clean up merge leftovers")
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Cc: Quentin Young <qlyoung@cumulusnetworks.com>
2017-01-25 02:27:29 +01:00
Donald Sharp
ac9ddce37d Merge pull request #104 from opensourcerouting/time-cleanup
Time cleanup
2017-01-24 11:43:32 -05:00
David Lamparter
e5951aa21d Merge pull request #42 from donaldsharp/pim_lib_work2
Pim-SM + MSDP
2017-01-24 17:10:09 +01:00
Donald Sharp
ece35fdcb7 lib: Add VRF_ALL define
Allow the specification of a VRF_ALL to be
used for CLI.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-23 22:34:49 -05:00
David Lamparter
290c1eb150 Merge branch 'frr/pull/93'
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-24 03:16:01 +01:00
David Lamparter
b285cf4b74 grammar_sandbox: detab
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-24 02:52:07 +01:00
David Lamparter
14152706b4 lib: parser: guard yylloc
yylloc seems to be NULL on parser init for some flex+bison
combinations...

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-24 02:52:07 +01:00
David Lamparter
05dbb7df2f build: support bison < 3.0 for parse.error=verbose
*sigh*

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23 23:26:23 +01:00
David Lamparter
39cea8220a lib: time: add TIMEVAL_TO_TIMESPEC
Should be in system headers, but not specified by any standard.
Not currently used anywhere yet.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23 23:17:35 +01:00
David Lamparter
af2567b646 grammar_sandbox: add into daemons if DEV_BUILD
Also adds "grammar access <node>" to test/dump an existing command node
(e.g. BGP_NODE).

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23 21:52:44 +01:00
David Lamparter
818a5168a1 grammar_sandbox: add .dot file writing capability
Writing a .dot graphviz file is very useful to get a graphical
representation of the command graph.

This code is intended solely for testing & development, it uses some
fixed-size array and may unexpectedly crash.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23 21:52:44 +01:00
David Lamparter
8bb647a830 lib: parser: add error location reporting
flex+bison have nice capabilities to track the location that is
currently being processed; let's enable these and get better warnings
for broken CLI specs.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23 21:52:44 +01:00
David Lamparter
663982cda7 lib: parser: unify subgraphs & simplify even more
This cuts a large piece of complexity from the parser by making the
sequences between | the same, no matter whether it's <> () or [].

This causes some changes in behaviour:
- [foo|bar] is now accepted
- <foo|[bar]> is now accepted (yes it's stupid)
- {a|b} is now means "at least one of these, in any order"; to allow
  zero use [{a|b}] instead.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23 21:52:44 +01:00
David Lamparter
2020b1c8a8 lib: parser: keep subgraph pointers on stack
There's no need to malloc() these, we can just keep them on the stack.
The entire struct will get copied around, but replacing a 2-pointer copy
with a 1-pointer copy + malloc + free overhead is not quite efficient.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23 21:52:44 +01:00
David Lamparter
ab03715928 lib: parser: track matching FORK_TKN & JOIN_TKN
This associates pairs of FORK and JOIN tokens, so the merge function can
identify where a subgraph begins and ends.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23 21:52:44 +01:00
David Lamparter
0bf5b1cbe3 lib: parser: simplify OPTION_TKN & SELECTOR_TKN
These are functionally identical as "fork" tokens.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23 21:52:43 +01:00
David Lamparter
61617d382e lib: parser: free Mr. T
Mr. T was abducted by the parser and held hostage for ransom.
Murdock was called, flew in and replaced him with a Tab character.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23 21:49:57 +01:00
David Lamparter
e0e2a99068 lib: cope with negative timeout in thread.c
Since time is no longer cached, if we schedule something with zero
timeout, it will automatically be negative by the time we reach the
event loop.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23 18:59:15 +01:00
David Lamparter
4b185cb399 lib: time: clean out thread.c
Remove quagga_get_relative(), replace with monotime().

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23 18:55:33 +01:00
David Lamparter
816c2194ca ospfd: simplify SPF time consumption calculations
monotime_since() does exactly the same thing.
... and timeval_elapsed is now private to lib/thread.c

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23 18:26:33 +01:00
David Lamparter
cf672a8654 *: use monotime()
This is largely a bulk-replace made with coccinelle.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23 18:26:32 +01:00
David Lamparter
d9d5c3e8bf lib: time: remove local time helpers
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23 18:26:32 +01:00
David Lamparter
3dad49ca94 lib: time: remove recent_time
This isn't even used anywhere.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23 18:26:32 +01:00
David Lamparter
6ced0e7f10 lib: time: remove recent_relative_time()
Replace with monotime() [which is not cached].

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23 18:26:32 +01:00
David Lamparter
7790a2d69e lib: time: add new monotime() helpers
This adds monotime() to retrieve monotonic clock time, as well as
monotime_since() and monotime_until() for relative monotonic time.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23 16:54:51 +01:00
Lou Berger
5ff06872e9 bgpd: add vrf-policy config using existing vnc code
add add/clear vrf prefix
      + Modified for FRR master parser

Signed-off-by: Lou Berger <lberger@labn.net>
2017-01-22 20:54:57 -05:00
Quentin Young
5320569435 lib: guard strict cli completions
Completions are checked for token and docstring equality before
deduplicating. Put an ifdef guard around checking docstrings because
many of them are inconsistent and may confuse users in a release build.

It is a good idea to enable VTYSH_DEBUG when adding new CLI in the
future to help check docstrings.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-01-19 17:15:45 +00:00
Donald Sharp
b8b35c63a5 Merge remote-tracking branch 'origin/master' into pim_lib_work2
Conflicts:
	lib/zebra.h
	zebra/rt_netlink.c
2017-01-19 04:32:49 -05:00
Donald Sharp
e2064401d3 lib: Add some documentation to wheel.h
Add some hopefully useful documentation to the
timer wheel.h code.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-18 19:08:04 -05:00
Job Snijders
57d187bc77 Support for BGP Large Communities
BGP Large Communities are a novel way to signal information between
networks. An example of a Large Community is: "2914:65400:38016". Large
BGP Communities are composed of three 4-byte integers, separated by a
colon. This is easy to remember and accommodates advanced routing
policies in relation to 4-Byte ASNs.

This feature was developed by:
Keyur Patel <keyur@arrcus.com> (Arrcus, Inc.),
Job Snijders <job@ntt.net> (NTT Communications),
David Lamparter <equinox@opensourcerouting.org>
and Donald Sharp <sharpd@cumulusnetworks.com>

Signed-off-by: Job Snijders <job@ntt.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-18 18:38:53 -05:00
Quentin Young
88e5a8cbe1 lib: additional patch for 496e83a
Fixes a couple off-by-ones introduced in previous commit.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
[cherry-picked from master d1e4a518e6]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-18 17:15:12 +01:00
David Lamparter
cd27ec47ef Merge pull request 'frr/pull/87'
Fixes a couple off-by-ones introduced in previous commit.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-18 17:13:27 +01:00
Quentin Young
d1e4a518e6 lib: additional patch for 496e83a
Fixes a couple off-by-ones introduced in previous commit.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-01-18 06:12:08 +00:00
Donald Sharp
b58ed1f8a8 Merge remote-tracking branch 'origin/master' into pim_lib_work2 2017-01-17 21:01:56 -05:00
Donald Sharp
2047fdb5e7 lib: Allow json to work across different versions.
The json_object_object_get_ex function is not fully available
across all versions of json.  Write a wrapper to allow
it to work.

Ticket: CM-13872
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-17 18:46:24 -05:00
Donald Sharp
dd3415b74b lib: Fix clang SA warnings.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-17 18:45:23 -05:00
Donald Sharp
f7c62e11d6 lib: Fix 'show thread cpu' to display active threads
Fix the display of 'show thread cpu' to keep track
of the number of active threads and to display that
information.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>

lib: Fix thread_execute_crash
2017-01-17 18:43:28 -05:00
Donald Sharp
b3f5645df3 lib: Slight Optimization of thread handling.
This commit does these things:

1) Make thread_add_unuse own the setting of THREAD_UNUSED.
2) Move thread->hist finding to to thread_get.
   We are storing the thread->hist even when the thread
   is on the unused.  This means that we check to see
   if the funcname or func have changed and we get new
   history.  Else we've probably just retrieved the last
   unused which has the same func/funcanme.  This is
   a common practice to do THREAD_OFF/THREAD_ON in
   quick succession.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com.
2017-01-17 18:40:33 -05:00
Donald Sharp
cbea873754 lib: Add Timer Wheel functionality
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-17 18:40:25 -05:00
Donald Sharp
b339bde737 zebra: Fully decode mcast messages
Fully decode mcast messages from the kernel.  We are not
doing anything with this at the moment, but that will
change.

Additionally convert over to using lookup for
displaying the route type.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-17 18:34:17 -05:00
vivek
a9ea959fae lib: Use single correct definition for prefix string buffer
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reivewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-12262
Reviewed By: CCR-5065
Testing Done: Manual
2017-01-17 18:30:18 -05:00
Donald Sharp
e921929069 lib: Setup prefix.h to allow it to store (s,g)
We need the ability to store the (s,g) in a struct prefix.
This will allow us to consolidate some duplicated code in
pimd as well as set us up to switch from a link list to a
table to store (s,g) state.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-17 18:26:43 -05:00
David Lamparter
eb3d20d398 Merge pull request #59 from donaldsharp/cli_cleanup
Cli cleanup, largely VNC related, minor bgpd/ospfd/lib fixes.
2017-01-17 21:36:07 +01:00
Donald Sharp
efd64b137a Merge remote-tracking branch 'frr/master' into cli_cleanup 2017-01-15 18:56:01 -05:00
Donald Sharp
9aa7f43f7e Merge branch 'master' into cleanup 2017-01-13 14:48:16 -05:00
David Lamparter
b6f1faf045 Merge branch 'stable/2.0-for-merge'
Conflicts (CLI vs. atol()):
- bgpd/bgp_vty.c
- ospfd/ospf_vty.c
- zebra/zebra_vty.c

NB: pull req #65 (LabNConsulting/working/2.0/afi-safi-vty/c) was
excluded from this merge.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-13 15:24:25 +01:00
Quentin Young
78af6edc6c lib: limit size of vty buffer to 4096 bytes
This removes the automatic resizing of the vty input buffer and places a
hard size cap of 4096 bytes. It also fixes a potentially unsafe strcpy.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
[cherry-picked from master 2af38873d8]
2017-01-13 14:37:40 +01:00
David Lamparter
496e83a5d7 Merge pull request #63 from qlyoung/fix-vty-buffer
lib: limit size of vty buffer to 4096 bytes
2017-01-13 14:33:50 +01:00
Donald Sharp
56c1f7d852 frr: Remove HAVE_IPV6 from code base
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-13 08:05:50 -05:00
vivek
9cabb64b32 Quagga: AFI/SAFI mappings IANA to/from internal values
Introduce internal and IANA defintions for AFI/SAFI and mapping
functions and modify code to use these. This refactoring will
facilitate adding support for other AFI/SAFI whose IANA values
won't be suitable for internal data structure definitions (e.g.,
they are not contiguous).
The commit adds some fixes related to afi/safi testing with 'make check
' command.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>

Ticket: CM-11416
Reviewed By: CCR-3594 (mpls branch)
Testing Done: Not tested now, tested earlier on mpls branch
2017-01-12 09:28:43 +01:00
Quentin Young
2af38873d8 lib: limit size of vty buffer to 4096 bytes
This removes the automatic resizing of the vty input buffer and places a
hard size cap of 4096 bytes. It also fixes a potentially unsafe strcpy.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-01-10 23:33:50 +00:00
Donald Sharp
4e93448fbe lib: Fixup 'ipv6 distribute-list ... ' cli help strings
Fixup the cli help strings for 'ipv6 distribute-list [prefix] WORD <in|out> [WORD]'

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-09 10:22:39 -05:00
Donald Sharp
556022477e Merge pull request #47 from donaldsharp/valgrind
Valgrind
2017-01-09 09:17:17 -05:00
Quentin Young
d92c729ba5 lib: make interface metric a uint32_t
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-01-09 01:35:41 +00:00
Quentin Young
b84aadae44 Merge branch 'master' into fix-proto_redistnum 2017-01-06 19:44:46 -05:00
Donald Sharp
46c323a66b Merge pull request #27 from qlyoung/fix-derefs2
bgpd, lib: fix a few scan-build catches
2017-01-06 19:36:59 -05:00
Donald Sharp
15667da96d Merge pull request #24 from qlyoung/fix-uninitialized-jump
lib: Initialize ->allowrepeat
2017-01-06 19:34:09 -05:00
Donald Sharp
3b14d86eed Merge remote-tracking branch 'origin/stable/2.0' 2017-01-06 09:58:21 -05:00
Donald Sharp
41c17d61a2 lib: Stop potential uninitialized memory access
VRF_UNKNOWN = MAX_INT16_T

The vrf macros to determine where in the bitmap something belongs
assume that the valid values of a vrf are 0 - (MAX_INT16 - 1)
so when they attempt to determine where to look in the bitmap
for VRF_DEFAULT, we can get invalid reads of memory.

This happens because bgp can create vrf's with VRF_UNKNOWN
when we get configuration for a vrf before we've been actually
created in zebra.

Ticket: CM-14090
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-05 19:39:56 -05:00
Donald Sharp
0b0038b8bc Merge pull request #43 from pguibert6WIND/frr_6wind_mpbgpgracefulrestart_1
VPNv4 Enhancement of Graceful Restart
2017-01-05 07:58:32 -05:00
Olivier Dugeon
daf0a4d29c Rationalize Link Parameters flags
* lib/if.h: Remove LP_TE as Link Parameters is set if different from 0
See IS_LINK_PARAMS_SET macro and use LP_TE_METRIC to determine if TE metric
is set or not
 * lib/if.c: replace LP_TE by LP_TE_METRIC in default LP status
 * zebra/interface.c: replace LP_TE by LP_TE_METRIC and check if TE metric
is equal to standard metric or not
 * ospfd/ospf_te.c: replace LP_TE by LP_TE_METRIC
 * isisd/isis_te.c: replace LP_TE by LP_TE_METRIC

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2017-01-05 08:19:11 +01:00
Julien Courtat
4d5b4f7bd9 bgpd: graceful restart for vpnv4 address family
This patch enable the support of graceful restart for routes sets with
vpnv4 address family format. In this specific case, data model is
slightly different and some additional processing must be done when
accessing bgp tables and nodes.
The clearing stale algorithm takes into account the specificity where
the 2 node level for MPLS has to be reached.

Signed-off-by: Julien Courtat <julien.courtat@6wind.com>
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-01-04 18:02:04 +01:00
Philippe Guibert
db19215a73 lib: remove SAFI_RESERVED_3 and move SAFI_MPLS to that value
Because SAFI_RESERVED_3 value is no more used, the SAFI_MPLS value is
lowered to that value.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-01-04 17:58:53 +01:00
Philippe Guibert
268fef65f9 lib: add SAFI_RESERVED_4 value
This value is used to limit certain feature to the safi values until
that reserved value.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-01-04 17:58:44 +01:00
Donald Sharp
80e71dcd1f lib: Update ZAPI to version 4 and HEADER_MARKER to 254
Update the ZEBRA_HEADER_MARKER to 254.  This will differentiate
ourselves from Quagga.  Zebra should not listen to people not
properly using the right programs now.

Update the ZAPI version number to 4.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-04 08:05:39 -05:00
Donald Sharp
9473e34052 watchfrr: Rename watchquagga -> watchfrr
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-03 20:13:02 -05:00
David Lamparter
9b532e09f9 Merge pull request #37 from LabNConsulting/working/2.0/patch-set-170102a
Working/2.0/patch set 170102a
2017-01-03 16:44:44 +01:00
Donald Sharp
9f221bd1a8 Merge pull request #28 from opensourcerouting/dev/osr/rename-part1
rename, part1
2017-01-03 10:44:11 -05:00
Donald Sharp
ff9eb96a93 lib: Partial Revert of 4ecc09d and modify zclient connect behavior
Commit 43cc09d has been shown to cause several issues with clients
connecting.

Partial revert, since I wanted to keep the debug logs added
for that commit, as well remove the piece of code that
stops attempting to connect to zebra.  If we've failed
a bunch of times, there is nothing wrong with continuing
to do so once every 60 seconds.  I've debug guarded
the connect failure for those people running bgp
without zebra.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-01-02 15:13:32 -05:00
G. Paul Ziemba
5ee62c66a9 BGP: deal with vnc related string ambiguities (issue #9)
- "redist foo" parsing modified to check for foo==vnc and foo==vnc-direct
      instead of just leading 'v' character
    - string designating ZEBRA_ROUTE_VNC_DIRECT changed from "vpn" to "vnc-direct"
    - route_types.pl parser recognizes 7th field to restrict availability
      of a route type in the redist command to specific daemons
    - restrict "vnc-direct" to bgpd only (doesn't make sense elsewhere)
    - vnc documentation updated to match

Signed-off-by: Lou Berger <lberger@labn.net>
2017-01-02 15:04:47 -05:00
Lou Berger
271a0c2548 lib/command.c: fix leak id'ed by valgrind
Signed-off-by: Lou Berger <lberger@labn.net>
2017-01-02 15:04:47 -05:00
Lou Berger
21ab852483 prefix.c: replace free with XFREE for memory allocated with XMALLOC
Signed-off-by: Lou Berger <lberger@labn.net>
2017-01-02 15:04:47 -05:00
Donald Sharp
8474f80e5a lib: Allow json to work across different versions.
The json_object_object_get_ex function is not fully available
across all versions of json.  Write a wrapper to allow
it to work.

Ticket: CM-13872
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:18 -05:00
Donald Sharp
8f21cf48a1 lib: Fix clang SA warnings.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:15 -05:00
Donald Sharp
c8ff19f7be lib: Fix thread_execute_crash
With the change to have thread_get fill inthe ->hist
pointer, thread_execute was missed and it
needs to fill in the .hist pointer for the
dummy thread created.

I'm not really sure why we need to call a
thread_execute on a function.  When we
could, you know, just call the bloody
thing.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:15 -05:00
Donald Sharp
e4fe5b196e lib: Fix 'show thread cpu' to display active threads
Fix the display of 'show thread cpu' to keep track
of the number of active threads and to display that
information.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:14 -05:00
Donald Sharp
a2012b80b1 lib: Slight Optimization of thread handling.
This commit does these things:

1) Make thread_add_unuse own the setting of THREAD_UNUSED.
2) Move thread->hist finding to to thread_get.
   We are storing the thread->hist even when the thread
   is on the unused.  This means that we check to see
   if the funcname or func have changed and we get new
   history.  Else we've probably just retrieved the last
   unused which has the same func/funcanme.  This is
   a common practice to do THREAD_OFF/THREAD_ON in
   quick succession.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com.
2016-12-21 20:26:14 -05:00
Donald Sharp
95f0715748 lib: Turn off automatic debugging of Wheel code.
Turn off the automatic debugging of Timer wheel code.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:13 -05:00
Donald Sharp
1de1c5bed3 lib: Add Timer Wheel functionality
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:13 -05:00
Donald Sharp
5f8fec8728 lib, pimd: Modify writen to retry on certain failures
When writen fails, allow itto retry on certain failures
until it succeeds.

Ticket: CM-12986
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:10 -05:00
Donald Sharp
e3be04328f lib, pimd, zebra: Allow pimd to ask the kernel about mroute info
When we need to lookup the mroute info for a route.  Allow
pimd to ask the kernel.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:06 -05:00
Donald Sharp
90d82769a8 zebra: Fully decode mcast messages
Fully decode mcast messages from the kernel.  We are not
doing anything with this at the moment, but that will
change.

Additionally convert over to using lookup for
displaying the route type.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:06 -05:00