Commit Graph

1641 Commits

Author SHA1 Message Date
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
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