summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2021-11-24bgpd: Add an ability to match ipv6 next-hop by prefix-listDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-23lib: Use autocomplete for `route-map <name> <action> <seq>`Donatas Abraitis
``` exit1-debian-11(config)# route-map ? RMAP_NAME Route map tag belekas testas ``` Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-23Merge pull request #10024 from ton31337/feature/match_ipv6_next-hop_access-listIgor Ryzhov
bgpd: match ipv6 next-hop
2021-11-23bgpd: Add an ability to match ipv6 next-hop by access-listDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-22*: cleanup ifp->vrf_idIgor Ryzhov
Since f60a1188 we store a pointer to the VRF in the interface structure. There's no need anymore to store a separate vrf_id field. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-11-22Merge pull request #10076 from idryzhov/if-is-loopback-or-vrfDonald Sharp
*: unify if_is_loopback/if_is_loopback_or_vrf
2021-11-22Merge pull request #10096 from mjstapp/fix_ted_freeDonatas Abraitis
lib: use _safe iteration during link_state/ted cleanup
2021-11-19bgpd, lib: fix inconsistency of match ip/ipv6 next-hop commandsIgor Ryzhov
For IPv4 matching, we have "match ip next-hop address A.B.C.D". For IPv6 matching, we have "match ipv6 next-hop X:X::X:X". To have consistency, let's add "address" keyword to IPv6 commands. Old commands are preserved as hidden for backward compatibility. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-11-19Merge pull request #10074 from opensourcerouting/assorted-20211116Igor Ryzhov
lib/vtysh/ospf6d: assorted small bits
2021-11-18Merge pull request #10092 from ↵Igor Ryzhov
ton31337/feature/replace_json_object_string_add_to_json_object_string_addf_for_inet_ntop *: inet_ntop for JSON output
2021-11-18*: Remove unused variablesDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-18lib: use _safe iteration during link_state/ted cleanupMark Stapp
Use the _safe iterators when cleaning up the link-state module's vertices, edges, and subnets. Signed-off-by: Mark Stapp <mstapp@nvidia.com>
2021-11-18lib: Do not use sizeof() on `size_t errmsg_len`.zyxwvu Shi
This prevents caller from getting complete validation message. Signed-off-by: zyxwvu Shi <i@shiyc.cn>
2021-11-18lib: Replace inet_ntop to %pI4/6 for JSON outputsDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-18Merge pull request #10084 from opensourcerouting/json-sugarDonatas Abraitis
lib: make JSON output less painful/boilerplate-y
2021-11-17lib: use json-printf in filter codeDavid Lamparter
(This is mostly just to exercise the code, the actual replacement needs to be a cocci script.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-17lib: use vty_json()David Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-17lib: add printfrr to json string helpersDavid Lamparter
... these should probably have been added ages ago. `json_object_string_addf(json, "key", "%pFX", prefix)` is super useful. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-17lib: add vty_json() helperDavid Lamparter
... this is copypasted all over the codebase & should've been a helper to begin with really. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-17Merge pull request #9852 from opensourcerouting/pim-nht-reworkDonald Sharp
pimd: make PIM NHT less weird
2021-11-17Merge pull request #10075 from myloft/fix-chdir-judgeDavid Lamparter
2021-11-17lib: fix style misalignmentDavid Lamparter
Just a line that sticks out like a sore thumb. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-17*: clean up ifp-by-local-address function(s)David Lamparter
Most users of if_lookup_address_exact only cared about whether the address is any local address. Split that off into a separate function. For the users that actually need the ifp - which I'm about to add a few of - change it to prefer returning interfaces that are UP. (Function name changed due to slight change in behavior re. UP state, to avoid possible bugs from this change.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-16vtysh: dispatch unique-id backtrace cmd properlyDavid Lamparter
i.e. to whoever cares, since some unique IDs (from libfrr) are valid everywhere but some others (from the daemons) only apply to specific daemons. (Default handling aborts on first error, so configuring any unique IDs that don't exist on the first daemon vtysh connects to just failed before this.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-16lib: rework vty_check_node_for_xpath_decrementDavid Lamparter
...by having a flag in struct cmd_node rather than hardcoding it in `lib/command.c`. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-16lib: use hash for route-map set/match commandsDavid Lamparter
Why would this be in a vector to loop over with strcmp()'ing each item... that just makes no sense. Use a hash instead. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-16*: unify if_is_loopback/if_is_loopback_or_vrfIgor Ryzhov
We should always treat the VRF interface as a loopback. Currently, this is not the case, because in some old pre-VRF code we use if_is_loopback instead of if_is_loopback_or_vrf. To avoid any future problems, the proposal is to rename if_is_loopback_or_vrf to if_is_loopback and use it everywhere. if_is_loopback is renamed to if_is_loopback_exact in case it's ever needed, but currently it's not used anywhere. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-11-16zebra: fix chdir judgment to avoid starting failed in a non-existent directorySolyn
Signed-off-by: Solyn <admin@iloft.xyz>
2021-11-15lib: rename bfd function to reflect real functionalityIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-11-14Merge pull request #9956 from idryzhov/bfd-remove-ttlRuss White
lib: remove confusing bfd TTL API
2021-11-13Merge pull request #10032 from opensourcerouting/build-fix-20211111Donald Sharp
build: assorted build system improvements, 2021-11 edition
2021-11-12Merge pull request #10036 from donaldsharp/finally_frrJafar Al-Gharaibeh
Finally frr
2021-11-11Merge pull request #9981 from idryzhov/fix-vrf-deleteDonald Sharp
lib: fix vrf deletion when the last interface is deleted
2021-11-11*: Cleanup some documentation from quagga->frrDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-11-11*: Rename quagga_timestamp with frr_timestampDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-11-11*: Convert quagga_signal_X to frr_signal_XDonald Sharp
Naming functions/data structures more appropriately for the project we are actually in. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-11-11build: fix duplicate yang.c file inclusionsDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-11*: use compiler.h MIN/MAX macros instead of everyone having oneDonald Sharp
We had various forms of min/max macros across multiple daemons all of which duplicated what we have in compiler.h. Convert everyone to use the `correct` ones Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-11-11build: link libcrypt & libdl to libfrr onlyDavid Lamparter
They're not needed elsewhere. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-11Merge pull request #10025 from opensourcerouting/xref-backtraceRuss White
lib: backtraces for specific log messages
2021-11-11Merge pull request #9864 from ton31337/feature/access_list_autocompleteRuss White
lib: Add autocomplete for access-lists
2021-11-11lib: fix vrf deletion when the last interface is deletedIgor Ryzhov
Currently, we automatically delete an inactive VRF when its last interface is deleted. This code introduces a couple of crashes because of the following problems: - vrf_delete is called before calling if_del hook, so daemons may try to dereference an ifp->vrf pointer which is freed - in if_terminate, we continue to use the VRF in the loop condition after the last interface is deleted This check is needed only when the interface is deleted by the user, because if the interface is deleted by the system, VRF must still exist in the system. Move the check to appropriate places to fix crashes. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-11-11lib: remove confusing bfd TTL APIIgor Ryzhov
There are two APIs to control the expected number of hops for a BFD session – `bfd_sess_set_mininum_ttl` and `bfd_sess_set_hop_count`. The former is very confusing, as it takes an expected TTL in the BFD packet which is actually a protocol internal value. The latter is simple and straightforward – it takes an expected number of hops, which is always 1 for single-hop and >1 for multi-hop. As the former API is not used anywhere, just remove it to avoid any confusion. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-11-10lib: fix elf_py TLS section handlingDavid Lamparter
... need to ignore TLS sections, their address is effectively meaningless but can overlap other sections we actually need to access. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-10lib: avoid include loop with assert.hDavid Lamparter
`assert.h` -> `xref.h` -> `typesafe.h` -> `assert.h` Might be possible to do this more cleanly some way, but that way is not obvious, so here's the "simple & dumb" approach. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-10lib: add `debug uid XXXXX-XXXXX backtrace`David Lamparter
Looks much prettier if `libunwind` is available, but works with glibc or libexecinfo's `backtrace()` too. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-10lib: stuff xrefs into a tree for lookupDavid Lamparter
... so we can actually access by UID without searching the entire list. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-11-10lib: add missing include in typerb.hDavid Lamparter
The RB-tree macros use memset(), so we need to #include <string.h> Signed-off-by: David Lamparter <equinox@diac24.net>
2021-11-08lib: remove `vector_get_index()`David Lamparter
... its only purpose was to serve as a footgun, and all such uses have been eliminated now. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-08lib: fix c-ares thread misuseDavid Lamparter
The `struct thread **ref` that the thread code takes is written to and needs to stay valid over the lifetime of a thread. This does not hold up if thread pointers are directly put in a `vector` since adding items to a `vector` may reallocate the entire array. The thread code would then write to a now-invalid `ref`, potentially corrupting entirely unrelated data. This should be extremely rare to trigger in practice since we only use one c-ares channel, which will likely only ever use one fd, so the vector is never resized. That said, c-ares using only one fd is just plain fragile luck. Either way, fix this by creating a resolver_fd tracking struct, and clean up the code while we're at it. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>