summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2018-01-29lib: When we shutdown we would leak interface descriptionDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com.
2018-01-24lib: streamline frr_pthreads, add default loopQuentin Young
Some work on FRR's pthread wrapper. * Provide a built-in way to synchronize thread startup * Make utility functions take frr_pthread * instead of its integer ID * Pass frr_pthread * as pthread start function argument * Correct some comment styling * Rename some variables to match naming conventions in the file * Change parameter ordering in stop function prototype to follow the convention in the other functions * Default new frr_pthreads to using a vanilla event loop For the last point, the original goal when designing the implementation of pthreads into FRR was to be able to use the thread.c event based system inside pthreads. This code essentially encapuslates all the thread.c functionality into an easy to use pthread out of the box. Creating a new frr_pthread with a null attributes field will cause the created frr_pthread to run a thread.c event loop. The upshot of this is that it is now possible to safely run existing functions in a pthread in roughly 3 lines of code. It also serves as an example / starting point for others. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-01-23Merge pull request #1665 from donaldsharp/nexthop_labelsRuss White
Cleanup some zclient code
2018-01-23Merge pull request #1618 from donaldsharp/zebra_startup_orderingPhilippe Guibert
zebra route-leaking for static routes
2018-01-22bgpd, lib, pimd: Abstract commands for nexthop trackingDonald Sharp
Abstract the code that sends the zapi message into zebra for the turn on/off of nexthop tracking for a prefix. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-01-22lib: Unset bitmap when not using itDonald Sharp
The zclient->redist bitmap for vrf's was being set again for the zclient_send_dereg_requests function. This should be a unset on tear down. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-01-22lib: Cleanup some zclient clutter.Donald Sharp
The zclient code can be cleaned up a tiny bit and hopefully improve it's indentation some. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-01-22lib, zebra: Rename and place appropriately the label stackDonald Sharp
Fix and rename the label stack to be better named. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-01-22lib: ns_id_t changed to 32 bitPhilippe Guibert
Because the VRF_ID is mapped into 32 bit, and because when NETNS will be the backend of VRF, then the NS identifier must also be encoded as 32 bit. Also, the NS_UNKNOWN value is changed accordingly to UINT32_MAX. Also, the NS_UNKNOWN and NS_DEFAULT values are removed from zebra_ns.h and kept on ns.h header file. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-01-22lib: vrf_bitmap_groups increased from 8 to 1024Philippe Guibert
The number of vrf bitmap groups is increased so as to avoid consuming too much memory. This fix is related to a fork memory that occured when running pimd as daemon. A check on memory consumed shows that the memory consumed goes from 33480ko to 46888ko with that change. This is less compared to if the value of the bitmap groups is increased to 16 ( 852776ko). Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-01-22lib: increase vrf_id from 16 bit to 32 bit identifierPhilippe Guibert
This is a preparatory work for configuring vrf/frr over netns vrf structure is being changed to 32 bit, and the VRF will have the possibility to have a backend made up of NETNS. Let's put some history. Initially the 32 bit was because one wanted to map on vrf_id both the VRFLITE and the NSID. Initially, one would have liked to make zebra configure at the same time both vrf lite and vrf from netns in a flat way. From the show running perspective, one would have had both kind of vrfs, thatone would configure on the same way. however, it leads to inconsistencies in concepts, because it mixes vrf vrf with vrf, and vrf is not always mapped with netns. For instance, logical-router could also be used with netns. In that case, it would not be possible to map vrf with netns. There was an other reason why 32 bit is proposed. this is because some systems handle NSID to 32 bits. As vrf lite exists only on Linux, there are other systems that would like to use an other vrf backend than vrf lite. The netns backend for vrf will be used for that too. for instance, for windows or freebsd, some similar netns concept exists; so it will be easier to reuse netns backend for vrf, than reusing vrflite backend for vrf. This commit is here to extend vrf_id to 32 bits. Following commits in a second step will help in enable a VRF backend. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-01-18Merge pull request #1645 from qlyoung/fix-cancel-invalid-rwJafar Al-Gharaibeh
lib: avoid crash when cancelling invalid rw job
2018-01-16lib: avoid crash when cancelling invalid rw jobQuentin Young
There are some observed instances where we end up trying to cancel a rw job based on a file descriptor that we don't have a reference on. The specific cancel function for rw jobs assumes it's called with a file descriptor that is valid within pollfds and will cause a segmentation fault by buffer overrun if this is not the case. Instead log it and move on. Since the fd does not exist this should patch over the buggy behavior and provide additional information to help in finding the root cause. Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-01-16Merge pull request #1614 from qlyoung/imp-bgpd-pthread-startup-syncLou Berger
improve bgpd thread startup characteristics
2018-01-12lib: Increment zapi version numberDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-01-12*: Send/receive the nexthop vrf_idDonald Sharp
Modify the code to send and receive to/from zebra the nexthops vrf_id. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-01-12lib: Allow interface lookup by VRF_UNKNOWNDonald Sharp
Modify if_lookup_by_index to accept a VRF_UNKNOWN as a vrf_id. This will cause it to look in all vrf's for the interface pointer. Subsequently all if_XXXX functions that call this function will also get this behavior. VRF_UNKNOWN *should* not be used for interface creation as that this will break some core assumptions. This work is part of allowing vrf route leaking. Currently it is possible to create a route in the linux kernel that has a nexthop across vrf boundaries. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-01-12lib: Add notice of when we can remove some deprecated code.Donald Sharp
The zapi_ipv4_route, zapi_ipv6_route and zapi_ipv4_route_ipv6_nexthop functions are deprecated. Add notice of when we can remove the deprecated code from the system. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-01-12Merge pull request #1455 from mkanjari/evpn-symmetric-routingPhilippe Guibert
Support for Evpn symmetric routing + EVPN Prefix route
2018-01-11Merge branch 'master' into evpn-symmetric-routingMitesh Kanjariya
2018-01-11lib, bgpd: fixup use of of CMD_ARGC_MAXQuentin Young
The constant to limit # of allowed cli tokens on any one line was defined in multiple places, all inconsistent with each other. Fix. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-01-10Merge pull request #1591 from qlyoung/bgpd-ringbufRuss White
bgpd: use ring buffer for network input
2018-01-09lib: add MTYPE for synchronization primitivesQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-01-08Merge pull request #1590 from chiragshah6/pim_devJafar Al-Gharaibeh
lib: Fix no interface cmd vrf parsing
2018-01-06lib: Add pthread_yieldDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-01-03lib: Fix no interface cmd vrf parsingChirag Shah
For no interface <ifname> vrf VRFNAME, vrf-name is not parsed properly. Ticket:CM-19274 Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2018-01-03lib: fix a few bugs in ring buffersQuentin Young
* Fix rare failure caused when end pointer is at end of buffer memory and a call to ringbuf_get() is made that reads all of the data in the buffer; start pointer was advanced past end pointer, causing some special handling to be skipped * Fix ringbuf_peek() moving start pointer * Fix use after free * Remove extraneous assignment * Update relevant tests Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-01-03lib: add ringbuf_copy()Quentin Young
Quick 'n easy way to copy the contents of one ringbuf to another. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-01-02Merge pull request #1569 from qlyoung/ringbufRuss White
lib: add ring buffer
2017-12-27bgpd, lib, zebra: fix style problemsmitesh
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-12-26lib: add ringbuf_peek()Quentin Young
Peek functionality for ring buffers and associated tests. Also: * Slight optimization to avoid 0-byte memcpy() by changing > to >= * Add rv checks for some ringbuf_[put|get] calls that were missing them in the test Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-12-19lib: add ring bufferQuentin Young
Simple ring buffer implementation useful for fixed size FIFO queues. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-12-19Merge pull request #1515 from donaldsharp/selected_to_front1Renato Westphal
Store selected_fib as a pointer off of rib_dest_t
2017-12-14bgpd: process evpn type-5 routes received from peersMitesh Kanjariya
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-12-14bgpd: only advertise valid subnet routes as evpn type-5 routesMitesh Kanjariya
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-12-14bgpd: follow AFI/SAFI style for advertising/withdrawing type-5 routesMitesh Kanjariya
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-12-14bgpd: advertise/withdraw type-5 routes upon user configmitesh
CLI config for enabling/disabling type-5 routes router bgp <as> vrf <vrf> address-family l2vpn evpn [no] advertise <ipv4|ipv6|both> loop through all the routes in VRF instance and advertise/withdraw all ip routes as type-5 routes in default instance. Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-12-14bgpd: json support for show bgp l2vpn evpn vrf-import-rtMitesh Kanjariya
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-12-14bgpd: set evpn rvtep nexthops as active by defaultMitesh Kanjariya
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-12-14bgpd: program nh/rmac entriesmitesh
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-12-14bgpd: program mac-ip routes in matching vrfsmitesh
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-12-14zebra, lib: zebra changes for symmetric routing supportMitesh Kanjariya
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-12-13Merge pull request #1478 from bingen/zeromq4Donald Sharp
lib: Address ZMQ lib TODOs
2017-12-07Merge pull request #1519 from donaldsharp/ptmRafael Zalamena
Ptm
2017-12-05*: Remove cvs control pointsDonald Sharp
The $Id: lines would allow code kept in cvs to substitute the file version upon checkout. Since we are not using cvs there is no need to keep these lines anymore. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-12-05lib: Fix gcc 7 warning 'error: ‘fld’ may be used uninitialized in this ↵Martin Winter
function' Warning breaks Debian Package build with gcc 7 which uses -Werror=maybe-uninitialized Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2017-12-04lib: Allow memory to be cleaned up for error cases in ptmDonald Sharp
ptm_lib.c had no way to cleanup after itself when an error was detected. This adds a function to cleanup context in such a case. A followup commit will use this new functionality. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-12-04*: make clippy usage more consistentRenato Westphal
Fixes #1511. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-12-01*: don't use deprecated stream.h macrosQuentin Young
Some of the deprecated stream.h macros see such little use that we may as well just remove them and use the non-deprecated macros. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-11-29lib: Fix thread removal from a pqueueDonald Sharp
When we remove a thread from a pqueue, use the saved index to go to the correct spot immediately instead of having to search the whole queue for it. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>