]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: fix show bgp l2vpn evpn route rd crashes
authorTrey Aspelund <taspelund@nvidia.com>
Thu, 4 Aug 2022 01:43:31 +0000 (01:43 +0000)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Thu, 4 Aug 2022 07:37:21 +0000 (07:37 +0000)
bgpd was crashing every time `show bgp l2vpn evpn route rd` was issued
with an RD that didn't match "all".  This was introduced by 9b01d289883
which changed how argv_find() is handled in various vtysh commands, but
the new changes forgot a "!".  So let's re-add the "!".

Before:
```
ub20# show bgp l2vpn evpn route rd 399672:100
vtysh: error reading from bgpd: Resource temporarily unavailable (11)Warning: closing connection to bgpd because of an I/O error!
ub20#

ub20# show bgp l2vpn evpn route rd 399672:100 mac 11:11:11:11:11:11
vtysh: error reading from bgpd: Resource temporarily unavailable (11)Warning: closing connection to bgpd because of an I/O error!
ub20#
```

After:
```
ub20# show bgp l2vpn evpn route rd 399672:100
ub20#

ub20# show bgp l2vpn evpn route rd 399672:100 mac 11:11:11:11:11:11
% Network not in table
ub20#
```

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
(cherry picked from commit 8923315db481f2a9f45e76405480edb339738677)

bgpd/bgp_evpn_vty.c

index d94dcdd362cb349227f33936e26a3595d4e4130e..89fe426a86097d101b99a37ee565c7a8d1661753 100644 (file)
@@ -4700,7 +4700,7 @@ DEFUN(show_bgp_l2vpn_evpn_route_rd,
        if (uj)
                json = json_object_new_object();
 
-       if (argv_find(argv, argc, "all", &rd_all)) {
+       if (!argv_find(argv, argc, "all", &rd_all)) {
                /* get the RD */
                if (argv_find(argv, argc, "ASN:NN_OR_IP-ADDRESS:NN",
                              &idx_ext_community)) {
@@ -4772,7 +4772,7 @@ DEFUN(show_bgp_l2vpn_evpn_route_rd_macip,
                json = json_object_new_object();
 
        /* get the prd */
-       if (argv_find(argv, argc, "all", &rd_all)) {
+       if (!argv_find(argv, argc, "all", &rd_all)) {
                if (argv_find(argv, argc, "ASN:NN_OR_IP-ADDRESS:NN",
                              &idx_ext_community)) {
                        ret = str2prefix_rd(argv[idx_ext_community]->arg, &prd);