summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2017-04-01lib: fix usage of getgrouplist() in *BSDMike Tancsa
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-03-30Rename: FreeRangeRouting FRRoutingLou Berger
Signed-off-by: Lou Berger <lberger@labn.net>
2017-03-28*: track version & "defaults" in configsDavid Lamparter
[CF]: Move default name to autoconf and update tests Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2017-03-10Merge pull request #266 from donaldsharp/nhtDavid Lamparter
bug fixes
2017-03-09lib: handle case specifc types, protect against double free (issue #144)Lou Berger
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-09Revert "lib: Fix tab completions memleak, memory stats corruption"David Lamparter
This reverts commit 039dc61292de5f3ed5f46316b1940ab6bb184c3f. 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-09Lowercase frr.confMartín Beauchamp
2017-02-27*: remove QUAGGA_NO_DEPRECATED_INTERFACESQuentin Young
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-21Add missing DESC_ENTRY to lib/log.cßingen
2017-02-10lib: CID 1399296: Assign instead of compare (PW.ASSIGN_WHERE_COMPARE_MEANT)Martin Winter
Needs to be a comparison, not assignment Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2017-02-09lib: use fsync() for config writes, plug fd leakDavid Lamparter
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-07*: Found some instances of Quagga.confDonald Sharp
Cleanup Quagga.conf -> Frr.conf Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-07Merge pull request #176 from opensourcerouting/mtype-underflow-backtraceDonald Sharp
lib: print backtrace on MTYPE count underflow
2017-02-07Merge pull request #161 from donaldsharp/stableMcLibraryDavid Lamparter
Stable mc library
2017-02-07lib: print backtrace on MTYPE count underflowDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-07lib: Fixup CR commentDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-06lib: Don't use malloc!Donald Sharp
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-03*: Convert libzebra -> libfrrDonald Sharp
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-01lib: plug leak in prefix_list_delete()David Lamparter
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*: fix warning fallout from set_socket_pathDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-26lib: Don't change uid/gid if we are already the correct uid/gidMartin Winter
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2017-01-26lib: Add set_socket_path() to sockopt.c to override the path element of a ↵Martin Winter
(vty) socket (but keep filename) Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2017-01-18lib: additional patch for 496e83aQuentin Young
Fixes a couple off-by-ones introduced in previous commit. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com> [cherry-picked from master d1e4a518e6f55ccf80c67b58d16eeb1cbf5923e3] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-13lib: limit size of vty buffer to 4096 bytesQuentin Young
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 2af38873d89e20bd039255418366c1601aa99e64]
2017-01-09Merge pull request #47 from donaldsharp/valgrindDonald Sharp
Valgrind
2017-01-05lib: Stop potential uninitialized memory accessDonald Sharp
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-04lib: Update ZAPI to version 4 and HEADER_MARKER to 254Donald Sharp
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-03watchfrr: Rename watchquagga -> watchfrrDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-03Merge pull request #37 from LabNConsulting/working/2.0/patch-set-170102aDavid Lamparter
Working/2.0/patch set 170102a
2017-01-03Merge pull request #28 from opensourcerouting/dev/osr/rename-part1Donald Sharp
rename, part1
2017-01-02lib: Partial Revert of 4ecc09d and modify zclient connect behaviorDonald Sharp
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-02BGP: deal with vnc related string ambiguities (issue #9)G. Paul Ziemba
- "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-02lib/command.c: fix leak id'ed by valgrindLou Berger
Signed-off-by: Lou Berger <lberger@labn.net>
2017-01-02prefix.c: replace free with XFREE for memory allocated with XMALLOCLou Berger
Signed-off-by: Lou Berger <lberger@labn.net>
2016-12-20build: rename (2 of ?): route_types macrosDavid Lamparter
All of the autogenerated macros in lib/route_types.pl are now called FRR_* instead of QUAGGA_*. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-20build: replace some hardcoding with ./configureDavid Lamparter
Several places have paths and names that can change hardcoded, e.g. the package name and the /var/run path. This fixes a few of them, there's still some to do. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-20build: rename (1 of ?): configure.ac + preprocDavid Lamparter
This replaces Quagga -> FRR in most configure.ac settings as well as a handful of preprocessor macros in the source code. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-15lib: Ensure ptrs are NULL on freeDonald Sharp
There exists a possibility that when we cleanup for shutdown that we may attempt to access them again. Found via valgrind, stopped showing up in there. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-08lib: fix prefix2str return value and assertChristian Franke
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2016-12-08*: always set SO_SNDBUF and SO_RCVBUF using a best effort approachRenato Westphal
If we fail to set any socket's buffer size, try again with a smaller value and keep going until it succeeds. This is better than just giving up or, even worse, abort the creation of a socket (ospf6d and ripd). Fix broken ospf6d on FreeBSD. Signed-off-by: Renato Westphal <renato@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-05lib: remove unused NS_BITMAP MTYPEDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-05Merge branch '-rip' into stable/2.0David Lamparter
This fixes up a lot of RIP/RIPng compliance tests that were still flagged up. Tested-by: Martin Winter <mwinter@opensourcerouting.org>
2016-12-05Merge branch '-renato' into stable/2.0David Lamparter
This contains bgp memory leak fixes as well as cleanups to VRF/namespace handling and has been run through extended testing in Cumulus' testbed: Tested-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-05lib, zebra: Minimize display of link-params sub dataDonald Sharp
When link-params is configured it auto starts displaying 6000-02# conf t dell-s6000-02(config)# int swp1 dell-s6000-02(config-if)# link-params dell-s6000-02(config-link-params)# admin-grp 0x12345678 dell-s6000-02(config-link-params)# end dell-s6000-02# show run interface swp1 link-params enable metric 0 <----Remove the bw lines max-bw 1.25e+06 max-rsv-bw 1.25e+06 unrsv-bw 0 1.25e+06 unrsv-bw 1 1.25e+06 unrsv-bw 2 1.25e+06 unrsv-bw 3 1.25e+06 unrsv-bw 4 1.25e+06 unrsv-bw 5 1.25e+06 unrsv-bw 6 1.25e+06 unrsv-bw 7 1.25e+06 admin-grp 305419896 exit-link-params ! I'd like to reduce this to: interface enp0s3 ip igmp ip pim sm link-params enable admin-grp 0x12345678 <----- Fix this to be what we entered exit-link-params ! Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-01lib: replace MIT license with ISCDavid Lamparter
Since other parts (e.g. ldpd) use the ISC license, and the ISC license is just a simplified form of the MIT license, just move things over and reduce the number of different licenses we have in use here. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-28zebra/lib: remove redundant fields from zebra_vrfRenato Westphal
There's no need to duplicate the 'vrf_id' and 'name' fields from the 'vrf' structure into the 'zebra_vrf' structure. Instead of that, add a back pointer in 'zebra_vrf' that should point to the associated 'vrf' structure. Additionally, modify the vrf callbacks to pass the whole vrf structure as a parameter. This allow us to make further simplifications in the code. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-11-28lib/zebra: put vrf_get() on a dietRenato Westphal
Also, for some reason we had two functions to search a VRF by its name: zebra_vrf_lookup_by_name() and zebra_vrf_list_lookup_by_name(). The first one would loop through vrf_table and the other one through vrf_list. This is not necessary anymore, so remove zebra_vrf_lookup_by_name() and rename zebra_vrf_list_lookup_by_name() to zebra_vrf_lookup_by_name(). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-11-28zebra: order VRFs by name on user outputRenato Westphal
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-11-28lib/zebra: convert vrf_list to a red-black treeRenato Westphal
Since we're already using a red-black tree to store VRFs sorted by their vrf_id's, create a new tree to store VRFs sorted by their names. The biggest advantage of doing this is that we reduce the time complexity of vrf_list_lookup_by_name() from O(n) to O(log n). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-11-28*: rename two vrf functionsRenato Westphal
Since VRFs can be searched by vrf_id or name, make this explicit in the helper functions. s/vrf_lookup/vrf_lookup_by_id/ s/zebra_vrf_lookup/zebra_vrf_lookup_by_id/ Signed-off-by: Renato Westphal <renato@opensourcerouting.org>