summaryrefslogtreecommitdiffstats
path: root/lib/nexthop.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* lib: Add hash and use const a bit more intelligentlyQuentin Young2018-04-061-1/+14
| | | | | | | | | | | This commit adds code to notify the compiler that we will not be changing the arguments to nexthop2str and we expect thre return to be treated the same. Additionally we add some code to allow nexthops to be hashed to be used in a hash. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: use C99 standard fixed-width integer typesQuentin Young2018-03-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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>
* lib: Add nexthop-group cliDonald Sharp2018-03-141-0/+51
| | | | | | | | | | | | | | | | | | | | Add a nexthop-group cli: nexthop-group NAME nexthop A nexthop B nexthop C ! This will allow interested parties to hook into the cli for nexthops. Users can add callback functions for add/delete of a nexthop group as well as add/delete of each individual nexthop. Future work( PBR and static routes ) will take advantage of this. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: Isolate nexthop_group functions to nexthop_group.cDonald Sharp2018-03-091-43/+0
| | | | | | | Also modify `struct route_entry` to use nexthop_groups. Move ALL_NEXTHOPS loop to nexthop_group.h Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: conform with COMMUNITY.md formatting rules, via 'make indent'Lou Berger2018-03-061-7/+6
| | | | Signed-off-by: Lou Berger <lberger@labn.net>
* *: Track vrfs per nexthop not per route entryDonald Sharp2018-02-091-0/+1
| | | | | | | Track the vfrs on a per nexthop basis instead of on a per route entry basis. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib, zebra: Rename and place appropriately the label stackDonald Sharp2018-01-221-3/+3
| | | | | | Fix and rename the label stack to be better named. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: fix a64448ba, invalid NULL->num_labelsVincent JARDIN2017-10-091-1/+1
| | | | | | | | | | | | We should assume match OK only when neither nhl1 and neither nhl2 are NULL. If both are NULL, it means match NOK. Clang Warning: Access to field 'num_labels' results in a dereference of a null pointer (loaded from variable 'nhl1') Signed-off-by: Vincent Jardin <vincent.jardin@6wind.com>
* zebra: deduplicate nexthopsDavid Lamparter2017-09-121-0/+33
| | | | | | | | | | | | | | | There exists situations where it is possible to have duplicate nexthops passed from a higher level protocol into zebra. This code notices this duplication of nexthops and marks the duplicates as DUPLICATE so we don't attempt to install it into the kernel. This is important on *BSD as I understand it because passing duplicate nexthops will cause the route to be rejected. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: rib: use nexthop ptr in rib_add/deleteDavid Lamparter2017-08-281-1/+2
| | | | | | This simplifies the API for the following blackhole rework. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: copy_nexthops() only copies the first nexthopDaniel Walton2017-07-201-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Before the fix NHT had each path resolving via swp1 cel-redxp-10# show ip route 20.0.11.253 Routing entry for 20.0.11.0/24 Known via "bgp", distance 20, metric 0, best Last update 00:00:20 ago * 169.254.0.1, via swp1 * 169.254.0.17, via swp2 cel-redxp-10# cel-redxp-10# show ip nht [snip] 20.0.11.253 resolved via bgp via 169.254.0.1, swp1 via 169.254.0.1, swp1 Client list: pim(fd 19) After the fix cel-redxp-10# show ip nht [snip] 20.0.11.253 resolved via bgp via 169.254.0.1, swp1 via 169.254.0.17, swp2 Client list: pim(fd 19)
* *: reindentreindent-master-afterwhitespace / reindent2017-07-171-177/+160
| | | | | | indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* zebra: prettier format for multilevel-recursive routesChristian Franke2017-07-121-0/+11
| | | | Signed-off-by: Christian Franke <chris@opensourcerouting.org>
* lib: copy rmap_src too in copy_nexthopsChristian Franke2017-07-121-5/+6
| | | | Signed-off-by: Christian Franke <chris@opensourcerouting.org>
* lib,zebra: Fix ALL_NEXTHOPS iteratorChristian Franke2017-07-121-0/+31
| | | | Signed-off-by: Christian Franke <chris@opensourcerouting.org>
* Allow for more than 1 NH recursion levelßingen2017-06-281-3/+4
| | | | | | Before, only one level of recursive resolution was supported. Signed-off-by: ßingen <bingen@voltanet.io>
* *: 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>
* zebra: labeled unicast handlingDon Slice2017-04-061-0/+22
| | | | | | | | | 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>
* Merge remote-tracking branch 'cmaster-next' into cmaster-next-relengDavid Lamparter2016-11-281-1/+0
|\
| * lib: Fix nexthop strings to coincide with enumvivek2016-11-251-1/+0
| | | | | | | | Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
* | lib: replace strlcpy & strlcat with glibc versionsDavid Lamparter2016-11-151-1/+0
|/ | | | | | | | It seems these two were at some point copied in from rsync; replace with more recent versions that will hopefully become available in glibc as well. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* zebra: fix bug in nexthop label allocationßingen2016-09-231-1/+2
| | | | Label array in nexthop_label struct was not being allocated.
* mpls: add support for LDP LSPsRenato Westphal2016-09-231-5/+9
| | | | Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* MPLS: Install labeled static routesvivek2016-09-231-0/+3
| | | | | | | | | | | | This patch installs labeled static routes in the FIB. The routes are installed using the RTA_ENCAP (and RTA_ENCAP_TYPE) nested attributes. Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Ticket: CM-6040 Reviewed By: CCR-3091 Testing Done: Tested in SE-1, brief manual testing now
* Quagga: Install label forwarding entries for statically configured LSPsvivek2016-09-231-1/+27
| | | | | | | | | | | | | Install the statically configured LSPs into the FIB (kernel). This is done using the new attributes and definitions for MPLS in the kernel - RTA_VIA, RTA_NEWDST and AF_MPLS. Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Ticket: CM-4804 Reviewed By: CCR-3088 Testing Done: Manual in SE-1
* *: 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>
* lib, bgpd: Log next hopsvivek2016-09-081-0/+33
| | | | | | | | | | Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com> Ticket: CM-12390 Reviewed By: CCR-5156 Testing Done: Manual
* lib: Fix some more compiler warningsDonald Sharp2016-05-201-5/+0
| | | | | | | | | | | | | | | Three different changes: a) in nexthop.c we have an actual bug, we've rearranged the enumerated types and the list of enums has changed, we were displaying the wrong nexthop information. b) Remove some dead code from sockunion.h c) '\0' evaluates to 0 which is NULL. vector_set takes a pointer. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
* ZEBRA: Remove NEXTHOP_TYPE_XXX_IFNAMEDonald Sharp2015-12-041-8/+0
| | | | | | | The NEXTHOP_TYPE_XXX_IFNAME types were never being used. Remove them and the code associated with them. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Quagga: Nexthop refactoringDonald Sharp2015-11-271-4/+72
| | | | | | Upstream wanted some nexthop code to be refactored. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* nexthop-tracking.patchDonald Sharp2015-05-201-0/+100
quagga: nexthop-tracking.patch Add next hop tracking support to Quagga. Complete documentation in doc/next-hop-tracking.txt. Signed-off-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com> Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Signed-off-by: Dinesh Dutt <ddutt@cumulusnetworks.com>