summaryrefslogtreecommitdiffstats
path: root/lib/log.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* *: rename ferr_zlog -> flog_err_sysQuentin Young2018-08-141-13/+15
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: rename zlog_fer -> flog_errQuentin Young2018-08-141-7/+7
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: Add LIB_ERR_DEVELOPMENTDonald Sharp2018-08-141-3/+7
| | | | | | | | | Sometimes a error state is detected when we have added new code to FRR, but not updated all the places that we should have. Consider this a developmental escape that needs to be fixed. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: Add LIB_ERR_SYSTEM_CALL and convert VRF_SOCKET to SOCKETDonald Sharp2018-08-141-12/+15
| | | | | | | | Add a new error code LIB_ERR_SYSTEM_CALL to the ferr subsystem. Additionally convert LIB_ERR_VRF_SOCKET to a more generic LIB_ERR_SOCKET. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: support for evpn type-4 routemitesh2018-05-301-0/+2
| | | | Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
* lib: add ZEBRA IPSET definesPhilippe Guibert2018-04-161-0/+4
| | | | | | | ZEBRA IPSET defines are added for creating/deleting ipset contexts. Ans also create ipset hash sets. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* lib: add framework for allocating routing table identifier IDsPhilippe Guibert2018-03-291-0/+3
| | | | | | | | | | | | | | | | | | The library changes add 3 new messages to exchange between daemons and ZEBRA. - ZEBRA_TABLE_MANAGER_CONNECT, - ZEBRA_GET_TABLE_CHUNK, - ZEBRA_RELEASE_TABLE_CHUNK, the need is that routing tables identifier are shared by various services. For the current case, policy routing enhancements are planned to be used in FRR. Poliy routing relies on routing tables identifiers from kernels. It will be mainly used by the future policy based routing daemon, but not only. In the flowspec case, the BGP will need also to inject policy routing information into specific routing tables. For that, the proposal is made to let zebra give the appropriate range that is needed for all daemons. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* *: use C99 standard fixed-width integer typesQuentin Young2018-03-271-13/+14
| | | | | | | | | | | | | | | | | | | | | | 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>
* bgpd: new vpn-policy CLIG. Paul Ziemba2018-03-201-4/+0
| | | | | | | | | | | | | | | | | | | | | PR #1739 added code to leak routes between (default VRF) VPN safi and unicast RIBs in any VRF. That set of changes included temporary CLI including vpn-policy blocks to specify RD/RT/label/&c. After considerable discussion, we arrived at a consensus CLI shown below. The code of this PR implements the vpn-specific parts of this syntax: router bgp <as> [vrf <FOO>] address-family <afi> unicast rd (vpn|evpn) export (AS:NN | IP:nn) label (vpn|evpn) export (0..1048575) rt (vpn|evpn) (import|export|both) RTLIST... nexthop vpn (import|export) (A.B.C.D | X:X::X:X) route-map (vpn|evpn|vrf NAME) (import|export) MAP [no] import|export [vpn|evpn|evpn8] [no] import|export vrf NAME User documentation of the vpn-specific parts of the above syntax is in PR #1937 Signed-off-by: G. Paul Ziemba <paulz@labn.net>
* Merge branch 'master' into working/master/bgp-vpn-vrf-leakingpaulzlabn2018-03-141-16/+27
|\
| * tests: add unit test for zlogQuentin Young2018-03-121-8/+10
| | | | | | | | | | | | Just tests zlog_hexdump right now Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
| * lib: fixup zlog_hexdumpQuentin Young2018-03-121-16/+25
| | | | | | | | | | | | | | * Allocate correct amount of memory * Use snprintf() instead of sprintf() Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | lib: add BGP VPN route typeG. Paul Ziemba2018-03-091-0/+4
|/ | | | Signed-off-by: G. Paul Ziemba <paulz@labn.net>
* lib, zebra: Add rule encodingDonald Sharp2018-03-091-0/+3
| | | | | | | Add some code to pass the rule we want installed into the kernel. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: conform with COMMUNITY.md formatting rules, via 'make indent'Lou Berger2018-03-061-13/+11
| | | | Signed-off-by: Lou Berger <lberger@labn.net>
* lib, zebra: Add new api to specify a label associated with the vrfDonald Sharp2018-02-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | For L3VPN's we need to create a label associated with the specified vrf to be installed into the kernel to allow a pop and lookup operation. The new api is: zclient_send_vrf_label(struct zclient *zclient, vrf_id_t vrf_id, mpls_label_t label); For the specified vrf_id associate the specified label for a pop and lookup operation for forwarding. To setup a POP and Forward use MPLS_LABEL_IMPLICIT_NULL If the same label is passed in we ignore the call. If the label is different we update entry. If the label is MPLS_LABEL_NONE we remove the entry. This sets up the api. Future commits will have the functionality to actually install into the kernel. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* bgpd: advertise VNI subnetMitesh Kanjariya2018-01-241-0/+3
| | | | | | | | | | | | | | In EVPN symmetric routing, not all subnets are presents everywhere. We have multiple scenarios where a host might not get learned locally. 1. GARP miss 2. SVI down/up 3. Silent host We need a mechanism to resolve such hosts. In order to achieve this, we will be advertising a subnet route from a box and that box will help in resolving the ARP to such hosts. Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
* zebra, lib: zebra changes for symmetric routing supportMitesh Kanjariya2017-12-141-0/+2
| | | | Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
* sharpd: Add Super Happy Advanced Routing ProtocolDonald Sharp2017-11-271-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Add a daemon that will allow us to test the zapi as well as test route install/removal times from the kernel. The current commands are: install route <starting ip address> nexthop <nexthop> (1-1000000) This command starts installing at <starting ip address>/32 (1-100000) routes that it auto-increments by 1 Installation start time is noted in the log and finish time is noted as well. remove routes <starting ip address> (1-1000000) This command removes routes at <starting ip address>/32 and removes (1-100000) routes created by the install route command. This code can be considered experimental and *is not* something that should be run in a production environment. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib, zebra: Add ability to notify to Routing Protocols Success/FailureDonald Sharp2017-11-271-0/+1
| | | | | | | | | | | | | | | Provide ZAPI code that can pass to an upper level protocol what happened to it's route on install. There are these notifications: 1) ZAPI_ROUTE_FAIL_INSTALL - The route attempted to be installed did not work. 2) ZAPI_ROUTE_BETTER_ADMIN_WON - A route that was installed has become un-installed due to another routing protocol installing a better admin distance 3) ZAPI_ROUTE_INSTALLED - The route specified has been installed Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: smallify loglockQuentin Young2017-09-121-6/+4
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: mt-safe log.cQuentin Young2017-09-121-32/+62
| | | | | | | Tentative thread-safety support for zlog. Functions designed to be called from signal handlers are not mt-safe. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* Merge pull request #1031 from opensourcerouting/small-bitsDonald Sharp2017-08-241-1/+1
|\ | | | | small bits
| * lib: centralized memstats-at-exitDavid Lamparter2017-08-241-1/+1
| | | | | | | | | | | | | | | | | | adds a new all-daemon "debug memstats-at-exit" command. Also saves memstats to a file in /tmp, useful if a long-running daemon is having weird issues (e.g. in a user install). Fixes: #437 Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | *: use zapi_route to send/receive redistributed routes as wellRenato Westphal2017-08-241-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some differences compared to the old API: * Now the redistributed routes are sent using address-family independent messages (ZEBRA_REDISTRIBUTE_ROUTE_ADD and ZEBRA_REDISTRIBUTE_ROUTE_DEL). This allows us to unify the ipv4/ipv6 zclient callbacks in the client daemons and thus remove a lot of duplicate code; * Now zebra sends all nexthops of the redistributed routes to the client daemons, not only the first one. This shouldn't have any noticeable performance implications and will allow us to remove an ugly exception we had for ldpd (which needs to know all nexthops of the redistributed routes). The other client daemons can simply ignore the nexthops if they want or consult just the first one (e.g. ospfd/ospf6d/ripd/ripngd). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* | lib/zserv: introduce address-family independent ZAPI message typesRenato Westphal2017-08-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As noticed in 657cde1, the zapi_ipv[4|6]_route functions are broken in many ways and that's the reason that many client daemons (e.g. ospfd, isisd) need to send handcrafted messages to zebra. The zapi_route() function introduced by Donald solves the problem by providing a consistent way to send ipv4/ipv6 routes to zebra with nexthops of any type, in all possible combinations including IPv4 routes with IPv6 nexthops (for BGP unnumbered routes). This patch goes a bit further and creates two new address-family independent ZAPI message types that the client daemons can use to advertise route information to zebra: ZEBRA_ROUTE_ADD and ZEBRA_ROUTE_DELETE. The big advantage of having address-family independent messages is that it allows us to remove a lot of duplicate code in zebra and in the client daemons. This patch also introduces the zapi_route_decode() function. It will be used by zebra to decode route messages sent by the client daemons using zclient_route_send(), which calls zapi_route_encode(). Later on we'll use this same pair of encode/decode functions to send/receive redistributed routes from zebra to the client daemons, taking the idea of removing code duplication to the next level. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* | lib: remove redundant zebra messagesRenato Westphal2017-08-231-4/+0
|/ | | | | | | This also fixes a bug of ipv6 routes advertised by the VNC code being ignored by zebra. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* Merge branch 'frr/pull/822' ("EVPN fixes")David Lamparter2017-08-091-0/+1
|\ | | | | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * bgpd/zebra/lib: EVPN support for asymmetric VxLan routingMitesh Kanjariya2017-08-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 1. Advertise gateway mac-ip in EVPN 2. Advertise VRR mac-ip in EVPN 3. Ignore gateway mac-ip advertisements in case of distributed gateway 4. Config knob to enable/disable gateway mac-ip advertisements Ticket: CM-16456, CM-16543, CM-16555, CM-16778 Review: CCR-6283 Unit-test: Manual Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
* | Merge pull request #892 from opensourcerouting/watchfrr-simplifyDonald Sharp2017-08-091-26/+35
|\ \ | | | | | | simplify watchfrr, add --terminal, improve startup logging
| * | lib: plug logging hole during startupDavid Lamparter2017-08-021-26/+35
| | | | | | | | | | | | | | | | | | | | | zlog_* doesn't work in startup before we've loaded the real logging configuration. Add some code to log to stderr for that window of time. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | | zebra: add pseudowire managerßingen2017-08-091-0/+5
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Base framework for supporting MPLS pseudowires in FRR. A consistent zserv interface is provided so that any client daemon (e.g. ldpd, bgpd) can install/uninstall pseudowires in a standard way. Static pseudowires can also be implemented by using the same interface. When zebra receives a request to install a pseudowire and the installation in the kernel or hardware fails, a notification is sent back to the client daemon and a new install attempt is made every 60 seconds (until it succeeds). Support for external dataplanes is provided by the use of hooks to install/uninstall pseudowires. Signed-off-by: ßingen <bingen@voltanet.io> Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* | lib, pimd, zebra: Allow pim to set pimregX into appropriate vrfDonald Sharp2017-07-241-0/+1
|/ | | | | | | | | The pimregX devices when created by the kernel are put into the default vrf. When pim gets the callback that the device exists, check to see if it is a pimregX device and if so move it into the appropriate vrf. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Revert "*: reindent pt. 2"David Lamparter2017-07-221-5/+6
| | | | | | | | | This reverts commit c14777c6bfd0a446c85243d3a9835054a259c276. clang 5 is not widely available enough for people to indent with. This is particularly problematic when rebasing/adjusting branches. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: reindent pt. 2whitespace / reindent2017-07-171-6/+5
| | | | | | | | w/ clang 5 * reflow comments * struct members go 1 per line * binpack algo was adjusted
* *: reindentreindent-master-afterwhitespace / reindent2017-07-171-869/+821
| | | | | | indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* zebra: MAC and Neighbor (ARP/ND) handlingvivek2017-07-121-0/+4
| | | | | | | | | | | | | | | | | | | Implement handling of MACs and Neighbors (ARP/ND entries) in zebra: - MAC and Neighbor database handlers - Read MACs and Neighbors from the kernel, when needed and create entries in zebra's MAC and Neighbor databases. - Handle add/update/delete notifications from the kernel for MACs and Neighbors and update zebra's database appropriately - Inform locally learnt MACs and Neighbors to client - Handle MACIP add/delete from client and install appriporiate entries into the kernel - Since Neighbor entries will be installed on an SVI, implement the needed mappings NOTE: kernel interface is only implemented for Linux/netlink Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: VNI and VTEP handlingvivek2017-07-121-0/+5
| | | | | | | | | | | | | Implement fundamental handling for VNIs and VTEPs: - Handle EVPN enable/disable by client (advertise-all-vni) - Create/update/delete VNIs based on VxLAN interface events and inform client - Handle VTEP add/delete from client and install into kernel - New debug command for VxLAN/EVPN - kernel interface (Linux/netlink only) Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: mt-safe tracebacksQuentin Young2017-06-301-7/+12
| | | | | | can't be using them statics anymore sonny Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: simplify log message lookupQuentin Young2017-06-211-56/+26
| | | | | | | | | | | | | | | | log.c provides functionality for associating a constant (typically a protocol constant) with a string and finding the string given the constant. However this is highly delicate code that is extremely prone to stack overflows and off-by-one's due to requiring the developer to always remember to update the array size constant and to do so correctly which, as shown by example, is never a good idea.b The original goal of this code was to try to implement lookups in O(1) time without a linear search through the message array. Since this code is used 99% of the time for debugs, it's worth the 5-6 additional cmp's worst case if it means we avoid explitable bugs due to oversights... Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* Merge remote-tracking branch 'origin/master' into babelDonald Sharp2017-05-301-10/+3
|\
| * lib: detangle protocol name/instance from loggingDavid Lamparter2017-05-181-6/+0
| | | | | | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * *: make consistent & update GPLv2 file headersDavid Lamparter2017-05-151-4/+3
| | | | | | | | | | | | | | | | | | | | | | The FSF's address changed, and we had a mixture of comment styles for the GPL file header. (The style with * at the beginning won out with 580 to 141 in existing files.) Note: I've intentionally left intact other "variations" of the copyright header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | lib: Fix up string -> proto # conversion for babelDonald Sharp2017-05-141-0/+4
|/ | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Merge remote-tracking branch 'origin/master' into EIGRPDonald Sharp2017-04-061-2/+16
|\
| * Merge pull request #310 from opensourcerouting/thread-prepDonald Sharp2017-04-051-0/+11
| |\ | | | | | | MT preparations
| | * lib: make sure SEGV handler cannot lock upDavid Lamparter2017-03-311-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Just adding -pthread to gcc options changes libc's behaviour, e.g. making malloc() use proper locking. This means a SEGV inside malloc() (e.g. because malloc bookkeeping structures have been damaged by writing to a broken pointer) can lead to a lockup by the following chain: - random_function() - malloc() --- SEGV - core_handler() - zlog_backtrace_sigsafe() - backtrace() - malloc() This will hang forever waiting for the malloc() lock to be released. Another failure mode is dynamic linking with lazy binding (-z lazy, default). Since backtrace() is seldomly used, this means the call to backtrace() in the core handler can in fact result in the dynamic linker trying to resolve the "backtrace" symbol, which can also deadlock. Add several safeguards to prevent any of this from happening. (Unfortunately, these are not theoretical issues - I found them by running into them headfirst.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * | lib: fix proto_redistnum() oversight from #257Quentin Young2017-04-031-2/+2
| |/ | | | | | | | | | | | | proto_redistnum() now accepts full protocol strings and not partial names per #10 Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
| * Implement generic label managerßingen2017-03-201-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Label Manager allows to share MPLS label space among different daemons. Each daemon can request a chunk of consecutive labels and release it if it doesn't need them anymore. Label Manager stores the daemon protocol and instance to identify the owner client. It uses them to perform garbage collection, releasing all label chunks from a client when it gets disconnected or reconnected. Additionally, every client can request that the chunk is never garbage collected. In that case client has the responsibility to release non-used labels. Zebra can host the label manager itself (if no -l param is provided) or connect to an external one using zserv/zclient (providing its address with -l param). Client code is in lib/zclient.c, but currently only LDP is using it. TODO: Allow for custom ranges requests, i.e., specify the start label besides the chunk. TODO: Release labels from LDP. Signed-off-by: Bingen Eguzkitza <bingen@voltanet.io>
* | eigrp: Initial CommitDonald Sharp2017-03-091-0/+2
|/ | | | | | | | | | Please Note, I will be redoing this commit message with more information. Additionally I will rework the lib/* changes into their own commits. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>