summaryrefslogtreecommitdiff
path: root/tools
AgeCommit message (Collapse)Author
2020-04-27tools: fix frr-reload AF issue with ldpdEmanuele Di Pascale
when removing a whole address-family block from ldpd config we were erroneously trying to also remove each of the interface sub-sub-contexts that belonged to it; this would effectively re-enable the AF we just removed. Work around this by ignoring these sub-sub-contexts if we detect that we are already removing the parent block. Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
2020-04-27tools/symalyzer: fix copypastaDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-04-27python: move MakeVars class into separate moduleDavid Lamparter
... so I can reuse it. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-04-24Merge pull request #6279 from opensourcerouting/nb-cb-argsDonald Sharp
*: change the signature of the northbound callbacks to be more flexible
2020-04-23*: change the signature of the northbound callbacks to be more flexibleRenato Westphal
Having a fixed set of parameters for each northbound callback isn't a good idea since it makes it difficult to add new parameters whenever that becomes necessary, as several hundreds or thousands of existing callbacks need to be updated accordingly. To remediate this issue, this commit changes the signature of all northbound callbacks to have a single parameter: a pointer to a 'nb_cb_x_args' structure (where x is different for each type of callback). These structures encapsulate all real parameters (both input and output) the callbacks need to have access to. And adding a new parameter to a given callback is as simple as adding a new field to the corresponding 'nb_cb_x_args' structure, without needing to update any instance of that callback in any daemon. This commit includes a .cocci semantic patch that can be used to update old code to the new format automatically. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2020-04-20bgpd, isis, tools: style fixenQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-04-20*: use appropriate buffer sizes, specifiersQuentin Young
- Fix 1 byte overflow when showing GR info in bgpd - Use PATH_MAX for path buffers - Use unsigned specifiers for uint16_t's in zebra pbr Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-04-20*: sprintf -> snprintfQuentin Young
Replace sprintf with snprintf where straightforward to do so. - sprintf's into local scope buffers of known size are replaced with the equivalent snprintf call - snprintf's into local scope buffers of known size that use the buffer size expression now use sizeof(buffer) - sprintf(buf + strlen(buf), ...) replaced with snprintf() into temp buffer followed by strlcat Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-04-20tools: add more macros to cocci.hQuentin Young
Coccinelle needs to know about complicated macros to understand certain code paths, add some more macros there. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-04-08tools: Add coccinelle script to catch typecasts to same typeDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-04-08*: Do not cast to the same typeDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-04-07tools: Add coccinelle script to catch typecasts to larger sizesDonatas Abraitis
That's valid only for uint*_t Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-04-03lib, tools: silence harmless warnings in the northbound toolsRenato Westphal
Our two northbound tools don't have embedded YANG modules like the other FRR binaries. As such, ly_ctx_set_module_imp_clb() shouldn't be called when the YANG subsystem it being initialized by a northbound tool. To make that possible, add a new "embedded_modules" parameter to the yang_init() function to control whether libyang should look for embedded modules or not. With this fix, "gen_northbound_callbacks" and "gen_yang_deviations" won't emit "YANG model X not embedded, trying external file" warnings anymore. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2020-03-29tools/gcc-plugins: add small test for frr-formatDavid Lamparter
Just enough to check that it works. Signed-off-by: David Lamparter <equinox@diac24.net>
2020-03-29tools/gcc-plugins: frr-formatDavid Lamparter
This provides the first reasonably-working version of the frr-format GCC plugin. I've only tested it with gcc 9.3.0. Signed-off-by: David Lamparter <equinox@diac24.net>
2020-03-29tools/gcc-plugins: cut c-format.c to sizeDavid Lamparter
... remove everything we don't need (or can't use because GCC doesn't export all of its internal classes & stuff.) Signed-off-by: David Lamparter <equinox@diac24.net>
2020-03-29tools/gcc-plugins: import c-format from GCCDavid Lamparter
(and gcc-common.h from the Linux kernel) Signed-off-by: David Lamparter <equinox@diac24.net>
2020-03-21tools: Convert type int functions to bool where possibleDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-10tools: Move scripts/coccinelle to tools/coccinelleDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-01-25tools: Update generate_support_bundle.py to support Python 3Martin Winter
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2020-01-16tools: improve frr-reload delete performance for some commandsDon Slice
Problem seen when deleting many static routes or access-lists due to frr-reload.py issuing individual vtysh -c commands for every line. On slow switches, this can take long enough for systemd to time out the reload process and restart frr. This fix uses add logic for static routes, prefix-lists, and access-lists to gang the changes together. Signed-off-by: Don Slice <dslice@cumulusnetworks.com> Ticket: CM-27856
2019-12-14tools: symalyzerDavid Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2019-12-06tools/frr-reload.py: remove stderr redirectsDavid Lamparter
These make no sense. stderr=subprocess.STDOUT means that vtysh's stdout and stderr are combined and returned by check_output. We don't expect errors in that, and we certainly don't log them. Leaving vtysh's stderr as stderr is perfectly fine, it'll be captured for logging just like stderr output from frr-reload.py. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-12-06build: apply DFLT_NAME/profiles in init scriptDavid Lamparter
Hopefully at some point we can get rid of the --enable-datacenter switch and just have the init script do magic. Should already work for Cumulus as it is. NB: the profile name can't be baked into the package. The whole point is to make the package profile-agnostic; in theory at some point the exact same package files should work on both, say, a Cumulus switch and a Linux software BGP DFZ router. Signed-off-by: David Lamparter <equinox@diac24.net>
2019-12-05tools: [ [ is not valid test syntaxQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-11-19Merge pull request #5224 from manuhalo/fix_frr_reload_pathsQuentin Young
Fixes and extensions to frr_reload.py
2019-11-19tools: resolve issue with bfd timer change fix in frr-reload.pyDon Slice
Found that while the previous fix solved the traceback and created the correct configuration, it was doing a delete/add process rather than just an add. This was due to an incorrectly created search string. This commit fixes that search string and testing verifies that the correct thing is now being done. Ticket: CM-27233 Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2019-11-13tools: stop repeating lines to delete for multiple bfd timer changesDon Slice
Problem reported with tracebacks seen when making multiple bfd timer changes in frr.conf and applying via frr-reload.py. Found that when multiple bfd timer changes are made, the same line can be added for deletion more than once, causing the traceback when the deletion is performed. This fix verifies the correct line is being appended for deletion. Ticket: CM-27233 Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2019-11-12tools, vtysh: improved fix for ldpd ifacesEmanuele Di Pascale
instead of suppressing the 'exit' markers at the end of each 'interface XXX' clause in the mpls ldp configuration, mark those with a special marker 'exit-ldp-if' and teach the reload script to correctly recognize the new sub-subcontext Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
2019-11-01tools: generate .changes file required for deb pkg uploadJafar Al-Gharaibeh
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2019-10-30tools: update the northbound callbacks generatorRenato Westphal
Add a new '-s' option which controls whether the generated northbound callbacks are declared with the 'static' specifier or not. If not (the default), a prototype is generated for each callback before their declarations. It's suggested that daemons shouldn't use the '-s' option so that their northbound callbacks can be implemented in different files according to their class (config, state, rpc or notification). libfrr commands, on the other hand, can use the '-s' option when their associated YANG module is too small and putting all callbacks in the same file is desirable. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-10-29tools, vtysh: fix ldpd + frr-reload.pyEmanuele Di Pascale
frr-reload.py has many special case rules that did not consider ldpd at all. Specifically: 1. The bulk of ldp configuration comes in a big 'mpls ldp' context, which was previously considered a single-line context as it started with 'mpls'. This rule should only apply to labels and lsps. 2. ldp has a 'router-id' config line that fell into the same rule as the above one. It should not be considered a single-line context as more ldp configuration can follow. 3. enabled interfaces should not end their context. A better fix would actually require popping a new context for each interface in case there is any interface-specific config, but at least this fix will address the most common use case. 4. when declaring pseudowires, any line with 'member pseudowire XXX' should be considered a sub-context of the 'l2vpn YYY type ZZZ' context. Without this fix, changes in the first psuedowire declared would not correctly be processed (e.g. removing a 'control-word exclude' line would not be picked up). Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
2019-10-29tools: frr-reload.py for single daemonEmanuele Di Pascale
allow frr-reload.py to be invoked with a --daemon option to specify an individual daemon for which the configuration diff should be computed. This is useful when integrated config is not used and we want to apply a patch to a single daemon config file. No attempt to integrate this with 'service frr reload' has been done. Making watchfrr work with per-daemon config is outside the scope of this simple patch. Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
2019-10-29tools: non hardcoded paths in frr-reloadEmanuele Di Pascale
allow command line parameters to specify different folder for the vtysh binary, config file location and temporary file. Keep the old hardcoded paths as default values for those options to preserve current functionality. Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
2019-09-13tools: Adding new commands to the list of support bundle commandsSri Mohana Singamsetty
Signed-off-by: Sri Mohana Singamsetty <msingamsetty@vmware.com>
2019-09-13tools: Modifications to copy support bundle filesSri Mohana Singamsetty
This commit is to copy the support bundle scripts to appropriate directories during installation Signed-off-by: Sri Mohana Singamsetty <msingamsetty@vmware.com>
2019-09-03*: frr_elevate_privs -> frr_with_privsDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-09-03tools: extend checkpatch.pl for frr_{with,each}David Lamparter
For frr_each, just fix some existing warnings; for frr_with_* add a warning indicating that braces should always be used. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-09-03lib: add frr_with_mutex() block-wrapperDavid Lamparter
frr_with_mutex(...) { ... } locks and automatically unlocks the listed mutex(es) when the block is exited. This adds a bit of safety against forgetting the unlock in error paths & co. and makes the code a slight bit more readable. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-08-06*: fix ctype (isalpha & co.) castsDavid Lamparter
The correct cast for these is (unsigned char), because "char" could be signed and thus have some negative value. isalpha & co. expect an int arg that is positive, i.e. 0-255. So we need to cast to (unsigned char) when calling any of these. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-07-31Merge pull request #4754 from opensourcerouting/gen-northbound-improvementsDonald Sharp
tools: improve gen_northbound_callbacks
2019-07-30tools: generate code that handles all casesRafael Zalamena
Help developers to start implementing northbound with more complete callbacks. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-07-29tools: generate northbound code without warningsRafael Zalamena
Use the alternate struct instantiation that does not generates warning on old compilers. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-07-29tools: allow YANG model path specificationRafael Zalamena
This allows developer to set a temporary YANG model directory path for generating northbound for models not yet installed. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-07-23frr-reload.py: fix reload with different settingsRafael Zalamena
Add `allow-external-route-update` and `domainname` to the one line context list, otherwise reload will fail when those commands show up in the running configuration. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-06-12tools: add vim snippetDavid Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2019-06-10tools: retain sanity when reloading under systemdDavid Lamparter
Without this, we end up restarting watchfrr with the systemd watchdog non-functional & tripped a bit later. Also, if watchfrr is in the "control" cgroup, systemd 232 will kill it. (241 apparently doesn't. Can't find anything about this in systemd's ChangeLog though.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-05-31tools: On shutdown no need to flush from tools/frr.in scriptDonald Sharp
Zebra already flushes routes on proper shutdown if you are not using the -K option. If you are using the -K option then you do not want the tools/frr script to flush routes. If zebra crashes and we restart then load up will either delete the routes or leave them depending on the -K option. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-05-24doc, tools: Update to code to show example MAX_FDSDonald Sharp
Place in the code the ability for end operators to know how to modify MAX_FDS so that they can run large scale operations. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-05-17tools: add vrrpd to frrcommon.shQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>