summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2021-06-23Merge pull request #8656 from opensourcerouting/xref-5424-prep-2Donald Sharp
lib: preparations for RFC5424 syslog support
2021-06-23Merge pull request #6695 from adharkar/frr-master-gateway_ipPatrick Ruddy
EVPN route type-5 gateway IP overlay Index
2021-06-21lib: remove vrf-interface config when removing the VRFIgor Ryzhov
If we have the following configuration: ``` vrf red smth exit-vrf ! interface red vrf red smth ``` And we delete the VRF using "no vrf red" command, we end up with: ``` interface red smth ``` Interface config is preserved but moved to the default VRF. This is not an expected behavior. We should remove the interface config when the VRF is deleted. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-06-19Merge pull request #8749 from pjdruddy/bitfield_mtypeRenato Westphal
lib: add an MTYPE for bitfields
2021-06-19Merge pull request #8864 from idryzhov/fix-vtysh-vrf-changeRenato Westphal
lib: fix interface configuration after vrf change
2021-06-19Merge pull request #8876 from idryzhov/remove-pureDavid Lamparter
lib: remove pure attribute from functions that modify memory
2021-06-18lib: fix printf format on NetBSDDavid Lamparter
*sigh*. It doesn't accept `%m` otherwise. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-06-18lib: make a few log symbols accessibleDavid Lamparter
Might've made a few things too many `static` there. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-06-18lib: save instance number in zlogDavid Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2021-06-18lib: cache PID & TID in zlog codeDavid Lamparter
glibc removed its pid cache a while back, and grabbing this from TLS is faster than repeatedly calling the kernel... Also use `intmax_t` which is more appropriate for both PID & TID. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-06-18lib: include `\n` in zlog_msg_text()David Lamparter
Since the file targets append one anyway, save them some extra work. syslog can use `%.*s` since it's "forced" printf by API anyway. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-06-18lib: add RFC3164 logging timestampsDavid Lamparter
This is old-style syslog, used among other things for /dev/log. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-06-18lib: use fbuf for zlog_msg_ts()David Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2021-06-18lib: record output argument positions in zlogDavid Lamparter
printfrr() recently acquired the capability to record start/end of formatting outputs. Make use of this in the zlog code so logging targets have access to this information. (This also records how long the `[XXXXX-XXXXX][EC 9999999]` prefix was so log targets can choose to skip over it.) Signed-off-by: David Lamparter <equinox@diac24.net>
2021-06-18lib: add hook for `show logging` CLIDavid Lamparter
... so additional targets can print their state. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-06-18lib: de-conflict `log-filter` CLI commandDavid Lamparter
`log-filter WORD` was giving me a serious headache since it also matches `log WORD` due to the way the CLI token handling works. This meant that a mistyped `log something` command would silently be interpreted as a filter string, causing me serious headscratching and WTFs until I figured what was going on. Remove this UX pitfall so noone else falls into it. (Since the command was never saved to config, renaming it shouldn't cause trouble.) [Also I apparently forgot to update the docs when I transferred this over to the new zlog bits...] TODO for a rainy day: since we collect all the CLI commands anyway, we should warn somewhere for "2nd level ambiguous" commands like this. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-06-18lib: remove pure attribute from functions that modify memoryIgor Ryzhov
Almost all functions currently marked with pure attribute acquire a route_node lock. By marking them pure we allow compiler to optimize the code and not call them when it already knows the return value. This is completely incorrect. Only two of eleven functions can be marked as pure. And they still won't be optimized because they are never called from the same function twice. Let's remove the ext_pure macro completely to reduce the chance of repeating this mistake in the future. Fixes #8866, #8809, #8595, #6992. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-06-18Merge pull request #8478 from mjstapp/fix_nb_grpc_shutdownDonald Sharp
lib: stop grpc pthread at shutdown
2021-06-18lib: add an MTYPE for bitfieldsPat Ruddy
it is handy to be able to see allocated bitfields in the show memory output. Signed-off-by: Pat Ruddy <pat@voltanet.io>
2021-06-18lib: fix interface configuration after vrf changeIgor Ryzhov
This commit fixes the following problem: - enter the interface node - move the interface to another VRF - try to continue configuring the interface It is not possible to continue configuration because the XPath stored in the vty doesn't correspond with the actual state of the system anymore. For example: ``` nfware# conf nfware(config)# interface enp2s0 <-- move the enp2s0 to a different VRF --> nfware(config-if)# ip router isis 1 % Failed to get iface dnode in candidate DB ``` To fix the issue, go through all connected vty shells and update the stored XPath. Suggested-by: Renato Westphal <renato@opensourcerouting.org> Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-06-17lib: Do not double-assign freed pointer to NULLDonatas Abraitis
It's already done by XFREE. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-06-15lib: cleanup and stop grpc pthreadMark Stapp
At shutdown, try to stop the grpc module and its dedicated pthread cleanly. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-06-15Merge pull request #8838 from LabNConsulting/chopps/fix-nb-edit-cliIgor Ryzhov
lib: do not attempt to create default nodes from NULL tree node
2021-06-12lib: do not attempt to create default nodes from NULL tree nodeChristian Hopps
Perform same NULL check for dependent node creation code too. Signed-off-by: Christian Hopps <chopps@labn.net>
2021-06-11lib: terminate default vrf lastStephen Worley
Always terminate default VRF last during FRR shutdown. On shutdown we were simply looping over the RB tree and terminating VRFs from the ROOT. This is not guaranteed to be the default last ever. Instead switch to RB_SAFE and skip the default VRF till the very end. Signed-off-by: Stephen Worley <sworley@nvidia.com>
2021-06-09Merge pull request #8807 from mjstapp/fix_srv6_deleteDonald Sharp
lib,zebra: srv6 cleanup
2021-06-09Merge pull request #8798 from opensourcerouting/ospfd-fixesOlivier Dugeon
ospfd: assorted fixes
2021-06-08Merge pull request #8593 from idryzhov/cmd-ambiguousQuentin Young
vtysh: fix searching commands in parent nodes
2021-06-08lib, ospfd, ospf6d: fix logging of pointer addressesRenato Westphal
The %p printf format specifier does already print the pointer address with a leading "0x" prefix (indicating a hexadecimal number). There's no need to add that prefix manually. While here, replace explicit function names in log messages by __func__. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-06-08Merge pull request #8713 from LabNConsulting/chopps/grpc-unit-testQuentin Young
2021-06-07bgpd: Add "set evpn gateway-ip" clause for route-mapAmeya Dharkar
- Add following set clause for route-maps "set evpn gateway-ip <ipv4|ipv6 >A.B.C.D|X:X::X:X" - When this route-map is applied as outboubd policy in BGP, it will set the gateway-ip in BGP attribute For EVPN type-5 routes. Example configuration: route-map RMAP-EVPN_GWIP permit 5 set evpn gateway-ip ipv4 50.0.2.12 set evpn gateway-ip ipv6 50:0:2::12 router bgp 101 bgp router-id 10.100.0.1 neighbor 10.0.1.2 remote-as 102 ! address-family l2vpn evpn neighbor 10.0.1.2 activate neighbor 10.0.1.2 route-map RMAP-EVPN_GWIP out advertise-all-vni exit-address-family Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
2021-06-07lib: fix address sanitizer crash on `find`Rafael Zalamena
Fix the following address sanitizer crash when running the command `find`: ERROR: AddressSanitizer: dynamic-stack-buffer-overflow WRITE of size 1 at 0x7fff4840fc1d thread T0 0 in print_cmd ../lib/command.c:1541 1 in cmd_find_cmds ../lib/command.c:2364 2 in find ../vtysh/vtysh.c:3732 3 in cmd_execute_command_real ../lib/command.c:995 4 in cmd_execute_command ../lib/command.c:1055 5 in cmd_execute ../lib/command.c:1219 6 in vtysh_execute_func ../vtysh/vtysh.c:486 7 in vtysh_execute ../vtysh/vtysh.c:671 8 in main ../vtysh/vtysh_main.c:721 9 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2) 10 in _start (/usr/bin/vtysh+0x21f64d) Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-06-07lib: add dtor for srv6 locator chunk listMark Stapp
Add a delete function for the chunk list in an srv6 locator. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-06-07Merge pull request #8778 from idryzhov/fix-zebra-vrfRafael Zalamena
zebra: fix config after exit from vrf
2021-06-07Merge pull request #8758 from idryzhov/bfd-fixesRafael Zalamena
BFD fixes
2021-06-07Merge pull request #8781 from idryzhov/fix-list-findRafael Zalamena
lib: fix output of "list" and "find" commands
2021-06-06tests: add grpc unit testChristian Hopps
Test uses staticd which required some C++ header protections. Additionally, the test also runs in the ubuntu20 docker container as grpc is supported there by the packaging system. Signed-off-by: Christian Hopps <chopps@labn.net>
2021-06-04Merge pull request #8706 from LabNConsulting/chopps/fix-grpc-threadingQuentin Young
2021-06-04Merge pull request #5865 from slankdev/slankdev-zebra-srv6-managerMark Stapp
zebra: srv6 manager
2021-06-04zebra: fix config after exit from vrfIgor Ryzhov
When the VRF node is exited using "exit" or "quit", there's still a VRF pointer stored in the vty context. If you try to configure some router related command, it will be applied to the previous VRF instead of the default VRF. For example: ``` (config)# vrf test (config-vrf)# ip router-id 1.1.1.1 (config-vrf)# do show run ... ! vrf test ip router-id 1.1.1.1 exit-vrf ! ... (config-vrf)# exit (config)# ip router-id 2.2.2.2 (config)# do show run ... ! vrf test ip router-id 2.2.2.2 exit-vrf ! ... ``` `vrf-exit` works correctly, because it stores a pointer to the default VRF into the vty context (but weirdly keeping the VRF_NODE instead of changing it to CONFIG_NODE). Instead of relying on the behavior of exit function, always use the default VRF when in CONFIG_NODE. Another problem is missing `VTY_CHECK_CONTEXT`. If someone deletes the VRF in which node the user enters the command, then zebra applies the command to the default VRF instead of throwing an error. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-06-03lib: fix output of "list" and "find" commandsIgor Ryzhov
Currently, we output the command exactly how it is defined in DEFUN. We shouldn't output varnames and excessive whitespace. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-06-03lib, vtysh: reduce code duplicationIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-06-02Merge pull request #8210 from LabNConsulting/chopps/always-batchDonald Sharp
northbound: KISS always batch yang config, it's faster.
2021-06-02*: delete ZEBRA_FLAG_SEG6*_ROUTE and add ZAPI_NEXTHOP_FLAG_SEG6*Hiroki Shirokura
https://github.com/FRRouting/frr/pull/5865#discussion_r597670225 As this comment says. ZEBRA_FLAG_XXX should not have been used. To communicate SRv6 Route Information. A simple Nexthop Flag would have been sufficient for SRv6 information. And I fixed the whole thing that way. Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02lib,sharpd,zebra: update nexthop object with nh_srv6Hiroki Shirokura
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02*: eliminate redundant info from srv6 locator zapiHiroki Shirokura
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02zebra: drop un-needed info in locator-zapiHiroki Shirokura
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02zebra: delete unneeded zebra_srv6_manager_connectHiroki Shirokura
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02lib: erase wrong comments by copy-pasteHiroki Shirokura
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02lib: eliminate odd line-breakHiroki Shirokura
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>