summaryrefslogtreecommitdiffstats
path: root/lib (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #8888 from dlqs/lua-callQuentin Young2021-07-058-49/+199
|\
| * lib: add comments for functionsDonald Lee2021-06-253-10/+28
| | | | | | | | Signed-off-by: Donald Lee <dlqs@gmx.com>
| * lib: use in6addr comparator in testDonald Lee2021-06-222-2/+2
| | | | | | | | Signed-off-by: Donald Lee <dlqs@gmx.com>
| * lib: Pop tables off Lua stack when decodingDonald Lee2021-06-221-0/+13
| | | | | | | | Signed-off-by: Donald Lee <dlqs@gmx.com>
| * lib: Use noop decoder for bgp_script valuesDonald Lee2021-06-211-2/+5
| | | | | | | | Signed-off-by: Donald Lee <dlqs@gmx.com>
| * lib: Add lua noop decoderDonald Lee2021-06-212-0/+9
| | | | | | | | | | | | | | | | Use this noop decoder for const values (since we can't mutate a const value passed into frrscript_call anyways) or values we don't want to write a decoder for. Signed-off-by: Donald Lee <dlqs@gmx.com>
| * bgpd: Update bgp_script encoders and decodersDonald Lee2021-06-211-2/+6
| | | | | | | | | | | | | | | | This is an example of creating encoders and decoders for user defined structs and registering them in the ENCODE_ARGS DECODE_ARGS macro in frrscript. Signed-off-by: Donald Lee <dlqs@gmx.com>
| * lib: Update script SCRIPT commandDonald Lee2021-06-211-2/+4
| | | | | | | | | | | | Can now test out script by modifying a prefix Signed-off-by: Donald Lee <dlqs@gmx.com>
| * lib: Add decoder functionsDonald Lee2021-06-213-23/+82
| | | | | | | | | | | | | | | | | | | | Split existing lua_to* functions into two functions: - lua_decode_*: unmarshall Lua values into an existing C data structure - lua_to*: allocate *and* unmarshall Lua values into C data structure This allows us to mutate C data structures passed into frrscript_call, without allocation Signed-off-by: Donald Lee <dlqs@gmx.com>
| * lib: Add basic encodersDonald Lee2021-06-211-2/+12
| | | | | | | | Signed-off-by: Donald Lee <dlqs@gmx.com>
| * lib: make frrscript_call encode args based on typeDonald Lee2021-06-212-19/+28
| | | | | | | | Signed-off-by: Donald Lee <dlqs@gmx.com>
| * lib: Add MAP_LIST macroDonald Lee2021-06-211-0/+23
| | | | | | | | Signed-off-by: Donald Lee <dlqs@gmx.com>
* | *: Replace 4/16 integers to IPV4_MAX_BYTELEN/IPV6_MAX_BYTELENDonatas Abraitis2021-07-011-3/+7
| | | | | | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* | *: Convert numeric 32 into IPV4_MAX_BITLEN for prefixlenDonatas Abraitis2021-07-011-1/+1
| | | | | | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* | *: Convert numeric 128 into IPV6_MAX_BITLEN for prefixlenDonatas Abraitis2021-07-012-2/+2
| | | | | | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* | *: Replace IPV4_MAX_PREFIXLEN to IPV4_MAX_BITLENDonatas Abraitis2021-07-014-11/+11
| | | | | | | | | | | | Just drop IPV4_MAX_PREFIXLEN at all, no need keeping both. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* | *: Replace IPV6_MAX_PREFIXLEN to IPV6_MAX_BITLENDonatas Abraitis2021-07-013-4/+3
| | | | | | | | | | | | Just drop IPV6_MAX_PREFIXLEN at all, no need keeping both. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* | Merge pull request #8780 from idryzhov/fix-zebra-coverityRenato Westphal2021-06-301-8/+0
|\ \ | | | | | | zebra: fix a couple of coverity warnings
| * | *: unify prefix copyingIgor Ryzhov2021-06-291-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | There are a few places in the code where we use PREFIX_COPY(_IPV4/IPV6) macro to copy a prefix. Let's always use prefix_copy function for this. This should fix CID 1482142 and 1504610. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* | | Merge pull request #8824 from volta-networks/fix_check_for_link_param_changeOlivier Dugeon2021-06-292-2/+17
|\ \ \ | |/ / |/| | isisd, ospfd: update interface_link_params callback to check for change
| * | isisd, ospfd: update interface_link_params callback to check for changeKaren Schoener2021-06-282-2/+17
| | | | | | | | | | | | | | | | | | | | | Adding defensive code to the interface_link_params zebra callback to check if the link params changed before taking action. Signed-off-by: Karen Schoener <karen@voltanet.io>
* | | Merge pull request #8835 from ranjanyash54/clear_processIgor Ryzhov2021-06-291-0/+5
|\ \ \ | | | | | | | | ospf6d: "clear ipv6 ospf6 process" command
| * | | ospf6d: "clear ipv6 ospf6 process" commandYash Ranjan2021-06-281-0/+5
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adding the "clear ipv6 ospf6 command" . It resets the ospfv3 datastructures and clears the database as well as route tables. It resets the neighborship by restarting the interface state machine. If the user wants to change the router-id, this command updates the router-id to the latest static router-id and starts the neighbor formation with the new router-id. Signed-off-by: Yash Ranjan <ranjany@vmware.com>
* | | Merge pull request #8911 from donaldsharp/command_nodeDonatas Abraitis2021-06-291-2/+7
|\ \ \ | |/ / |/| | lib: Add some hash name differentiation for Command Hash's
| * | lib: Add some hash name differentiation for Command Hash'sDonald Sharp2021-06-241-2/+7
| | | | | | | | | | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* | | build: add `-Werror` to xrelfo log format warningsDavid Lamparter2021-06-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Adding a `\n' should now produce a warning. Controlled by `-Werror` so if you're doing a dev build and it's warning about some `prefix2str` that should be converted to `%pFX`, you can turn off `-Werror` to fix it later like with all other warnings. Signed-off-by: David Lamparter <equinox@diac24.net>
* | | lib: try CLOCK_THREAD_CPUTIME_IDDavid Lamparter2021-06-242-3/+23
| | | | | | | | | | | | | | | | | | | | | | | | This might be faster if at some point in the future the Linux vDSO supports CLOCK_THREAD_CPUTIME_ID without making a syscall. (Same applies for other OSes.) Signed-off-by: David Lamparter <equinox@diac24.net>
* | | lib: make cputime checks runtime options (v2)David Lamparter2021-06-245-73/+189
|/ / | | | | | | | | | | | | | | | | | | ...really no reason to force this into a compile time decision. The only point is avoiding the getrusage() syscall, which can easily be a runtime decision. [v2: also split cputime & walltime limits] Signed-off-by: David Lamparter <equinox@diac24.net>
* | Merge pull request #8656 from opensourcerouting/xref-5424-prep-2Donald Sharp2021-06-237-49/+211
|\ \ | | | | | | lib: preparations for RFC5424 syslog support
| * | lib: fix printf format on NetBSDDavid Lamparter2021-06-181-0/+4
| | | | | | | | | | | | | | | | | | *sigh*. It doesn't accept `%m` otherwise. Signed-off-by: David Lamparter <equinox@diac24.net>
| * | lib: make a few log symbols accessibleDavid Lamparter2021-06-184-4/+18
| | | | | | | | | | | | | | | | | | Might've made a few things too many `static` there. Signed-off-by: David Lamparter <equinox@diac24.net>
| * | lib: save instance number in zlogDavid Lamparter2021-06-182-0/+3
| | | | | | | | | | | | Signed-off-by: David Lamparter <equinox@diac24.net>
| * | lib: cache PID & TID in zlog codeDavid Lamparter2021-06-182-3/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | lib: include `\n` in zlog_msg_text()David Lamparter2021-06-184-21/+27
| | | | | | | | | | | | | | | | | | | | | 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>
| * | lib: add RFC3164 logging timestampsDavid Lamparter2021-06-182-1/+40
| | | | | | | | | | | | | | | | | | This is old-style syslog, used among other things for /dev/log. Signed-off-by: David Lamparter <equinox@diac24.net>
| * | lib: use fbuf for zlog_msg_ts()David Lamparter2021-06-183-18/+37
| | | | | | | | | | | | Signed-off-by: David Lamparter <equinox@diac24.net>
| * | lib: record output argument positions in zlogDavid Lamparter2021-06-182-1/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | lib: add hook for `show logging` CLIDavid Lamparter2021-06-182-0/+5
| | | | | | | | | | | | | | | | | | ... so additional targets can print their state. Signed-off-by: David Lamparter <equinox@diac24.net>
| * | lib: de-conflict `log-filter` CLI commandDavid Lamparter2021-06-181-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `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>
* | | Merge pull request #6695 from adharkar/frr-master-gateway_ipPatrick Ruddy2021-06-232-0/+14
|\ \ \ | | | | | | | | EVPN route type-5 gateway IP overlay Index
| * | | bgpd: Add "set evpn gateway-ip" clause for route-mapAmeya Dharkar2021-06-082-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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>
* | | | lib: remove vrf-interface config when removing the VRFIgor Ryzhov2021-06-211-1/+15
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Merge pull request #8749 from pjdruddy/bitfield_mtypeRenato Westphal2021-06-192-2/+5
|\ \ \ | | | | | | | | lib: add an MTYPE for bitfields
| * | | lib: add an MTYPE for bitfieldsPat Ruddy2021-06-182-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | it is handy to be able to see allocated bitfields in the show memory output. Signed-off-by: Pat Ruddy <pat@voltanet.io>
* | | | Merge pull request #8864 from idryzhov/fix-vtysh-vrf-changeRenato Westphal2021-06-193-10/+62
|\ \ \ \ | | | | | | | | | | lib: fix interface configuration after vrf change
| * | | | lib: fix interface configuration after vrf changeIgor Ryzhov2021-06-183-10/+62
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | Merge pull request #8876 from idryzhov/remove-pureDavid Lamparter2021-06-192-33/+20
|\ \ \ \ | |_|_|/ |/| | | lib: remove pure attribute from functions that modify memory
| * | | lib: remove pure attribute from functions that modify memoryIgor Ryzhov2021-06-182-33/+20
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Merge pull request #8478 from mjstapp/fix_nb_grpc_shutdownDonald Sharp2021-06-181-12/+30
|\ \ \ | | | | | | | | lib: stop grpc pthread at shutdown
| * | | lib: cleanup and stop grpc pthreadMark Stapp2021-06-151-12/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | At shutdown, try to stop the grpc module and its dedicated pthread cleanly. Signed-off-by: Mark Stapp <mjs@voltanet.io>