summaryrefslogtreecommitdiffstats
path: root/lib (follow)
Commit message (Collapse)AuthorAgeFilesLines
* lib,zebra: add zapi msg top level error handlingStephen Worley2020-01-083-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add error handling for top level failures (not able to execute command, unable to find vrf for command, etc.) With this error handling we add a new zapi message type of ZEBRA_ERROR used when we are unable to properly handle a zapi command and pass it down into the lower level code. In the event of this, we reply with a message of type enum zebra_error_types containing the error type. The sent packet will look like so: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Length | Marker | Version | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | VRF ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Command | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ERROR TYPE | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Also add appropriate hooks for clients to subscribe to for handling these types of errors. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* Merge pull request #5314 from qlyoung/yang-vrrpRenato Westphal2020-01-082-0/+7
|\ | | | | VRRP northbound conversion
| * lib: add ipaddr_isset()Quentin Young2019-12-091-0/+6
| | | | | | | | | | | | Compare ip address against 0 Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
| * vrrpd: northbound conversionQuentin Young2019-12-091-0/+1
| | | | | | | | | | | | Convert VRRPD to use the northbound API. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | Merge pull request #5621 from qlyoung/fix-zclient-excess-nexthop-decodeMark Stapp2020-01-061-0/+11
|\ \ | | | | | | lib: dont decode more nexthops than we can handle
| * | lib: dont decode more nexthops than we can handleQuentin Young2020-01-061-0/+11
| | | | | | | | | | | | | | | | | | | | | If someone provides us more nexthops than our configured multipath setting, drop the rest of them Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | | lib: fix ifindex comparison overflowQuentin Young2020-01-041-1/+6
|/ / | | | | | | | | | | Very small (negative!) ifindexes, when subtracted, can overflow. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | Merge pull request #5268 from qlyoung/vrrp-vrfDonatas Abraitis2019-12-222-2/+24
|\ \ | | | | | | VRRP VRF support
| * | lib: document vrf_socket(), vrf_bind()Quentin Young2019-12-182-2/+24
| |/ | | | | | | | | | | These two don't really do what you might expect, document them Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | lib: fix build of the northbound pluginsRenato Westphal2019-12-192-1/+4
| | | | | | | | | | | | | | | | Commit 1b3e9a21dd4 removed the global visibility of the yang_modules variable, breaking the build of all northbound plugins. Revert a small part of that commit to fix this issue. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* | lib: default nexthop weights to oneStephen Worley2019-12-161-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Default all nexthop weights to one. The linux kernel does some weird stuff where it adds one to all nexthop weight values it gets. So, we added df7fb5800b3798057747873c8be245eb13f3ec36 with some special subtracing/adding to account for this. Though, that patch did not account for the default case of the weight being zero for elements in the group. Hence, this patch defaults the nexthop weight to one during creation. This should be a valid value on all platforms anyway so shouldn't affect anything. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* | Merge pull request #5535 from opensourcerouting/santa-elfDonald Sharp2019-12-1626-582/+79
|\ \ | | | | | | *: cleanup elves were here
| * | lib/linklist: flip the bitrot compostDavid Lamparter2019-12-142-47/+0
| | | | | | | | | | | | | | | | | | | | | | | | The whole lib/linklist.c code shouldn't really be used for new code (the lib/typesafe.h bits are better.) So, a new need for these unused functions shouldn't be coming up. Signed-off-by: David Lamparter <equinox@diac24.net>
| * | lib: random unused bits cleanupDavid Lamparter2019-12-147-34/+12
| | | | | | | | | | | | Signed-off-by: David Lamparter <equinox@diac24.net>
| * | lib/prefix: flip the bitrot compostDavid Lamparter2019-12-142-464/+35
| | | | | | | | | | | | Signed-off-by: David Lamparter <equinox@diac24.net>
| * | lib: make some variables staticDavid Lamparter2019-12-1313-22/+18
| | | | | | | | | | | | Signed-off-by: David Lamparter <equinox@diac24.net>
| * | lib: completely get rid of the MTYPE alias hackDavid Lamparter2019-12-132-15/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | Sometimes the easiest solution is hardest to find... the whole point of all this "static const", aliasing, & co. was to make "MTYPE_FOO" usable without adding the extra & as in "&MTYPE_FOO". Making it a size-1 array does that perfectly through the magic of ISO C array decay... Signed-off-by: David Lamparter <equinox@diac24.net>
| * | lib: make rcu_free() NULL-safeDavid Lamparter2019-12-131-0/+2
| | | | | | | | | | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | | Merge pull request #5452 from mjstapp/fix_notify_nhgDonald Sharp2019-12-132-18/+70
|\ \ \ | |/ / |/| | zebra: align dplane notify processing with nhg work
| * | lib,zebra: add api to enforce nexthop sort order when copyingMark Stapp2019-12-092-18/+70
| |/ | | | | | | | | | | | | | | | | | | | | Add an api that creates a copy of a list of nexthops and enforces the canonical sort ordering; consolidate some nhg code to avoid copy-and-paste. The zebra dplane uses that api when a plugin sets up a list of nexthops, ensuring that the plugin's list is ordered when it's processed in zebra. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* | Merge pull request #5528 from opensourcerouting/bmp-dns-fixingDonald Sharp2019-12-112-9/+48
|\ \ | | | | | | BMP: improve active outbound connection details
| * | lib,nhrpd,bgpd/bmp: pass resolver failure detailsDavid Lamparter2019-12-112-10/+15
| | | | | | | | | | | | | | | | | | | | | | | | To keep the calling code agnostic of the DNS resolver libary used, pass a strerror-style string instead of a status code that would need extra handling. Signed-off-by: David Lamparter <equinox@diac24.net>
| * | lib/resolver: support/bypass IP literalsDavid Lamparter2019-12-112-1/+35
| | | | | | | | | | | | | | | | | | | | | | | | libc-ares doesn't do IP literals, so we have to do that before running off to do DNS. Since this isn't BMP specific, move to lib/ so NHRP can benefit too. Signed-off-by: David Lamparter <equinox@diac24.net>
* | | Merge pull request #5497 from donaldsharp/unequality_ecmpMark Stapp2019-12-115-20/+63
|\ \ \ | | | | | | | | Unequality ecmp
| * | | lib: Add weight to nexthop for nexthop-group nexthopsDonald Sharp2019-12-091-20/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add the ability to read in the weight of a nexthop and store/handle it appropriately nexthop-group BLUE nexthop 192.168.201.44 weight 33 nexthop 192.168.201.45 weight 66 nexthop 192.168.201.46 weight 99 Is appropriately read in and handled as appropriate. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
| * | | lib, zebra: Allow for encode/decode of nexthop weight in pass downDonald Sharp2019-12-093-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add code to encode/decode the nexthop weight when we pass it down into zebra. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
| * | | lib, zebra: Allow for installation of a weighted nexthopDonald Sharp2019-12-092-0/+4
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux has the idea of allowing a weight to be sent down as part of a nexthop group to allow the kernel to weight particular nexthop paths a bit more or less than others. See: http://tldp.org/HOWTO/Adv-Routing-HOWTO/lartc.rpdb.multiple-links.html Allow for installation into the kernel using the weight attribute associated with the nexthop. This code is foundational in that it just sets up the ability to do this, we do not use it yet. Further commits will allow for the pass through of this data from upper level protocols. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | | lib/skiplist: fix gcc-9 used-uninitialized warningDavid Lamparter2019-12-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Under some circumstances (apparently depends on several optimization flags), gcc-9 throws an used-uninitialized warning for this variable in the skiplist code. Just initialize to NULL. Signed-off-by: David Lamparter <equinox@diac24.net>
* | | lib: fixes invalid running_entry when VRF is changedMahdi Varasteh2019-12-101-0/+2
|/ / | | | | | | | | | | we just unset the entry from old node and add it to the new one Signed-off-by: Mahdi Varasteh <mahdy.varasteh@gmail.com>
* | Merge pull request #5498 from mjstapp/sharp_with_labelsDonald Sharp2019-12-071-0/+3
|\ \ | | | | | | lib,sharpd: support labelled nexthop-groups in sharpd
| * | lib,sharpd: support labelled nexthop-groups in sharpdMark Stapp2019-12-061-0/+3
| | | | | | | | | | | | | | | | | | | | | Update sharpd's zapi client code to support labelled nexthops if they're present in a nexthop-group. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* | | Merge pull request #4765 from opensourcerouting/defaults-v2Donald Sharp2019-12-0610-42/+482
|\ \ \ | |/ / |/| | lib/*: new config defaults system, v2
| * | ospfd: use new defaults mechanism (v2)David Lamparter2019-12-061-14/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some preprocessor constants converted to enums to make the names usable in the preprocessor. v2: better isolation between core and vty code to make future northbound conversion easier. Signed-off-by: David Lamparter <equinox@diac24.net>
| * | bgpd: use new defaults system (v2)David Lamparter2019-12-061-16/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This moves all the DFLT_BGP_* stuff over to the new defaults mechanism. bgp_timers_nondefault() added to get better file-scoping. v2: moved everything into bgp_vty.c so that the core BGP code is independent of the CLI-specific defaults. This should make the future northbound conversion easier. Signed-off-by: David Lamparter <equinox@diac24.net>
| * | lib/defaults: add bool variable supportDavid Lamparter2019-12-062-0/+12
| | | | | | | | | | | | | | | | | | | | | (I hadn't initially added this because I thought it superfluous, but it kinda makes things nicer.) Signed-off-by: David Lamparter <equinox@diac24.net>
| * | lib: new defaults logicDavid Lamparter2019-12-066-17/+376
| | | | | | | | | | | | | | | | | | | | | Since we've been writing out "frr version" and "frr defaults" for about a year and a half now, we can now actually use them to manage defaults. Signed-off-by: David Lamparter <equinox@diac24.net>
| * | lib: add frr_version_cmp()David Lamparter2019-12-064-1/+101
| | | | | | | | | | | | | | | | | | This just compares 2 version strings. Signed-off-by: David Lamparter <equinox@diac24.net>
| * | lib: rename memory_vty.c to lib_vty.cDavid Lamparter2019-12-066-25/+24
| | | | | | | | | | | | | | | | | | And memory_init() to lib_cmd_init(). Signed-off-by: David Lamparter <equinox@diac24.net>
* | | Merge pull request #5332 from mjstapp/remove_zapi_label_flagDonald Sharp2019-12-064-143/+209
|\ \ \ | | | | | | | | *: revise zapi nexthop encoding
| * | | *: revise zapi nexthop encodingMark Stapp2019-12-062-133/+194
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use a per-nexthop flag to indicate the presence of labels; add some utility zapi encode/decode apis for nexthops; use the zapi apis more consistently. Signed-off-by: Mark Stapp <mjs@voltanet.io>
| * | | lib: use const in several stream lib apisMark Stapp2019-12-062-10/+15
| | |/ | |/| | | | | | | | | | | | | Add some const to some stream apis. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* | | Merge pull request #5438 from sworleys/PBR-FixesRenato Westphal2019-12-061-0/+23
|\ \ \ | | | | | | | | pbrd: Assorted Fixes
| * | | lib: Add zapi_rule_notify_owner2str() functionStephen Worley2019-12-031-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a function for converting the zapi_rule_notify_owner enum type to a string for ease of use. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* | | | Merge pull request #5439 from mjstapp/nhg_add_labelsRenato Westphal2019-12-062-25/+114
|\ \ \ \ | |_|_|/ |/| | | lib: support labelled nexthops in nexthop_groups
| * | | lib: support labelled nexthops in nexthop_groupsMark Stapp2019-12-032-25/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for labelled nexthops in nexthop-group vtysh configuration. Also update the PBR doc where the cli is described. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* | | | Merge pull request #5464 from qlyoung/fix-bgp-prefix-orf-heap-overflowDonatas Abraitis2019-12-061-0/+2
|\ \ \ \ | |_|_|/ |/| | | lib: fix heap buf overflow when adding prefix orf
| * | | lib: fix heap buf overflow when adding prefix orfQuentin Young2019-12-031-0/+2
| | |/ | |/| | | | | | | | | | | | | Don't lose your way Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | | Merge pull request #5416 from mjstapp/re_nhe_pointerDonald Sharp2019-12-045-4/+108
|\ \ \ | |/ / |/| | lib,zebra: use shared nexthop-group in route_entry
| * | lib,zebra: use nhg_hash_entry pointer in route_entryMark Stapp2019-12-043-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Replace the existing list of nexthops (via a nexthop_group struct) in the route_entry with a direct pointer to zebra's new shared group (from zebra_nhg.h). This allows more direct access to that shared group and the info it carries. Signed-off-by: Mark Stapp <mjs@voltanet.io>
| * | lib: add some nexthop ctorsMark Stapp2019-11-222-0/+104
| |/ | | | | | | | | | | | | | | Add some apis that allocate and init nexthop objects from various kinds of arguments: ip addrs, interfaces, blackhole types. Signed-off-by: Mark Stapp <mjs@voltanet.io>