summaryrefslogtreecommitdiff
path: root/python
AgeCommit message (Collapse)Author
2022-05-26build: reformat makefile.pyDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-05-26build: add a bunch of comments to makefile.pyDavid Lamparter
... to (maybe?) make understandable what it's doing. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-05-26build: fix LLVM bitcode per-target CFLAGSDavid Lamparter
When automake decides to customize CFLAGS, use those for building LLVM bitcode files too. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-28python: improve clippy/clidef macro processingDavid Lamparter
Process macros from the current file, and warn if something is redefined (to a different value). Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-13python: pass conditionals through clippy for DEFPYDavid Lamparter
Track what conditionals apply when a DEFPY is encountered, and stack them around the autogenerated clippy wrapper. Otherwise conditional DEFPYs result in undefined function warnings. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-10-05isisd: fix redistribute CLIIgor Ryzhov
Currently, it is possible to configure IPv6 protocols for IPv4 redistribution and vice versa in CLI. The YANG model doesn't allow this so the user receives the following error: ``` nfware(config-router)# redistribute ipv4 ospf6 level-1 % Failed to edit configuration. YANG error(s): Invalid enumeration value "ospf6". Invalid enumeration value "ospf6". Invalid enumeration value "ospf6". YANG path: Schema location /frr-isisd:isis/instance/redistribute/ipv4/protocol. ``` Let's make CLI more user-friendly and allow only supported protocols in redistribution commands. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-06-24build: add `-Werror` to xrelfo log format warningsDavid Lamparter
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>
2021-04-23*: make sure `config.h` or `zebra.h` is firstDavid Lamparter
`config.h` has all the defines from autoconf, which may include things that switch behavior of other included headers (e.g. _GNU_SOURCE enabling prototypes for additional functions.) So, the first include in any `.c` file must be either `config.h` (with the appropriate guard) or `zebra.h` (which includes `config.h` first thing.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-04-15python: add demo checker tool using frr.xrefDavid Lamparter
More of a demo on what to do with the frr.xref file, but also slightly useful in finding vtysh SNAFUs :) Signed-off-by: David Lamparter <equinox@diac24.net>
2021-04-08python: fix 32-bit pointers in xrelfo container_ofDavid Lamparter
This was mistakenly using the host platform's pointer size rather than the ELF file's. Only noticeable when cross compiling... Signed-off-by: David Lamparter <equinox@diac24.net>
2021-02-23python/xrelfo: cross-platform xrefstructs.jsonDavid Lamparter
Just get names, types and order from pahole; ditch offset & size since they're different on 32/64 bit. None of the structs has padding currently; if we really need that it can be implemented in the future. (Padding will raise an exception, so it won't break silently.) Signed-off-by: David Lamparter <equinox@diac24.net>
2021-02-23lib/xref: record log message format argsDavid Lamparter
Apparently you can do `#__VA_ARGS__` and it actually does something sensible, so here we go recording the format parameters for log messages into the xref. This allows some more checking in xrelfo.py, e.g. hints to use `%pFX` and co. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-02-23build: extract xrefsDavid Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2021-02-23python/xrelfo: the ELF xref extractorDavid Lamparter
This creates JSON dumps of all the xref structs littered around FRR. Signed-off-by: David Lamparter <equinox@diac24.net>
2020-10-07*: reformat python fileswhitespace
We are now using black. Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2020-08-19python: Make FRR build compatible with python 2.7 and 3.xMartin Winter
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2020-07-17build: fix Makefile rule redefinitionDavid Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2020-05-05python: add graphviz callgraphsDavid Lamparter
Uses the JSON data extracted from LLVM bitcode by tools/frr-llvm-cg. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-05-05build: add LLVM bitcode targetsDavid Lamparter
Just an easy way to produce LLVM .bc (bitcode) files. Not used during normal builds. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-05-05build: rework Makefile var extraction... againDavid Lamparter
*sigh* I can't seem to catch a break on this. Add a regex variant. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-04-27python: add check-first-header toolDavid Lamparter
The first #include statement in all FRR .c files should be either zebra.h or config.h. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-04-27build: make clippy Makefile rules nicerDavid Lamparter
These are easy to get subtly wrong, and doing so can cause nondeterministic failures when racing in parallel builds. 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>
2019-08-30bgpd/bmp: BMP implementationDavid Lamparter
This implements BMP. There's no fine-grained history here, the non-BMP preparations are already split out from here so all that remains is BMP proper. Signed-off-by: David Lamparter <equinox@diac24.net>
2019-07-03clippy: find headers relative to source treeDavid Lamparter
The current directory is in the build tree while running clippy; find ourselves so we can access headers from the source tree. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-06-12lib/clippy: expand some macrosDavid Lamparter
At least the "easy" cases of macros work. Signed-off-by: David Lamparter <equinox@diac24.net>
2019-06-12lib/clippy: assert() for non-optional argsDavid Lamparter
This is mostly to help static analysis; since we know from the command string which args are optional and which aren't, we can add assert() statements on them. Fixes: #3270 Signed-off-by: David Lamparter <equinox@diac24.net>
2019-06-12lib/clippy: error out on unsupported bitsDavid Lamparter
clippy can't process #ifdef or similar bits inside of an argument list (e.g. within the braces of a DEFUN or DEFPY statement.) Improve error reporting to catch these cases instead of generating broken C code. Fixes: #3840 Signed-off-by: David Lamparter <equinox@diac24.net>
2019-01-21python: make DEFPY provide the text token of fixed parametersRenato Westphal
In the CLI code, each cmd_token has both a "text" field, containing the full token text (e.g. "unicast"), and an "arg" field, containing the original text entered by the user (which might be an abbreviation, like "uni" instead of "unicast"). To avoid the need to handle abbreviations, the recommended pattern for DEFUN commands is to use the "text" value of fixed parameters and the "arg" value of everything else. Using DEFPY, however, the CLI parameters are automagically turned into C variables which are initialized under the hood (so that they're conveniently ready for use). The problem is that this initialization was always using the "arg" value of the parameters, which was leading to problems like these: debian# show ipv6 route isi Unknown route type debian# debian# conf t debian(config)# router isis 1 debian(config-router)# redistribute ipv4 st level-1 % Configuration failed. Invalid value "st" in "protocol" element. YANG path: /frr-isisd:isis/instance[area-tag='1']/redistribute/ipv4[protocol='st']/protocol To fix these problems (and probably others too), make DEFPY commands auto-detect the type of the input parameters and use either the "arg" or "text" value from the cmd_tokens accordingly. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-12-01Revert "isisd lib ospfd pbrd python: fix empty init"David Lamparter
This reverts commit 48944eb65e1d1ced03d46121d923d9d613a480d5. We're using GNU C, not ISO C - and this commit triggers new (real) warnings about {0} instead of bogus ones about {}. Signed-off-by: David Lamparter <equinox@diac24.net>
2018-11-21isisd lib ospfd pbrd python: fix empty initF. Aragon
ISO C forbids empty initializer braces. Empty initializers have been replaced with {0} Signed-off-by: F. Aragon <paco@voltanet.io>
2018-09-08*: fix some solaris warningsDavid Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-08-30build: trigger fewer unneccessary clippy rebuildsDavid Lamparter
Make sure we include the clippy binary file in our timestamp mangling so `make` will correctly determine when clippy files don't need to be rebuilt. Signed-off-by: David Lamparter <equinox@diac24.net>
2018-04-10lib, python: DEFPY_ATTR, DEFPY_HIDDENQuentin Young
Add support for element attributes in DEFPY macros. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-10-24zebra: unify the ipv4/ipv6 'show ip route' commands - part 1/2Renato Westphal
Note: I had to remove one assert in clidef.py in order to fix a build error when using a preprocessor string (FRR_IP_REDIST_STR_ZEBRA) inside a DEFPY command. This should be revisited later. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-25clippy: disable unneeded autogenerated codeDavid Lamparter
Coverity is generating a lot of warnings about unused stuff being around. Disabling these bits is most easily done by just putting a few preprocessor directives into the template. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-24python/clippy: make output file writing less weirdDavid Lamparter
This should stomp out any parallel build issues in this regard. Fixes: #971 Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-14lib, python: add M:A:C support for clippyQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-07-31build: non-recursive auxiliary directoriesDavid Lamparter
Flatten {m4,pkgsrc,python,redhat,snapcraft}/Makefile.am into the main one. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-13*: ditch vty_outln(), part 1 of 2David Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-06-29*: rebase vty_outln() -> masterQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-14python: clidef.pyDavid Lamparter
Adds "DEFPY()" which invokes an additional layer of preprocessing, so that we get pre-parsed and named function arguments for the CLI. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>