summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_ptm.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* *: unify thread/event cancel macrosMark Stapp2020-10-231-1/+1
| | | | | | | | | Replace all lib/thread cancel macros, use thread_cancel() everywhere. Only the THREAD_OFF macro and thread_cancel() api are supported. Also adjust thread_cancel_async() to NULL caller's pointer (if present). Signed-off-by: Mark Stapp <mjs@voltanet.io>
* * : update signature of thread_cancel apiMark Stapp2020-10-231-7/+4
| | | | | | | | Change thread_cancel to take a ** to an event, NULL-check before dereferencing, and NULL the caller's pointer. Update many callers to use the new signature. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* *: un-split strings across linesDavid Lamparter2020-07-141-6/+3
| | | | | | | | | | | | | | | | | Remove mid-string line breaks, cf. workflow doc: .. [#tool_style_conflicts] For example, lines over 80 characters are allowed for text strings to make it possible to search the code for them: please see `Linux kernel style (breaking long lines and strings) <https://www.kernel.org/doc/html/v4.10/process/coding-style.html#breaking-long-lines-and-strings>`_ and `Issue #1794 <https://github.com/FRRouting/frr/issues/1794>`_. Scripted commit, idempotent to running: ``` python3 tools/stringmangle.py --unwrap `git ls-files | egrep '\.[ch]$'` ``` Signed-off-by: David Lamparter <equinox@diac24.net>
* *: sprintf -> snprintfQuentin Young2020-04-211-20/+24
| | | | | | | | | | | | | Replace sprintf with snprintf where straightforward to do so. - sprintf's into local scope buffers of known size are replaced with the equivalent snprintf call - snprintf's into local scope buffers of known size that use the buffer size expression now use sizeof(buffer) - sprintf(buf + strlen(buf), ...) replaced with snprintf() into temp buffer followed by strlcat Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: Replace __PRETTY_FUNCTION__/__FUNCTION__ to __func__Donatas Abraitis2020-03-051-1/+1
| | | | | | Just keep the code cool. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* zebra: Add vrf name to debug outputDonald Sharp2020-02-141-2/+4
| | | | | | | The vrf id is insufficient of a discriminator in people's head Give them what they need. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: Remove parenthesis on return for constantsDonatas Abraitis2020-02-091-3/+3
| | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* zebra: bfd message handling cleanup fooQuentin Young2020-01-141-3/+5
| | | | | | | | | | Previous patches introduced various issues: - Removal of stream_free() to fix double free caused memleak - Patch for memleak was incomplete This should fix it hopefully. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* zebra: fix bfd deregister message memleakQuentin Young2020-01-101-0/+2
| | | | | | Removing double frees accidentally introduced a memleak Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* Merge pull request #5624 from qlyoung/fix-zebra-ptm-buffer-overrunRafael Zalamena2020-01-071-25/+14
|\ | | | | Fix PTM ZAPI stream parsing
| * zebra: free ptm message on errorQuentin Young2020-01-061-0/+1
| | | | | | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
| * zebra: fix multiple bfd buffer issuesQuentin Young2020-01-041-25/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Whatever this BFD re-transmission function is had a few problems. 1. Used memcpy instead of the (more concise) stream APIs, which include bounds checking. 2. Did not sufficiently check packet sizes. Actually, 2) is mitigated but is still a problem, because the BFD header is 2 bytes larger than the "normal" ZAPI header, while the overall message size remains the same. So if the source message being duplicated is actually right up against the ZAPI_MAX_PACKET_SIZ, you still can't fit the whole message into your duplicated message. I have no idea what the intent was here but at least there's a warning if it happens now. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | zebra: fix ptm heap double freeQuentin Young2020-01-071-2/+0
|/ | | | | | Don't need to free these, they're freed by the caller. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* Revert "Ospf missing interface handling 2"Donald Sharp2019-06-241-1/+1
|
* *: change interface structure, from vrf_id to vrfPhilippe Guibert2019-06-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Field vrf_id is replaced by the pointer of the struct vrf *. For that all other code referencing to (interface)->vrf_id is replaced. This work should not change the behaviour. It is just a continuation work toward having an interface API handling vrf pointer only. some new generic functions are created in vrf: vrf_to_id, vrf_to_name, a zebra function is also created: zvrf_info_lookup an ospf function is also created: ospf_lookup_by_vrf it is to be noted that now that interface has a vrf pointer, some more optimisations could be thought through all the rest of the code. as example, many structure store the vrf_id. those structures could get the exact vrf structure if inherited from an interface vrf context. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* bfdd, lib, bgpd: add bfd cbit usagePhilippe Guibert2019-05-141-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | bfd cbit is a value carried out in bfd messages, that permit to keep or not, the independence between control plane and dataplane. In other words, while most of the cases plan to flush entries, when bfd goes down, there are some cases where that bfd event should be ignored. this is the case with non stop forwarding mechanisms where entries may be kept. this is the case for BGP, when graceful restart capability is used. If BFD event down happens, and bgp is in graceful restart mode, it is wished to ignore the BFD event while waiting for the remote router to restart. The changes take into account the following: - add a config flag across zebra layer so that daemon can set or not the cbit capability. - ability for daemons to read the remote bfd capability associated to a bfd notification. - in bfdd, according to the value, the cbit value is set - in bfdd, the received value is retrived and stored in the bfd session context. - by default, the local cbit announced to remote is set to 1 while preservation of the local path is not set. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* bfdd, zebra: pass the vrf identifier between zebra and bfddPhilippe Guibert2019-05-071-9/+9
| | | | | | | messages from daemons to bfd daemons go through zebra. zebra reuses the vrf identifier to send messages to bfd. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* *: remove trailing newlines from zlog messagesQuentin Young2019-03-141-2/+2
| | | | | | Zlog puts its own newlines on, and doing this makes logs look nasty. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: do not check XMALLOC / XCALLOC for null retQuentin Young2019-02-261-2/+0
| | | | | | They never return NULL Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* zebra: Move client_list to the zebra_router data structureDonald Sharp2019-01-311-3/+3
| | | | | | | The client_list should be owned by the zebra_router data structure as that it is part of global state information. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: Move the master thread handler to the zrouter structureDonald Sharp2019-01-311-12/+12
| | | | | | | | The master thread handler is really part of the zrouter structure. So let's move it over to that. Eventually zserv.h will only be used for zapi messages. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra_ptm: Introduce IS_BFD_ENABLED_PROTOCOL macroChristian Franke2018-10-051-27/+3
| | | | | | Unify the check if a client supports BFD into one location. Signed-off-by: Christian Franke <chris@opensourcerouting.org>
* *: style for EC replacementsQuentin Young2018-09-131-7/+7
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: LIB_[ERR|WARN] -> EC_LIBQuentin Young2018-09-131-3/+3
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* zebra: ZEBRA_[ERR|WARN] -> EC_ZEBRAQuentin Young2018-09-131-3/+3
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* zebra: fix includesQuentin Young2018-09-061-0/+1
| | | | | | Add and remove error related includes as necessary. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* zebra: flog_warn conversionQuentin Young2018-09-061-18/+20
| | | | | | Convert Zebra to user error subsystem. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* Merge pull request #2856 from opensourcerouting/bfd-workDonald Sharp2018-08-171-0/+2
|\ | | | | bfdd: bug fixes and improvements
| * bfdd: fix zebra_ptm adapter memory leakRafael Zalamena2018-08-161-0/+2
| | | | | | | | | | | | Memory leak detect with Address Sanitizer and topotests. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* | zebra: When using BFD ensure that zebra thinks ptm is disabledDonald Sharp2018-08-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | In order for connected routes to be installed the if_is_operative function is called. This function checks the status of ptm and decides to use ptm enabled/disabled on the interface. The call to zebra_ptm_get_enable was returning true and causing the interface subsystem to do the wrong thing. Modify the internal bfd case to when checking for ptm enabled to say it is not enabled. Tested-by: Mark Stapp <mjs@voltanet.io> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | *: rename zlog_fer -> flog_errQuentin Young2018-08-141-2/+2
| | | | | | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | zebra, lib: error references for zebraQuentin Young2018-08-141-19/+25
|/ | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* bfdd: clean-up bfd clients data on shutdownRafael Zalamena2018-08-081-4/+18
| | | | | | | | | On `zebra` / `bfdd` shutdown we now clean up all client data to avoid memory leaks (ghost clients). This also prevents 'slow' shutdown on `zebra` sparing us from seeing some rare topotests shutdown failures (signal handler getting stopped by signal). Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* bfdd: send replay request on zebra connectionRafael Zalamena2018-08-081-7/+26
| | | | | | | This will make `bfdd` synchronize with its client when zebra dies or bfdd is restarted. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* bfdd: re-route PTM-BFD daemon messagesRafael Zalamena2018-08-081-0/+405
| | | | | | | | | | | When `bfdd` is enabled - which it is by default - re-route the PTM-BFD messages to the FRR's internal BFD daemon instead of the external PTM daemon. This will help the migration of BFD implementations and avoid duplicating code. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* eigrpd lib pimd zebra: dead code (PVS-Studio)F. Aragon2018-07-061-20/+16
| | | | Signed-off-by: F. Aragon <paco@voltanet.io>
* zebra: refactor zserv names, consolidate eventsQuentin Young2018-05-291-1/+1
| | | | | | | | | | | | | | * Add centralized thread scheduling dispatchers for client threads and the main thread * Rename everything in zserv.c to stop using a combination of: - zebra_server_* - zebra_* - zserv_* Everything in zserv.c now begins with zserv_*. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* Zebra: Fix ptm-enable config failure on internally created interfacesradhika2018-05-091-3/+3
| | | | | | | | | | | | | | Ticket: CM-15658 Reviewed By: CCR-6534 Testing Done: Unit Issue: frr ptm-enable command not working for interfaces that have been created by frr as a place holder. Root Cause: The ptm-enable on interface configuration was not getting stored when the interface was internally created by frr. Fix: Store the ptm-enable configuration even if the interface is internally created. Signed-off-by: Radhika Mahankali <radhika@cumulusnetworks.com>
* zebra: style last 3 changesQuentin Young2018-04-231-1/+1
| | | | | | Fixup latent style issues in copied code. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* zebra: cleanup for zapi_msg.c splitQuentin Young2018-04-231-1/+1
| | | | | | | | | | * Rename client_connect and client_close hooks to zapi_client_connect and zapi_client_close * Remove some more unnecessary headers * Fix a copy-paste error in zapi_msg.[ch] header comments * Fix an inclusion comment in zserv.c Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* zebra: use hooks for client lifecycle callbacksQuentin Young2018-04-231-10/+9
| | | | | | | | | zserv.c was using hardcoded callbacks to clean up various components when a client disconnected. Ergo zserv.c had to know about all these unrelated components that it should not care about. We have hooks now, let's use the proper thing instead. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: use C99 standard fixed-width integer typesQuentin Young2018-03-271-6/+6
| | | | | | | | | | | | | | | | | | | | | | The following types are nonstandard: - u_char - u_short - u_int - u_long - u_int8_t - u_int16_t - u_int32_t Replace them with the C99 standard types: - uint8_t - unsigned short - unsigned int - unsigned long - uint8_t - uint16_t - uint32_t Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* zebra: reorganize zserv, batch i/oQuentin Young2018-03-121-5/+3
| | | | | | | | Group send and receive functions together, change handlers to take a message instead of looking at ->ibuf and ->obuf, allow zebra to read multiple packets off the wire at a time. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* zebra: standardize ZAPI message handler argsQuentin Young2018-03-121-9/+7
| | | | | | | | | | | | A lot of the handler functions that are called directly from the ZAPI input processing code take different argument sets where they don't need to. These functions are called from only one place and all have the same fundamental information available to them to do their work. There is no need to specialize what information is passed to them; it is cleaner and easier to understand when they all accept the same base set of information and extract what they need inline. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* zebra: dont return a status code in zapi handlersQuentin Young2018-03-121-14/+14
| | | | | | | | All of the ZAPI message handlers return an integer that means different things to each of them, but nobody ever reads these integers, so this is technical debt that we can just eliminate outright. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: conform with COMMUNITY.md formatting rules, via 'make indent'Lou Berger2018-03-061-2/+1
| | | | Signed-off-by: Lou Berger <lberger@labn.net>
* zebra: Clean up some SA issues found by new codeDonald Sharp2018-02-141-2/+7
| | | | | | | | | 1) Add asserts in a couple of spots to show we never expect prefix to be bad. 2) Fix some bfd code where out_ctxt will always be NULL. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: Fix crash in ptm codeDonald Sharp2018-01-251-1/+10
| | | | | | | | | | The code change to switch from stream_getX to STREAM_GETX added a goto statement to be handled for a failure case. The failure case was properly handled but the normal case was not tested properly and there exists a situation where we would free the out_ctxt 2 times. Prevent that from happening. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: increase vrf_id from 16 bit to 32 bit identifierPhilippe Guibert2018-01-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* zebra: Cleanup leaked context information on failureDonald Sharp2017-12-051-0/+2
| | | | | | | | When we get a STREAM_GET failure of some sort we need to handle the failure case here and safely free up stored memory/context and return gracefully. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>