summaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* zebra: support FIB override routestterasTimo Teräs2015-06-041-0/+1
| | | | | | | | | | | | | | | FIB override routes are for routing protocols that establish shortcut routes, or establish point-to-point routes that should not be redistributed. Namely this is useful NHRP daemon to come. Zebra is extended to select two entries from RIB the "best" entry from routing protocols, and the FIB entry to install to kernel. FIB override routes are never selected as best entry, and thus are never adverticed to other routing daemons. The best FIB override, or if it does not exist the otherwise best RIB is selected as FIB entry to be installed. Signed-off-by: Timo Teräs <timo.teras@iki.fi>
* zebra: make ZEBRA_FLAG_CHANGED internal statusTimo Teräs2015-06-041-1/+0
| | | | | | | | This flag is used internally in zebra only. And it makes no sense to expose it over the zclient API, as having it set from client could corrupt the internal state. Signed-off-by: Timo Teräs <timo.teras@iki.fi>
* zebra-nexthop-tracking.patchDinesh G Dutt2015-06-049-3/+213
| | | | | | | | | | | | | | | Added support for nexthop tracking of a prefix. Support for protocols to register zebra to notify them when a nexthop becomes valid. With this support, protocols such as BGP no longer have to periodically scan the RIB checking if a prefix is valid or invalid. Complete documentation in doc/next-hop-tracking.txt. [TT: Rebased on top of master.] Signed-off-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com> Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Signed-off-by: Dinesh Dutt <ddutt@cumulusnetworks.com>
* zebra: redistribute hw_type to connected daemonsTimo Teräs2015-06-041-0/+1
| | | | | | nhrp module will need it, and it can be useful for others too. Signed-off-by: Timo Teräs <timo.teras@iki.fi>
* lib: make prefix2str simpler to use, and use it in zclientTimo Teräs2015-06-013-7/+11
| | | | | | | | | | | Returning the buffer allows using it in the logging functions in easier way. This also makes the API consistent with sockunion. Add also PREFIX_STRLEN to be the generic buffer length required for any prefix string representation. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: make sockunion2str safer to useTimo Teräs2015-06-011-5/+12
| | | | | | | | It's mostly used for logging, and the return value is never checked, so try to make it valid. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* route table: constify some APIsTimo Teräs2015-05-292-8/+8
| | | | | Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* sockunion: add accessors for sockunion addressTimo Teräs2015-05-292-0/+61
| | | | | | | | Upcoming nhrp code will use this, and it can be used to remove the sockunion2ip(X) macro. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: allow caller to provide prefix storage in sockunion2hostprefixTimo Teräs2015-05-293-16/+10
| | | | | | | Avoids a dynamic allocation which is usually freed immediate afterwards. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* privs: fix privilege dropping to use system defined groupsTimo Teräs2015-05-291-19/+47
| | | | | | | | | | It may be requred for quagga process to belong to additional groups. E.g. nhrp module will need to talk to strongSwan using vici and may require additional permissions. Initialize groups from the system group database. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* Revert "lib: wrong #define used for IPV6_MINHOPCOUNT"David Lamparter2015-05-271-7/+3
| | | | | | | | | | This reverts commit 54b88cac24f335414caa875b390d2d78ff4bf9e0. Unfortunately, this breaks the build on systems where linux/in6.h and netinet/in.h can't both be included, such as Ubuntu 14.04 and Debian Jessie. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: wrong #define used for IPV6_MINHOPCOUNTDonald Sharp2015-05-271-3/+7
| | | | | | | | | | | The #define IPV6_MINHOPCNT define is never defined on any unix platform. >From what I can tell the original implementation on the linux platform was IPV6_MINHOPCNT, when it got accepted into the mainstream kernel it was transformed into IPV6_MINHOPCOUNT. Since we test for the define before attempting to use the code it was silently doing nothing for a long time. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib/privs: Don't use CAP_NET_BROADCASTChristian Franke2015-05-271-2/+1
| | | | | | | | | | | | From what I can tell, CAP_NET_BROADCAST has never been required for any functionality in the Linux kernel, so we do not really need it. However, it causes breakage in contexts where Quagga is started with a limited set of capabilities, e.g. in Docker, because these may not include CAP_NET_BROADCAST and in the case of Docker do not even support adding CAP_NET_BROADCAST. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib/privs: display more info if cap_set_proc fails.Christian Franke2015-05-271-1/+15
| | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib/vty: don't clear output buffer on input EOFDavid Lamparter2015-05-271-1/+1
| | | | | | | | | | | A VTY's input can be closed without the output becoming unavailable. This happens both on stdio when stdin ends, as well as over TCP when an unidirectional input shutdown() happens. In such a case, resetting the output buffer is not appropriate since there might still be data to be successfully written. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib/vty: add vty_stdio at-close hookDavid Lamparter2015-05-272-2/+8
| | | | | | | | | This is intended to be used for either "exit on close", "fork on close" or "reopen vty on close" functionality for the stdio vty. Which of these options to take depends on the context, the use case right now is test programs exiting on EOF. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib/vty: put stdin in raw mode for vtyDavid Lamparter2015-05-271-1/+36
| | | | | | | The interactive CLI actually works just fine, if we just put the terminal in raw mode to get keystrokes as they come. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib/vty: add vty_stdio()David Lamparter2015-05-272-21/+57
| | | | | | | | this introduces a new public/API function to the vty code for opening a VTY on stdin/stdout. Intended for unrestricted use by the individual daemons, i.e. "offical API". Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib/vty: add separate output fd support to VTYsDavid Lamparter2015-05-273-13/+19
| | | | | | | | | to be used with stdin/stdout terminals, this adds support for writing to a different FD than we're reading from. Also fixes error messages from config load being written to stdin. [v2: fixed config write] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: fix "sockunion: add hash function" for BSD (9196caf)David Lamparter2015-05-201-0/+10
| | | | | | | | | | | | | The sockunion_hash() function uses s6_addr32, which is not defined on BSD systems. (It only works on glibc because we set _GNU_SOURCE) ripngd/ripng_nexthop.h already contains a workaround for this. Bump workaround to prefix.h so it's available everywhere. Reported-by: NetDEF CI System <mwinter@netdef.org> Fixes: 9196caf ("sockunion: add hash function") Cc: Timo Teräs <timo.teras@iki.fi> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* sockunion: add hash functionTimo Teräs2015-05-202-0/+17
| | | | | Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* sockopt: add support for querying tcp round-trip-timeTimo Teräs2015-05-202-0/+17
| | | | | Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: assert(0) still needs a returnDavid Lamparter2015-05-141-0/+1
| | | | | | | | assert(0) is not guaranteed to not return since assert() in general can be optimised out when building without debug / with optimisation. This breaks the build in clang, which warns/errors about the missing return. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: fix "reduce strcmp in CLI" fallout (10bac801)David Lamparter2015-05-142-33/+19
| | | | | | | | | | | | | | | In "lib/cli: reduce strcmp in CLI hot paths", I failed to notice that CMD_VARIABLE as a boolean test covers a superset of the other types of variables. Thus, the patch broke processing of IP/IPv6/Integer range parameters in the CLI. Fix by some reordering and introducing TERMINAL_RECORD macro (which marks whether a given terminal type is a parameter) to be used in places where the check is really for all kinds of variables. Reported-by: Timo Teräs <timo.teras@iki.fi> Tested-by: Martin Winter <mwinter@netdef.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: straighten out ORF prefix list supportDavid Lamparter2015-05-052-102/+54
| | | | | | | | | BGP ORF prefix lists are in a separate namespace; this was previously hooked up with a special-purpose AFI value. This is a little kludgy for extension, hence this splits it off. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Acked-by: Paul Jakma <paul@jakma.org>
* lib: hide internal prefix list structuresDavid Lamparter2015-05-054-43/+82
| | | | | | | These are about to be touched and there's no point in other code touching into prefix list's internas. Add some isolation. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib/cli: reduce strcmp in CLI hot pathsDavid Lamparter2015-05-052-136/+174
| | | | | | | | | | | | Er, no idea how anyone could ever have thought that it would be a good idea to have a zillion of strcmp() calls in the CLI's active paths, just to compare against things like "A.B.C.D". Reduces 40k prefix list load time from 1.65s to 1.23s (1.34:1). Acked-by: Paul Jakma <paul@jakma.org> [v2: killed CMDS_* macros] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: constify sockunion apiTimo Teräs2015-05-052-18/+18
| | | | | | | Add const to read-only api calls. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* build: add --enable-werrorDavid Lamparter2015-04-211-0/+1
| | | | | | | | | | | | | | | This allows enabling -Werror in a consistent way. Note that this is different from just specifiying it in CFLAGS, since that would either break configure tests (if done on ./configure), or would override configure's CFLAGS (if done on make). Using --enable-werror instead provides a new WERROR variable that is additionally used during make with a consistent set of warning flags. The tests/ directory is exempt. (Rationale being, better to have more tests than pedantically complain about them.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* snmp: fix warningsDavid Lamparter2015-04-212-4/+4
| | | | | | batch-fix all warnings that come up when enabling AgentX SNMP support. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* vtysh: don't use '\0' as NULLDavid Lamparter2015-04-211-3/+3
| | | | | | for some reason, the vty code was using '\0' in place of NULL. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib, vtysh: reduce unneccessary C extension usageDavid Lamparter2015-04-211-1/+1
| | | | | | | We're only supporting GCC, Clang and ICC; but there's no reason to use nonstandard C constructs if they don't actually provide any benefit. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: use const consistently for zserv pathDavid Lamparter2015-04-212-3/+3
| | | | | | | The global variable is missing its const, but the accessor function has a meaningless extra const in exchange... Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: silence type range warning in macroDavid Lamparter2015-04-211-6/+10
| | | | | | | | While splitting up the CLI input macro is a bit annoying, this seems to be the least annoying way to get rid of the "< 0" comparison warning for unsigned long. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: add/cleanup initialisersDavid Lamparter2015-04-211-1/+1
| | | | | | | | There were some (inconsequential) warnings about uninitialised use of variables. Also, in one case, sub-structs were mixed in initialisation, which doesn't quite work as intended. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: add missing includesDavid Lamparter2015-04-212-0/+3
| | | | | | | Some places, particularly headers, were spewing warnings since they don't include neccessary other headers to get struct/enum definitions. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: remove stray extra semicolonsDavid Lamparter2015-04-211-1/+1
| | | | | | Some places had extra semicolons where none belong. Remove them. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: use void * for printing pointersDavid Lamparter2015-04-213-3/+4
| | | | | | | | | On higher warning levels, compilers expect %p printf arguments to be void *. Since format string / argument warnings can be useful otherwise, let's get rid of this noise by sprinkling casts to void * over printf calls. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: Fix POSIX capabilities on SunOS platformsBrian Bennett2015-03-041-27/+49
| | | | | | | | | | | | | | When using POSIX capabilities on SunOS the capabilities are too restricitve resulting in quagga processes not being able to read their own config files. Credit goes to Oracle where this patch was originally authored and included in OpenSolaris. lib/privs.c: Include additional capabilities, better checking of missing capabilities. Fixes: #820 Acked-by: Greg Troxel <gdt@ir.bbn.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* build: track config argsDavid Lamparter2015-02-142-0/+5
| | | | | | | Record the ./configure arguments used and make them user-visible. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Acked-by: Paul Jakma <paul@jakma.org>
* build: get rid of INCLUDES, use AM_CPPFLAGSDavid Lamparter2015-02-141-1/+1
| | | | | | | | | | | | INCLUDES in configure.ac was not used at all, and INCLUDES in Makefile.am is supposed to be AM_CPPFLAGS these days. Reduces warnings spewed during bootstrap/autoreconf. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Acked-by: Greg Troxel <gdt@ir.bbn.com> Acked-by: Feng Lu <lu.feng@6wind.com> Acked-by: Paul Jakma <paul@jakma.org>
* build: remove INRIA, NRL and MUSICA IPv6 quirksDavid Lamparter2015-02-142-14/+4
| | | | | | | | | Valar dohaeris. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Acked-by: Greg Troxel <gdt@ir.bbn.com> Acked-by: Feng Lu <lu.feng@6wind.com> Acked-by: Paul Jakma <paul@jakma.org>
* build: remove AIX, NEC EWS and IRIXDavid Lamparter2015-02-141-14/+0
| | | | | | | | | Valar morghulis. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Acked-by: Greg Troxel <gdt@ir.bbn.com> Acked-by: Feng Lu <lu.feng@6wind.com> Acked-by: Paul Jakma <paul@jakma.org>
* pimd: Remove non-standard copyright line.Everton Marques2015-02-046-7/+0
|
* zebra: mrib: Remove non-standard copyright line.Everton Marques2015-02-041-1/+0
|
* pimd: Revert accidental removal of show_memory_isis_cmd().Everton Marques2015-02-041-0/+1
|
* zclient: Revert lib export of zclient_socket()/zclient_socket_un().Everton Marques2015-02-042-4/+2
|
* pimd: Remove motd tweaking.Everton Marques2015-02-041-1/+1
|
* pimd: -z command-line switch to specify zebra socket path.Everton Marques2015-02-042-1/+7
|
* zebra: Export zclient_socket_un().Everton Marques2015-02-042-1/+2
|