Commit graph

768 commits

Author SHA1 Message Date
Donald Sharp 611d6ac0d8
Merge pull request #15834 from pguibert6WIND/alias_path_iproute2
tools: add iproute2 alias for pathd daemon
2024-04-29 09:21:48 -04:00
Philippe Guibert ce614c2971 tools: add iproute2 alias for pathd daemon
With SRv6 traffic engineering, some ipv6 routes will
be installed by the Pathd daemon.
Populate the iproute2 aliasing table with pathd.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-04-29 08:20:37 +02:00
Chirag Shah 439c6f70b5 tools: Handle seq num for BGP as-path in frr-reload.py
If frr.conf has bgp as-path access-list clause without sequence number
then upon performing frr-rleoad, the running config clause with sequence
number will always be deleted and the new ones without sequence will
be re-added.
This could lead to blackholing until the config gets reapplied.

Testing:

frr.conf:
bgp as-path access-list important_internet_bgp_as_numbers permit _16509_

Running config:
bgp as-path access-list important_internet_bgp_as_numbers seq 5 permit
_16509_
!

Before fix
Upon frr-reload it deletes and readd line as without seq

2024-04-26 03:16:45,772  INFO: Executed "no bgp as-path access-list
important_internet_bgp_as_numbers seq 5 permit _16509_"

'bgp as-path access-list important_internet_bgp_as_numbers permit
_16509_\n'

After fix:
no form is not executed and no delta determine between frr.conf
and running-config.

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2024-04-25 20:30:12 -07:00
Chirag Shah da2093ba39 tools: fix frr-reload for no ip msdp peer cmd
no form of 'ip pm msdp peer <> source <>' does not
accept source argument. Stip the 'source <>' part from
config line being deleted via frr-reload.

Ticket: #3874971
Testing:

Config:
vrf blue
 ip msdp peer 1.1.1.1 source 1.1.1.1

frr-reload failure log:
2024-04-23 02:08:32,501  INFO: Failed to execute vrf blue  no ip
msdp peer 1.1.1.1 source 1.1.1.1 exit
2024-04-23 02:08:32,501 ERROR: "vrf blue --  no ip msdp peer 1.1.1.1
source 1.1.1.1 -- exit" we failed to remove this command
2024-04-23 02:08:32,501 ERROR: % Unknown command:  no ip msdp peer
1.1.1.1 source 1.1.1.1

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2024-04-23 13:40:13 -07:00
Chirag Shah bb52e5ebdc tools: fix pim interface config deletionII
When no ip pim is performed subsequent pim related
configs under the interface also implicitly deleted.
The previous fix was attempting to remove from the same
list which was being integrated.
First collect the lines to remove in separate list
then at the end remove from the original lines_to_del.

commit 623af04e1c does not work properly if tries to delete
an entry from existing list which is being walked on.

Ticket: #3869779

Testing done:

frr.conf:
no interface config

running-config:
--------------
interface swp1
ip pim
ip pim active-active
ip pim allow-rp rp-list sample
ip pim bfd
ip pim use-source 1.1.1.1
ip multicast boundary oil test
exit

frr-reload log pointing only no ip pim config
is removed under interface:
2024-04-18 18:44:37,202  INFO: "frr defaults datacenter" cannot be removed
2024-04-18 18:44:37,202  INFO: "service integrated-vtysh-config" cannot be removed
2024-04-18 18:44:37,504  INFO: Executed "interface swp1  no ip pim exit"
2024-04-18 18:44:37,505  INFO: /var/run/frr/reload-YHS51E.txt content

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2024-04-23 13:40:07 -07:00
Mark Stapp 84d1fb19e2
Merge pull request #15709 from chiragshah6/fdev2
tools: frr-reload strip interface vrf ctx line
2024-04-16 11:32:18 -04:00
Chirag Shah c1356f0e85 tools: frr-reload strip interface vrf ctx line
if frr.conf file contains 'interface x vrf <name> config
it causes protocol (like ospf) neighbor session flap,
as it deletes interface base config line ('interface x') from
running config and readds with 'interface x vrf <name>'
line from frr.conf.
This deletion and readdition of lines leads to neighborship
flaps.

This issue is by product of (PR-10411 | https://github.com/FRRouting/frr/pull/10411)
(commit id: 788a036fdb)
where running config for interface config no loger displays associated
vrf line.

Ticket: #3858146
Testing:

frr.conf
interface swp1.2 vrf vrf1012
ip ospf network point-to-point

running-config:
interface swp1.2
 ip ospf network point-to-point
 exit

Before fix:
frr-reload logs:

2024-04-09 00:28:31,096  INFO: Executed "interface swp1.2  no ip ospf
network point-to-point exit"

 'interface swp1.2 vrf vrf1012\n ip ospf network
 point-to-point\nexit\n',

After fix:
frr-reload strips vrf line, thus no config change between
frr.conf and running config.

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2024-04-10 16:24:03 -07:00
Andrew Cooks e443644fdd tools/indent.py: fix encoded byte stream handling
Python subprocess communication now operates on bytes, not strings.

Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-04-10 16:05:03 +10:00
Donatas Abraitis 874242f129 *: Add missing SPDX-License-Identifier for some .c/.h files
Adding them as others: GPL-2.0-or-later

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-21 16:46:58 +02:00
Donald Sharp 852a74807f doc, tools: Remove ARRAY_SIZE check
checkpatch.pl wants you to use ARRAY_SIZE in a kernel
header file.  We don't have access to this kernel header
file for normal compilation.  I'm just going to remove it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-03-04 11:03:46 -05:00
Donatas Abraitis 36ae7f331a
Merge pull request #14898 from chiragshah6/mdev
tools: fix frr-reload for nbr deletion
2024-02-29 09:26:13 +02:00
Mark Stapp 77143ce77a tools: add config-write callbacks to nb templates
Add the cli_show (config write) callback when emitting the
create or modify callback in the northbound template. Split
the config-handling and config-output callbacks into two
structs/arrays; this seems to be helpful when doing mgmtd
conversion.

Signed-off-by: Mark Stapp <mjs@labn.net>
2024-01-30 08:09:25 -05:00
Igor Ryzhov 3625360d88 lib: add support for "features" when loading YANG modules
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28 23:28:40 +02:00
David Lamparter bbd858935f build: homologize path handling
Use consistent `e_somepath` names for expanded versions of `somepath`.
Also remove all paths from `config.h` and put them into
`lib/config_paths.h` - this is to make more obvious when someone is
doing something probably not quite properly structured.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-01-27 19:02:52 +01:00
Igor Ryzhov 5d1a314038 lib: split nb_operation into two types
Currently, nb_operation enum means two different things - edit operation
type (frontend part), and callback type (backend part). These types
overlap, but they are not identical. We need to add more operation
types to support NETCONF/RESTCONF integration, so it's better to have
separate enums to identify different entities.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-11 15:06:50 +02:00
Donald Sharp 848dcf3d03 *: remove sys/stat.h from zebra.h
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-09 12:39:23 -05:00
Donatas Abraitis 2435c218e9 tools: Rename show thread ... to show event ...
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-01-07 14:14:56 +02:00
Chirag Shah 2db979522e tools: fix frr-reload for nbr deletion
bgp neighbor config can have multiple lines, if neighbor is
deleted via frr-reload, no neighbor remote-as <> wipes out
the neighbor, subsequent neighbor associated config deletion
would throw generic error.
Frr-reload needs to move neighbor remote-as line to end and allow
all other config lines to be removed.

Ticket:#3588361 #3589216

Testing Done:
config:
neighbor swp3 interface remote-as external
 neighbor swp3 bfd 3 300 300
 neighbor swp3 password leaf11-spine

INFO: Executed "router bgp 65101  no neighbor swp3 interface remote-as external"
INFO: Failed to execute router bgp 65101  no neighbor swp3 bfd 3 300 300
INFO: Failed to execute router bgp 65101  no neighbor swp3 bfd 3 300
INFO: Failed to execute router bgp 65101  no neighbor swp3 bfd 3
INFO: Failed to execute router bgp 65101  no neighbor swp3 bfd
INFO: Failed to execute router bgp 65101  no neighbor swp3
INFO: Failed to execute router bgp 65101  no neighbor
INFO: Failed to execute router bgp 65101  no
  ERROR: "router bgp 65101 --  no" we failed to remove this command
  ERROR: % Specify remote-as or peer-group commands first

INFO: Failed to execute router bgp 65101  no neighbor swp3 password leaf11-spine
INFO: Failed to execute router bgp 65101  no neighbor swp3 password
INFO: Failed to execute router bgp 65101  no neighbor swp3
INFO: Failed to execute router bgp 65101  no neighbor
INFO: Failed to execute router bgp 65101  no
 ERROR: "router bgp 65101 --  no" we failed to remove this command
 ERROR: % Specify remote-as or peer-group commands first

After fix:

move the neighbor remote-as deletion line to end which allows to remove
other neighbor associated lines to be deleted.
router bgp 65101  no neighbor swp3 interface remote-as external

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2024-01-06 14:58:41 -08:00
Donald Sharp daa80a5afa tools: Add some more data to support bundles
The ipv[4|6] vpn tables in bgp were not being
gathered.  This would be useful for some situations

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-12-21 10:26:47 -05:00
Donatas Abraitis 204508433d tools: Use error log level when failing to execute commands via frr-reload.py
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-12-14 09:05:02 +02:00
Chirag Shah 8a5c6e4389 tools: fix frr-reload multiple no description cmds
Ensure to change description for index 0 from the list.

Ticket: #3628756
Testing Done:

After fix:
start with three interfaces description delete in lines_to_del:
(Pdb) lines_to_del
[(('interface swp1',), "description swp1 -> sp1's swp1"),
(('interface swp2',), "description swp2 -> sp2's swp
1"), (('interface swp3',), "description swp3 -> sp3's swp1")]

After first iteration swp1:
(Pdb) index
0
(Pdb) lines_to_del
[(('interface swp1',), 'description'), (('interface swp2',),
"description swp2 -> sp2's swp1"), (('interface swp
1s2',), "description swp3 -> sp3's swp1")]

After second iteration swp2:
(Pdb) lines_to_del
[(('interface swp1',), 'description'), (('interface swp2',),
'description'), (('interface swp3',), "description
swp3 -> sp3's swp1")]

After third iteration swp3 fix
(Pdb) lines_to_del
[(('interface swp1',), 'description'), (('interface swp2',),
'description'), (('interface swp3',), 'description'
)]

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2023-12-12 17:47:00 -08:00
Chirag Shah ac30911160 bgpd: lttng tp add evpn route events
Ticket:#3597393
Testing Done:

2023-09-08T22:53:03.532 frr_bgp:evpn_withdraw_type5 {'vrf_id': 42, 'ip':
'53.1.1.0'}
2023-09-08T22:53:06.207 frr_bgp:evpn_advertise_type5 {'vrf_id': 42,
'ip': '53.1.1.0', 'rmac': '00:02:00:00:00:38', 'vtep': '27.0.0.15'}

2023-09-08T21:51:15.637 frr_bgp:evpn_mh_local_ead_es_evi_route_upd
{'esi': '03:44:38:39:ff:ff:01:00:00:03', 'vni': 1000, 'route_type': 1,
'vtep': '27.0.0.15'}

2023-09-08T20:45:17.059 frr_bgp:evpn_mh_local_ead_es_evi_route_del
{'esi': '03:44:38:39:ff:ff:01:00:00:01', 'vni': 0, 'route_type': 4,
'vtep': '27.0.0.15'}

2023-09-08T21:51:18.363 frr_bgp:evpn_mh_es_evi_vtep_add {'esi':
'03:44:38:39:ff:ff:01:00:00:02', 'vni': 1000, 'vtep': '27.0.0.16',
'ead_es': 1}

2023-09-08T20:43:50.206 frr_bgp:evpn_mh_es_evi_vtep_del {'esi':
'03:44:38:39:ff:ff:01:00:00:01', 'vni': 1002, 'vtep': '27.0.0.16',
'ead_es': 0}

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2023-11-29 21:44:30 -08:00
Chirag Shah 00b96f70df tools: fix frr-reload interface desc cmd
Fix frr-reload script to only render 'no description'
rather than 'no description blah'

Ticket:#3628756
Testing Done:

Before:
2023-11-29 02:38:55,758  INFO: Failed to execute interface hostbond_1
no description hostbond_1_to_host exit
2023-11-29 02:38:55,758 ERROR: "interface hostbond_1 --  no description
hostbond_1_to_host -- exit" we failed to remove this command
2023-11-29 02:38:55,758 ERROR: % Unknown command:  no description
hostbond_1_to_host

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2023-11-28 19:04:22 -08:00
David Lamparter 8b23c0b0bd *: convert struct interface->connected to DLIST
Replace `struct list *` with `DLIST(if_connected, ...)`.

NB: while converting this, I found multiple places using connected
prefixes assuming they were IPv4 without checking:

- vrrpd/vrrp.c: vrrp_socket()
- zebra/irdp_interface.c: irdp_get_prefix(), irdp_if_start(),
  irdp_advert_off()

(these fixes are really hard to split off into separate commits as that
would require going back and reapplying the change but with the old list
handling)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-22 23:00:30 +01:00
Christian Hopps 756002e277 tools: suppress some reachable external lib "leaks"
- These are just normal reachable allocs from inside external library code;
however, when running valgrind with memleak types "all" in order to find FRR
specific leaks (from memory.h) these are the only other reported leaks. Makes
easier checking and fixing.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-11-11 21:10:45 +01:00
Igor Ryzhov 448f75e56d
Merge pull request #14525 from LabNConsulting/chopps/mgmtd-simplify-xpaths
chopps/mgmtd simplify xpaths
2023-11-08 16:30:46 +02:00
Christian Hopps bec10915a4 tools: checkpatch updated with darr_foreach iter macros
Also update `checkpatch.sh` so it runs `checkpatch.pl` from the same directory
it resides in. This allows copying them both somewhere else to use a specific
version.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-11-06 17:44:58 -05:00
Christian Hopps a65cda16b2 mgmtd: simplify xpath registries
- move from client id indexed array of uints for register info
  per client to a u64 bitmask.
- add bit walking FOREACH macro

Walk the client IDs whose bits are set in a mask.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-11-06 17:44:58 -05:00
Donatas Abraitis 885613e45d tools: Apply black formatting for tools/frr-reload.py
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-11-02 13:39:53 +02:00
Chirag Shah 989991cf3c tools: fix frr-reload route-map desc cmd
Fix frr-reload script to only render 'no description'
rather than 'no description blah'

Ticket:#3650752
Testing:

route-map TEST permit 140
 description rule for PFIX_IPV6_7
 match ipv6 address prefix-list PFIX_IPV6_7
exit
!
end

torc-11# confi t
torc-11(config)# route-map TEST permit 140
torc-11(config-route-map)# no description rule for PFIX_IPV6_7
% Unknown command: no description rule for PFIX_IPV6_7

torc-11(config-route-map)# no description rule
% There is no matched command.
torc-11(config-route-map)# no description
  <cr>
torc-11(config-route-map)# no description
torc-11(config-route-map)#

Using frr-reload failure log:
2023-10-31 00:30:31,972  INFO: Failed to execute route-map TEST permit 140  no description rule for PFIX_IPV6_7 exit
2023-10-31 00:30:31,972 ERROR: "route-map TEST permit 140 --  no description rule for PFIX_IPV6_7 -- exit" we failed to remove this command
2023-10-31 00:30:31,972 ERROR: % Unknown command:  no description rule for PFIX_IPV6_7

With fix:

2023-11-02 06:10:30,024  INFO: Executed "route-map TEST permit 140  no description exit"

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2023-11-01 23:06:07 -07:00
Igor Ryzhov 7d67b9ff28 build: add -Wimplicit-fallthrough
Also:
- replace all /* fallthrough */ comments with portable fallthrough;
pseudo keyword to accomodate both gcc and clang
- add missing break; statements as required by older versions of gcc
- cleanup some code to remove unnecessary fallthrough

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2023-10-12 21:23:18 +03:00
Jonas Gorski 312d5ee159 tools: make --quiet actually suppress output
When calling daemon_stop() with --quiet and e.g. the pidfile is empty,
it won't return early since while "$fail" is set, "$2" is "--quiet", so
the if condition isn't met and it will continue executing, resulting
in error messages in the log:

> Sep 14 14:48:33 localhost watchfrr[2085]: [YFT0P-5Q5YX] Forked background command [pid 2086]: /usr/lib/frr/watchfrr.sh restart all
> Sep 14 14:48:33 localhost frrinit.sh[2075]: /usr/lib/frr/frrcommon.sh: line 216: kill: `': not a pid or valid job spec
> Sep 14 14:48:33 localhost frrinit.sh[2075]: /usr/lib/frr/frrcommon.sh: line 216: kill: `': not a pid or valid job spec
> Sep 14 14:48:33 localhost frrinit.sh[2075]: /usr/lib/frr/frrcommon.sh: line 216: kill: `': not a pid or valid job spec

Fix this by moving the --quiet check into the block to log_failure_msg(),
and also add the check to all other invocations of log_*_msg() to make
--quiet properly suppress output.

Fixes: 19a99d89f0 ("tools: suppress unuseful warnings during restarting frr")
Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
2023-09-14 17:20:25 +02:00
Manoj Naragund 1dfc0d200c mgmtd: support bundle commands for mgmt daemon.
Signed-off-by: Manoj Naragund <mnaragund@vmware.com>
2023-09-12 01:53:04 -07:00
Donald Sharp 58201b3d63
Merge pull request #14344 from opensourcerouting/freebsd-printf-sync-20230903
lib/printf: sync with FreeBSD for ISO C23 enhancements
2023-09-06 07:59:15 -04:00
David Lamparter 2821d3b91b tools/gcc-plugins: fix for GCC 13
As usual, new GCC version, new small random changes in the API.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-09-04 12:16:48 +02:00
David Lamparter f9ba355aa8 tools/gcc-plugins: allow ISO C23 %b
It behaves exactly like `%x`, so adding it is a single byte diff.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-09-03 23:34:03 +02:00
Rafael Zalamena 96f76f7663 tools: fix key chain reload removal
When deleting a key chain with frr-reload track if the whole root node
is being removed or not.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2023-07-27 10:47:23 -03:00
Mark Stapp 3c7eec9625
Merge pull request #10136 from idryzhov/frr-reload-exit
tools: always append "exit" in frr-reload.py
2023-07-18 12:19:10 -04:00
Donald Sharp 33b1b8a04c tools: Add what FRR thinks as the fib routes for support_bundle
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-07-17 09:56:06 -04:00
Donald Sharp 89bbdb5fdb
Merge pull request #13891 from opensourcerouting/fix/ignore_errors_from_frr-reload.py
tools: Ignore errors for frr reload stuff
2023-07-12 15:11:58 -04:00
Chirag Shah 84f543a8a4 tools: fix ospf area stub summary in frr-reload
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>
2023-07-09 11:53:22 -07:00
Igor Ryzhov 792ada4738 tools: always append "exit" in frr-reload.py
When reloading the following config:
```
router ospf6
 area 0 range 2001:db8::/32 advertise
exit
!
interface eth0
 ipv6 ospf6 area 0
exit
```
frr-reload.py doesn't execute "exit" commands. Because of that, it tries
to execute "interface eth0" inside the "router ospf6" context and fails.

To always execute all commands from the correct context, frr-reload.py
should properly exit from every entered node.

Fixes #10132.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2023-07-04 21:07:19 +03:00
Donatas Abraitis 243e27abcc tools: Ignore errors for frr reload stuff
When we pass an unknown/wrong command and do `systemctl reload frr`, all processes
are killed, and not started up.

Like doing with frr-reload.py, all good:

```
$ /usr/lib/frr/frr-reload.py --reload /etc/frr/frr.conf
vtysh failed to process new configuration: vtysh (mark file) exited with status 2:
b'line 20: % Unknown command:  neighbor 192.168.10.123 bfd 300 300\n\n'
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-06-30 13:01:08 +03:00
Chirag Shah 623af04e1c tools: fix pim interface config deletion
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>
2023-06-29 18:09:05 -07:00
Christian Hopps 181fab6d06 tools: checkpatch: FRR modifications to linux checkpatch.pl
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-06-20 01:05:30 -04:00
Christian Hopps f7bec5aab1 tools: unmodified import of scripts/checkpatch.pl from linux
0ee3e7b8893e * checkpatch: get default codespell dictionary path from package location

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-06-20 01:05:30 -04:00
Chirag Shah 9845c09d61 tools: fix list value remove in frr-reload
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>
2023-06-05 22:22:27 -07:00
Christian Hopps 960ab543cf style: add format checker config that matches FRR style standards
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>
2023-04-18 05:18:26 -04:00
anlan_cs 9ea17a5d49 tools: Make check flag really work for reload
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>
2023-04-15 06:46:25 +08:00
anlan_cs a70895e83a tools: fix missing remote-as configuration when reload
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>
2023-04-15 06:42:36 +08:00
Donald Sharp 35bd38705f
Merge pull request #13101 from opensourcerouting/fix/bindir_for_frr-reload
tools: Set correct directory of vtysh for frr-reload.py
2023-03-26 08:20:33 -04:00
Donatas Abraitis c9bdc0c79e tools: Set correct directory of vtysh for frr-reload.py
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>
2023-03-24 19:38:46 +02:00
Donald Sharp 8c1186d38e *: Convert thread_execute to event_execute
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp 907a2395f4 *: Convert thread_add_XXX functions to event_add_XXX
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Christian Hopps 1c84efe4fa mgmtd: Bringup MGMTD daemon and datastore module support
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>
2023-03-21 22:08:32 -04:00
Chirag Shah 1543f58b55 tools: frr-reload fix list value not present
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>
2023-03-14 21:32:40 -07:00
David Lamparter a45b2bf4a4 tools: allow // SPDX... in checkpatch.pl
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>
2023-02-10 10:56:07 +01:00
David Lamparter acddc0ed3c *: auto-convert to SPDX License IDs
Done with a combination of regex'ing and banging my head against a wall.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-09 14:09:11 +01:00
David Lamparter 47a3a82770 *: manual SPDX License ID conversions
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>
2023-02-09 14:09:07 +01:00
David Lamparter 47b6d5406f *: sort out & explain licenses used in FRR
New "introduction" note in `COPYING`, and all the licenses moved into
`doc/licenses/`.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-09 12:46:13 +01:00
Donald Sharp 7386031781 tools: Fix missing pbrd in rsyslog.d 45-frr.conf file
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-02-08 13:04:01 -05:00
Donatas Abraitis 96475dfde9
Merge pull request #12707 from donaldsharp/missed_enums
Missed enums
2023-02-07 22:22:27 +02:00
David Lamparter 40e98aa8c8 tools: add GotoXref vim script
Let's make these unique IDs actually a bit useful.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-01-31 23:20:03 +01:00
Donald Sharp 0678d01a70 tools: Add missing enums to switch statement
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-01-31 15:15:59 -05:00
Yuxiang Zhu 559f208ea5 tools: Add missing daemons
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>
2023-01-15 10:57:53 +08:00
Donatas Abraitis 4a9ea00a27 tools: Ignore agentx command for frr-reload.py
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>
2022-12-22 17:55:40 +02:00
Mark Stapp 828ac45474 Revert "tools: stop zebra daemon last"
This reverts commit 2000ac4075.

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>
2022-12-06 11:21:02 -05:00
Michal Ruprich 1d42fb941a tools: Enable start of FRR for non-root user
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>
2022-11-23 10:19:10 +01:00
Jafar Al-Gharaibeh a221745a40
Merge pull request #11058 from opensourcerouting/fix/redhat_debian_logrotate
packaging: Reuse frr.logrotate for Debian and Redhat builds
2022-11-15 22:15:45 -06:00
Marius Tomaschewski 5216a05b32 tools: remove backslash from declare check regex
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>
2022-11-11 15:43:59 +01:00
Sai Gomathi N 358a7549dc tools: Add pim6d support bundle commands
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>
2022-11-08 01:41:48 -08:00
Donatas Abraitis c4831d2864 packaging: Reuse frr.logrotate for Debian and Redhat builds
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>
2022-11-08 11:17:56 +02:00
Donatas Abraitis efe9529821 tools: Honor sysdir, confdir, bindir for frr-reload.py from "frr" wrapper
Without this, those variables are not passed to frr-reload.py and uses
default values.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-11-03 20:15:10 +02:00
Donatas Abraitis 6f26cc245c tools: Do not try creating /proc with install command
Leftovers.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-10-14 21:30:13 +03:00
Donald Sharp e3e3d729c4
Merge pull request #12066 from opensourcerouting/cleanup-cli-xref
*: clean up various CLI-related bits
2022-10-13 13:47:04 -04:00
Donatas Abraitis 972cdc560e tools: Use install instead of touch/chown combination
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>
2022-10-13 11:14:07 +03:00
Donatas Abraitis 63f99a91c8 tools: Apply black formatting for frr-reload.py
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-10-11 22:38:30 +03:00
Donatas Abraitis 8bcbee1999 tools: Handle sequence numbers for BGP community (large/ext) in frr-reload.py
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>
2022-10-11 22:36:26 +03:00
David Lamparter 9eebf97e3d lib: make cmd_element->attr a bitmask & clarify
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>
2022-10-06 15:34:32 +02:00
Brian Rak d087003451 tools: Configure systemd to always restart FRR, regardless of exit code
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>
2022-09-26 11:23:29 -04:00
Donatas Abraitis fd283bd250 bgpd: Use route_map_result_t for route_map_apply() as return type
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-09-20 10:45:02 +03:00
Mark Stapp 2000ac4075 tools: stop zebra daemon last
When stopping the FRR daemons, stop zebra last, after trying
to stop the other daemons.

Signed-off-by: Mark Stapp <mstapp@nvidia.com>
2022-08-15 16:40:08 -04:00
Donald Sharp 5651da2461 tools: Add pim6d to tools so that pim6d will work properly
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-08-06 08:35:59 -04:00
David Lamparter 3d3ed1afb2 tools/gcc-plugins: make GCC 12 compatible
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>
2022-07-26 15:38:16 -04:00
Donatas Abraitis 9dedc9eb37 tools: Do not wrap the pidfile into double-quotes for frrcommon.sh
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>
2022-07-11 14:47:09 +03:00
Donatas Abraitis 9763474278 tools: Add missing bfdd to logrotate config
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-07-07 11:05:00 +03:00
Christian Hopps 63b46c8fb4
tools: fix boot config load in watchfrr
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>
2022-06-24 18:44:43 -04:00
Quentin Young e99126f0ac tools: document frr_global_options in daemons file
Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2022-06-16 12:20:36 -04:00
Quentin Young da9601225f tools: apply various shellcheck recommendations
Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2022-06-16 12:20:36 -04:00
Quentin Young 2469a37fd0 tools: print daemon start cmd, vtysh_b cmd
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>
2022-06-16 12:00:23 -04:00
Quentin Young 66edf91772 tools: clean up whitespace in daemons file
Bit easier to read this way.

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2022-06-16 12:00:23 -04:00
Quentin Young 88323f0f96 tools: improve explanation of watchfrr_options
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>
2022-06-16 12:00:23 -04:00
Quentin Young 5e24868b15 tools: improve explanation of 'wrap' options
We support 'wrap' variables in /etc/frr/daemons, but the explanation
given there doesn't touch on some of the subtleties of using these
variables.

The variables were designed for use with Valgrind, which has special
behavior when run with programs that daemonize; Valgrind will intercept
the fork()'d child process and run itself instead of the child. This
behavior allows it to follow the same forking semantics as the target
program.

For virtually every other wrapper, the wrap variables do not work as
demonstrated because the wrapper programs do not daemonize. If the
wrappers do not daemonize, they will block the init script. The examples
given with "perf" for example simply do not work, because perf remains
in the foreground even as it tracks forked children.

This patch adds an explanation of the behavior expected by the init
script and offers a solution for getting that behavior.

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2022-06-16 12:00:23 -04:00
Martin Buck c594796d0f tools: Really fix all daemon shutdown without complaining about PID files
Fix daemon shutdown broken by f0cccaa6bf. Now
we still don't complain about missing PID files but actually stop the
running daemons.

The previous fix was broken because it passed a new "--all" option to
daemon_stop which wasn't handled properly (it assumed $1 contains the
daemon name when at that time it acutally contained the "--all" option).
Plus, "--all" wasn't actually necessary, because we already passed
"--reallyall" from all_stop to daemon_stop after the daemon name.

So remove "--all" again and simply check for "--reallyall" in $2. This
should *really* fix #11317.

Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
2022-06-01 11:58:52 +02:00
Donatas Abraitis 134890bf13
Merge pull request #11315 from gromit1811/fix_init_stop_msgs
tools: Don't complain about missing PID files when stopping all damons
2022-06-01 11:24:13 +03:00
Donald Sharp da49af8cda
Merge pull request #11293 from opensourcerouting/feature/update_workflow_dates
doc, tools: Update release dates in workflow.rst
2022-05-31 13:20:47 -04:00
Martin Buck f0cccaa6bf tools: Don't complain about missing PID files when stopping all damons
Since 1686b1d486, we try to stop all daemons,
even those which are not (no longer) enabled in /etc/frr/daemons. But we
shouldn't complain about missing PID files for daemons which have never been
started and just silently ignore those.

Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
2022-05-31 14:16:34 +02:00
Christian Poessinger 93ced41342 tools: add eigrp support on frr-reload
Signed-off-by: Christian Poessinger <christian@poessinger.com>
2022-05-30 15:03:45 +02:00
Donatas Abraitis bfb8639395 doc, tools: Update release dates in workflow.rst
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-27 08:25:12 +03:00
Russ White 53f681fc22
Merge pull request #11282 from donaldsharp/pim_v2_v3
pimd: Disable handling v3 igmp packets on an interface config'ed for v2
2022-05-26 15:59:39 -04:00