summaryrefslogtreecommitdiffstats
path: root/lib/zclient.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* lib, pimd, zebra: Allow pim to set pimregX into appropriate vrfDonald Sharp2017-07-241-0/+20
| | | | | | | | | 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-3/+2
| | | | | | | | | 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-2/+3
| | | | | | | | w/ clang 5 * reflow comments * struct members go 1 per line * binpack algo was adjusted
* *: reindentreindent-master-afterwhitespace / reindent2017-07-171-1728/+1719
| | | | | | indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: Define handlers for VNI and MACIPvivek2017-07-121-0/+16
| | | | | | | Define client handlers for processing add or delete of local VNIs and local MACIPs. Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
* Merge remote-tracking branch 'frr/master' into pull-624David Lamparter2017-06-131-0/+3
|\
| * lib, zebra: Pass up kernel table_id for vrf'sDonald Sharp2017-06-021-0/+3
| | | | | | | | | | | | | | | | | | | | pim controls the vrf table creation for due to the way that pim must interact with the kernel. In order to match the table_id for unicast <-> multicast( not necessary but a real nice to have ) we need to pass up from zebra the table_id associated with the vrf. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | lib: Add zapi_route function.Donald Sharp2017-06-051-0/+92
|/ | | | | | | | | | | | | Allow routing protocols to call one function to add/delete routes into zebra. Future commits will start adding this code to individual routing protocols. Why are we doing this? Well the zapi_ipv[4|6]_route functions are fundamentally broken in their ability to pass down anything but NEXTHOP_TYPE_IFINDEX or NEXTHOP_TYPE_IPV[4|6] and we need the ability to pass down a bit more information. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Merge branch 'stable/3.0'David Lamparter2017-05-181-40/+60
|\ | | | | | | | | | | | | | | Conflicts: ldpd/lde.c zebra/label_manager.c Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * lm: Make relay label manager asyncßingen2017-05-111-40/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To avoid blocking zebra when it's acting as a proxy for an external label manager. Besides: Fix get chunk reconnection. Socket was still being destroyed on failure, so next attempt would never work. Filter out unwanted messages in lm sync sock. Until LDE client sends ZEBRA_LABEL_MANAGER_CONNECT message, zserv doesn't know which kind of client it is, so it might enqueue unwanted messages like interface add, interface up, etc. Changes in this commit discard those messages in the client side in case they arrive before the expected response. Change function name for zclient_connect in label manager to avoid confusion with zclient one. Signed-off-by: ßingen <bingen@voltanet.io>
* | Merge pull request #537 from donaldsharp/vrf_stuffDavid Lamparter2017-05-171-0/+2
|\ \ | | | | | | Vrf stuff
| * | lib, zebra: Cleanup vrf api someDonald Sharp2017-05-161-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Segregate the vrf enable/disable functionality from other vrf code. This is to ensure that people are not actually using the functions when they should not be. Also document the why of it properly in the new vrf_int.h header. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | | *: 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>
* | *: update thread_add_* callsQuentin Young2017-05-091-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | Pass pointer to pointer instead of assigning by return value. See previous commit message. To ensure that the behavior stays functionally correct, any assignments with the result of a thread_add* function have been transformed to set the pointer to null before passing it. These can be removed wherever the pointer is known to already be null. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | *: remove THREAD_ON macros, add nullity checkQuentin Young2017-05-091-11/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The way thread.c is written, a caller who wishes to be able to cancel a thread or avoid scheduling it twice must keep a reference to the thread. Typically this is done with a long lived pointer whose value is checked for null in order to know if the thread is currently scheduled. The check-and-schedule idiom is so common that several wrapper macros in thread.h existed solely to provide it. This patch removes those macros and adds a new parameter to all thread_add_* functions which is a pointer to the struct thread * to store the result of a scheduling call. If the value passed is non-null, the thread will only be scheduled if the value is null. This helps with consistency. A Coccinelle spatch has been used to transform code of the form: if (t == NULL) t = thread_add_* (...) to the form thread_add_* (..., &t) The THREAD_ON macros have also been transformed to the underlying thread.c calls. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | Merge remote-tracking branch 'origin/master' into mpls2Donald Sharp2017-04-261-10/+22
|\|
| * lib: Fix debugs to be guarded.Donald Sharp2017-04-081-10/+22
| | | | | | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | zebra: labeled unicast handlingDon Slice2017-04-061-1/+46
| | | | | | | | | | | | | | | | | | Support install of labeled-unicast routes by a client. This would be BGP, in order to install routes corresponding to AFI/SAFI 1/4 (IPv4) or 2/4 (IPv6). Convert labeled-unicast routes into label forwarding entries (i.e., transit LSPs) when there is a static label binding. Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
* | zebra: fec registerDon Slice2017-04-061-0/+6
|/ | | | | | | | Implement interface that allows a client to register a FEC for obtaining a label binding (in-label). Update client whenever the label binding is updated and cleanup when client goes away. Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
* lib, zebra: Add ability to pass interface speed up from zebraDonald Sharp2017-04-031-0/+3
| | | | | | | | This is a prepatory commit for future improvements. Add a change to the zapi to pass the interface speed up. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Merge pull request #285 from bingen/label_manager_3Donald Sharp2017-03-211-0/+218
|\ | | | | Implement generic label manager
| * Implement generic label managerßingen2017-03-201-0/+218
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | lib: Refactor if_get_by_name_len to be VRF awareDonald Sharp2017-03-151-3/+3
| | | | | | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | lib, ospfd: Refactor if_lookup_by_name_lenDonald Sharp2017-03-151-3/+3
| | | | | | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | *: Remove non-vrf based ifindex lookupDonald Sharp2017-03-151-4/+4
|/ | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: fix remaining coverity issuesDavid Lamparter2017-02-101-2/+3
| | | | | Reported-by: Coverity Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: Fix SA issue with stream s readDonald Sharp2017-02-021-2/+6
| | | | | | | | We were checking for non-null of 'struct stream *s' after we did a stream_getl, which would have crashed the program. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: send ZAPI IPv6 source prefixDavid Lamparter2017-01-301-1/+11
| | | | | | | | | | | | This introduces ZAPI_MESSAGE_SRCPFX, and if set adds a source prefix field to ZAPI IPv6 route messages sent from daemons to zebra. The function calls all have a new prefix_ipv6 * argument specifying the source, or NULL. All daemons currently supply NULL. Zebra support for processing the field was added in the previous patch, however, zebra does not do anything useful with the value yet. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: Fix missing break in zlcient switchßingen2017-01-251-0/+1
|
* frr: Remove HAVE_IPV6 from code baseDonald Sharp2017-01-131-2/+0
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: Partial Revert of 4ecc09d and modify zclient connect behaviorDonald Sharp2016-12-141-19/+9
| | | | | | | | | | | | | | | | 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>
* *: rename two vrf functionsRenato Westphal2016-11-281-1/+1
| | | | | | | | | | 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>
* lib: Fix redist memory free'ingDonald Sharp2016-10-191-5/+11
| | | | | | | When shutting down, properly free memory associated with zclient. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib/zebra: remove code duplication in redist_del_instance()Renato Westphal2016-10-181-20/+13
| | | | | | | | | | | | | Change redist_check_instance() to return a pointer instead of returning 1 on success. This way this function can be reused in redist_del_instance() instead of duplicating the same logic there. Also, remove unnecessary call to redist_check_instance() in zebra_redistribute_delete(). While here, remove unnecessary cast from void* in redist_add_instance(). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* *: Consistently support 32-bit route tagsChristian Franke2016-10-081-4/+4
| | | | | | | | | | | | | | | | | | | This patch improves zebra,ripd,ripngd,ospfd and bgpd so that they can make use of 32-bit route tags in the case of zebra,ospf,bgp or 16-bit route-tags in the case of ripd,ripngd. It is based on the following patch: commit d25764028829a3a30cdbabe85f32408a63cccadf Author: Paul Jakma <paul.jakma@hpe.com> Date: Fri Jul 1 14:23:45 2016 +0100 *: Widen width of Zserv routing tag field. But also contains the changes which make this actually useful for all the daemons. Signed-off-by: Christian Franke <chris@opensourcerouting.org>
* lib: fix vrf_bitmap leak in zclient_free()David Lamparter2016-09-281-0/+12
| | | | | | | | | zclient_stop(), which is used as antagonist to zclient_init(), needs to undo the vrf_bitmap allocation. Otherwise zclient_init() will leak the allocated memory, for example when zclient_reset() is used. Reported-by: Lou Berger <lberger@labn.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* Make route flags a 32bit fieldChristian Franke2016-09-231-3/+3
| | | | Signed-off-by: Christian Franke <chris@opensourcerouting.org>
* lib: Check prefix length from zebra is sensiblePaul Jakma2016-09-231-17/+28
| | | | | | | | | | | | | * zclient.c: prefix length on router-id and interface address add messages not sanity checked. fix. * */*_zebra.c: Prefix length on zebra route read was not checked, and clients use it to write to storage. An evil zebra could overflow client structures by sending overly long prefixlen. Prompted by discussions with: Donald Sharp <sharpd@cumulusnetworks.com>
* Revert "Make route flags a 32bit field"Donald Sharp2016-09-231-3/+3
| | | | This reverts commit 85eda2c98520a9553bdc05c136618f9d04917e9b.
* Make route flags a 32bit fieldChristian Franke2016-09-231-3/+3
| | | | Signed-off-by: Christian Franke <chris@opensourcerouting.org>
* *: remove dead codeRenato Westphal2016-09-231-16/+0
| | | | | | | | Since recently zebra uses only the ZEBRA_REDISTRIBUTE_* messages to advertise redistributed routes to its clientes. Now the old ZEBRA_IPV*_ROUTE_* messages are only used for client->zebra communication. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* *: split & distribute memtypes and stop (re|ab)using lib/ MTYPEsDavid Lamparter2016-09-191-0/+2
| | | | | | | | | | | | | | | | | | | This is a rather large mechanical commit that splits up the memory types defined in lib/memtypes.c and distributes them into *_memory.[ch] files in the individual daemons. The zebra change is slightly annoying because there is no nice place to put the #include "zebra_memory.h" statement. bgpd, ospf6d, isisd and some tests were reusing MTYPEs defined in the library for its own use. This is bad practice and would break when the memtype are made static. Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> Acked-by: Donald Sharp <sharpd@cumulusnetworks.com> [CF: rebased for cmaster-next] Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Signed-off-by: Christian Franke <chris@opensourcerouting.org>
* Update Traffic Engineering Support for OSPFDOlivier Dugeon2016-09-031-32/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NOTE: I am squashing several commits together because they do not independently compile and we need this ability to do any type of sane testing on the patches. Since this series builds together I am doing this. -DBS This new structure is the basis to get new link parameters for Traffic Engineering from Zebra/interface layer to OSPFD and ISISD for the support of Traffic Engineering * lib/if.[c,h]: link parameters struture and get/set functions * lib/command.[c,h]: creation of a new link-node * lib/zclient.[c,h]: modification to the ZBUS message to convey the link parameters structure * lib/zebra.h: New ZBUS message Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com> Add support for IEEE 754 format * lib/stream.[c,h]: Add stream_get{f,d} and stream_put{f,d}) demux and muxers to safely convert between big-endian IEEE-754 single and double binary format, as used in IETF RFCs, and C99. Implementation depends on host using __STDC_IEC_559__, which should be everything we care about. Should correctly error out otherwise. * lib/network.[c,h]: Add ntohf and htonf converter * lib/memtypes.c: Add new memeory type for Traffic Engineering support Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com> Add link parameters support to Zebra * zebra/interface.c: - Add new link-params CLI commands - Add new functions to set/get link parameters for interface * zebra/redistribute.[c,h]: Add new function to propagate link parameters to routing daemon (essentially OSPFD and ISISD) for Traffic Engineering. * zebra/redistribute_null.c: Add new function zebra_interface_parameters_update() * zebra/zserv.[c,h]: Add new functions to send link parameters Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com> Add support of new link-params CLI to vtysh In vtysh_config.c/vtysh_config_parse_line(), it is not possible to continue to use the ordered version for adding line i.e. config_add_line_uniq() to print Interface CLI commands as it completely break the new LINK_PARAMS_NODE. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com> Update Traffic Engineering support for OSPFD These patches update original code to RFC3630 (OSPF-TE) and add support of RFC5392 (Inter-AS v2) & RFC7471 (TE metric extensions) and partial support of RFC6827 (ASON - GMPLS). * ospfd/ospf_dump.[c,h]: Add new dump functions for Traffic Engineering * ospfd/ospf_opaque.[c,h]: Add new TLV code points for RFC5392 * ospfd/ospf_packet.c: Update checking of OSPF_OPTION * ospfd/ospf_vty.[c,h]: Update ospf_str2area_id * ospfd/ospf_zebra.c: Add new function ospf_interface_link_params() to get Link Parameters information from the interface to populate Traffic Engineering metrics * ospfd/ospfd.[c,h]: Update OSPF_OPTION flags (T -> MT and new DN) * ospfd/ospf_te.[c,h]: Major modifications to update the code to new link parameters structure and new RFCs Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com> tmp
* lib, zebra: unify link layer type and hardware address handlingTimo Teräs2016-09-031-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes the BSD specific usage of struct sockaddr_dl hardware address. This unifies to use explict hw_addr member for the address, and zebra specific enumeration for the link layer type. Additionally the zapi is updated to never send platform specific structures over the wire, but the ll_type along with hw_addr_len and hw_addr are now sent for all platforms. Based on initial work by Paul Jakma. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> # Please enter the commit message for your changes. Lines starting # with '#' will be kept; you may remove them yourself if you want to. # An empty message aborts the commit. # # Author: Timo Teräs <timo.teras@iki.fi> # # rebase in progress; onto 9c2f85d # You are currently editing a commit while rebasing branch 'renato' on '9c2f85d'. # # Changes to be committed: # modified: isisd/isis_circuit.c # modified: lib/if.c # modified: lib/if.h # modified: lib/zclient.c # modified: zebra/interface.c # modified: zebra/interface.h # modified: zebra/kernel_socket.c # modified: zebra/rt_netlink.c # modified: zebra/rtadv.c # modified: zebra/zserv.c # # Untracked files: # "\033\033OA\033OB\033" # 0001-bgpd-fix-build-on-Solaris.patch # ldpd/ # redhat/ldpd.init # redhat/ldpd.service # tags #
* bgpd, lib, ospfd, pimd, zebra: Use nexthop_types_tDonald Sharp2016-09-021-9/+10
| | | | | | | | | Use the 'enum nexthop_types_t' instead of the zebra.h #defines. And remove code from zebra.h that does not belong there. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
* zebra: implement per-route mtu handlingTimo Teräs2016-08-211-0/+8
| | | | | | | | | 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)
* *: use an ifindex_t type, defined in lib/if.h, for ifindex valuesPaul Jakma2016-08-181-1/+1
| | | | (cherry picked from commit 9099f9b2a66e86f8a90d7fe18f61bd2bb1bc6744)
* lib/zclient: Consolidate error reporting for zclient_read_headerDonald Sharp2016-06-091-0/+7
| | | | | | | | | 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)
* lib: make prefix2str simpler to use, and use it in zclientTimo Teräs2016-06-091-3/+3
| | | | | | | | | | | | 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)
* lib: use const consistently for zserv pathDavid Lamparter2016-06-081-2/+2
| | | | | | | The global variable is missing its const, but the accessor function has a meaningless extra const in exchange... Signed-off-by: David Lamparter <equinox@opensourcerouting.org>