summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2021-10-05Merge pull request #9733 from opensourcerouting/grpc-fix-missingfrr-8.2-devRuss White
lib: fix gRPC crash on missing YANG node
2021-10-05lib: prevent gRPC assert on missing YANG nodeRafael Zalamena
`yang_dnode_get` will `assert` if no YANG node/model exist, so lets test for its existence first before trying to access it. This `assert` is only acceptable for internal FRR usage otherwise we might miss typos or unmatching YANG models nodes/leaves. For gRPC usage we should let users attempt to use non existing models without `assert`ing. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-10-05lib: fix spelling nits in command.hewlumpkin
Signed-off-by: ewlumpkin <ewlumpkin@gmail.com>
2021-09-29Merge pull request #9560 from LabNConsulting/ziemba/frrmod_load-error-messagesDavid Lamparter
frrmod_load(): fix error messages
2021-09-22Merge pull request #9429 from yar-fed/vtysh-err-not-runningIgor Ryzhov
vtysh: Add error code if daemon is not running
2021-09-22Merge pull request #9646 from LabNConsulting/ziemba/skiplist-level-counters-intDonald Sharp
lib: skiplist: clean up level counter implementation
2021-09-21lib: skiplist: clean up level counter implementationG. Paul Ziemba
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2021-09-21Merge pull request #9052 from mjstapp/dplane_incoming_devDonald Sharp
zebra: Move incoming netlink interface address change events to the dplane pthread
2021-09-21vtysh: Add error code if daemon is not runningYaroslav Fedoriachenko
After `<daemon_name> is not running` message vtysh does not return error. For example if you disable ospf in `/etc/frr/daemons` and run `vtysh -c configure -c "router ospf"` it prints the message to stderr, but returns 0. This commit will make vtysh return error when not in interractive mode. But if you run commands from vtysh, you will still be able to enter views and exit them if daemon is not running. Signed-off-by: Yaroslav Fedoriachenko <yar.fed99@gmail.com>
2021-09-17lib: significantly improve nb cli command sortingIgor Ryzhov
Instead of sorting each command one-by-one using listnode_add_sort, add them to the list without sorting and then sort the list only once. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-09-15Merge pull request #9596 from LabNConsulting/ziemba/printfrr-nexthopDonald Sharp
printfrr %pNHcg, %pNHci
2021-09-15Merge pull request #9608 from idryzhov/vtysh-segfaultStephen Worley
lib: fix segfault on question mark on empty line
2021-09-14lib: Fix usage of defaultDonald Sharp
case default has snuck into our code base for switches over enumerated types. Remove. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-14lib,doc,tests: printfrr %pNHcg, %pNHciG. Paul Ziemba
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2021-09-14lib/module.c and callers of frrmod_load(): fix error messagesG. Paul Ziemba
frrmod_load() attempts to dlopen() several possible paths (constructed from its basename argument) until one succeeds. Each dlopen() attempt may fail for a different reason, and the important one might not be the last one. Example: dlopen(a/foo): file not found dlopen(b/foo): symbol "bar" missing dlopen(c/foo): file not found Previous code reported only the most recent error. Now frrmod_load() describes each dlopen() failure. Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2021-09-14Merge pull request #9486 from slankdev/slankdev-srv6-no-cli-1Igor Ryzhov
CLI to delete SRv6 locator
2021-09-14lib,zebra: use more constMark Stapp
Use const in ipX_martian apis, and in some zebra apis. Signed-off-by: Mark Stapp <mjs.ietf@gmail.com>
2021-09-14lib: fix segfault on question mark on empty lineIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-09-14Merge pull request #9364 from LabNConsulting/ziemba/vrf_name_to_id-unknownIgor Ryzhov
vrf_name_to_id(): remove and change callers to use vrf_lookup_by_name()
2021-09-12Merge pull request #9586 from idryzhov/bgp-default-originate-rmap-fixesDonatas Abraitis
BGP default-originate with route-map fixes
2021-09-12Merge pull request #9475 from iqras23/change1Donatas Abraitis
bgpd: VRF-Lite fix nexthop type
2021-09-09Merge pull request #9497 from opensourcerouting/cli-better-noQuentin Young
2021-09-08lib: add ability to supply separate match/set objects to routemapsIgor Ryzhov
Sometimes it's needed to match by fields of one object but set fields of another object. The following commit is an example. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-09-07vrf_name_to_id(): removeG. Paul Ziemba
vrf_name_to_id() returned VRF_DEFAULT when the vrf name was unknown, hiding errors. Per community recommendation, vrf_name_to_id() is now removed and the few callers now use vrf_lookup_by_name() directly. Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2021-09-07lib: add zapi encode/decode func for srv6 locatorHiroki Shirokura
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-09-07bgpd: VRF-Lite fix nexthop typeKantesh Mundaragi
Description: Change is intended for fixing the following issues related to vrf route leaking: Routes with special nexthops i.e. blackhole/sink routes when imported, are not programmed into the FIB and corresponding nexthop is set as 'inactive', nexthop interface as 'unknown'. While importing/leaking routes between VRFs, in case of special nexthop(ipv4/ipv6) once bgp announces route(s) to zebra, nexthop type is incorrectly set as NEXTHOP_TYPE_IPV6_IFINDEX/NEXTHOP_TYPE_IFINDEX i.e. directly connected even though we are not able to resolve through an interface. This leads to nexthop_active_check marking nexthop !NEXTHOP_FLAG_ACTIVE. Unable to find the active nexthop(s), route is not programmed into the FIB. Whenever BGP leaks routes, set the correct nexthop type, so that route gets resolved and correctly programmed into the FIB, in the imported vrf. Co-authored-by: Kantesh Mundaragi <kmundaragi@vmware.com> Signed-off-by: Iqra Siddiqui <imujeebsiddi@vmware.com>
2021-09-06Merge pull request #9563 from opensourcerouting/build-strict-prototypesDonald Sharp
build: `-Wstrict-prototypes` (+ BSD `sed`)
2021-09-02lib: Remove unused function vrf_generate_idDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-02Merge pull request #9106 from opensourcerouting/clippy-elf-bsd-condDonald Sharp
lib/clippy: fix forgotten conditional
2021-09-02*: fix for -Wstrict-prototypesDavid Lamparter
Just some "void" missing between empty braces. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-09-02lib: fix hook defs for -Wstrict-prototypesDavid Lamparter
Without this, the hook code creates functions with empty parameter lists like "void hook_something()", which is not a proper C prototype. It needs to be "void hook_something(void)". Add some macro shenanigans to handle that. ... and make the plumbing functions "inline" too. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-09-01Merge pull request #9439 from ton31337/feature/set_ext_community_to_noneRuss White
bgpd: Route-map `set extcommunity none`
2021-08-30Merge pull request #9502 from idryzhov/cmd-vtysh-cleanupRuss White
lib, vtysh: make node-processing code more generic
2021-08-28lib/clippy: fix forgotten conditionalDavid Lamparter
This fixes some spurious warnings on *BSD, where `elffile_add_dynreloc` isn't used since `elf_getdata_rawchunk` is not available. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-08-27Merge pull request #9488 from pguibert6WIND/fix_nhrp_neigh_stateRuss White
Fix nhrp neigh state
2021-08-27lib: Send c-bit when not using bfdd as daemon of choiceDonald Sharp
Commit: 4b983eef2cb5c7306a8303f002d0e053ebeabdca Modified the zapi send receive of the c-bit to only be under the HAVE_BFDD. If you are using ptm-bfd then the decoder function still expects this to be sent down. This commit puts this behavior back Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-08-27Merge pull request #9496 from idryzhov/vrf-cmd-init-unused-argDavid Lamparter
lib: remove unused argument from vrf_cmd_init
2021-08-26lib: fix indentation trainwreck in command_pyDavid Lamparter
Hooooo boooooyyyy... that `default` sure was in an "interesting" place. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-08-26lib: add `![...]` syntax for easy "no" formsDavid Lamparter
This allows defining a CLI command like this: `[no] some setting ![VALUE]` with VALUE being optional for the "no" form, but required for the positive form. It's just a `[...]` where the empty branch can only be taken for commands starting with `no`. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-08-26lib: make node_parent more genericIgor Ryzhov
Instead of adding a separate case clause for every node, just find the node structure in the global list and get its parent node from there. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-08-26Merge pull request #9331 from idryzhov/explicit-exitChristian Hopps
*: explicitly print "exit" at the end of every node config
2021-08-26lib: remove unused argument from vrf_cmd_initIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-08-26lib, zebra: complete the ndm flags on zclient apiPhilippe Guibert
Insist on the fact that zclient neighbor state flags are mapped over netlink state flags. List all the defines currently known on kernel, and create a netlink API to convert netlink values to zclient values. The function is simplified as it is a 1-1 match. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-08-26nhrp, zebra, lib: pass exact received neighbor state value to nhrpPhilippe Guibert
As NHRP expects some notification of neighboring entries on GRE interface, when a new interface notification is encountered, the exact neighbor state flag is found. Previously, the flag passed to the upper layer was forced to NDM_STATE which is REACHABLE, as can be seen on below trace: 2021/08/25 10:58:39 NHRP: [QQ0NK-1H449] Netlink: new-neigh 102.1.1.1 dev gre1 lladdr 10.125.0.2 nud 0x2 cache used 1 type 5 When passing the real value, NHRP received an other value like STALE. 2021/08/25 11:28:44 NHRP: [QQ0NK-1H449] Netlink: new-neigh 102.1.1.1 dev gre1 lladdr 10.125.0.2 nud 0x4 cache used 0 type 5 This flag is important for NHRP, as it permits to monitor the link layer of NHRP entries. Fixes: d603c0774eba ("nhrp, zebra, lib: enforce usage of zapi_neigh_ip structure") Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-08-26Merge pull request #9466 from idryzhov/vrf-netnsDonatas Abraitis
lib, zebra: move vrf netns commands from lib to zebra
2021-08-25*: Drop `break` after using frr_help_exit() in switch/caseDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-08-24lib: remove the dependency on bgpd codeIgor Ryzhov
The library code should not depend on a specific daemon's code. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-08-23lib, zebra: move vrf netns commands from lib to zebraIgor Ryzhov
"[no] netns NAME" commands are part of the lib, but they are actually zebra-only: - they are using vrf_netns_handler_create and its description clearly says that it "should be called from zebra only" - vtysh sends these commands only to zebra - only zebra outputs the netns related config - zebra notifies other daemons about netns attachment Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-08-23*: explicitly print "exit" at the end of every node configIgor Ryzhov
There is a possibility that the same line can be matched as a command in some node and its parent node. In this case, when reading the config, this line is always executed as a command of the child node. For example, with the following config: ``` router ospf network 193.168.0.0/16 area 0 ! mpls ldp discovery hello interval 111 ! ``` Line `mpls ldp` is processed as command `mpls ldp-sync` inside the `router ospf` node. This leads to a complete loss of `mpls ldp` node configuration. To eliminate this issue and all possible similar issues, let's print an explicit "exit" at the end of every node config. This commit also changes indentation for a couple of existing exit commands so that all existing commands are on the same level as their corresponding node-entering commands. Fixes #9206. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-08-23Merge pull request #9337 from dlqs/lua2Stephen Worley
lib: check return on str2sockunion