summaryrefslogtreecommitdiffstats
path: root/tools (follow)
Commit message (Collapse)AuthorAgeFilesLines
* tools: fix ospf area stub summary in frr-reloadChirag Shah2023-07-091-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | OSPFv2 no area x stub no-summary only resets 'no-summary' config. From frr-reload if the config line 'area x stub no-summary' is removed then it needs to remove completely. Before this change it took two frr-roload to remove the config which is inconsistent behavior. Fix is to frr-reload to add extra line to delete 'no area x stub'. Ticket:#3514775 Testing Done: Running config: router ospf ospf router-id 6.6.6.6 area 0.0.0.1 stub no-summary area 0.0.0.2 stub exit ! router ospf vrf sym_1 area 0.0.1.1 range 24.1.1.0/24 area 0.0.1.2 stub no-summary exit changed frr.conf: router ospf ospf router-id 6.6.6.6 area 0.0.0.2 stub exit ! router ospf vrf sym_1 area 0.0.1.1 range 24.1.1.0/24 exit Lines To Delete =============== router ospf no area 0.0.0.1 stub <<<< newly added router ospf vrf sym_1 no area 0.0.1.2 stub <<<< newly added router ospf no area 0.0.0.1 stub no-summary router ospf vrf sym_1 no area 0.0.1.2 stub no-summary After fix new running-config post reload: i router ospf ospf router-id 6.6.6.6 area 0.0.0.2 stub exit ! router ospf vrf sym_1 area 0.0.1.1 range 24.1.1.0/24 exit Before fix running-config post 1st reload: router ospf ospf router-id 6.6.6.6 area 0.0.0.1 stub area 0.0.0.2 stub exit ! router ospf vrf sym_1 area 0.0.1.1 range 24.1.1.0/24 area 0.0.1.2 stub exit Signed-off-by: Chirag Shah <chirag@nvidia.com>
* tools: fix pim interface config deletionChirag Shah2023-06-301-1/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When no ip pim is performed subsequent pim related configs under the interface also implicitly deleted. When doing this via frr-reload requires to remove any explicit no ip pim <blah> lines so delete list. Testing Done: running-config: interface lo ip pim ip pim use-source 6.0.0.1 exit frr.conf: remove two pim config lines. interface lo exit Before fix: 2023-06-29 23:44:26,062 INFO: Failed to execute interface lo no ip pim use-source 6.0.0.1 2023-06-29 23:44:26,142 INFO: Failed to execute interface lo no ip pim use-source 2023-06-29 23:44:26,221 INFO: Executed "interface lo no ip pim" After fix: Only no ip pim executed and rest of the other lines removed from delete list. 2023-06-30 01:07:32,618 INFO: Executed "interface lo no ip pim" Signed-off-by: Chirag Shah <chirag@nvidia.com>
* tools: checkpatch: FRR modifications to linux checkpatch.plChristian Hopps2023-06-201-29/+174
| | | | Signed-off-by: Christian Hopps <chopps@labn.net>
* tools: unmodified import of scripts/checkpatch.pl from linuxChristian Hopps2023-06-201-654/+1685
| | | | | | 0ee3e7b8893e * checkpatch: get default codespell dictionary path from package location Signed-off-by: Christian Hopps <chopps@labn.net>
* tools: fix list value remove in frr-reloadChirag Shah2023-06-061-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There might be a time element(s) from temporary list are removed more than once which leads to valueError in certain python3 version. commit-id 1543f58b5 did not handle valueError properly. This caused regression where prefix-list config leads to delete followed by add. The new fix should just pass the exception as value removal from list_to_add or list_to_del is best effort. This allows prefix-list config has no change then removes the lines from lines_to_del and lines_to_add properly. Ticket:#3490252 Testing: Configure prefix-list in frr.conf and perform multiple frr-reload. After first reload operatoin subsequent ones should not result in delete followed by add of the prefix-list but rather no-op operation. (Pdb) lines_to_add [(('ip prefix-list FOO permit 10.2.1.0/24',), None)] (Pdb) lines_to_del [(('ip prefix-list FOO seq 5 permit 10.2.1.0/24',), None), (('ip prefix-list FOO seq 10 permit 10.2.1.0/24',), None)] (Pdb) lines_to_del_to_del [(('ip prefix-list FOO seq 5 permit 10.2.1.0/24',), None), (('ip prefix-list FOO seq 10 permit 10.2.1.0/24',), None)] (Pdb) lines_to_add_to_del [(('ip prefix-list FOO permit 10.2.1.0/24',), None), (('ip prefix-list FOO permit 10.2.1.0/24',), None)] (Pdb) c > /usr/lib/frr/frr-reload.py(1562)ignore_delete_re_add_lines() -> return (lines_to_add, lines_to_del) (Pdb) lines_to_add [] (Pdb) lines_to_del [] Signed-off-by: Chirag Shah <chirag@nvidia.com>
* style: add format checker config that matches FRR style standardsChristian Hopps2023-04-181-0/+8
| | | | | | | Also move .dir-locals.el to a sample file. This file should not be in the repository as it affects the user's ability to modify it. Signed-off-by: Christian Hopps <chopps@labn.net>
* tools: Make check flag really work for reloadanlan_cs2023-04-151-0/+6
| | | | | | | The check flag of `found_pg_cmd` is already there, but not used. So, make it really work for reload. Signed-off-by: anlan_cs <vic.lan@pica8.com>
* tools: fix missing remote-as configuration when reloadanlan_cs2023-04-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | From commit `411d1a2`, `bgp_delete_nbr_remote_as_line()` is added to remove some specific bgp neighbors. But, when reloading the following configuration, it will wrongly remove some good ones: `neighbor 66.66.66.6 remote-as internal`: ``` router bgp 66 bgp router-id 172.16.204.6 neighbor ANLAN peer-group neighbor ANLAN remote-as internal neighbor 66.66.66.6 remote-as internal <- LOST neighbor 66.66.66.60 peer-group ANLAN ``` The reason is that "66.66.66.6" is included in "66.66.66.60" literally, then it is mistakenly thought to be a match. Just fix it with excat match. Signed-off-by: anlan_cs <vic.lan@pica8.com>
* Merge pull request #13101 from opensourcerouting/fix/bindir_for_frr-reloadDonald Sharp2023-03-263-2/+4
|\ | | | | tools: Set correct directory of vtysh for frr-reload.py
| * tools: Set correct directory of vtysh for frr-reload.pyDonatas Abraitis2023-03-243-2/+4
| | | | | | | | | | | | | | | | Before it was setting SDIR, which is /usr/lib/frr, but the vtysh binary is put under bindir (which is /usr/local by default). And running `/usr/lib/frr/frr reload` failed. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* | *: Convert thread_execute to event_executeDonald Sharp2023-03-241-1/+1
| | | | | | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* | *: Convert thread_add_XXX functions to event_add_XXXDonald Sharp2023-03-241-5/+5
|/ | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* mgmtd: Bringup MGMTD daemon and datastore module supportChristian Hopps2023-03-223-3/+4
| | | | | | | | | | | | | | | | | | | Features added in this commit: 1. Bringup/shutdown new management daemon 'mgmtd' along with FRR. 2. Support for Startup, Candidate and Running DBs. 3. Lock/Unlock DS feature using pthread lock. 4. Load config from a JSON file onto candidate DS. 5. Save config to a JSON file from running/candidate DS. 6. Dump candidate or running DS contents on the terminal or a file in JSON/XML format. 7. Maintaining commit history (Full rollback support to be added in future commits). 8. Addition of debug commands. Co-authored-by: Yash Ranjan <ranjany@vmware.com> Co-authored-by: Abhinay Ramesh <rabhinay@vmware.com> Co-authored-by: Ujwal P <ujwalp@vmware.com> Signed-off-by: Pushpasis Sarkar <pushpasis@gmail.com>
* tools: frr-reload fix list value not presentChirag Shah2023-03-151-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Check for value present in list before removing as in certain python3 ValueError traceback is observed. Traceback (most recent call last): File "/usr/lib/frr/frr-reload.py", line 2278, in <module> (lines_to_add, lines_to_del, restart_frr) = compare_context_objects(newconf, running) File "/usr/lib/frr/frr-reload.py", line 1933, in compare_context_objects lines_to_add, lines_to_del File "/usr/lib/frr/frr-reload.py", line 1549, in ignore_delete_re_add_lines lines_to_del.remove((ctx_keys, line)) ValueError: list.remove(x): x not in list Ticket:#3389979 Issue:3389979 Testing Done: With fix perform frr-relaod on frr.conf config where earlier traceback was seen. Signed-off-by: Donald Sharp <sharpd@nvidia.com> Signed-off-by: Chirag Shah <chirag@nvidia.com>
* tools: allow // SPDX... in checkpatch.plDavid Lamparter2023-02-101-1/+3
| | | | | | | | Using // style comments for the SPDX license identifier was kind of an intentional choice to make it stand out as "directive-like" comment (and also to constrain it to the one line.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: auto-convert to SPDX License IDsDavid Lamparter2023-02-095-75/+5
| | | | | | Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: manual SPDX License ID conversionsDavid Lamparter2023-02-0918-151/+20
| | | | | | | | | | The files converted in this commit either had some random misspelling or formatting weirdness that made them escape automated replacement, or have a particularly "weird" licensing setup (e.g. dual-licensed.) This also marks a bunch of "public domain" files as SPDX License "NONE". Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: sort out & explain licenses used in FRRDavid Lamparter2023-02-091-674/+0
| | | | | | | New "introduction" note in `COPYING`, and all the licenses moved into `doc/licenses/`. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* tools: Fix missing pbrd in rsyslog.d 45-frr.conf fileDonald Sharp2023-02-081-0/+2
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* Merge pull request #12707 from donaldsharp/missed_enumsDonatas Abraitis2023-02-071-1/+1
|\ | | | | Missed enums
| * tools: Add missing enums to switch statementDonald Sharp2023-01-311-1/+1
| | | | | | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* | tools: add GotoXref vim scriptDavid Lamparter2023-01-311-0/+41
|/ | | | | | Let's make these unique IDs actually a bit useful. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* tools: Add missing daemonsYuxiang Zhu2023-01-151-0/+2
| | | | | | | | Got `ERROR: Daemon babeld is not a valid option for 'show running-config'` when using `frr-reload.py --reload --daemon babeld`. Adds `babeld` and `nhrpd` as valid daemons. Signed-off-by: Yuxiang Zhu <vfreex@gmail.com>
* tools: Ignore agentx command for frr-reload.pyDonatas Abraitis2022-12-221-0/+1
| | | | | | | | | | | | agentx can't be disabled once enabled, so we should ignore it for frr-reload.py. ``` $ /usr/lib/frr/frr-reload.py --reload /etc/frr/bgpd.conf --bindir /usr/local/bin "no agentx" we failed to remove this command SNMP AgentX support cannot be disabled once enabled ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* Revert "tools: stop zebra daemon last"Mark Stapp2022-12-061-11/+1
| | | | | | | | | | This reverts commit 2000ac4075bbe1a9557ee30286309d3ade72b3a7. There were concerns that ensuring zebra stopped last led to problems with zebra's "-r" flag, so we'll revert that for the time being and reconsider this area. Signed-off-by: Mark Stapp <mjs@labn.net>
* tools: Enable start of FRR for non-root userMichal Ruprich2022-11-232-0/+9
| | | | | | | There might be use cases when this would make sense, for example running FRR in a container as a designated user. Signed-off-by: Michal Ruprich <mruprich@redhat.com>
* Merge pull request #11058 from opensourcerouting/fix/redhat_debian_logrotateJafar Al-Gharaibeh2022-11-161-0/+27
|\ | | | | packaging: Reuse frr.logrotate for Debian and Redhat builds
| * packaging: Reuse frr.logrotate for Debian and Redhat buildsDonatas Abraitis2022-11-081-0/+27
| | | | | | | | | | | | | | | | | | It will be easier to maintain a single file instead of two separate. Also, fixes the issue when the file (/var/log/frr/frr.log) is not created after logrotate. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* | tools: remove backslash from declare check regexMarius Tomaschewski2022-11-111-1/+1
| | | | | | | | | | | | | | The backslash in `grep -q '^declare \-a'` is not needed and causes `grep: warning: stray \ before -` warning in grep-3.8. Signed-off-by: Marius Tomaschewski <mt@suse.com>
* | tools: Add pim6d support bundle commandsSai Gomathi N2022-11-081-0/+31
|/ | | | | | | PIMv6 Support Bundle commands are added in support_bundle_commands.conf file. This will help in debugging PIMv6 test Failures. Signed-off-by: Sai Gomathi <nsaigomathi@vmware.com>
* tools: Honor sysdir, confdir, bindir for frr-reload.py from "frr" wrapperDonatas Abraitis2022-11-032-2/+2
| | | | | | | Without this, those variables are not passed to frr-reload.py and uses default values. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* tools: Do not try creating /proc with install commandDonatas Abraitis2022-10-142-2/+2
| | | | | | Leftovers. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* Merge pull request #12066 from opensourcerouting/cleanup-cli-xrefDonald Sharp2022-10-131-2/+1
|\ | | | | *: clean up various CLI-related bits
| * lib: make cmd_element->attr a bitmask & clarifyDavid Lamparter2022-10-061-2/+1
| | | | | | | | | | | | | | | | | | It already "looks" like a bitmask, but we currently can't flag a command both YANG and HIDDEN at the same time. It really should be a bitmask. Also clarify DEPRECATED behaviour (or the absence thereof.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | tools: Use `install` instead of `touch/chown` combinationDonatas Abraitis2022-10-132-27/+7
| | | | | | | | | | | | | | | | | | touch + chown can have a gap between the commands (or the second failed). This could lead to unexpected permissions (root, instead of frr) for some .conf files or directories. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* | tools: Apply black formatting for frr-reload.pyDonatas Abraitis2022-10-111-2/+2
| | | | | | | | Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* | tools: Handle sequence numbers for BGP community (large/ext) in frr-reload.pyDonatas Abraitis2022-10-111-0/+31
|/ | | | | | | | | | If we add/modify community/large/ext lists without sequence numbers, and doing frr-reload.py, then rules with sequence numbers (show running-config always adds sequence numbers) will be deleted and new ones will be re-added. This could lead to blackholing for some time. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* tools: Configure systemd to always restart FRR, regardless of exit codeBrian Rak2022-09-262-2/+2
| | | | | | The current service file configures restarts on-abnormal, which translates to "unclean signal", "timeout", or "watchdog". This patch updates it to always restart, as there's never really a time watchfrr should exit by itself at all. Signed-off-by: Brian Rak <brak@vultr.com>
* bgpd: Use route_map_result_t for route_map_apply() as return typeDonatas Abraitis2022-09-201-0/+15
| | | | Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* tools: stop zebra daemon lastMark Stapp2022-08-151-1/+11
| | | | | | | When stopping the FRR daemons, stop zebra last, after trying to stop the other daemons. Signed-off-by: Mark Stapp <mstapp@nvidia.com>
* tools: Add pim6d to tools so that pim6d will work properlyDonald Sharp2022-08-065-2/+7
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* tools/gcc-plugins: make GCC 12 compatibleDavid Lamparter2022-07-262-1/+6
| | | | | | | check_function_arguments_recurse() has received a new function argument in GCC 12. Fill it in and add a compatibility wrapper. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* tools: Do not wrap the pidfile into double-quotes for frrcommon.shDonatas Abraitis2022-07-111-2/+2
| | | | | | | | | | | | The problem is that when we run watchfrr.sh/frrinit.sh, we get something like: ``` cat: '"/var/run/frr/staticd.pid"': No such file or directory cat: '"/var/run/frr/babeld.pid"': No such file or directory cat: '"/var/run/frr/zebra.pid"': No such file or directory ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* tools: Add missing bfdd to logrotate configDonatas Abraitis2022-07-071-0/+2
| | | | Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* tools: fix boot config load in watchfrrChristian Hopps2022-06-251-1/+1
| | | | | | | 2469a37f reversed the logic of the existence check for /etc/frr/frr.conf breaking boot config loading, fix it. Signed-off-by: Christian Hopps <chopps@labn.net>
* tools: document frr_global_options in daemons fileQuentin Young2022-06-161-10/+17
| | | | Signed-off-by: Quentin Young <qlyoung@nvidia.com>
* tools: apply various shellcheck recommendationsQuentin Young2022-06-161-7/+7
| | | | Signed-off-by: Quentin Young <qlyoung@nvidia.com>
* tools: print daemon start cmd, vtysh_b cmdQuentin Young2022-06-161-6/+12
| | | | | | | | | | | | When starting a daemon, print the full command run by the init script to start it. This gives more information and is especially helpful when debugging wrap commands. Also add some more logs to vtysh_b to print the command used there, log when we exit early because frr.conf doesn't exist, and simplify the code path for creating the command to use. Signed-off-by: Quentin Young <qlyoung@nvidia.com>
* tools: clean up whitespace in daemons fileQuentin Young2022-06-161-5/+6
| | | | | | Bit easier to read this way. Signed-off-by: Quentin Young <qlyoung@nvidia.com>
* tools: improve explanation of watchfrr_optionsQuentin Young2022-06-161-4/+7
| | | | | | | | | | The explanation block for watchfrr_options was split into two blocks, one explaining the --netns option and one making a vague statement that the init script provides the list of daemons to start. The former can be merged with the latter and the latter is more useful when stated as a caveat for what you should actually use watchfrr_options for. Signed-off-by: Quentin Young <qlyoung@nvidia.com>