summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2016-08-26build/solaris: fix one error and a few warningsRenato Westphal
Signed-off-by: Renato Westphal <renato@openbsd.org>
2016-08-22quagga route-map on-match and continue statements accept 65536Daniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Ticket: CM-12581
2016-08-21zebra: implement per-route mtu handlingTimo Teräs
This commits allow overriding MTU using netlink attributes on per-route basis. This is useful for routing protocols that can advertice prefix specific MTUs between routers (e.g. NHRP). Signed-off-by: Timo Teräs <timo.teras@iki.fi> (cherry picked from commit b11f3b54c842117e22e2f5cf1561ea34eee8dfcc)
2016-08-19zebra: make ZEBRA_FLAG_CHANGED internal statusTimo Teräs
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> Acked-by: Donald Sharp <sharpd@cumulusnetworks.com> (cherry picked from commit 7eb6136b2732d4782360f9f376336c6d4f667ff0)
2016-08-19Merge remote-tracking branch 'origin/cmaster' into cmaster-nextDonald Sharp
2016-08-18*: use an ifindex_t type, defined in lib/if.h, for ifindex valuesPaul Jakma
(cherry picked from commit 9099f9b2a66e86f8a90d7fe18f61bd2bb1bc6744)
2016-08-17Fix for CM-12450 Ensure quagga logs at startup are sent to syslog (until log ↵Sid Khot
configuration is processed) Ticket: CM-12450 Reviewed By: CCR-5112 Testing Done: Manual
2016-08-16lib, bgpd, tests: Refactor FILTER_X in zebra.hDonald Sharp
lib/zebra.h has FILTER_X #define's. These do not belong there. Put them in lib/filter.h where they belong. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> (cherry picked from commit 0490729cc033a3483fc6b0ed45085ee249cac779)
2016-08-16lib: don't have log functions change errnoChristian Franke
Signed-off-by: Christian Franke <chris@opensourcerouting.org> Acked-by: Donald Sharp <sharpd@cumulusnetworks.com> (cherry picked from commit abfd40d68202882696260617729518a6d2c99302)
2016-08-07lib: update strlcpy to OpenBSD v1.13Renato Westphal
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-08-07lib: fix setting of IPv4 multicast sockopts on OpenBSDRenato Westphal
OpenBSD doesn't support the "ifindex hack" derived from RFC 1724 which allows an ifindex to be encoded in the imr_interface field (in_addr) of the ip_mreq structure. OpenBSD also doesn't support the RFC3678 Protocol-Independent socket API extensions, which allows an interface to be specified by its ifindex. With that said, in OpenBSD we still need to specify an interface by its IP address. This patch adds an exception in the multicast sockopt functions to handle this case. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-08-03lib: Arm build breakage with MAX_INT macro issuesDonald Sharp
The VTY_GET_INTEGER_RANGE macro is failing on arm with a warning->error issue where we are passing in a unsigned MAXINT to this macro and it is complaining that the comparison of (TMPL) > MAXINT is always going to be false because of data structure size. I've changed the tmp variable to a unsigned long long which alleviates this issue. Ticket: CM-12187 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
2016-07-28lib: 'show commandtree' is not a CLI commandDonald Sharp
The 'show commandtree' command was added to the CONFIG_NODE. We have a basic assumption that CONFIG_NODE commands actually change state. 'show commandtree' doesn't meet this requirement. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-07-28*: get rid of "MTYPE 0"David Lamparter
A few places are using 0 in place of the MTYPE_* argument. The following rewrite of the alloc tracking won't deal with that, so let's use MTYPE_TMP instead. Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> Acked-by: Donald Sharp <sharpd@cumulusnetworks.com> [DL: v2: fix XFREE(0, foo) calls too] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-07-28lib: add 3-byte stream functionsDavid Lamparter
This will be used for BGP MPLS labels. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-07-28lib: linklist: clean up insert-before/after dupsDavid Lamparter
- list_add_node_next was in fact unused - list_add_node_prev performs a subset of listnode_add_before and its only use in isisd replaced with that. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-07-28lib: AgentX: use threads instead of eventloop hackDavid Lamparter
AgentX fd/timeout handling is rather hackishly monkeyed into thread.c. Replace with code that uses plain thread_* functions. NB: Net-SNMP's API rivals Quagga's in terms of age and absence of documentation. netsnmp_check_outstanding_agent_requests() in particular seems to be unused and is therefore untested. The most useful documentation on this is actually the blog post Vincent Bernat wrote when he originally integrated this into lldpd and Quagga: https://vincent.bernat.im/en/blog/2012-snmp-event-loop.html Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-07-28lib: add thread_add_timer_tv (struct timeval)David Lamparter
Another zoo extension, this adds a timer scheduling function that takes a struct timeval argument (which is actually what the wrappers boil down to, yet it's not exposed...) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-07-28lib: linklist: add listnode_add_before()David Lamparter
This utility function, to join the zoo that the Quagga linked-list implementation has accumulated, does an insert-before while returning the newly allocated node. It is similar to: - listnode_add_after(), but - complementary direction - returns allocated node - list_add_node_prev(), but - supports before == NULL - returns allocated node In general, the entire linked-list implementation is in bad shape, and while it needs a cleanup / rewrite / replacement, this would both cause significant conflicts and block other cleanups... Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-07-28lib: remove a whole bunch of unused time stuffDavid Lamparter
QUAGGA_CLK_REALTIME and QUAGGA_CLK_REALTIME_STABILISED aren't used anywhere in the code. Remove. The enum is kept to avoid having to change the calls everywhere. Same applies to the workaround code for systems that don't have a monotonic clock. None of the systems Quagga works on fall into that category; Linux, BSD and Solaris all do clock_gettime, for OSX we have mach_absolute_time() - that covers everything. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-07-28ospfd: monotonic clock for lsa_refresher_startedDavid Lamparter
ospf->lsa_refresher_started is only used in relative timing to itself; replace with monotonic clock which is appropriate for this. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-07-24Revert "lib: Rewrite ipv4 address and prefix validator"David Lamparter
This reverts commit d4dc41b6a23d5156b0d9068006a1eeb3ba32e301. The rewritten parser fails to recognise "1.2." as partial input for an IPv4 address, which causes "make check" to fail. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-07-24*: fixup snmp supportDavid Lamparter
- HAVE_POLL is overloaded by net-snmp - missing includes - ospf6_snmp converted to vrf_iflist() Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-07-26lib: Free memory correctly when braces used in parserDon Slice
When braces (optional parameters) are used in the quagga parser, there was a small leak on every iteration. Since this construct is primarily used in the configuation process rather than show commands, it was not readily apparent. With the addition of the "show ip bgp {json}" form of the commands, each time one was run, memory was leaked. Ticket: CM-11435 Signed-off-by: Don Slice Reviewed By: Donald Sharp Testing Done: Manual testing, bgp-min and bgp-smoke successful
2016-07-22lib: Modify 'banner motd file <X>'Donald Sharp
Modify the banner motd file X command to do these things differently: 1) Only allow the file <X> to be in SYSCONFDIR 2) Only allow the user to use a file that exists. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Dinesh Dutt <ddutt@cumulusnetworks.com>
2016-07-12lib: Rewrite ipv4 address and prefix validatorQuentin Young
Simplify ipv4 prefix and address matcher / validator to use standard Linux networking functions instead of a state machine. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
2016-07-12lib: Disallow % in IPv6 addresses and prefixesQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-07-12lib: Rewrite ipv6 prefix matcherQuentin Young
Simplify ipv6 prefix matcher / validator to use standard Linux networking functions instead of a state machine. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
2016-07-11all: add default log file if none are definedDon Slice
Added a default log file named /var/log/quagga/Quagga.log to every daemon to capture log entries if no log file is defined. This also allows the capture of logged information prior to reading each daemon's config file. If a log file is defined manually, it will override this default file name. Ticket: CM-10987 Signed-off-by: Don Slice Reviewed By: Donald Sharp Testing Done: Manual testing
2016-06-28zebra/ospf/ospf6: Fix several memory leaks on if up/downDon Slice
Resolved several memory leaks caused by ifdown/ifup the vrf device or a swp port. For bgp/zebra/ospf/ospf6, bouncing the vrf device would cause a linked list, Interface, and route-table to get leaked. For ospf6, bouncing the swp device also caused leaks of Connected and Prefix entries. Ticket: CM-10841 Signed-off-by: Don Slice Reviewed-By: Donald Sharp Testing Done: Manual testing, bgp and ospf mins passed, smokes had fewer failures than base
2016-06-23lib: Add documentation to internal command format parser functionsQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-06-17lib: Remove 'show memory pim' unused commandDonald Sharp
This command is not used, Remove it. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-16lib: Clean command.cQuentin Young
Removed dead code paths and fixed a typo. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-06-13Merge branch 'cmaster-next' of ↵Don Slice
ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster-next
2016-06-13ospfd/ospf6d/zebra: Change interface bandwidth range and auto-cost range to 100GDon Slice
Prior to this change, interface bandwidth could not be defined above 10G. With the use of higher speed interfaces, the ability to effectively define the path links was highly impacted. Additionally, the default auto-cost reference-bandwidth for ospf and ospfv3 was set to 100M, which relects a much earlier time. Changed both the range of interface bandwidth definitions and reference bandwidths to be up to 100G. Set the default interface bandwidth (if not defined) to 10G to make the ratio continue to cause a cost of 10 as before. Manual testing as well as ospf-min and ospf-smoke passed successfully. Ticket: CM-10756 Signed-of-by: Don Slice Reviewed-by: Donald Sharp
2016-06-11bgpd, lib, vtysh: hook up bgp ENCAP CLI nodeLou Berger
Signed-off-by: Lou Berger <lberger@labn.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit a3fda886cdd48b6d8c421ebb1401142fa9ee93b0) Conflicts: bgpd/bgp_vty.c bgpd/bgpd.c vtysh/vtysh_config.c
2016-06-10lib: Fix some poll semanticsDonald Sharp
Two Fixes: 1) When a fd has both read and write as a .events. (POLLHUP | POLLIN | POLLOUT) and a thread_cancel_read_write call is executed from a protocol, the code was blindly removing the fd from consideration at all. 2) POLLNVAL was being evaluated before POLLIN|POLLOUT were being evaluated. While I didn't see a case of POLLNVAL being included with other .revent flags I decided to move the POLLNVAL and POLLHUP handling to the same section of code. Additionally the function thread_cancel_read_write was poorly named and let me to poorly implement the poll version of it. I've renamed the function thread_cancel_read_or_write in an attempt to make this problem moot in the future. Ticket: CM-11027 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> (cherry picked from commit f6da66a913bcae1d3f75c55f24e72e97288af619)
2016-06-10configure: Auto pick-up the correct json envDonald Sharp
Fix the code to allow Quagga to automatically compile with the correct json library. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-09bgpd: encap: add attribute handlingLou Berger
Signed-off-by: Lou Berger <lberger@labn.net> Reviewed-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit c3741789530ee824693fd606356acac2ad695f83) Conflicts: bgpd/Makefile.am bgpd/bgp_attr.c bgpd/bgp_attr.h lib/memtypes.c
2016-06-09lib: change command logging to be off by default, and add 'log_commands' to ↵Lou Berger
enable it.
2016-06-09lib: add facility to log all CLI commandsLou Berger
Signed-off-by: Lou Berger <lberger@labn.net> (cherry picked from commit c7f7e49a4f68c92152384582ff70d64609858170)
2016-06-09*: make sure zebra.h is always included firstDavid Lamparter
zebra.h pulls in config.h, which results in fiddling with things like __FILE_OFFSET_BITS. It must always be included first, in order to set flags that influence the compiler via <features.h>. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit 821df2cf18e5978cc7ab532a8695444380d08270)
2016-06-09lib/zclient: Consolidate error reporting for zclient_read_headerDonald Sharp
All functions that call zclient_read_header immediately turn around and check to ensure that the version and marker fields are correct Move this code into zclient_read_header Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> (cherry picked from commit a9d4cb33faa6af622240190a80f41c4672374925)
2016-06-09lib: make prefix2str simpler to use, and use it in zclientTimo Teräs
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> (cherry picked from commit 41eb9a4305fbcb206c900a18af7df7115d857d60)
2016-06-09lib: allow caller to provide prefix storage in sockunion2hostprefixTimo Teräs
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>
2016-06-08lib/vty: don't clear output buffer on input EOFDavid Lamparter
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>
2016-06-08lib/vty: add vty_stdio at-close hookDavid Lamparter
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> (cherry picked from commit 464ccf36b4aa1b942cad413ea30267b4bf9e6315)
2016-06-08lib/vty: put stdin in raw mode for vtyDavid Lamparter
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> (cherry picked from commit ba53a8fdecef07577dcc4109e5c82bb124d49c58)
2016-06-08lib/vty: add vty_stdio()David Lamparter
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>
2016-06-08lib/vty: add separate output fd support to VTYsDavid Lamparter
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> (cherry picked from commit 4715a53b4d390e72a06c864a6a505971841e3dc9)