summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2020-09-08Merge pull request #7047 from qlyoung/fix-zlog-target-null-derefbase_7.5Mark Stapp
lib: fix possible null dereference in zlog
2020-09-08lib: fix possible null dereference in zlogQuentin Young
In some cases one or both of the zlog targets in use here can be null, we need to check for that. Interestingly it appears we don't crash even when this is the case. Undefined behavior ftw Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2020-09-04Merge pull request #7046 from qlyoung/fix-various-integer-issuesRenato Westphal
Fix various integer signedness / overflow issues
2020-09-04Merge pull request #6971 from volta-networks/fix_ldp_no_configRenato Westphal
ldpd: Fix issue when starting up LDP with no configuration.
2020-09-04ldpd: Fix issue when starting up LDP with no configuration.lynne
LDP would mark all routes as learned on a non-ldp interface. Then when LDP was configured the labels were not updated correctly. This commit fixes issues 6841 and 6842. Signed-off-by: Lynne Morrison <lynne@voltanet.io>
2020-09-03lib: add stream_rewind_getp()Quentin Young
stream_forward_getp() cannot be used with negative numbers due to the size_t argument, we'll end up doing overflow arithmetic. Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2020-09-03lib: remove unused stream_get_data apiMark Stapp
Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-09-03Merge pull request #6987 from Niral-Networks/acl_fixSantosh P K
lib, ospf : Fix when redist is performed with route-map using access-list
2020-09-02lib: remove overflow arithmetic from hash statsQuentin Young
Signed values get converted to unsigned for addition, so when the value to adjust a stats variable for hash tables was negative this resulted in overflow arithmetic, which we generally don't want. Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2020-09-02lib: explicitly cast -1 to uid_tQuentin Young
We should be explicit about what's happening here Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2020-09-02Merge pull request #6997 from opensourcerouting/cisco-acl-nameDonald Sharp
lib,yang: allow cisco access lists to use names plus fixes
2020-09-01Merge pull request #7016 from donaldsharp/pbr_vrf_is_burfRuss White
Pbr vrf is burf
2020-08-31lib: silence overly verbose CLI warningRenato Westphal
When not using the transactional CLI mode, do not display a warning when a YANG-modeled commmand doesn't perform any effective configuration change. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2020-08-31lib : Fix when redist is performed with route-map using access-list.Kaushik
1. Added new API for add/delete acl with route map notify. Co-authored-by: harios <hari@niralnetworks.com> Signed-off-by: Kaushik <kaushik@niralnetworks.com>
2020-08-28lib: Note old ifindex on shutdownDonald Sharp
If we have an interface configured in a daemon on shutdown store the old ifindex value for retrieval on when it is possibly recreated. This is especially important for nexthop groups as that we had at one point in time the ability to restore the configuration but it was lost when we started deleting all deleted interfaces. We need the nexthop group subsystem to also mark that it has configured an interface. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-08-28lib: Allow nexthop simple display to take an alternate ifp nameDonald Sharp
The nexthop_group_write_nexthop_simple function outputs the interface name, because we've stored the ifindex. The problem is that there are ephermeal interfaces in linux that can be destroyed/recreated. Allow us to keep that data and do something a bit smarter to allow show run's and other show commands to continue to work when the interface is deleted. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-08-27lib: break up show nexthop API a bit for reuseStephen Worley
Not everything cares about the vrf and backup info. Break up the API to add a simple version to just write gateway/interface info. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-08-26lib: refactory cisco access list net wildcardRafael Zalamena
Wildcards bits have the opposite representation of a network mask, example: 192.168.0.0/24 has the following netmask 255.255.0.0 and the wildcard representation is 0.0.255.255. To avoid future confusion lets put those definitions into a macro so we know for sure which form to use. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-08-26Merge pull request #5799 from pguibert6WIND/flowspec_ipv6Donald Sharp
Flowspec ipv6
2020-08-25lib: fix a crash in zebra style access listRafael Zalamena
When removing an IPv4 prefix configuration the wrong amount of bytes will be read from `struct prefix_ipv4` from `DEFPY`, so lets use the proper function for this. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-08-25lib: remove ambiguous cisco commandRafael Zalamena
When configuring a access list rule with type `any` it is now ambiguous between cisco and zebra because both have the same syntax, so lets remove the cisco command to avoid that. YANG users will not notice this change. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-08-25lib: fix filter extended address assignmentRafael Zalamena
`nb_cli_enqueue_change` just points to the string values passed in parameter, so we must use different strings for different function calls (at least until `nb_cli_apply_changes`). While here fix a variable name typo/copy paste error on destination host case. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-08-25lib: allow cisco typed rules to use namesRafael Zalamena
The restriction was already lift at the YANG model level, now lets unlock the CLI as well. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-08-25Merge pull request #6976 from achernavin22/rip_tools_key_chain_reloadingDonald Sharp
lib, tools: fix reloading of key sub-context in key chains
2020-08-25Merge pull request #6962 from mjstapp/fix_zapi_nh_sortRuss White
lib: zapi nexthop sort fixes
2020-08-24Merge pull request #6963 from chiragshah6/mdevRenato Westphal
*: record northbound transaction based on control flag
2020-08-24lib, tools: fix reloading of key sub-context in key chainsAlexander Chernavin
When you add a key chain in the RIP configuration file and reload the configurations via the frr-reload.py script, the script will fail and the key chain will not appear in the running configuration. The reason is that frr-reload.py doesn't recognize key as a sub-context. Before this change, keys were generated this way: key chain test key 2 key-string 123 key 3 key-string 456 With this change, keys will be generated this way: key chain test key 2 key-string 123 exit key 3 key-string 456 exit This will allow frr-reload.py to see the key sub-context and correctly reload them. Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
2020-08-21bgpd, lib: support for flow_label flowspec typePhilippe Guibert
in ipv6 flowspec, a new type is defined to be able to do filtering rules based on 20 bits flow label field as depicted in [0]. The change include the decoding by flowspec, and the addition of a new attribute in policy routing rule, so that the data is ready to be sent to zebra. The commit also includes a check on fragment option, since dont fragment bit does not exist in ipv6, the value should always be set to 0, otherwise the flowspec rule becomes invalid. [0] https://tools.ietf.org/html/draft-ietf-idr-flow-spec-v6-09 Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2020-08-21lib: add family attribute for flowspec prefix structurePhilippe Guibert
to recognize whether a flowspec prefix has been carried out by ipv4 flowspec or ipv6 flowspec ( actually, the hypothesis is that only ipv4 flowspec is supported), then a new attribute should contain the family value: AF_INET or AF_INET6. That value will be further used in the BGP flowspec code. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2020-08-20*: record transaction based on control flagChirag Shah
In case of config rollback is enabled, record northbound transaction based on a control flag. The actual frr daemons would set the flag to true via nb_init from frr_init. This will allow test daemon to bypass recording transacation to db. Signed-off-by: Chirag Shah <chirag@nvidia.com>
2020-08-20lib: zapi nexthop sort fixesMark Stapp
The sorting for zapi nexthops in zapi routes needs to match the sorting of nexthops done in zebra. Ensure all zapi_nexthop attributes are included in the sort. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-08-20lib: add yang modules to native module listChirag Shah
Signed-off-by: Chirag Shah <chirag@nvidia.com>
2020-08-20lib: adapt plugin to use new Sysrepo versionRenato Westphal
Sysrepo recently underwent a complete rewrite, where some substantial architectural changes were made (the most important one being the extinction of the sysrepod daemon). While most of the existing API was preserved, quite a few backward-incompatible changes [1] were introduced (mostly simplifications). This commit adapts our sysrepo northbound plugin to those API changes in order for it to be compatible with the latest Sysrepo version. Additional notes: * The old Sysrepo version is EOL and not supported anymore. * The new Sysrepo version requires libyang 1.x. Closes #6936 [1] https://github.com/sysrepo/sysrepo/blob/devel/CHANGES Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2020-08-20Merge pull request #6924 from AnuradhaKaruppiah/mem-fixesRafael Zalamena
bgpd: fixes for problems found during EVPN fuzzing
2020-08-19Merge pull request #6945 from qlyoung/nb-more-messagesRenato Westphal
More gRPC logging + errmsg for no changes
2020-08-19lib: fill nb errmsg when no changes during prepQuentin Young
During the prep phase to apply a northbound commit, if no changes were detected make sure we fill the error message buffer to explain this. Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2020-08-19Merge pull request #6939 from sworleys/NH-Vrf-DelMark Stapp
lib: fix crash in show nexthop when vrf deleted
2020-08-18lib: add better zlogging to gRPC Commit RPCQuentin Young
Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2020-08-18lib: fix crash in show nexthop when vrf deletedStephen Worley
Fix a crash where if we issue a show run after a vrf has been deleted we would crash here due to not null checking. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-08-15lib: add STREAM_FORWARD_[GET|ENDP]Quentin Young
Safe stream macros for adjusting buffer pointers Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-08-14lib: don't ignore error messages generated during the commit apply phaseRenato Westphal
While a configuration transaction can't be rejected once it reaches the APPLY phase, we should allow NB callbacks to generate error or warning messages when a configuration change is being applied. That should be useful, for example, to return warnings back to the user informing that the applied configuration has some kind of inconsistency or is missing something in order to be effectively activated. The infrastructure for this was already present, but the northbound layer was ignoring all errors/warnings generated during the apply/abort phases instead of returning them to the user. This commit changes that. In the gRPC plugin, extend the Commit() RPC adding a new "error_message" field to the response type. This is necessary to allow errors/warnings to be returned even when the commit operation succeeds (since grpc::Status::OK doesn't support error messages like the other status codes). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2020-08-14Merge pull request #6889 from opensourcerouting/isisd-assorted-fixesDonald Sharp
isisd minor fixes and enhancements
2020-08-13lib: show prefix error message on command failureRafael Zalamena
Use `args->errmsg` instead of just `zlog_info` for registering the error so the users don't need to check their log files. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-08-13Merge pull request #6869 from xThaid/zebra_arpDonald Sharp
lib, zebra: add support for sending ARP requests
2020-08-12lib, zebra: add support for sending ARP requestsJakub Urbańczyk
We can make the Linux kernel send an ARP/NDP request by adding a neighbour with the 'NUD_INCOMPLETE' state and the 'NTF_USE' flag. This commit adds new dataplane operation as well as new zapi message to allow other daemons send ARP/NDP requests. Signed-off-by: Jakub Urbańczyk <xthaid@gmail.com>
2020-08-12Merge pull request #6906 from donaldsharp/poll_errorMark Stapp
Poll error
2020-08-12lib: Properly handle POLLERR from poll()Donald Sharp
There are situations where POLLERR will be returned. But since we were not handling it. Thread processing effectively is turned into an infinite loop, which is bad. Modify the code so that if we receive a POLLERR we turn it into a read event to be handled as an error from the handler function. This was discovered in pim: Thread statistics for pimd: Showing poll FD's for main -------------------------- Count: 14/1024 0 fd: 9 events: 1 revents: 0 mroute_read 1 fd: 12 events: 1 revents: 0 vty_accept 2 fd: 13 events: 1 revents: 0 vtysh_accept 3 fd: 11 events: 1 revents: 0 zclient_read 4 fd: 15 events: 1 revents: 0 mroute_read 5 fd: 16 events: 1 revents: 0 mroute_read 6 fd: 17 events: 1 revents: 0 pim_sock_read 7 fd: 19 events: 1 revents: 0 pim_sock_read 8 fd: 21 events: 1 revents: 0 pim_igmp_read 9 fd: 22 events: 1 revents: 0 pim_sock_read 10 fd: 23 events: 1 revents: 0 pim_sock_read 11 fd: 20 events: 1 revents: 0 vtysh_read 12 fd: 18 events: 1 revents: 0 pim_sock_read 13 fd: 24 events: 0 revents: 0 strace was showing this line over and over and over: poll([{fd=9, events=POLLIN}, {fd=12, events=POLLIN}, {fd=13, events=POLLIN}, {fd=11, events=POLLIN}, {fd=15, events=POLLIN}, {fd=16, events=POLLIN}, {fd=17, events=POLLIN}, {fd=19, events=POLLIN}, {fd=21, events=POLLIN}, {fd=22, events=POLLIN}, {fd=23, events=POLLIN}, {fd=20, events=POLLIN}, {fd=18, events=POLLIN}, {fd=6, events=POLLIN}], 14, 20) = 1 ([{fd=21, revents=POLLERR}]) Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-08-12lib: Fixup comment indentations in thread.cDonald Sharp
Somewhere along the way the indentation for comments got all messed up. Let's make it follow our standards and also look right too. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-08-11lib: yang wrapper for getting empty typeChirag Shah
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-08-11lib: introduce new list_dup() APIRenato Westphal
This new function will be used by the upcoming TI-LFA code. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>